event-msg

Simple, embedded news post vehicle for EVM smart contracts
Log | Files | Refs

commit da18d4f2d209cd85e6bd59540212d325a7ff5ee7
parent a76c4bfa16a5ebaa2e4c337ae87cfc74e34e3b1a
Author: lash <dev@holbrook.no>
Date:   Fri, 17 Feb 2023 23:50:10 +0000

Add messager event, methods

Diffstat:
Mpython/eth_event_msg/__init__.py | 17++++++++++++++++-
Mpython/eth_event_msg/data/Msg.bin | 4++--
Mpython/eth_event_msg/data/Msg.json | 2+-
Mpython/tests/test_basic.py | 39++++++++++++++++++++++++++++++++-------
Msolidity/Msg.sol | 16++++++++++++++++
5 files changed, 67 insertions(+), 11 deletions(-)

diff --git a/python/eth_event_msg/__init__.py b/python/eth_event_msg/__init__.py @@ -58,6 +58,22 @@ class EventMsg(TxFactory): return EventMsg.bytecode() + def set_msg(self, contract_address, sender_address, v, tx_format=TxFormat.JSONRPC): + enc = ABIContractEncoder() + enc.method('setMsg') + enc.typ(ABIContractType.BYTES) + enc.bytes(v) + data = enc.get() + tx = self.template(sender_address, contract_address, use_nonce=True) + tx = self.set_code(tx, data) + tx = self.finalize(tx, tx_format) + return tx + + + def get_msg(self, contract_address, sender_address=ZERO_ADDRESS, id_generator=None): + return self.call_noarg('getMsg', contract_address, sender_address=sender_address, id_generator=id_generator) + + def to_hash(self, contract_address, v, sender_address=ZERO_ADDRESS, id_generator=None): j = JSONRPCRequest(id_generator) o = j.template() @@ -96,7 +112,6 @@ class EventMsg(TxFactory): def parse_to_hash(self, v): v = strip_0x(v) l = int(v[64:128], 16) - logg.debug('llll {} {}'.format(l, v[64:128])) r = v[128:128+(l*2)] return r diff --git a/python/eth_event_msg/data/Msg.bin b/python/eth_event_msg/data/Msg.bin @@ -1 +1 @@ -60806040523480156200001157600080fd5b5062000065602060126040518060400160405280600681526020017f736861323536000000000000000000000000000000000000000000000000000081525062000086640100000000026401000000009004565b620000806012620003aa640100000000026401000000009004565b6200080e565b6000600160ff166002541614620000d4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000cb9062000502565b60405180910390fd5b606081905060108151111562000121576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001189062000574565b60405180910390fd5b6200012b6200043b565b6000600790505b60008160ff16106200018f5760006008826200014f9190620005d2565b60ff1660ff9060020a029050600086821667ffffffffffffffff1611156200017857506200018f565b8180620001859062000618565b9250505062000132565b6001816200019e919062000646565b826020019060ff16908160ff16815250506008816007620001c0919062000682565b620001cc9190620005d2565b60ff168567ffffffffffffffff169060020a02780100000000000000000000000000000000000000000000000002826080019077ffffffffffffffffffffffffffffffffffffffffffffffff1916908177ffffffffffffffffffffffffffffffffffffffffffffffff1916815250508251826040019060ff16908160ff1681525050826200025a906200072c565b82606001906fffffffffffffffffffffffffffffffff191690816fffffffffffffffffffffffffffffffff19168152505085826000019060ff16908160ff1681525050816000808767ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a8154816fffffffffffffffffffffffffffffffff02191690837001000000000000000000000000000000009004021790555060808201518160000160136101000a81548167ffffffffffffffff0219169083780100000000000000000000000000000000000000000000000090040217905550905050505050505050565b6000600160ff166002541614620003f8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620003ef90620007ec565b60405180910390fd5b6000806000838152602001908152602001600020905060008160000160009054906101000a900460ff1660ff16116200043057600080fd5b816001819055505050565b6040518060a00160405280600060ff168152602001600060ff168152602001600060ff16815260200160006fffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff191681525090565b600082825260208201905092915050565b7f4552525f5345414c5f434f4445434c4953540000000000000000000000000000600082015250565b6000620004ea601283620004a1565b9150620004f782620004b2565b602082019050919050565b600060208201905081810360008301526200051d81620004db565b9050919050565b7f4552525f5052454649585f544f4f5f4c4f4e4700000000000000000000000000600082015250565b60006200055c601383620004a1565b9150620005698262000524565b602082019050919050565b600060208201905081810360008301526200058f816200054d565b9050919050565b600060ff82169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620005df8262000596565b9150620005ec8362000596565b9250828202620005fc8162000596565b9150808214620006115762000610620005a3565b5b5092915050565b6000620006258262000596565b9150600082036200063b576200063a620005a3565b5b600182039050919050565b6000620006538262000596565b9150620006608362000596565b9250828201905060ff8111156200067c576200067b620005a3565b5b92915050565b60006200068f8262000596565b91506200069c8362000596565b9250828203905060ff811115620006b857620006b7620005a3565b5b92915050565b600081519050919050565b6000819050602082019050919050565b60007fffffffffffffffffffffffffffffffff0000000000000000000000000000000082169050919050565b6000620007138251620006d9565b80915050919050565b60008160020a8302905092915050565b60006200073982620006be565b826200074584620006c9565b9050620007528162000705565b925060108210156200079557620007907fffffffffffffffffffffffffffffffff00000000000000000000000000000000836010036008026200071c565b831692505b5050919050565b7f4552525f5345414c5f434f444543000000000000000000000000000000000000600082015250565b6000620007d4600e83620004a1565b9150620007e1826200079c565b602082019050919050565b600060208201905081810360008301526200080781620007c5565b9050919050565b611c0d806200081e6000396000f3fe608060405234801561001057600080fd5b50600436106100bb576000357c0100000000000000000000000000000000000000000000000000000000900480639a7c5e9f116100835780639a7c5e9f1461018c578063ad0dec2f146101a8578063b238d603146101d8578063c5bec6fc1461020c578063ccc094c21461023c576100bb565b806318cbbcfc146100c05780632c1758c1146100de57806331a5995d1461010e578063779ab6671461012c57806386fe212d1461015c575b600080fd5b6100c8610258565b6040516100d5919061116d565b60405180910390f35b6100f860048036038101906100f391906111c8565b61025d565b6040516101059190611210565b60405180910390f35b610116610290565b604051610123919061116d565b60405180910390f35b61014660048036038101906101419190611371565b610296565b6040516101539190611439565b60405180910390f35b610176600480360381019061017191906111c8565b610540565b604051610183919061116d565b60405180910390f35b6101a660048036038101906101a191906111c8565b610627565b005b6101c260048036038101906101bd9190611371565b6106b4565b6040516101cf91906114b0565b60405180910390f35b6101f260048036038101906101ed91906111c8565b61098a565b604051610203959493929190611564565b60405180910390f35b61022660048036038101906102219190611371565b610a29565b60405161023391906114b0565b60405180910390f35b610256600480360381019061025191906116c4565b610de2565b005b600381565b60006003821061026c57600080fd5b6000820361028157600360025414905061028b565b8160025483161490505b919050565b60025481565b6060600060608060006102a886610a29565b9150600080600154815260200190815260200160002093508360000160029054906101000a900460ff1660ff16905060018251826102e69190611762565b6102f09190611762565b67ffffffffffffffff81111561030957610308611246565b5b6040519080825280601f01601f19166020018201604052801561033b5781602001600182028036833780820191505090505b50925060005b818110156103f5578460000160039054906101000a900470010000000000000000000000000000000002816010811061037d5761037c611796565b5b1a7f0100000000000000000000000000000000000000000000000000000000000000028482815181106103b3576103b2611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806103ed906117c5565b915050610341565b50603a7f01000000000000000000000000000000000000000000000000000000000000000283828151811061042d5761042c611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610467906117c5565b91505060005b82518110156105335782818151811061048957610488611796565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028482846104e09190611762565b815181106104f1576104f0611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061052b906117c5565b91505061046d565b5082945050505050919050565b600060108210610585576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161057c90611859565b60405180910390fd5b60006002548316146105cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c3906118c5565b60405180910390fd5b8160026000828254179250508190555060036002541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e600254604051610615919061116d565b60405180910390a26002549050919050565b6000600160ff166002541614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066990611931565b60405180910390fd5b6000806000838152602001908152602001600020905060008160000160009054906101000a900460ff1660ff16116106a957600080fd5b816001819055505050565b606060006060600080600154815260200190815260200160002091508160000160019054906101000a900460ff1660ff168260000160009054906101000a900460ff1660ff1685516107069190611762565b6107109190611762565b67ffffffffffffffff81111561072957610728611246565b5b6040519080825280601f01601f19166020018201604052801561075b5781602001600182028036833780820191505090505b50905060005b8260000160019054906101000a900460ff1660ff16811015610831578260000160139054906101000a900478010000000000000000000000000000000000000000000000000281600881106107b9576107b8611796565b5b1a7f0100000000000000000000000000000000000000000000000000000000000000028282815181106107ef576107ee611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610829906117c5565b915050610761565b8260000160009054906101000a900460ff167f01000000000000000000000000000000000000000000000000000000000000000282828151811061087857610877611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806108b2906117c5565b91505060005b855181101561097e578581815181106108d4576108d3611796565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000283828461092b9190611762565b8151811061093c5761093b611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610976906117c5565b9150506108b8565b50819350505050919050565b60006020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16908060000160029054906101000a900460ff16908060000160039054906101000a900470010000000000000000000000000000000002908060000160139054906101000a9004780100000000000000000000000000000000000000000000000002905085565b60608060008060028551610a3d9190611951565b67ffffffffffffffff811115610a5657610a55611246565b5b6040519080825280601f01601f191660200182016040528015610a885781602001600182028036833780820191505090505b5092506000905060005b6020811015610dd657600460f0878381518110610ab257610ab1611796565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090041660ff16908060020a82049150509250600a8360ff161015610bb157603083610b489190611993565b7f010000000000000000000000000000000000000000000000000000000000000002848381518110610b7d57610b7c611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610c23565b605783610bbe9190611993565b7f010000000000000000000000000000000000000000000000000000000000000002848381518110610bf357610bf2611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600f868281518110610c3857610c37611796565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f01000000000000000000000000000000000000000000000000000000000000009004169250600a8360ff161015610d3657603083610cc19190611993565b7f01000000000000000000000000000000000000000000000000000000000000000284600184610cf19190611762565b81518110610d0257610d01611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610db4565b605783610d439190611993565b7f01000000000000000000000000000000000000000000000000000000000000000284600184610d739190611762565b81518110610d8457610d83611796565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600282610dc19190611762565b91508080610dce906117c5565b915050610a92565b50829350505050919050565b6000600160ff166002541614610e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2490611a14565b60405180910390fd5b6060819050601081511115610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e90611a80565b60405180910390fd5b610e7f6110ee565b6000600790505b60008160ff1610610edb576000600882610ea09190611aa0565b60ff1660ff9060020a029050600086821667ffffffffffffffff161115610ec75750610edb565b8180610ed290611add565b92505050610e86565b600181610ee89190611993565b826020019060ff16908160ff16815250506008816007610f089190611b06565b610f129190611aa0565b60ff168567ffffffffffffffff169060020a02780100000000000000000000000000000000000000000000000002826080019077ffffffffffffffffffffffffffffffffffffffffffffffff1916908177ffffffffffffffffffffffffffffffffffffffffffffffff1916815250508251826040019060ff16908160ff168152505082610f9e90611b70565b82606001906fffffffffffffffffffffffffffffffff191690816fffffffffffffffffffffffffffffffff19168152505085826000019060ff16908160ff1681525050816000808767ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a8154816fffffffffffffffffffffffffffffffff02191690837001000000000000000000000000000000009004021790555060808201518160000160136101000a81548167ffffffffffffffff0219169083780100000000000000000000000000000000000000000000000090040217905550905050505050505050565b6040518060a00160405280600060ff168152602001600060ff168152602001600060ff16815260200160006fffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff191681525090565b6000819050919050565b61116781611154565b82525050565b6000602082019050611182600083018461115e565b92915050565b6000604051905090565b600080fd5b600080fd5b6111a581611154565b81146111b057600080fd5b50565b6000813590506111c28161119c565b92915050565b6000602082840312156111de576111dd611192565b5b60006111ec848285016111b3565b91505092915050565b60008115159050919050565b61120a816111f5565b82525050565b60006020820190506112256000830184611201565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61127e82611235565b810181811067ffffffffffffffff8211171561129d5761129c611246565b5b80604052505050565b60006112b0611188565b90506112bc8282611275565b919050565b600067ffffffffffffffff8211156112dc576112db611246565b5b6112e582611235565b9050602081019050919050565b82818337600083830152505050565b600061131461130f846112c1565b6112a6565b9050828152602081018484840111156113305761132f611230565b5b61133b8482856112f2565b509392505050565b600082601f8301126113585761135761122b565b5b8135611368848260208601611301565b91505092915050565b60006020828403121561138757611386611192565b5b600082013567ffffffffffffffff8111156113a5576113a4611197565b5b6113b184828501611343565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156113f45780820151818401526020810190506113d9565b60008484015250505050565b600061140b826113ba565b61141581856113c5565b93506114258185602086016113d6565b61142e81611235565b840191505092915050565b600060208201905081810360008301526114538184611400565b905092915050565b600081519050919050565b600082825260208201905092915050565b60006114828261145b565b61148c8185611466565b935061149c8185602086016113d6565b6114a581611235565b840191505092915050565b600060208201905081810360008301526114ca8184611477565b905092915050565b600060ff82169050919050565b6114e8816114d2565b82525050565b60007fffffffffffffffffffffffffffffffff0000000000000000000000000000000082169050919050565b611523816114ee565b82525050565b60007fffffffffffffffff00000000000000000000000000000000000000000000000082169050919050565b61155e81611529565b82525050565b600060a08201905061157960008301886114df565b61158660208301876114df565b61159360408301866114df565b6115a0606083018561151a565b6115ad6080830184611555565b9695505050505050565b6115c0816114d2565b81146115cb57600080fd5b50565b6000813590506115dd816115b7565b92915050565b600067ffffffffffffffff82169050919050565b611600816115e3565b811461160b57600080fd5b50565b60008135905061161d816115f7565b92915050565b600067ffffffffffffffff82111561163e5761163d611246565b5b61164782611235565b9050602081019050919050565b600061166761166284611623565b6112a6565b90508281526020810184848401111561168357611682611230565b5b61168e8482856112f2565b509392505050565b600082601f8301126116ab576116aa61122b565b5b81356116bb848260208601611654565b91505092915050565b6000806000606084860312156116dd576116dc611192565b5b60006116eb868287016115ce565b93505060206116fc8682870161160e565b925050604084013567ffffffffffffffff81111561171d5761171c611197565b5b61172986828701611696565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061176d82611154565b915061177883611154565b92508282019050808211156117905761178f611733565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006117d082611154565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361180257611801611733565b5b600182019050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b60006118436011836113c5565b915061184e8261180d565b602082019050919050565b6000602082019050818103600083015261187281611836565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b60006118af6012836113c5565b91506118ba82611879565b602082019050919050565b600060208201905081810360008301526118de816118a2565b9050919050565b7f4552525f5345414c5f434f444543000000000000000000000000000000000000600082015250565b600061191b600e836113c5565b9150611926826118e5565b602082019050919050565b6000602082019050818103600083015261194a8161190e565b9050919050565b600061195c82611154565b915061196783611154565b925082820261197581611154565b9150828204841483151761198c5761198b611733565b5b5092915050565b600061199e826114d2565b91506119a9836114d2565b9250828201905060ff8111156119c2576119c1611733565b5b92915050565b7f4552525f5345414c5f434f4445434c4953540000000000000000000000000000600082015250565b60006119fe6012836113c5565b9150611a09826119c8565b602082019050919050565b60006020820190508181036000830152611a2d816119f1565b9050919050565b7f4552525f5052454649585f544f4f5f4c4f4e4700000000000000000000000000600082015250565b6000611a6a6013836113c5565b9150611a7582611a34565b602082019050919050565b60006020820190508181036000830152611a9981611a5d565b9050919050565b6000611aab826114d2565b9150611ab6836114d2565b9250828202611ac4816114d2565b9150808214611ad657611ad5611733565b5b5092915050565b6000611ae8826114d2565b915060008203611afb57611afa611733565b5b600182039050919050565b6000611b11826114d2565b9150611b1c836114d2565b9250828203905060ff811115611b3557611b34611733565b5b92915050565b6000819050602082019050919050565b6000611b5782516114ee565b80915050919050565b60008160020a8302905092915050565b6000611b7b8261145b565b82611b8584611b3b565b9050611b9081611b4b565b92506010821015611bd057611bcb7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083601003600802611b60565b831692505b505091905056fea2646970667358221220c40dc545351de8e204643c8ec0b06d9a24e411aea9dcefa0ae864583db7331b264736f6c63430008110033 -\ No newline at end of file +60806040523480156200001157600080fd5b5062000065602060126040518060400160405280600681526020017f7368613235360000000000000000000000000000000000000000000000000000815250620000e9640100000000026401000000009004565b6200008060126200040d640100000000026401000000009004565b602067ffffffffffffffff8111156200009e576200009d62000504565b5b6040519080825280601f01601f191660200182016040528015620000d15781602001600182028036833780820191505090505b5060029081620000e2919062000784565b5062000bbd565b6000600160ff16600354161462000137576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200012e90620008cc565b60405180910390fd5b606081905060108151111562000184576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200017b906200093e565b60405180910390fd5b6200018e6200049e565b6000600790505b60008160ff1610620001f2576000600882620001b291906200099c565b60ff1660ff9060020a029050600086821667ffffffffffffffff161115620001db5750620001f2565b8180620001e890620009e2565b9250505062000195565b60018162000201919062000a10565b826020019060ff16908160ff1681525050600881600762000223919062000a4c565b6200022f91906200099c565b60ff168567ffffffffffffffff169060020a02780100000000000000000000000000000000000000000000000002826080019077ffffffffffffffffffffffffffffffffffffffffffffffff1916908177ffffffffffffffffffffffffffffffffffffffffffffffff1916815250508251826040019060ff16908160ff168152505082620002bd9062000adb565b82606001906fffffffffffffffffffffffffffffffff191690816fffffffffffffffffffffffffffffffff19168152505085826000019060ff16908160ff1681525050816000808767ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a8154816fffffffffffffffffffffffffffffffff02191690837001000000000000000000000000000000009004021790555060808201518160000160136101000a81548167ffffffffffffffff0219169083780100000000000000000000000000000000000000000000000090040217905550905050505050505050565b6000600160ff1660035416146200045b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620004529062000b9b565b60405180910390fd5b6000806000838152602001908152602001600020905060008160000160009054906101000a900460ff1660ff16116200049357600080fd5b816001819055505050565b6040518060a00160405280600060ff168152602001600060ff168152602001600060ff16815260200160006fffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff191681525090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200058657607f821691505b6020821081036200059c576200059b6200053e565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b600060088302620006097fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82620005c7565b620006158683620005c7565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620006626200065c62000656846200062d565b62000637565b6200062d565b9050919050565b6000819050919050565b6200067e8362000641565b620006966200068d8262000669565b848454620005d7565b825550505050565b600090565b620006ad6200069e565b620006ba81848462000673565b505050565b5b81811015620006e257620006d6600082620006a3565b600181019050620006c0565b5050565b601f8211156200073157620006fb81620005a2565b6200070684620005b7565b8101602085101562000716578190505b6200072e6200072585620005b7565b830182620006bf565b50505b505050565b60008160020a8304905092915050565b6000620007596000198460080262000736565b1980831691505092915050565b600062000774838362000746565b9150826002028217905092915050565b6200078f8262000533565b67ffffffffffffffff811115620007ab57620007aa62000504565b5b620007b782546200056d565b620007c4828285620006e6565b600060209050601f831160018114620007fc5760008415620007e7578287015190505b620007f3858262000766565b86555062000863565b601f1984166200080c86620005a2565b60005b8281101562000836578489015182556001820191506020850194506020810190506200080f565b8683101562000856578489015162000852601f89168262000746565b8355505b6001600288020188555050505b505050505050565b600082825260208201905092915050565b7f4552525f5345414c5f434f4445434c4953540000000000000000000000000000600082015250565b6000620008b46012836200086b565b9150620008c1826200087c565b602082019050919050565b60006020820190508181036000830152620008e781620008a5565b9050919050565b7f4552525f5052454649585f544f4f5f4c4f4e4700000000000000000000000000600082015250565b6000620009266013836200086b565b91506200093382620008ee565b602082019050919050565b60006020820190508181036000830152620009598162000917565b9050919050565b600060ff82169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000620009a98262000960565b9150620009b68362000960565b9250828202620009c68162000960565b9150808214620009db57620009da6200096d565b5b5092915050565b6000620009ef8262000960565b91506000820362000a055762000a046200096d565b5b600182039050919050565b600062000a1d8262000960565b915062000a2a8362000960565b9250828201905060ff81111562000a465762000a456200096d565b5b92915050565b600062000a598262000960565b915062000a668362000960565b9250828203905060ff81111562000a825762000a816200096d565b5b92915050565b6000819050602082019050919050565b60007fffffffffffffffffffffffffffffffff0000000000000000000000000000000082169050919050565b600062000ad2825162000a98565b80915050919050565b600062000ae88262000533565b8262000af48462000a88565b905062000b018162000ac4565b9250601082101562000b445762000b3f7fffffffffffffffffffffffffffffffff0000000000000000000000000000000083601003600802620005c7565b831692505b5050919050565b7f4552525f5345414c5f434f444543000000000000000000000000000000000000600082015250565b600062000b83600e836200086b565b915062000b908262000b4b565b602082019050919050565b6000602082019050818103600083015262000bb68162000b74565b9050919050565b6120168062000bcd6000396000f3fe608060405234801561001057600080fd5b50600436106100d1576000357c0100000000000000000000000000000000000000000000000000000000900480639a7c5e9f1161008e5780639a7c5e9f146101be578063ad0dec2f146101da578063b238d6031461020a578063b5fdeb231461023e578063c5bec6fc1461025c578063ccc094c21461028c576100d1565b806318cbbcfc146100d65780632c1758c1146100f457806331a5995d146101245780635344299a14610142578063779ab6671461015e57806386fe212d1461018e575b600080fd5b6100de6102a8565b6040516100eb91906112a2565b60405180910390f35b61010e600480360381019061010991906112fd565b6102ad565b60405161011b9190611345565b60405180910390f35b61012c6102df565b60405161013991906112a2565b60405180910390f35b61015c600480360381019061015791906114a6565b6102e5565b005b610178600480360381019061017391906114a6565b610332565b604051610185919061156e565b60405180910390f35b6101a860048036038101906101a391906112fd565b6105dc565b6040516101b591906112a2565b60405180910390f35b6101d860048036038101906101d391906112fd565b6106c2565b005b6101f460048036038101906101ef91906114a6565b61074f565b60405161020191906115e5565b60405180910390f35b610224600480360381019061021f91906112fd565b610a25565b604051610235959493929190611699565b60405180910390f35b610246610ac4565b60405161025391906115e5565b60405180910390f35b610276600480360381019061027191906114a6565b610b5e565b60405161028391906115e5565b60405180910390f35b6102a660048036038101906102a191906117f9565b610f17565b005b600381565b6000600382106102bc57600080fd5b600082036102d057600380541490506102da565b8160035483161490505b919050565b60035481565b6000806000600154815260200190815260200160002090508060000160009054906101000a900460ff1660ff1682511461031e57600080fd5b816002908161032d9190611a7a565b505050565b60606000606080600061034486610b5e565b9150600080600154815260200190815260200160002093508360000160029054906101000a900460ff1660ff16905060018251826103829190611b7b565b61038c9190611b7b565b67ffffffffffffffff8111156103a5576103a461137b565b5b6040519080825280601f01601f1916602001820160405280156103d75781602001600182028036833780820191505090505b50925060005b81811015610491578460000160039054906101000a900470010000000000000000000000000000000002816010811061041957610418611baf565b5b1a7f01000000000000000000000000000000000000000000000000000000000000000284828151811061044f5761044e611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061048990611bde565b9150506103dd565b50603a7f0100000000000000000000000000000000000000000000000000000000000000028382815181106104c9576104c8611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061050390611bde565b91505060005b82518110156105cf5782818151811061052557610524611baf565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000284828461057c9190611b7b565b8151811061058d5761058c611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806105c790611bde565b915050610509565b5082945050505050919050565b600060108210610621576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061890611c72565b60405180910390fd5b6000600354831614610668576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065f90611cde565b60405180910390fd5b81600360008282541792505081905550600380541415157f6b7e2e653f93b645d4ed7292d6429f96637084363e477c8aaea1a43ed13c284e6003546040516106b091906112a2565b60405180910390a26003549050919050565b6000600160ff16600354161461070d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070490611d4a565b60405180910390fd5b6000806000838152602001908152602001600020905060008160000160009054906101000a900460ff1660ff161161074457600080fd5b816001819055505050565b606060006060600080600154815260200190815260200160002091508160000160019054906101000a900460ff1660ff168260000160009054906101000a900460ff1660ff1685516107a19190611b7b565b6107ab9190611b7b565b67ffffffffffffffff8111156107c4576107c361137b565b5b6040519080825280601f01601f1916602001820160405280156107f65781602001600182028036833780820191505090505b50905060005b8260000160019054906101000a900460ff1660ff168110156108cc578260000160139054906101000a9004780100000000000000000000000000000000000000000000000002816008811061085457610853611baf565b5b1a7f01000000000000000000000000000000000000000000000000000000000000000282828151811061088a57610889611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806108c490611bde565b9150506107fc565b8260000160009054906101000a900460ff167f01000000000000000000000000000000000000000000000000000000000000000282828151811061091357610912611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061094d90611bde565b91505060005b8551811015610a195785818151811061096f5761096e611baf565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028382846109c69190611b7b565b815181106109d7576109d6611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610a1190611bde565b915050610953565b50819350505050919050565b60006020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16908060000160029054906101000a900460ff16908060000160039054906101000a900470010000000000000000000000000000000002908060000160139054906101000a9004780100000000000000000000000000000000000000000000000002905085565b6060610b5960028054610ad690611897565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0290611897565b8015610b4f5780601f10610b2457610100808354040283529160200191610b4f565b820191906000526020600020905b815481529060010190602001808311610b3257829003601f168201915b505050505061074f565b905090565b60608060008060028551610b729190611d6a565b67ffffffffffffffff811115610b8b57610b8a61137b565b5b6040519080825280601f01601f191660200182016040528015610bbd5781602001600182028036833780820191505090505b5092506000905060005b6020811015610f0b57600460f0878381518110610be757610be6611baf565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f010000000000000000000000000000000000000000000000000000000000000090041660ff16908060020a82049150509250600a8360ff161015610ce657603083610c7d9190611dac565b7f010000000000000000000000000000000000000000000000000000000000000002848381518110610cb257610cb1611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610d58565b605783610cf39190611dac565b7f010000000000000000000000000000000000000000000000000000000000000002848381518110610d2857610d27611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600f868281518110610d6d57610d6c611baf565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027f01000000000000000000000000000000000000000000000000000000000000009004169250600a8360ff161015610e6b57603083610df69190611dac565b7f01000000000000000000000000000000000000000000000000000000000000000284600184610e269190611b7b565b81518110610e3757610e36611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610ee9565b605783610e789190611dac565b7f01000000000000000000000000000000000000000000000000000000000000000284600184610ea89190611b7b565b81518110610eb957610eb8611baf565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b600282610ef69190611b7b565b91508080610f0390611bde565b915050610bc7565b50829350505050919050565b6000600160ff166003541614610f62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f5990611e2d565b60405180910390fd5b6060819050601081511115610fac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa390611e99565b60405180910390fd5b610fb4611223565b6000600790505b60008160ff1610611010576000600882610fd59190611eb9565b60ff1660ff9060020a029050600086821667ffffffffffffffff161115610ffc5750611010565b818061100790611ef6565b92505050610fbb565b60018161101d9190611dac565b826020019060ff16908160ff1681525050600881600761103d9190611f1f565b6110479190611eb9565b60ff168567ffffffffffffffff169060020a02780100000000000000000000000000000000000000000000000002826080019077ffffffffffffffffffffffffffffffffffffffffffffffff1916908177ffffffffffffffffffffffffffffffffffffffffffffffff1916815250508251826040019060ff16908160ff1681525050826110d390611f79565b82606001906fffffffffffffffffffffffffffffffff191690816fffffffffffffffffffffffffffffffff19168152505085826000019060ff16908160ff1681525050816000808767ffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a8154816fffffffffffffffffffffffffffffffff02191690837001000000000000000000000000000000009004021790555060808201518160000160136101000a81548167ffffffffffffffff0219169083780100000000000000000000000000000000000000000000000090040217905550905050505050505050565b6040518060a00160405280600060ff168152602001600060ff168152602001600060ff16815260200160006fffffffffffffffffffffffffffffffff19168152602001600077ffffffffffffffffffffffffffffffffffffffffffffffff191681525090565b6000819050919050565b61129c81611289565b82525050565b60006020820190506112b76000830184611293565b92915050565b6000604051905090565b600080fd5b600080fd5b6112da81611289565b81146112e557600080fd5b50565b6000813590506112f7816112d1565b92915050565b600060208284031215611313576113126112c7565b5b6000611321848285016112e8565b91505092915050565b60008115159050919050565b61133f8161132a565b82525050565b600060208201905061135a6000830184611336565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6113b38261136a565b810181811067ffffffffffffffff821117156113d2576113d161137b565b5b80604052505050565b60006113e56112bd565b90506113f182826113aa565b919050565b600067ffffffffffffffff8211156114115761141061137b565b5b61141a8261136a565b9050602081019050919050565b82818337600083830152505050565b6000611449611444846113f6565b6113db565b90508281526020810184848401111561146557611464611365565b5b611470848285611427565b509392505050565b600082601f83011261148d5761148c611360565b5b813561149d848260208601611436565b91505092915050565b6000602082840312156114bc576114bb6112c7565b5b600082013567ffffffffffffffff8111156114da576114d96112cc565b5b6114e684828501611478565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561152957808201518184015260208101905061150e565b60008484015250505050565b6000611540826114ef565b61154a81856114fa565b935061155a81856020860161150b565b6115638161136a565b840191505092915050565b600060208201905081810360008301526115888184611535565b905092915050565b600081519050919050565b600082825260208201905092915050565b60006115b782611590565b6115c1818561159b565b93506115d181856020860161150b565b6115da8161136a565b840191505092915050565b600060208201905081810360008301526115ff81846115ac565b905092915050565b600060ff82169050919050565b61161d81611607565b82525050565b60007fffffffffffffffffffffffffffffffff0000000000000000000000000000000082169050919050565b61165881611623565b82525050565b60007fffffffffffffffff00000000000000000000000000000000000000000000000082169050919050565b6116938161165e565b82525050565b600060a0820190506116ae6000830188611614565b6116bb6020830187611614565b6116c86040830186611614565b6116d5606083018561164f565b6116e2608083018461168a565b9695505050505050565b6116f581611607565b811461170057600080fd5b50565b600081359050611712816116ec565b92915050565b600067ffffffffffffffff82169050919050565b61173581611718565b811461174057600080fd5b50565b6000813590506117528161172c565b92915050565b600067ffffffffffffffff8211156117735761177261137b565b5b61177c8261136a565b9050602081019050919050565b600061179c61179784611758565b6113db565b9050828152602081018484840111156117b8576117b7611365565b5b6117c3848285611427565b509392505050565b600082601f8301126117e0576117df611360565b5b81356117f0848260208601611789565b91505092915050565b600080600060608486031215611812576118116112c7565b5b600061182086828701611703565b935050602061183186828701611743565b925050604084013567ffffffffffffffff811115611852576118516112cc565b5b61185e868287016117cb565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806118af57607f821691505b6020821081036118c2576118c1611868565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b60008160020a8302905092915050565b60006008830261192d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826118ed565b61193786836118ed565b95508019841693508086168417925050509392505050565b6000819050919050565b600061197461196f61196a84611289565b61194f565b611289565b9050919050565b6000819050919050565b61198e83611959565b6119a261199a8261197b565b8484546118fd565b825550505050565b600090565b6119b76119aa565b6119c2818484611985565b505050565b5b818110156119e6576119db6000826119af565b6001810190506119c8565b5050565b601f821115611a2b576119fc816118c8565b611a05846118dd565b81016020851015611a14578190505b611a28611a20856118dd565b8301826119c7565b50505b505050565b60008160020a8304905092915050565b6000611a5160001984600802611a30565b1980831691505092915050565b6000611a6a8383611a40565b9150826002028217905092915050565b611a8382611590565b67ffffffffffffffff811115611a9c57611a9b61137b565b5b611aa68254611897565b611ab18282856119ea565b600060209050601f831160018114611ae45760008415611ad2578287015190505b611adc8582611a5e565b865550611b44565b601f198416611af2866118c8565b60005b82811015611b1a57848901518255600182019150602085019450602081019050611af5565b86831015611b375784890151611b33601f891682611a40565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611b8682611289565b9150611b9183611289565b9250828201905080821115611ba957611ba8611b4c565b5b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000611be982611289565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611c1b57611c1a611b4c565b5b600182019050919050565b7f4552525f494e56414c49445f5354415445000000000000000000000000000000600082015250565b6000611c5c6011836114fa565b9150611c6782611c26565b602082019050919050565b60006020820190508181036000830152611c8b81611c4f565b9050919050565b7f4552525f414c52454144595f4c4f434b45440000000000000000000000000000600082015250565b6000611cc86012836114fa565b9150611cd382611c92565b602082019050919050565b60006020820190508181036000830152611cf781611cbb565b9050919050565b7f4552525f5345414c5f434f444543000000000000000000000000000000000000600082015250565b6000611d34600e836114fa565b9150611d3f82611cfe565b602082019050919050565b60006020820190508181036000830152611d6381611d27565b9050919050565b6000611d7582611289565b9150611d8083611289565b9250828202611d8e81611289565b91508282048414831517611da557611da4611b4c565b5b5092915050565b6000611db782611607565b9150611dc283611607565b9250828201905060ff811115611ddb57611dda611b4c565b5b92915050565b7f4552525f5345414c5f434f4445434c4953540000000000000000000000000000600082015250565b6000611e176012836114fa565b9150611e2282611de1565b602082019050919050565b60006020820190508181036000830152611e4681611e0a565b9050919050565b7f4552525f5052454649585f544f4f5f4c4f4e4700000000000000000000000000600082015250565b6000611e836013836114fa565b9150611e8e82611e4d565b602082019050919050565b60006020820190508181036000830152611eb281611e76565b9050919050565b6000611ec482611607565b9150611ecf83611607565b9250828202611edd81611607565b9150808214611eef57611eee611b4c565b5b5092915050565b6000611f0182611607565b915060008203611f1457611f13611b4c565b5b600182039050919050565b6000611f2a82611607565b9150611f3583611607565b9250828203905060ff811115611f4e57611f4d611b4c565b5b92915050565b6000819050602082019050919050565b6000611f708251611623565b80915050919050565b6000611f8482611590565b82611f8e84611f54565b9050611f9981611f64565b92506010821015611fd957611fd47fffffffffffffffffffffffffffffffff00000000000000000000000000000000836010036008026118ed565b831692505b505091905056fea264697066735822122021af19aa70e591f4696eeb5a45ef013f2371031795cb4e3f363caee6534aa25264736f6c63430008110033 +\ No newline at end of file diff --git a/python/eth_event_msg/data/Msg.json b/python/eth_event_msg/data/Msg.json @@ -1 +1 @@ -[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[{"internalType":"uint8","name":"_length","type":"uint8"},{"internalType":"uint64","name":"_codecId","type":"uint64"},{"internalType":"string","name":"_uriPrefix","type":"string"}],"name":"addCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"multiCodecs","outputs":[{"internalType":"uint8","name":"l","type":"uint8"},{"internalType":"uint8","name":"codecRLength","type":"uint8"},{"internalType":"uint8","name":"prefixRLength","type":"uint8"},{"internalType":"bytes16","name":"prefix","type":"bytes16"},{"internalType":"bytes8","name":"codec","type":"bytes8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"}],"name":"setMsgCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"toHash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"toHex","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"toUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}] +[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"_multiHash","type":"bytes"}],"name":"Msg","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_final","type":"bool"},{"indexed":false,"internalType":"uint256","name":"_sealState","type":"uint256"}],"name":"SealStateChange","type":"event"},{"inputs":[{"internalType":"uint8","name":"_length","type":"uint8"},{"internalType":"uint64","name":"_codecId","type":"uint64"},{"internalType":"string","name":"_uriPrefix","type":"string"}],"name":"addCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getMsg","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"isSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"multiCodecs","outputs":[{"internalType":"uint8","name":"l","type":"uint8"},{"internalType":"uint8","name":"codecRLength","type":"uint8"},{"internalType":"uint8","name":"prefixRLength","type":"uint8"},{"internalType":"bytes16","name":"prefix","type":"bytes16"},{"internalType":"bytes8","name":"codec","type":"bytes8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_state","type":"uint256"}],"name":"seal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sealState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"setMsg","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_codec","type":"uint256"}],"name":"setMsgCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"toHash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"toHex","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes","name":"_digest","type":"bytes"}],"name":"toUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}] diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py @@ -7,9 +7,11 @@ import logging # external imports from chainlib.eth.unittest.ethtester import EthTesterCase from chainlib.eth.nonce import RPCNonceOracle +from chainlib.eth.constant import ZERO_CONTENT from chainlib.connection import RPCConnection from chainlib.eth.tx import receipt from chainlib.eth.address import to_checksum_address +from hexathon import strip_0x # local imports from eth_event_msg import EventMsg @@ -29,17 +31,17 @@ class Test(EthTesterCase): c = EventMsg(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) (tx_hash, o) = c.constructor(self.accounts[0]) self.conn = RPCConnection.connect(self.chain_spec, 'default') - r = self.conn.do(o) + self.conn.do(o) o = receipt(tx_hash) - rr = self.conn.do(o) - self.assertEqual(rr['status'], 1) - logg.debug('smart contract published with hash {}'.format(r)) - self.address = to_checksum_address(rr['contract_address']) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + self.address = to_checksum_address(r['contract_address']) + logg.debug('smart contract published with hash {}'.format(tx_hash)) def test_hash(self): nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) - c = EventMsg(self.chain_spec) #, signer=self.signer, nonce_oracle=nonce_oracle) + c = EventMsg(self.chain_spec) o = c.to_hash(self.address, hash_of_foo, sender_address=self.accounts[0]) r = self.conn.do(o) mh = c.parse_to_hash(r) @@ -49,13 +51,36 @@ class Test(EthTesterCase): def test_uri(self): nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) - c = EventMsg(self.chain_spec) #, signer=self.signer, nonce_oracle=nonce_oracle) + c = EventMsg(self.chain_spec) o = c.to_uri(self.address, hash_of_foo, sender_address=self.accounts[0]) r = self.conn.do(o) mh = c.parse_to_uri(r) self.assertEqual(mh, 'sha256:' + hash_of_foo) + def test_msg(self): + nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) + c = EventMsg(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) + + o = c.get_msg(self.address, sender_address=self.accounts[0]) + r = self.conn.do(o) + mh = c.parse_to_hash(r) + self.assertEqual(mh[:4], '1220') + self.assertEqual(mh[4:68], strip_0x(ZERO_CONTENT)) + + (tx_hash, o) = c.set_msg(self.address, self.accounts[0], hash_of_foo) + self.conn.do(o) + o = receipt(tx_hash) + r = self.conn.do(o) + self.assertEqual(r['status'], 1) + + o = c.get_msg(self.address, sender_address=self.accounts[0]) + r = self.conn.do(o) + mh = c.parse_to_hash(r) + self.assertEqual(mh[:4], '1220') + self.assertEqual(mh[4:68], hash_of_foo) + + if __name__ == '__main__': unittest.main() diff --git a/solidity/Msg.sol b/solidity/Msg.sol @@ -12,6 +12,7 @@ contract Msg { mapping (uint256 => MultiHash) public multiCodecs; uint256 msgCodec; + bytes currentMsg; // Implements Sealer uint256 public sealState; @@ -19,10 +20,25 @@ contract Msg { uint8 constant CODEC_STATE = 2; uint256 constant public maxSealState = 3; event SealStateChange(bool indexed _final, uint256 _sealState); + event Msg(bytes _multiHash); constructor() { addCodec(32, 0x12, "sha256"); setMsgCodec(0x12); + currentMsg = new bytes(32); + } + + function setMsg(bytes memory _digest) public { + MultiHash storage _hsh; + + _hsh = multiCodecs[msgCodec]; + require(_digest.length == _hsh.l); + + currentMsg = _digest; + } + + function getMsg() public view returns(bytes memory) { + return toHash(currentMsg); } function addCodec(uint8 _length, uint64 _codecId, string memory _uriPrefix) public {