Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kevm-pyk/src/kevm_pyk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,8 @@ def evm_chain_args(self) -> ArgumentParser:
'SHANGHAI',
'CANCUN',
'PRAGUE',
'OSAKA',
'AMSTERDAM',
)
modes = ('NORMAL', 'VMTESTS')

Expand Down
10 changes: 10 additions & 0 deletions kevm-pyk/src/kevm_pyk/gst_to_kore.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
'Frontier': 'FRONTIER',
'Homestead': 'HOMESTEAD',
'EIP150': 'TANGERINE_WHISTLE',
'TangerineWhistle': 'TANGERINE_WHISTLE',
'EIP158': 'SPURIOUS_DRAGON',
'SpuriousDragon': 'SPURIOUS_DRAGON',
'Byzantium': 'BYZANTIUM',
'Constantinople': 'CONSTANTINOPLE',
'ConstantinopleFix': 'PETERSBURG',
Expand All @@ -51,6 +53,12 @@
'CancunToPragueAtTime15k': 'PRAGUE',
'Osaka': 'OSAKA',
'PragueToOsakaAtTime15k': 'OSAKA',
'Amsterdam': 'AMSTERDAM',
'BPO2ToAmsterdamAtTime15k': 'AMSTERDAM',
'OsakaToBPO1AtTime15k': 'OSAKA',
'BPO1ToBPO2AtTime15k': 'OSAKA',
'BPO2ToBPO3AtTime15k': 'AMSTERDAM',
'BPO3ToBPO4AtTime15k': 'AMSTERDAM',
}

_GST_DISCARD_KEYS: Final = frozenset(
Expand All @@ -65,6 +73,8 @@
'hasBigInt',
'config',
'network',
'receipts',
'blockAccessList',
]
)
_GST_LOAD_KEYS: Final = frozenset(
Expand Down
16 changes: 11 additions & 5 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ Here we check the other post-conditions associated with an EVM test.
SetItem("receiptTrie") SetItem("stateRoot") SetItem("timestamp")
SetItem("transactionsTrie") SetItem("uncleHash") SetItem("baseFeePerGas") SetItem("withdrawalsRoot")
SetItem("blobGasUsed") SetItem("excessBlobGas") SetItem("parentBeaconBlockRoot") SetItem("requestsHash")
SetItem("blockAccessListHash") SetItem("slotNumber")
)

rule <k> check "blockHeader" : { "bloom" : VALUE } => .K ... </k> <logsBloom> VALUE </logsBloom>
Expand All @@ -647,6 +648,8 @@ Here we check the other post-conditions associated with an EVM test.
rule <k> check "blockHeader" : { "excessBlobGas" : VALUE } => .K ... </k> <excessBlobGas> VALUE </excessBlobGas>
rule <k> check "blockHeader" : { "parentBeaconBlockRoot": VALUE } => .K ... </k> <beaconRoot> VALUE </beaconRoot>
rule <k> check "blockHeader" : { "requestsHash" : VALUE } => .K ... </k> <requestsRoot> VALUE </requestsRoot>
rule <k> check "blockHeader" : { "blockAccessListHash" : VALUE } => .K ... </k> <balHash> VALUE </balHash>
rule <k> check "blockHeader" : { "slotNumber" : VALUE } => .K ... </k> <slotNumber> VALUE </slotNumber>


rule <k> check "blockHeader" : { "hash": HASH:Bytes } => .K ...</k>
Expand All @@ -671,11 +674,14 @@ Here we check the other post-conditions associated with an EVM test.
<excessBlobGas> EB </excessBlobGas>
<beaconRoot> BR </beaconRoot>
<requestsRoot> RR </requestsRoot>
requires #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR) ==Int #asWord(HASH)
<balHash> BAL </balHash>
<slotNumber> SN </slotNumber>
requires #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR) ==Int #asWord(HASH)
orBool #blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, BAL, SN) ==Int #asWord(HASH)

rule <k> check { "genesisBlockHeader" : BLOCKHEADER } => check "genesisBlockHeader" : BLOCKHEADER ... </k>
// ---------------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/evm.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ In the comments next to each cell, we've marked which component of the YellowPap
<excessBlobGas> 0 </excessBlobGas>
<beaconRoot> 0 </beaconRoot>
<requestsRoot> 0 </requestsRoot>
<balHash> 0 </balHash>
<slotNumber> 0 </slotNumber>

<ommerBlockHeaders> [ .JSONs ] </ommerBlockHeaders>
</block>
Expand Down Expand Up @@ -2190,6 +2192,7 @@ Precompiled Contracts
rule #precompiledAccountsUB(CANCUN) => 10
rule #precompiledAccountsUB(PRAGUE) => 17
rule #precompiledAccountsUB(OSAKA) => #precompiledAccountsUB(PRAGUE)
rule #precompiledAccountsUB(AMSTERDAM) => #precompiledAccountsUB(OSAKA)


syntax Set ::= #precompiledAccountsSet ( Schedule ) [symbol(#precompiledAccountsSet), function, total]
Expand Down
19 changes: 18 additions & 1 deletion kevm-pyk/src/kevm_pyk/kproj/evm-semantics/schedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,24 @@ A `ScheduleConst` is a constant determined by the fee schedule.
rule [GhasclzOsaka]: Ghasclz << OSAKA >> => true
rule [SCHEDFLAGOsaka]: SCHEDFLAG << OSAKA >> => SCHEDFLAG << PRAGUE >>
requires notBool ( SCHEDFLAG ==K Ghasclz )


