Last active
December 17, 2018 09:55
-
-
Save nrryuya/b15d1cc88bdabb2df15fccfee60a8363 to your computer and use it in GitHub Desktop.
This file contains 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
requires "abstract-semantics.k" | |
requires "verification.k" | |
module TEST-SPEC | |
imports ETHEREUM-SIMULATION | |
imports ABSTRACT-SEMANTICS | |
imports VERIFICATION | |
// transferFrom-success-1 | |
rule | |
<k> #execute => #halt </k> | |
<exit-code> 1 </exit-code> | |
<mode> NORMAL </mode> | |
<schedule> BYZANTIUM </schedule> | |
<analysis> .Map </analysis> // not part of evm | |
<ethereum> | |
<evm> | |
<output> _ => _ </output> | |
<statusCode> _ => EVMC_SUCCESS </statusCode> | |
<callStack> _ </callStack> | |
<interimStates> _ </interimStates> | |
<touchedAccounts> _ => _ </touchedAccounts> | |
<callState> | |
<program> #asMapOpCodes(#dasmOpCodes(#parseByteStack("0x600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a05263f9f0fe7760005114156100b35734156100ac57600080fd5b6000600055005b60006000fd"), BYZANTIUM)) </program> | |
<programBytes> #parseByteStack("0x600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a05263f9f0fe7760005114156100b35734156100ac57600080fd5b6000600055005b60006000fd") </programBytes> | |
<id> ACCT_ID </id> // contract owner | |
<caller> CALLER_ID </caller> // who called this contract; in the begining, origin // msg.sender | |
<callData> #abiCallData("setZero", .TypedArgs) </callData> | |
<callValue> 0 </callValue> | |
<wordStack> .WordStack => _ </wordStack> | |
<localMem> .Map => _ </localMem> | |
<pc> 0 => _ </pc> | |
<gas> 100000 => _ </gas> | |
<memoryUsed> 0 => _ </memoryUsed> | |
<previousGas> _ => _ </previousGas> | |
<static> false </static> // NOTE: non-static call | |
<callDepth> CALL_DEPTH </callDepth> | |
</callState> | |
<substate> | |
<selfDestruct> _ </selfDestruct> | |
<log> _:List </log> | |
<refund> _ => _ </refund> // TODO: more detail | |
</substate> | |
<gasPrice> _ </gasPrice> | |
<origin> ORIGIN_ID </origin> // who fires tx | |
<previousHash> _ </previousHash> | |
<ommersHash> _ </ommersHash> | |
<coinbase> _ </coinbase> | |
<stateRoot> _ </stateRoot> | |
<transactionsRoot> _ </transactionsRoot> | |
<receiptsRoot> _ </receiptsRoot> | |
<logsBloom> _ </logsBloom> | |
<difficulty> _ </difficulty> | |
<number> _ </number> | |
<gasLimit> _ </gasLimit> | |
<gasUsed> _ </gasUsed> | |
<timestamp> _ </timestamp> | |
<extraData> _ </extraData> | |
<mixHash> _ </mixHash> | |
<blockNonce> _ </blockNonce> | |
<ommerBlockHeaders> _ </ommerBlockHeaders> | |
<blockhash> _ </blockhash> | |
</evm> | |
<network> | |
<activeAccounts> SetItem(ACCT_ID) _:Set </activeAccounts> | |
<accounts> | |
<account> | |
<acctID> ACCT_ID </acctID> | |
<balance> _ </balance> | |
<code> #parseByteStack("0x600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a05263f9f0fe7760005114156100b35734156100ac57600080fd5b6000600055005b60006000fd") </code> | |
<storage> | |
#hashedLocation("Vyper", 0, .IntList) |-> (DDD => 0:Int) | |
_:Map | |
</storage> | |
<origStorage> | |
#hashedLocation("Vyper", 0, .IntList) |-> DDD | |
_:Map | |
</origStorage> | |
<nonce> _ </nonce> | |
</account> | |
// ... // TODO: fix | |
</accounts> | |
<txOrder> _ </txOrder> | |
<txPending> _ </txPending> | |
<messages> _ </messages> | |
</network> | |
</ethereum> | |
requires 0 <=Int ACCT_ID andBool ACCT_ID <Int (2 ^Int 160) | |
andBool 0 <=Int CALLER_ID andBool CALLER_ID <Int (2 ^Int 160) | |
andBool 0 <=Int ORIGIN_ID andBool ORIGIN_ID <Int (2 ^Int 160) | |
andBool 0 <=Int CALL_DEPTH andBool CALL_DEPTH <Int 1024 | |
andBool 0 <=Int DDD andBool DDD <Int (2 ^Int 256) | |
endmodule | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment