Skip to content
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

Annotating rules that preserve definedness #2260

Merged
merged 21 commits into from
Feb 28, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
28 changes: 15 additions & 13 deletions kevm-pyk/src/kevm_pyk/kproj/evm-semantics/evm.md
Original file line number Diff line number Diff line change
Expand Up @@ -748,10 +748,23 @@ These are just used by the other operators for shuffling local execution state a
```k
syntax InternalOp ::= "#newAccount" Int
| "#newExistingAccount" Int
| "#newFreshAccount" Int
// --------------------------------------------
rule <k> #newAccount ACCT => #newExistingAccount ACCT ... </k> <account> <acctID> ACCT </acctID> ... </account>
rule <k> #newAccount ACCT => #newFreshAccount ACCT ... </k> [owise]
rule <k> #newAccount ACCT => . ... </k>
<accounts>
( .Bag
=>
<account>
<acctID> ACCT </acctID>
<balance> 0 </balance>
<code> .Bytes:AccountCode </code>
<storage> .Map </storage>
<origStorage> .Map </origStorage>
<nonce> 0 </nonce>
</account>
)
...
</accounts> [owise, preserves-definedness]
Comment on lines +754 to +768
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving this account creation here, the [owise] guarantees that ACCT is not in the <accounts> map, and the rule preserves definedness. Previosly, with the account creation isolated inside #newFreshAccount, which could be in principle called from anywhere, this would not hold.


rule <k> #newExistingAccount ACCT => #end EVMC_ACCOUNT_ALREADY_EXISTS ... </k>
<account>
Expand All @@ -772,17 +785,6 @@ These are just used by the other operators for shuffling local execution state a
...
</account>
requires lengthBytes(CODE) ==Int 0

rule <k> #newFreshAccount ACCT => . ... </k>
<accounts>
( .Bag
=> <account>
<acctID> ACCT </acctID>
...
</account>
)
...
</accounts>
```

- `#transferFunds` moves money from one account into another, creating the destination account if it doesn't exist.
Expand Down
Loading