Guest User

Untitled

a guest
Jun 17th, 2018
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. requires "abstract-semantics.k"
  2. requires "verification.k"
  3.  
  4. module PROOF-SPEC
  5. imports ETHEREUM-SIMULATION
  6. imports ABSTRACT-SEMANTICS
  7. imports VERIFICATION
  8.  
  9. // rmul
  10. rule
  11. <k> #execute => #execute </k>
  12. <exit-code> 1 </exit-code>
  13. <mode> NORMAL </mode>
  14. <schedule> BYZANTIUM </schedule>
  15. <analysis> .Map </analysis> // not part of evm
  16.  
  17. <ethereum>
  18. <evm>
  19. <output> _ </output>
  20. <statusCode> _ </statusCode>
  21. <callStack> _ </callStack>
  22. <interimStates> _ </interimStates>
  23. <touchedAccounts> _ => _ </touchedAccounts>
  24.  
  25. <callState>
  26. <program> #asMapOpCodes(#dasmOpCodes(#parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806367b870af14610046575b600080fd5b34801561005257600080fd5b5061008560048036038101908080359060200190929190803590602001909291908035906020019092919050505061009b565b6040518082815260200191505060405180910390f35b6000806002840614600081146100b3578491506100b7565b8291505b50600282046002840493505b83156100fa576100d5818487886100ff565b945060028406156100ef576100ec818487856100ff565b91505b6002840493506100c3565b610142565b60008282029050818382041415600084141516156101205761011f610147565b5b8481018181101561013457610133610147565b5b848104915050949350505050565b61014c565b600080fd5b5093925050505600a165627a7a7230582012a5165e693c1e46176e27b7a9bf9ad99b696d20d5012720c153b44af91d4a5f0029"), BYZANTIUM)) </program>
  27. <programBytes> #parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806367b870af14610046575b600080fd5b34801561005257600080fd5b5061008560048036038101908080359060200190929190803590602001909291908035906020019092919050505061009b565b6040518082815260200191505060405180910390f35b6000806002840614600081146100b3578491506100b7565b8291505b50600282046002840493505b83156100fa576100d5818487886100ff565b945060028406156100ef576100ec818487856100ff565b91505b6002840493506100c3565b610142565b60008282029050818382041415600084141516156101205761011f610147565b5b8481018181101561013457610133610147565b5b848104915050949350505050565b61014c565b600080fd5b5093925050505600a165627a7a7230582012a5165e693c1e46176e27b7a9bf9ad99b696d20d5012720c153b44af91d4a5f0029") </programBytes>
  28.  
  29. <id> ACCT_ID </id> // contract owner
  30. <caller> CALLER_ID </caller> // who called this contract; in the begining, origin // msg.sender
  31.  
  32. <callData> _ </callData>
  33.  
  34. <callValue> 0 </callValue>
  35. <wordStack> X : Y : BASE : HALF : JUMPTO : WS => JUMPTO : (X *Int Y +Int HALF) /Int BASE : WS </wordStack>
  36. <localMem> .Map => _ </localMem>
  37. <pc> 255 => 321 </pc>
  38. <gas> G => G -Int 139 </gas>
  39. <memoryUsed> 0 => _ </memoryUsed>
  40. <previousGas> _ => _ </previousGas>
  41.  
  42. <static> false </static> // NOTE: non-static call
  43. <callDepth> CALL_DEPTH </callDepth>
  44. </callState>
  45.  
  46. <substate>
  47. <selfDestruct> _ </selfDestruct>
  48. <log> _ </log>
  49. <refund> _ </refund> // TODO: more detail
  50. </substate>
  51.  
  52. <gasPrice> _ </gasPrice>
  53. <origin> ORIGIN_ID </origin> // who fires tx
  54.  
  55. <previousHash> _ </previousHash>
  56. <ommersHash> _ </ommersHash>
  57. <coinbase> _ </coinbase>
  58. <stateRoot> _ </stateRoot>
  59. <transactionsRoot> _ </transactionsRoot>
  60. <receiptsRoot> _ </receiptsRoot>
  61. <logsBloom> _ </logsBloom>
  62. <difficulty> _ </difficulty>
  63. <number> _ </number>
  64. <gasLimit> _ </gasLimit>
  65. <gasUsed> _ </gasUsed>
  66. <timestamp> _ </timestamp>
  67. <extraData> _ </extraData>
  68. <mixHash> _ </mixHash>
  69. <blockNonce> _ </blockNonce>
  70.  
  71. <ommerBlockHeaders> _ </ommerBlockHeaders>
  72. <blockhash> _ </blockhash>
  73. </evm>
  74.  
  75. <network>
  76. <activeAccounts> SetItem(ACCT_ID) _:Set
  77.  
  78. </activeAccounts>
  79.  
  80. <accounts>
  81. <account>
  82. <acctID> ACCT_ID </acctID>
  83. <balance> _ </balance>
  84. <code> #parseByteStack("0x608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806367b870af14610046575b600080fd5b34801561005257600080fd5b5061008560048036038101908080359060200190929190803590602001909291908035906020019092919050505061009b565b6040518082815260200191505060405180910390f35b6000806002840614600081146100b3578491506100b7565b8291505b50600282046002840493505b83156100fa576100d5818487886100ff565b945060028406156100ef576100ec818487856100ff565b91505b6002840493506100c3565b610142565b60008282029050818382041415600084141516156101205761011f610147565b5b8481018181101561013457610133610147565b5b848104915050949350505050565b61014c565b600080fd5b5093925050505600a165627a7a7230582012a5165e693c1e46176e27b7a9bf9ad99b696d20d5012720c153b44af91d4a5f0029") </code>
  85. <storage>
  86. _
  87. </storage>
  88. <nonce> _ </nonce>
  89. </account>
  90.  
  91. ...
  92. </accounts>
  93.  
  94. <txOrder> _ </txOrder>
  95. <txPending> _ </txPending>
  96. <messages> _ </messages>
  97. </network>
  98. </ethereum>
  99. requires 0 <=Int ACCT_ID andBool ACCT_ID <Int (2 ^Int 160)
  100. andBool 0 <=Int CALLER_ID andBool CALLER_ID <Int (2 ^Int 160)
  101. andBool 0 <=Int ORIGIN_ID andBool ORIGIN_ID <Int (2 ^Int 160)
  102. andBool 0 <=Int CALL_DEPTH andBool CALL_DEPTH <Int 1024
  103. andBool #sizeWordStack(WS) <Int 250
  104. andBool #sizeWordStack(WS) >=Int 0
  105. andBool HALF ==Int BASE /Int 2
  106. andBool 0 <=Int X andBool X <Int pow256
  107. andBool 0 <=Int Y andBool Y <Int pow256
  108. andBool 0 <=Int X *Int Y andBool X *Int Y <Int pow256
  109. andBool 0 <=Int X *Int Y +Int HALF andBool X *Int Y +Int HALF <Int pow256
  110. andBool 1 <=Int BASE andBool BASE <Int pow256
  111. andBool G >=Int 1000000000
  112.  
  113.  
  114.  
  115. endmodule
Add Comment
Please, Sign In to add comment