Created
February 13, 2019 12:54
-
-
Save MrChico/359a5f02db27b387237ce3f5c3f9e233 to your computer and use it in GitHub Desktop.
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
requires "../rules.k" | |
module UINT_CALLIT_PASS_ROUGH | |
imports ETHEREUM-SIMULATION | |
imports EVM | |
imports RULES | |
// Uint_callIt | |
rule | |
<k> #execute ~> CONTINUATION => #halt ~> CONTINUATION </k> | |
<exit-code> 1 </exit-code> | |
<mode> NORMAL </mode> | |
<schedule> BYZANTIUM </schedule> | |
<analysis> .Map </analysis> | |
<ethereum> | |
<evm> | |
<output> .WordStack </output> | |
<statusCode> _ => EVMC_SUCCESS </statusCode> | |
<callStack> VCallStack </callStack> | |
<interimStates> _ </interimStates> | |
<touchedAccounts> _ => _ </touchedAccounts> | |
<callState> | |
<program> #asMapOpCodes(#dasmOpCodes(#parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063fa888c7414610046575b600080fd5b34801561005257600080fd5b5061007160048036038101908080359060200190929190505050610073565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663efa427a2826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561010357600080fd5b505af1158015610117573d6000803e3d6000fd5b505050506040513d602081101561012d57600080fd5b810190808051906020019092919050505050505600a165627a7a72305820ce11dc254897fc0daf11ab211b9f5eded26e94ee3a926c7fd5e7f51be1612cc60029"), BYZANTIUM)) </program> | |
<programBytes> #parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063fa888c7414610046575b600080fd5b34801561005257600080fd5b5061007160048036038101908080359060200190929190505050610073565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663efa427a2826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561010357600080fd5b505af1158015610117573d6000803e3d6000fd5b505050506040513d602081101561012d57600080fd5b810190808051906020019092919050505050505600a165627a7a72305820ce11dc254897fc0daf11ab211b9f5eded26e94ee3a926c7fd5e7f51be1612cc60029") </programBytes> | |
<id> ACCT_ID </id> | |
<caller> CALLER_ID </caller> | |
<callData> #abiCallData("callIt", #uint256(ABI_y)) ++ CD </callData> | |
<callValue> VCallValue </callValue> | |
<wordStack> .WordStack => _ </wordStack> | |
<localMem> .Map => _ </localMem> | |
<pc> 0 => _ </pc> | |
<gas> VGas => _ </gas> | |
<memoryUsed> 0 => _ </memoryUsed> | |
<previousGas> _ => _ </previousGas> | |
<static> false </static> | |
<callDepth> VCallDepth => _ </callDepth> | |
</callState> | |
<substate> | |
<selfDestruct> VSelfDestruct </selfDestruct> | |
<log> _ => VLog </log> | |
<refund> _ => VRefund </refund> | |
</substate> | |
<gasPrice> _ </gasPrice> | |
<origin> ORIGIN_ID </origin> | |
<previousHash> _ </previousHash> | |
<ommersHash> _ </ommersHash> | |
<coinbase> _ </coinbase> | |
<stateRoot> _ </stateRoot> | |
<transactionsRoot> _ </transactionsRoot> | |
<receiptsRoot> _ </receiptsRoot> | |
<logsBloom> _ </logsBloom> | |
<difficulty> _ </difficulty> | |
<number> _ </number> | |
<gasLimit> _ </gasLimit> | |
<gasUsed> _ </gasUsed> | |
<timestamp> TIME </timestamp> | |
<extraData> _ </extraData> | |
<mixHash> _ </mixHash> | |
<blockNonce> _ </blockNonce> | |
<ommerBlockHeaders> _ </ommerBlockHeaders> | |
<blockhash> _ </blockhash> | |
</evm> | |
<network> | |
<activeAccounts> SetItem(ACCT_ID) | |
SetItem(Int) _ </activeAccounts> | |
<accounts> | |
<account> | |
<acctID> ACCT_ID </acctID> | |
<balance> ACCT_ID_balance </balance> | |
<code> #parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063fa888c7414610046575b600080fd5b34801561005257600080fd5b5061007160048036038101908080359060200190929190505050610073565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663efa427a2826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561010357600080fd5b505af1158015610117573d6000803e3d6000fd5b505050506040513d602081101561012d57600080fd5b810190808051906020019092919050505050505600a165627a7a72305820ce11dc254897fc0daf11ab211b9f5eded26e94ee3a926c7fd5e7f51be1612cc60029") </code> | |
<storage> ((.Map) +Map (0 |-> (Int => Int))) | |
_:Map </storage> | |
<nonce> _ </nonce> | |
</account> | |
<account> | |
<acctID> Int </acctID> | |
<balance> Int_balance </balance> | |
<code> #parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063efa427a2146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506082565b6040518082815260200191505060405180910390f35b60008190509190505600a165627a7a72305820a6587a307832a1ec78ecdd4ac3a3b785dcec4afbb0142390c78c9fdaf322c15f0029") </code> | |
<storage> .Map | |
_:Map </storage> | |
<nonce> _ </nonce> | |
</account> | |
... | |
</accounts> | |
<txOrder> _ </txOrder> | |
<txPending> _ </txPending> | |
<messages> _ </messages> | |
</network> | |
</ethereum> | |
requires #rangeAddress(ACCT_ID) | |
andBool #notPrecompileAddress(ACCT_ID) | |
andBool #rangeAddress(CALLER_ID) | |
andBool #rangeAddress(ORIGIN_ID) | |
andBool #rangeUInt(48, TIME) | |
andBool #rangeUInt(256, ACCT_ID_balance) | |
andBool VCallDepth <=Int 1024 | |
andBool #rangeUInt(256, VCallValue) | |
andBool (#rangeUInt(256, ABI_y) | |
andBool (#rangeAddress(Int) | |
andBool (#rangeUInt(256, Int_balance) | |
andBool (#sizeWordStack(CD) <=Int 1250000000 | |
andBool (#notPrecompileAddress(Int) | |
andBool (ACCT_ID =/=Int Int | |
andBool (#rangeSInt(256, ABI_y) | |
andBool (VGas >=Int 3000000 | |
andBool (VCallDepth <Int 1024 | |
andBool (VCallValue ==Int 0)))))))))) | |
// Int_callMe | |
rule | |
<k> #execute ~> CONTINUATION => #halt ~> CONTINUATION </k> | |
<exit-code> 1 </exit-code> | |
<mode> NORMAL </mode> | |
<schedule> BYZANTIUM </schedule> | |
<analysis> .Map </analysis> | |
<ethereum> | |
<evm> | |
<output> _ => #asByteStackInWidthaux(#unsigned(ABI_x), 31, 32, .WordStack) </output> | |
<statusCode> _ => EVMC_SUCCESS </statusCode> | |
<callStack> VCallStack </callStack> | |
<interimStates> _ </interimStates> | |
<touchedAccounts> _ => _ </touchedAccounts> | |
<callState> | |
<program> #asMapOpCodes(#dasmOpCodes(#parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063efa427a2146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506082565b6040518082815260200191505060405180910390f35b60008190509190505600a165627a7a72305820a6587a307832a1ec78ecdd4ac3a3b785dcec4afbb0142390c78c9fdaf322c15f0029"), BYZANTIUM)) </program> | |
<programBytes> #parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063efa427a2146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506082565b6040518082815260200191505060405180910390f35b60008190509190505600a165627a7a72305820a6587a307832a1ec78ecdd4ac3a3b785dcec4afbb0142390c78c9fdaf322c15f0029") </programBytes> | |
<id> ACCT_ID </id> | |
<caller> CALLER_ID </caller> | |
<callData> #abiCallData("callMe", #int256(ABI_x)) ++ CD </callData> | |
<callValue> VCallValue </callValue> | |
<wordStack> .WordStack => _ </wordStack> | |
<localMem> .Map => _ </localMem> | |
<pc> 0 => _ </pc> | |
<gas> VGas => ( VGas -Int 263 ) </gas> | |
<memoryUsed> 0 => _ </memoryUsed> | |
<previousGas> _ => _ </previousGas> | |
<static> false </static> | |
<callDepth> VCallDepth => _ </callDepth> | |
</callState> | |
<substate> | |
<selfDestruct> VSelfDestruct </selfDestruct> | |
<log> _ => VLog </log> | |
<refund> _ => VRefund </refund> | |
</substate> | |
<gasPrice> _ </gasPrice> | |
<origin> ORIGIN_ID </origin> | |
<previousHash> _ </previousHash> | |
<ommersHash> _ </ommersHash> | |
<coinbase> _ </coinbase> | |
<stateRoot> _ </stateRoot> | |
<transactionsRoot> _ </transactionsRoot> | |
<receiptsRoot> _ </receiptsRoot> | |
<logsBloom> _ </logsBloom> | |
<difficulty> _ </difficulty> | |
<number> _ </number> | |
<gasLimit> _ </gasLimit> | |
<gasUsed> _ </gasUsed> | |
<timestamp> TIME </timestamp> | |
<extraData> _ </extraData> | |
<mixHash> _ </mixHash> | |
<blockNonce> _ </blockNonce> | |
<ommerBlockHeaders> _ </ommerBlockHeaders> | |
<blockhash> _ </blockhash> | |
</evm> | |
<network> | |
<activeAccounts> SetItem(ACCT_ID) _ </activeAccounts> | |
<accounts> | |
<account> | |
<acctID> ACCT_ID </acctID> | |
<balance> ACCT_ID_balance </balance> | |
<code> #parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063efa427a2146044575b600080fd5b348015604f57600080fd5b50606c600480360381019080803590602001909291905050506082565b6040518082815260200191505060405180910390f35b60008190509190505600a165627a7a72305820a6587a307832a1ec78ecdd4ac3a3b785dcec4afbb0142390c78c9fdaf322c15f0029") </code> | |
<storage> .Map | |
_:Map </storage> | |
<nonce> _ </nonce> | |
</account> | |
... | |
</accounts> | |
<txOrder> _ </txOrder> | |
<txPending> _ </txPending> | |
<messages> _ </messages> | |
</network> | |
</ethereum> | |
requires #rangeAddress(ACCT_ID) | |
andBool #notPrecompileAddress(ACCT_ID) | |
andBool #rangeAddress(CALLER_ID) | |
andBool #rangeAddress(ORIGIN_ID) | |
andBool #rangeUInt(48, TIME) | |
andBool #rangeUInt(256, ACCT_ID_balance) | |
andBool VCallDepth <=Int 1024 | |
andBool #rangeUInt(256, VCallValue) | |
andBool (#rangeSInt(256, ABI_x) | |
andBool (#sizeWordStack(CD) <=Int 1250000000 | |
andBool (VGas >=Int 263 | |
andBool (VCallValue ==Int 0)))) | |
[trusted] | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment