Created
February 25, 2019 16:56
-
-
Save MrChico/337a32bfa9c2f73482037b0497c0c552 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 SAFEADD_ADD_FAIL | |
imports ETHEREUM-SIMULATION | |
imports EVM | |
imports RULES | |
// SafeAdd_add | |
rule | |
<k> #execute ~> CONTINUATION => #halt ~> CONTINUATION </k> | |
<exit-code> 1 </exit-code> | |
<mode> NORMAL </mode> | |
<schedule> BYZANTIUM </schedule> | |
<analysis> .Map </analysis> | |
<ethereum> | |
<evm> | |
<output> _ => _ </output> | |
<statusCode> _ => FAILURE </statusCode> | |
<callStack> VCallStack </callStack> | |
<interimStates> _ </interimStates> | |
<touchedAccounts> _ => _ </touchedAccounts> | |
<callState> | |
<program> #asMapOpCodes(#dasmOpCodes(#parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063771602f7146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b6000828284019150811015151560a157600080fd5b929150505600a165627a7a723058203b57dad807fdb6480e9790466c6c7c093336994627575d793bb499d56ffb89090029"), BYZANTIUM)) </program> | |
<programBytes> #parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063771602f7146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b6000828284019150811015151560a157600080fd5b929150505600a165627a7a723058203b57dad807fdb6480e9790466c6c7c093336994627575d793bb499d56ffb89090029") </programBytes> | |
<id> ACCT_ID </id> | |
<caller> CALLER_ID </caller> | |
<callData> 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) _ </activeAccounts> | |
<accounts> | |
<account> | |
<acctID> ACCT_ID </acctID> | |
<balance> ACCT_ID_balance </balance> | |
<code> #parseByteStack("0x608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063771602f7146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b6000828284019150811015151560a157600080fd5b929150505600a165627a7a723058203b57dad807fdb6480e9790466c6c7c093336994627575d793bb499d56ffb89090029") </code> | |
<storage> .Map | |
_:Map=> _ </storage> | |
<origStorage> _ </origStorage> | |
<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 #sizeWordStack(CD) <=Int 1250000000 | |
andBool VGas >=Int 3000000 | |
andBool ((#take(4, CD) ==K #abiCallData("add", #uint256(ABI_X), #uint256(ABI_Y))) andBool #sizeWordStack(CD) <=Int #sizeWordStack(#abiCallData("add", #uint256(ABI_X), #uint256(ABI_Y))) orBool (notBool #take(4, CD) ==K #abiCallData("add", #uint256(ABI_X), #uint256(ABI_Y)))) | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment