Skip to content

Commit

Permalink
remove some nondeterminism in driver.md (#22)
Browse files Browse the repository at this point in the history
There are a few rules in driver.md that conflict with each other or
which conflict with rules in state-utils.md. It is pretty
straightforward to modify the semantics so that this is no longer the
case. We do this in order to test that the EVM semantics is actually
100% deterministic (which it is).
  • Loading branch information
dwightguth authored Dec 2, 2024
1 parent e87bb4f commit 54dfbc0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 0 additions & 7 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,6 @@ Here we check the other post-conditions associated with an EVM test.
rule check TESTID : { "blockHeader" : BLOCKHEADER } => check "blockHeader" : BLOCKHEADER ~> failure TESTID
// ----------------------------------------------------------------------------------------------------------
rule <k> check "blockHeader" : { KEY : VALUE , REST } => check "blockHeader" : { KEY : VALUE } ~> check "blockHeader" : { REST } ... </k>
requires REST =/=K .JSONs
rule <k> check "blockHeader" : { _KEY : (VALUE:String => #parseByteStack(VALUE)) } ... </k>
rule <k> check "blockHeader" : { KEY : (VALUE:Bytes => #asWord(VALUE)) } ... </k>
Expand Down Expand Up @@ -536,9 +533,6 @@ Here we check the other post-conditions associated with an EVM test.
rule check TESTID : { "genesisBlockHeader" : BLOCKHEADER } => check "genesisBlockHeader" : BLOCKHEADER ~> failure TESTID
// ------------------------------------------------------------------------------------------------------------------------
rule <k> check "genesisBlockHeader" : { KEY : VALUE , REST } => check "genesisBlockHeader" : { KEY : VALUE } ~> check "genesisBlockHeader" : { REST } ... </k>
requires REST =/=K .JSONs
rule <k> check "genesisBlockHeader" : { KEY : _ } => .K ... </k> requires KEY =/=String "hash"
rule <k> check "genesisBlockHeader" : { "hash": (HASH:String => #asWord(#parseByteStack(HASH))) } ... </k>
Expand All @@ -547,7 +541,6 @@ Here we check the other post-conditions associated with an EVM test.
rule <k> check TESTID : { "transactions" : TRANSACTIONS } => check "transactions" : TRANSACTIONS ~> failure TESTID ... </k>
// ---------------------------------------------------------------------------------------------------------------------------
rule <k> check "transactions" : [ .JSONs ] => .K ... </k> <txOrder> .List </txOrder>
rule <k> check "transactions" : { .JSONs } => .K ... </k> <txOrder> ListItem(_) => .List ... </txOrder>
rule <k> check "transactions" : [ TRANSACTION , REST ] => check "transactions" : TRANSACTION ~> check "transactions" : [ REST ] ... </k>
Expand Down
2 changes: 2 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 @@ -336,9 +336,11 @@ The `"rlp"` key loads the block information.
rule <k> loadTransaction TXID { "r" : TR:Bytes, REST => REST } ... </k>
<message> <msgID> TXID </msgID> <sigR> _ => TR </sigR> ... </message>
requires lengthBytes(TR) ==Int 32
rule <k> loadTransaction TXID { "s" : TS:Bytes, REST => REST } ... </k>
<message> <msgID> TXID </msgID> <sigS> _ => TS </sigS> ... </message>
requires lengthBytes(TS) ==Int 32
rule <k> loadTransaction TXID { "type" : T:Int, REST => REST } ... </k>
<message> <msgID> TXID </msgID> <txType> _ => #asmTxPrefix(T) </txType> ... </message>
Expand Down

0 comments on commit 54dfbc0

Please sign in to comment.