```

### Amsterdam Schedule

```k
syntax Schedule ::= "AMSTERDAM" [symbol(AMSTERDAM_EVM), smtlib(schedule_AMSTERDAM)]
// -----------------------------------------------------------------------------------
rule [GmaxblobgasAmsterdam]: Gmaxblobgas < AMSTERDAM > => 2752512
rule [GtargetblobgasAmsterdam]: Gtargetblobgas < AMSTERDAM > => 1835008
rule [BlobbasefeeupdatefractionAmsterdam]: Blobbasefeeupdatefraction < AMSTERDAM > => 11684671
rule [SCHEDCONSTAmsterdam]: SCHEDCONST < AMSTERDAM > => SCHEDCONST < OSAKA >
requires notBool ( SCHEDCONST ==K Gmaxblobgas
orBool SCHEDCONST ==K Gtargetblobgas
orBool SCHEDCONST ==K Blobbasefeeupdatefraction
)

rule [SCHEDFLAGAmsterdam]: SCHEDFLAG << AMSTERDAM >> => SCHEDFLAG << OSAKA >>
```

```k
Expand Down
17 changes: 17 additions & 0 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ Address/Hash Helpers
| #blockHeaderHash(Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes ) [function, symbol(blockHashHeaderBlobBeacon) ]
| #blockHeaderHash(Int , Int , Int , Int , Int , Int , Bytes, Int , Int , Int , Int , Int , Bytes, Int , Int , Int , Int , Int , Int , Int , Int ) [function, symbol(blockHeaderHashRequestsRoot) ]
| #blockHeaderHash(Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes) [function, symbol(blockHashHeaderRequestsRoot) ]
| #blockHeaderHash(Int , Int , Int , Int , Int , Int , Bytes, Int , Int , Int , Int , Int , Bytes, Int , Int , Int , Int , Int , Int , Int , Int , Int , Int ) [function, symbol(blockHeaderHashBALSlot)]
| #blockHeaderHash(Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes, Bytes) [function, symbol(blockHashHeaderBALSlot)]
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

rule #blockHeaderHash(HP:Bytes, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN)
Expand Down Expand Up @@ -199,6 +201,21 @@ Address/Hash Helpers
)
)
)

rule #blockHeaderHash(HP:Bytes, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WF, UB, EB, BR, RR, HA, SN)
=> #parseHexWord( Keccak256( #rlpEncode( [ HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WF, UB, EB, BR, RR, HA, SN] ) ) )

rule #blockHeaderHash(HP:Int, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WF, UB, EB, BR, RR, HA, SN)
=> #parseHexWord( Keccak256( #rlpEncode( [ #wordBytes(HP), #wordBytes(HO), #addrBytes(HC)
, #wordBytes(HR), #wordBytes(HT), #wordBytes(HE)
, HB, HD, HI, HL, HG, HS, HX
, #wordBytes(HM), #padToWidth(8, #asByteStack(HN))
, HF , #wordBytes(WF) , UB , EB , #wordBytes(BR)
, #wordBytes(RR) , #wordBytes(HA) , SN
]
)
)
)
```

- `#hashTxData` returns the Keccak-256 message hash `HT` to be signed.
Expand Down
14 changes: 14 additions & 0 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/state-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ module STATE-UTILS
<excessBlobGas> _ => 0 </excessBlobGas>
<beaconRoot> _ => 0 </beaconRoot>
<requestsRoot> _ => 0 </requestsRoot>
<balHash> _ => 0 </balHash>
<slotNumber> _ => 0 </slotNumber>
<depositRequests> _ => .Bytes </depositRequests>
<withdrawalRequests> _ => .Bytes </withdrawalRequests>
<consolidationRequests> _ => .Bytes </consolidationRequests>
Expand Down Expand Up @@ -235,10 +237,22 @@ The `"rlp"` key loads the block information.
</k>
<requestsRoot> _ => #asWord(RR) </requestsRoot>

rule <k> load "rlp" : [ [ HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, HA, SN, .JSONs ], BT, BU, BW, .JSONs ]
=> load "rlp" : [ [ HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, .JSONs ], BT, BU, BW, .JSONs ]
...
</k>
<balHash> _ => #asWord(HA) </balHash>
<slotNumber> _ => #asWord(SN) </slotNumber>

// fallback rule to catch invalid rlp encodings
rule <k> load "rlp" : _ => .K ... </k>
<statusCode> _ => EVMC_INVALID_BLOCK </statusCode> [owise]

rule <k> load "genesisRLP": [ [ HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, HA, SN, .JSONs ], _, _, _, .JSONs ] => .K ... </k>
<blockhashes> .List => ListItem(#blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, HA, SN)) ListItem(#asWord(HP)) </blockhashes>
<previousExcessBlobGas> 0 => #asWord(EB) </previousExcessBlobGas>
<previousBlobGasUsed> 0 => #asWord(UB) </previousBlobGasUsed>

rule <k> load "genesisRLP": [ [ HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR, .JSONs ], _, _, _, .JSONs ] => .K ... </k>
<blockhashes> .List => ListItem(#blockHeaderHash(HP, HO, HC, HR, HT, HE, HB, HD, HI, HL, HG, HS, HX, HM, HN, HF, WR, UB, EB, BR, RR)) ListItem(#asWord(HP)) </blockhashes>
<previousExcessBlobGas> 0 => #asWord(EB) </previousExcessBlobGas>
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _skipped_tests(test_dir: Path, slow_tests_file: Path, failing_tests_file: Pa
def read_csv_file(csv_file: Path) -> tuple[tuple[Path, str], ...]:
with csv_file.open(newline='') as file:
reader = csv.reader(file)
return tuple((Path(row[0]), row[1]) for row in reader)
return tuple((Path(row[0]), row[1]) for row in reader if row)


def _test(
Expand Down
2 changes: 1 addition & 1 deletion tests/execution-spec-tests/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.4.0
tests-glamsterdam-devnet@v7.2.0
Loading
Loading