- 
                Notifications
    
You must be signed in to change notification settings  - Fork 153
 
Implement Deposit Requests #2748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 14 commits
      Commits
    
    
            Show all changes
          
          
            19 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      57440ad
              
                fix typos in Makefile
              
              
                anvacaru 07da9d6
              
                define Prague schedule
              
              
                anvacaru d7feead
              
                update execution-spec-tests/failing.llvm
              
              
                anvacaru 80b06fc
              
                set Prague as the default schedule for testing
              
              
                anvacaru e34f4f8
              
                update expected output
              
              
                anvacaru 691e5fe
              
                implement execution layer requests
              
              
                anvacaru 4a5d2ec
              
                update execution-spec-tests/failing.llvm
              
              
                anvacaru 44457b1
              
                Merge branch 'master' into eip-7685
              
              
                anvacaru 4701a2c
              
                update golden files
              
              
                anvacaru 208a011
              
                update execution-spec-tests/failing.llvm
              
              
                anvacaru 10074bd
              
                update proof files
              
              
                anvacaru 19ac317
              
                update expected output for integration tests
              
              
                anvacaru 81983ad
              
                Merge branch 'master' into eip-7685
              
              
                anvacaru e798cd2
              
                Merge branch 'master' into eip-7685
              
              
                anvacaru eba5e71
              
                Update kevm-pyk/src/kevm_pyk/kproj/evm-semantics/driver.md
              
              
                anvacaru 95b0ee3
              
                Merge branch 'master' into eip-7685
              
              
                anvacaru 3235fb6
              
                Merge remote-tracking branch 'origin/master' into eip-7685
              
              
                anvacaru 7c7fb62
              
                update execution-specs-tests/failing.llvm
              
              
                anvacaru e4e36fe
              
                change cryptografic function to sha256
              
              
                anvacaru File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| Implementation of Execution Layer Requests | ||
| ------------------------------------------ | ||
| ```k | ||
| requires "serialization.md" | ||
| ``` | ||
| 
     | 
||
| ```k | ||
| module EVM-REQUESTS | ||
| imports SERIALIZATION | ||
| ``` | ||
| 
     | 
||
| A `requests` object consists of a `request_type` byte prepended to an opaque byte array `request_data`. | ||
| The `request_data` contains zero or more encoded request objects. | ||
| ``` | ||
| requests = request_type ++ request_data | ||
| ``` | ||
| Each request type will define its own requests object with its own `request_data` format. | ||
| 
     | 
||
| In order to compute the commitment, an intermediate hash list is first built by hashing all non-empty requests elements of the block requests list. | ||
| Items with empty `request_data` are excluded, i.e. the intermediate list skips requests items which contain only the `request_type` (1 byte) and nothing else. | ||
| 
     | 
||
| ```k | ||
| syntax Int ::= #computeRequestsHash(List) [function, symbol(#computeRequestsHash)] | ||
| // ---------------------------------------------------------------------------------- | ||
| rule #computeRequestsHash(RS) => keccak(#computeRequestsHashIntermediate(RS)) | ||
| 
     | 
||
| syntax Bytes ::= #computeRequestsHashIntermediate(List) [function, symbol(#computeRequestsHashIntermediate)] | ||
| | #computeRequestsHashIntermediate(List, Bytes) [function, symbol(#computeRequestsHashIntermediateAux)] | ||
| // ---------------------------------------------------------------------------------------------------------------------- | ||
| rule #computeRequestsHashIntermediate(RS) => #computeRequestsHashIntermediate(RS, .Bytes) | ||
| rule #computeRequestsHashIntermediate(.List, ACC) => ACC | ||
| rule #computeRequestsHashIntermediate(ListItem(R) RS, ACC) => #computeRequestsHashIntermediate(RS, ACC) | ||
| requires lengthBytes(R) <=Int 1 | ||
| rule #computeRequestsHashIntermediate(ListItem(R) RS, ACC) => #computeRequestsHashIntermediate(RS, ACC +Bytes Keccak256raw(R)) | ||
| requires lengthBytes(R) >Int 1 | ||
| ``` | ||
| 
     | 
||
| Deposit Requests | ||
| ---------------- | ||
| The structure denoting the new deposit request consists of the following fields: | ||
| 
     | 
||
| 1. `pubkey: Bytes48` | ||
| 2. `withdrawal_credentials: Bytes32` | ||
| 3. `amount: uint64` | ||
| 4. `signature: Bytes96` | ||
| 5. `index: uint64` | ||
| 
     | 
||
| ```k | ||
| syntax Int ::= "DEPOSIT_REQUEST_TYPE" [macro] | ||
| | "DEPOSIT_EVENT_LENGTH" [macro] | ||
| | "DEPOSIT_CONTRACT_ADDRESS" [alias] | ||
| | "DEPOSIT_EVENT_SIGNATURE_HASH" [alias] | ||
| // ----------------------------------------------------- | ||
| rule DEPOSIT_REQUEST_TYPE => 0 | ||
| rule DEPOSIT_CONTRACT_ADDRESS => #parseAddr("0x00000000219ab540356cbb839cbe05303d7705fa") | ||
| rule DEPOSIT_EVENT_SIGNATURE_HASH => #parseWord("0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5") | ||
| rule DEPOSIT_EVENT_LENGTH => 576 | ||
| 
     | 
||
| syntax Int ::= "PUBKEY_OFFSET" [macro] | ||
| | "WITHDRAWAL_CREDENTIALS_OFFSET"[macro] | ||
| | "AMOUNT_OFFSET" [macro] | ||
| | "SIGNATURE_OFFSET" [macro] | ||
| | "INDEX_OFFSET" [macro] | ||
| | "PUBKEY_SIZE" [macro] | ||
| | "WITHDRAWAL_CREDENTIALS_SIZE" [macro] | ||
| | "AMOUNT_SIZE" [macro] | ||
| | "SIGNATURE_SIZE" [macro] | ||
| | "INDEX_SIZE" [macro] | ||
| // ----------------------------------------------------- | ||
| rule PUBKEY_OFFSET => 160 | ||
| rule WITHDRAWAL_CREDENTIALS_OFFSET => 256 | ||
| rule AMOUNT_OFFSET => 320 | ||
| rule SIGNATURE_OFFSET => 384 | ||
| rule INDEX_OFFSET => 512 | ||
| rule PUBKEY_SIZE => 48 | ||
| rule WITHDRAWAL_CREDENTIALS_SIZE => 32 | ||
| rule AMOUNT_SIZE => 8 | ||
| rule SIGNATURE_SIZE => 96 | ||
| rule INDEX_SIZE => 8 | ||
| ``` | ||
| 
     | 
||
| 
     | 
||
| 
     | 
||
| ```k | ||
| syntax Bytes ::= #extractDepositData ( Bytes ) [function, symbol(#extractDepositData)] | ||
| // -------------------------------------------------------------------------------------- | ||
| rule #extractDepositData(DATA) => substrBytes(DATA, PUBKEY_OFFSET +Int 32, PUBKEY_OFFSET +Int 32 +Int PUBKEY_SIZE) | ||
| +Bytes substrBytes(DATA, WITHDRAWAL_CREDENTIALS_OFFSET +Int 32, WITHDRAWAL_CREDENTIALS_OFFSET +Int 32 +Int WITHDRAWAL_CREDENTIALS_SIZE) | ||
| +Bytes substrBytes(DATA, AMOUNT_OFFSET +Int 32, AMOUNT_OFFSET +Int 32 +Int AMOUNT_SIZE) | ||
| +Bytes substrBytes(DATA, SIGNATURE_OFFSET +Int 32, SIGNATURE_OFFSET +Int 32 +Int SIGNATURE_SIZE) | ||
| +Bytes substrBytes(DATA, INDEX_OFFSET +Int 32, INDEX_OFFSET +Int 32 +Int INDEX_SIZE) | ||
| 
     | 
||
| syntax Bool ::= #isValidDepositEventData ( Bytes ) [function, symbol(#isValidDepositEventData), total] | ||
| // ------------------------------------------------------------------------------------------------------ | ||
| rule #isValidDepositEventData(DATA) => true | ||
| requires lengthBytes(DATA) ==Int DEPOSIT_EVENT_LENGTH | ||
| andBool Bytes2Int(substrBytes(DATA, 0, 32), BE, Unsigned) ==Int PUBKEY_OFFSET | ||
| andBool Bytes2Int(substrBytes(DATA, 32, 64), BE, Unsigned) ==Int WITHDRAWAL_CREDENTIALS_OFFSET | ||
| andBool Bytes2Int(substrBytes(DATA, 64, 96), BE, Unsigned) ==Int AMOUNT_OFFSET | ||
| andBool Bytes2Int(substrBytes(DATA, 96, 128), BE, Unsigned) ==Int SIGNATURE_OFFSET | ||
| andBool Bytes2Int(substrBytes(DATA, 128, 160), BE, Unsigned) ==Int INDEX_OFFSET | ||
| andBool Bytes2Int(substrBytes(DATA, PUBKEY_OFFSET, PUBKEY_OFFSET +Int 32), BE, Unsigned) ==Int PUBKEY_SIZE | ||
| andBool Bytes2Int(substrBytes(DATA, WITHDRAWAL_CREDENTIALS_OFFSET, WITHDRAWAL_CREDENTIALS_OFFSET +Int 32), BE, Unsigned) ==Int WITHDRAWAL_CREDENTIALS_SIZE | ||
| andBool Bytes2Int(substrBytes(DATA, AMOUNT_OFFSET, AMOUNT_OFFSET +Int 32), BE, Unsigned) ==Int AMOUNT_SIZE | ||
| andBool Bytes2Int(substrBytes(DATA, SIGNATURE_OFFSET, SIGNATURE_OFFSET +Int 32), BE, Unsigned) ==Int SIGNATURE_SIZE | ||
| andBool Bytes2Int(substrBytes(DATA, INDEX_OFFSET, INDEX_OFFSET +Int 32), BE, Unsigned) ==Int INDEX_SIZE | ||
| 
     | 
||
| rule #isValidDepositEventData(_) => false [owise] | ||
| ``` | ||
| 
     | 
||
| ```k | ||
| endmodule | ||
| ``` | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.