commit 26f32f53908327893a11c33b13cb9c8f5c7ff9f7
parent e9701a5eb5ab68d65eca2c6d57cc42ff1ce07335
Author: lash <dev@holbrook.no>
Date: Mon, 27 Mar 2023 15:00:36 +0100
implement ERC191 version 0 (instead of 0x45)
Diffstat:
3 files changed, 16 insertions(+), 40 deletions(-)
diff --git a/python/eth_offline/data/Offline.bin b/python/eth_offline/data/Offline.bin
@@ -1 +1 @@
-608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506117cc806100606000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063aa1d23a011610078578063aa1d23a01461015a578063aeb024921461018a578063ca9bc523146101ba578063e9395679146101ea576100a5565b8063772295f6146100aa5780638da5cb5b146100da57806397aba7f9146100f8578063a7bb580314610128575b600080fd5b6100c460048036038101906100bf9190610f4a565b61021a565b6040516100d19190611048565b60405180910390f35b6100e2610633565b6040516100ef9190611072565b60405180910390f35b610112600480360381019061010d91906110b9565b61065c565b60405161011f9190611072565b60405180910390f35b610142600480360381019061013d9190610f4a565b6106cb565b60405161015193929190611140565b60405180910390f35b610174600480360381019061016f9190611177565b610733565b6040516101819190611072565b60405180910390f35b6101a4600480360381019061019f9190611177565b610761565b6040516101b1919061120a565b60405180910390f35b6101d460048036038101906101cf9190610f4a565b6107af565b6040516101e191906112a4565b60405180910390f35b61020460048036038101906101ff91906112f2565b610b7d565b6040516102119190611374565b60405180910390f35b610222610db6565b6060806060605485511461026b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610262906113e2565b60405180910390fd5b601467ffffffffffffffff81111561028657610285610e1f565b5b6040519080825280601f01601f1916602001820160405280156102b85781602001600182028036833780820191505090505b509250602067ffffffffffffffff8111156102d6576102d5610e1f565b5b6040519080825280601f01601f1916602001820160405280156103085781602001600182028036833780820191505090505b509050602067ffffffffffffffff81111561032657610325610e1f565b5b6040519080825280601f01601f1916602001820160405280156103585781602001600182028036833780820191505090505b50915060005b83518110156104195785818151811061037a57610379611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028482815181106103d7576103d6611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350808061041190611460565b91505061035e565b5060005b60208110156104e4578560148261043491906114a8565b8151811061044557610444611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028382815181106104a2576104a1611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806104dc90611460565b91505061041d565b5060005b60208110156105af57856034826104ff91906114a8565b815181106105105761050f611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000282828151811061056d5761056c611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806105a790611460565b9150506104e8565b50826105ba9061153d565b6c010000000000000000000000009004846000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508161060b906115b9565b8460200181815250508061061e906115b9565b60019004846040018181525050505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060008061066b856106cb565b925092509250600186828585604051600081526020016040526040516106949493929190611620565b6020604051602081039080840390855afa1580156106b6573d6000803e3d6000fd5b50505060206040510351935050505092915050565b60008060006041845114610714576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070b906116b1565b60405180910390fd5b6020840151925060408401519150606084015160001a90509193909250565b6000806060610741856107af565b905080805190602001209150610757828561065c565b9250505092915050565b60008061076c610633565b90506107788484610733565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161491505092915050565b606080600060606000806000601488516107c991906114a8565b94506107d485610b7d565b9350835192508483601a6107e891906114a8565b6107f291906114a8565b67ffffffffffffffff81111561080b5761080a610e1f565b5b6040519080825280601f01601f19166020018201604052801561083d5781602001600182028036833780820191505090505b50955060005b601a8110156108fa577919457468657265756d205369676e6564204d6573736167653a0a66010000000000000281601a811061088257610881611402565b5b1a7f0100000000000000000000000000000000000000000000000000000000000000028782815181106108b8576108b7611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806108f290611460565b915050610843565b50601a8261090891906114a8565b915060005b838110156109d25784818151811061092857610927611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000287848361097f91906114a8565b815181106109905761098f611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806109ca90611460565b91505061090d565b5082826109df91906114a8565b9150306c0100000000000000000000000002905060005b6014811015610a9557818160148110610a1257610a11611402565b5b1a7f010000000000000000000000000000000000000000000000000000000000000002878483610a4291906114a8565b81518110610a5357610a52611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610a8d90611460565b9150506109f6565b50601482610aa391906114a8565b915060005b8851811015610b6e57888181518110610ac457610ac3611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002878483610b1b91906114a8565b81518110610b2c57610b2b611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610b6690611460565b915050610aa8565b50859650505050505050919050565b606060006064905060008167ffffffffffffffff811115610ba157610ba0610e1f565b5b6040519080825280601f01601f191660200182016040528015610bd35781602001600182028036833780820191505090505b50905060005b60008514610c84576000600a86610bf09190611700565b9050600a86610bff9190611731565b9550806030610c0e91906114a8565b7f010000000000000000000000000000000000000000000000000000000000000002838380610c3c90611460565b945081518110610c4f57610c4e611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050610bd9565b60008167ffffffffffffffff811115610ca057610c9f610e1f565b5b6040519080825280601f01601f191660200182016040528015610cd25781602001600182028036833780820191505090505b50905060005b82811015610da9578381600185610cef9190611762565b610cf99190611762565b81518110610d0a57610d09611402565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002828281518110610d6757610d66611402565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610da190611460565b915050610cd8565b5080945050505050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008019168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610e5782610e0e565b810181811067ffffffffffffffff82111715610e7657610e75610e1f565b5b80604052505050565b6000610e89610df0565b9050610e958282610e4e565b919050565b600067ffffffffffffffff821115610eb557610eb4610e1f565b5b610ebe82610e0e565b9050602081019050919050565b82818337600083830152505050565b6000610eed610ee884610e9a565b610e7f565b905082815260208101848484011115610f0957610f08610e09565b5b610f14848285610ecb565b509392505050565b600082601f830112610f3157610f30610e04565b5b8135610f41848260208601610eda565b91505092915050565b600060208284031215610f6057610f5f610dfa565b5b600082013567ffffffffffffffff811115610f7e57610f7d610dff565b5b610f8a84828501610f1c565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610fbe82610f93565b9050919050565b610fce81610fb3565b82525050565b6000819050919050565b610fe781610fd4565b82525050565b6000819050919050565b61100081610fed565b82525050565b60608201600082015161101c6000850182610fc5565b50602082015161102f6020850182610fde565b5060408201516110426040850182610ff7565b50505050565b600060608201905061105d6000830184611006565b92915050565b61106c81610fb3565b82525050565b60006020820190506110876000830184611063565b92915050565b61109681610fd4565b81146110a157600080fd5b50565b6000813590506110b38161108d565b92915050565b600080604083850312156110d0576110cf610dfa565b5b60006110de858286016110a4565b925050602083013567ffffffffffffffff8111156110ff576110fe610dff565b5b61110b85828601610f1c565b9150509250929050565b61111e81610fd4565b82525050565b600060ff82169050919050565b61113a81611124565b82525050565b60006060820190506111556000830186611115565b6111626020830185611115565b61116f6040830184611131565b949350505050565b6000806040838503121561118e5761118d610dfa565b5b600083013567ffffffffffffffff8111156111ac576111ab610dff565b5b6111b885828601610f1c565b925050602083013567ffffffffffffffff8111156111d9576111d8610dff565b5b6111e585828601610f1c565b9150509250929050565b60008115159050919050565b611204816111ef565b82525050565b600060208201905061121f60008301846111fb565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561125f578082015181840152602081019050611244565b60008484015250505050565b600061127682611225565b6112808185611230565b9350611290818560208601611241565b61129981610e0e565b840191505092915050565b600060208201905081810360008301526112be818461126b565b905092915050565b6112cf81610fed565b81146112da57600080fd5b50565b6000813590506112ec816112c6565b92915050565b60006020828403121561130857611307610dfa565b5b6000611316848285016112dd565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006113468261131f565b611350818561132a565b9350611360818560208601611241565b61136981610e0e565b840191505092915050565b6000602082019050818103600083015261138e818461133b565b905092915050565b7f4552525f434f4e54454e545f4c454e4754480000000000000000000000000000600082015250565b60006113cc60128361132a565b91506113d782611396565b602082019050919050565b600060208201905081810360008301526113fb816113bf565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061146b82610fed565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361149d5761149c611431565b5b600182019050919050565b60006114b382610fed565b91506114be83610fed565b92508282019050808211156114d6576114d5611431565b5b92915050565b6000819050602082019050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b600061152482516114ec565b80915050919050565b60008160020a8302905092915050565b600061154882611225565b82611552846114dc565b905061155d81611518565b9250601482101561159d576115987fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008360140360080261152d565b831692505b5050919050565b60006115b08251610fd4565b80915050919050565b60006115c482611225565b826115ce846114dc565b90506115d9816115a4565b92506020821015611619576116147fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8360200360080261152d565b831692505b5050919050565b60006080820190506116356000830187611115565b6116426020830186611131565b61164f6040830185611115565b61165c6060830184611115565b95945050505050565b7f696e76616c6964207369676e6174757265206c656e6774680000000000000000600082015250565b600061169b60188361132a565b91506116a682611665565b602082019050919050565b600060208201905081810360008301526116ca8161168e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061170b82610fed565b915061171683610fed565b925082611726576117256116d1565b5b828206905092915050565b600061173c82610fed565b915061174783610fed565b925082611757576117566116d1565b5b828204905092915050565b600061176d82610fed565b915061177883610fed565b92508282039050818111156117905761178f611431565b5b9291505056fea264697066735822122084bc85cf55426925107b0b89627a80a189fbfa1975d1e00abeaf5cb672034ed164736f6c63430008120033
-\ No newline at end of file
+608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611664806100606000396000f3fe608060405234801561001057600080fd5b50600436106100a5576000357c010000000000000000000000000000000000000000000000000000000090048063aa1d23a011610078578063aa1d23a01461015a578063aeb024921461018a578063ca9bc523146101ba578063e9395679146101ea576100a5565b8063772295f6146100aa5780638da5cb5b146100da57806397aba7f9146100f8578063a7bb580314610128575b600080fd5b6100c460048036038101906100bf9190610de2565b61021a565b6040516100d19190610ee0565b60405180910390f35b6100e2610633565b6040516100ef9190610f0a565b60405180910390f35b610112600480360381019061010d9190610f51565b61065c565b60405161011f9190610f0a565b60405180910390f35b610142600480360381019061013d9190610de2565b6106cb565b60405161015193929190610fd8565b60405180910390f35b610174600480360381019061016f919061100f565b610733565b6040516101819190610f0a565b60405180910390f35b6101a4600480360381019061019f919061100f565b610761565b6040516101b191906110a2565b60405180910390f35b6101d460048036038101906101cf9190610de2565b6107af565b6040516101e1919061113c565b60405180910390f35b61020460048036038101906101ff919061118a565b610a15565b604051610211919061120c565b60405180910390f35b610222610c4e565b6060806060605485511461026b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102629061127a565b60405180910390fd5b601467ffffffffffffffff81111561028657610285610cb7565b5b6040519080825280601f01601f1916602001820160405280156102b85781602001600182028036833780820191505090505b509250602067ffffffffffffffff8111156102d6576102d5610cb7565b5b6040519080825280601f01601f1916602001820160405280156103085781602001600182028036833780820191505090505b509050602067ffffffffffffffff81111561032657610325610cb7565b5b6040519080825280601f01601f1916602001820160405280156103585781602001600182028036833780820191505090505b50915060005b83518110156104195785818151811061037a5761037961129a565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028482815181106103d7576103d661129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610411906112f8565b91505061035e565b5060005b60208110156104e457856014826104349190611340565b815181106104455761044461129a565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028382815181106104a2576104a161129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806104dc906112f8565b91505061041d565b5060005b60208110156105af57856034826104ff9190611340565b815181106105105761050f61129a565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000282828151811061056d5761056c61129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806105a7906112f8565b9150506104e8565b50826105ba906113d5565b6c010000000000000000000000009004846000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508161060b90611451565b8460200181815250508061061e90611451565b60019004846040018181525050505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060008061066b856106cb565b9250925092506001868285856040516000815260200160405260405161069494939291906114b8565b6020604051602081039080840390855afa1580156106b6573d6000803e3d6000fd5b50505060206040510351935050505092915050565b60008060006041845114610714576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161070b90611549565b60405180910390fd5b6020840151925060408401519150606084015160001a90509193909250565b6000806060610741856107af565b905080805190602001209150610757828561065c565b9250505092915050565b60008061076c610633565b90506107788484610733565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161491505092915050565b606080600080845160166107c39190611340565b67ffffffffffffffff8111156107dc576107db610cb7565b5b6040519080825280601f01601f19166020018201604052801561080e5781602001600182028036833780820191505090505b50925060197f010000000000000000000000000000000000000000000000000000000000000002836000815181106108495761084861129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060029150306c0100000000000000000000000002905060005b6014811015610930578181601481106108ad576108ac61129a565b5b1a7f0100000000000000000000000000000000000000000000000000000000000000028484836108dd9190611340565b815181106108ee576108ed61129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610928906112f8565b915050610891565b5060148261093e9190611340565b915060005b8551811015610a095785818151811061095f5761095e61129a565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028484836109b69190611340565b815181106109c7576109c661129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610a01906112f8565b915050610943565b50829350505050919050565b606060006064905060008167ffffffffffffffff811115610a3957610a38610cb7565b5b6040519080825280601f01601f191660200182016040528015610a6b5781602001600182028036833780820191505090505b50905060005b60008514610b1c576000600a86610a889190611598565b9050600a86610a9791906115c9565b9550806030610aa69190611340565b7f010000000000000000000000000000000000000000000000000000000000000002838380610ad4906112f8565b945081518110610ae757610ae661129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050610a71565b60008167ffffffffffffffff811115610b3857610b37610cb7565b5b6040519080825280601f01601f191660200182016040528015610b6a5781602001600182028036833780820191505090505b50905060005b82811015610c41578381600185610b8791906115fa565b610b9191906115fa565b81518110610ba257610ba161129a565b5b60200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002828281518110610bff57610bfe61129a565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080610c39906112f8565b915050610b70565b5080945050505050919050565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008019168152602001600081525090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610cef82610ca6565b810181811067ffffffffffffffff82111715610d0e57610d0d610cb7565b5b80604052505050565b6000610d21610c88565b9050610d2d8282610ce6565b919050565b600067ffffffffffffffff821115610d4d57610d4c610cb7565b5b610d5682610ca6565b9050602081019050919050565b82818337600083830152505050565b6000610d85610d8084610d32565b610d17565b905082815260208101848484011115610da157610da0610ca1565b5b610dac848285610d63565b509392505050565b600082601f830112610dc957610dc8610c9c565b5b8135610dd9848260208601610d72565b91505092915050565b600060208284031215610df857610df7610c92565b5b600082013567ffffffffffffffff811115610e1657610e15610c97565b5b610e2284828501610db4565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610e5682610e2b565b9050919050565b610e6681610e4b565b82525050565b6000819050919050565b610e7f81610e6c565b82525050565b6000819050919050565b610e9881610e85565b82525050565b606082016000820151610eb46000850182610e5d565b506020820151610ec76020850182610e76565b506040820151610eda6040850182610e8f565b50505050565b6000606082019050610ef56000830184610e9e565b92915050565b610f0481610e4b565b82525050565b6000602082019050610f1f6000830184610efb565b92915050565b610f2e81610e6c565b8114610f3957600080fd5b50565b600081359050610f4b81610f25565b92915050565b60008060408385031215610f6857610f67610c92565b5b6000610f7685828601610f3c565b925050602083013567ffffffffffffffff811115610f9757610f96610c97565b5b610fa385828601610db4565b9150509250929050565b610fb681610e6c565b82525050565b600060ff82169050919050565b610fd281610fbc565b82525050565b6000606082019050610fed6000830186610fad565b610ffa6020830185610fad565b6110076040830184610fc9565b949350505050565b6000806040838503121561102657611025610c92565b5b600083013567ffffffffffffffff81111561104457611043610c97565b5b61105085828601610db4565b925050602083013567ffffffffffffffff81111561107157611070610c97565b5b61107d85828601610db4565b9150509250929050565b60008115159050919050565b61109c81611087565b82525050565b60006020820190506110b76000830184611093565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156110f75780820151818401526020810190506110dc565b60008484015250505050565b600061110e826110bd565b61111881856110c8565b93506111288185602086016110d9565b61113181610ca6565b840191505092915050565b600060208201905081810360008301526111568184611103565b905092915050565b61116781610e85565b811461117257600080fd5b50565b6000813590506111848161115e565b92915050565b6000602082840312156111a05761119f610c92565b5b60006111ae84828501611175565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60006111de826111b7565b6111e881856111c2565b93506111f88185602086016110d9565b61120181610ca6565b840191505092915050565b6000602082019050818103600083015261122681846111d3565b905092915050565b7f4552525f434f4e54454e545f4c454e4754480000000000000000000000000000600082015250565b60006112646012836111c2565b915061126f8261122e565b602082019050919050565b6000602082019050818103600083015261129381611257565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061130382610e85565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611335576113346112c9565b5b600182019050919050565b600061134b82610e85565b915061135683610e85565b925082820190508082111561136e5761136d6112c9565b5b92915050565b6000819050602082019050919050565b60007fffffffffffffffffffffffffffffffffffffffff00000000000000000000000082169050919050565b60006113bc8251611384565b80915050919050565b60008160020a8302905092915050565b60006113e0826110bd565b826113ea84611374565b90506113f5816113b0565b92506014821015611435576114307fffffffffffffffffffffffffffffffffffffffff000000000000000000000000836014036008026113c5565b831692505b5050919050565b60006114488251610e6c565b80915050919050565b600061145c826110bd565b8261146684611374565b90506114718161143c565b925060208210156114b1576114ac7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff836020036008026113c5565b831692505b5050919050565b60006080820190506114cd6000830187610fad565b6114da6020830186610fc9565b6114e76040830185610fad565b6114f46060830184610fad565b95945050505050565b7f696e76616c6964207369676e6174757265206c656e6774680000000000000000600082015250565b60006115336018836111c2565b915061153e826114fd565b602082019050919050565b6000602082019050818103600083015261156281611526565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006115a382610e85565b91506115ae83610e85565b9250826115be576115bd611569565b5b828206905092915050565b60006115d482610e85565b91506115df83610e85565b9250826115ef576115ee611569565b5b828204905092915050565b600061160582610e85565b915061161083610e85565b9250828203905081811115611628576116276112c9565b5b9291505056fea2646970667358221220f913235d5218751b2e092cb2f9089491bc9b093946f2067c0854d2ad0ae6dd6f64736f6c63430008120033
+\ No newline at end of file
diff --git a/python/tests/test_basic.py b/python/tests/test_basic.py
@@ -19,7 +19,8 @@ from chainlib.error import JSONRPCException
from hexathon import add_0x
from hexathon import strip_0x
from hexathon import same as same_hex
-from funga.eth.message import to_personal_message
+#from funga.eth.message import to_personal_message
+from funga.eth.message import to_validator_message
script_dir = os.path.realpath(os.path.dirname(__file__))
data_dir = os.path.join(script_dir, '..', 'eth_offline', 'data')
@@ -95,14 +96,13 @@ class TestOfflineEth(EthTesterCase):
def test_sign_match(self):
- contract_bin = bytes.fromhex(strip_0x(self.address))
+ #contract_bin = bytes.fromhex(strip_0x(self.address))
beneficiary_bin = bytes.fromhex(strip_0x(self.accounts[2]))
msg_bin = b'foo'
msg_data = beneficiary_bin + msg_bin
- msg_tosign = contract_bin + msg_data
- msg_digest = to_personal_message(msg_tosign, digest=True)
+ msg_digest = to_validator_message(msg_data, self.address, digest=True)
- sig = self.signer.sign_ethereum_message(self.accounts[1], msg_tosign)
+ sig = self.signer.sign_validator_message(self.accounts[1], self.address, msg_data)
sig = sig[:64] + (sig[64] + 27).to_bytes(1, byteorder='big')
logg.debug('message is signed by {}'.format(self.accounts[1]))
@@ -130,13 +130,12 @@ class TestOfflineEth(EthTesterCase):
def test_message(self):
- contract_bin = bytes.fromhex(strip_0x(self.address))
+ #contract_bin = bytes.fromhex(strip_0x(self.address))
beneficiary_bin = bytes.fromhex(strip_0x(self.accounts[2]))
msg_bin = b'bar'
msg_data = beneficiary_bin + msg_bin
- msg_tosign = contract_bin + msg_data
- sig = self.signer.sign_ethereum_message(self.accounts[1], msg_tosign)
+ sig = self.signer.sign_validator_message(self.accounts[1], self.address, msg_data)
sig = sig[:64] + (sig[64] + 27).to_bytes(1, byteorder='big')
logg.debug('message is account {} {} signed by {}'.format(self.accounts[2], msg_data.hex(), self.accounts[1]))
@@ -157,8 +156,8 @@ class TestOfflineEth(EthTesterCase):
r = self.rpc.do(o)
r = strip_0x(r)
- rb = r[-192:]
- rb = rb[56:]
+ rb = r[-128:]
+ rb = rb[4:]
self.assertTrue(same_hex(rb[:40], self.address))
self.assertTrue(same_hex(rb[40:80], self.accounts[2]))
@@ -166,13 +165,11 @@ class TestOfflineEth(EthTesterCase):
def test_magic_request(self):
- contract_bin = bytes.fromhex(strip_0x(self.address))
beneficiary_bin = bytes.fromhex(strip_0x(self.accounts[2]))
msg_bin = b'bar'
msg_data = beneficiary_bin + msg_bin
- msg_tosign = contract_bin + msg_data
- sig = self.signer.sign_ethereum_message(self.accounts[1], msg_tosign)
+ sig = self.signer.sign_validator_message(self.accounts[1], self.address, msg_data)
sig = sig[:64] + (sig[64] + 27).to_bytes(1, byteorder='big')
logg.debug('message is {} signed by {}'.format(msg_data.hex(), self.accounts[1]))
@@ -200,13 +197,11 @@ class TestOfflineEth(EthTesterCase):
def test_verify(self):
- contract_bin = bytes.fromhex(strip_0x(self.address))
beneficiary_bin = bytes.fromhex(strip_0x(self.accounts[2]))
msg_bin = b'bar'
msg_data = beneficiary_bin + msg_bin
- msg_tosign = contract_bin + msg_data
- sig = self.signer.sign_ethereum_message(self.accounts[0], msg_tosign)
+ sig = self.signer.sign_validator_message(self.accounts[0], self.address, msg_data)
sig = sig[:64] + (sig[64] + 27).to_bytes(1, byteorder='big')
logg.debug('message is {} signed by {}'.format(msg_data.hex(), self.accounts[0]))
diff --git a/solidity/OfflineBase.sol b/solidity/OfflineBase.sol
@@ -4,10 +4,6 @@ pragma solidity ^0.8.0;
// Some methods are copied under other licenses, please see code comments for details
abstract contract Offline {
-
- // ERC191 - Ethereum Signed Message
- bytes26 constant prefix = bytes26(0x19457468657265756d205369676e6564204d6573736167653a0a);
-
function fromRequest(bytes memory _data, bytes memory _signature) public view returns(address) {
bytes32 messageDigest;
bytes memory message;
@@ -27,28 +23,13 @@ abstract contract Offline {
function toRequest(bytes memory _data) public view returns(bytes memory) {
bytes memory message;
- uint256 messageLength;
- bytes memory messageLengthStr;
- uint256 messageLengthLength;
uint256 c;
bytes20 contractBytes;
- messageLength = _data.length + 20;
- messageLengthStr = bytes(uintToString(uint(messageLength)));
- messageLengthLength = bytes(messageLengthStr).length;
-
- message = new bytes(26 + messageLengthLength + messageLength);
-
- for (uint256 i = 0; i < 26; i++) {
- message[i] = prefix[i];
- }
- c += 26;
-
- for (uint256 i = 0; i < messageLengthLength; i++) {
- message[i+c] = messageLengthStr[i];
- }
- c += messageLengthLength;
+ message = new bytes(22 + _data.length); //messageLength);
+ message[0] = 0x19;
+ c = 2;
contractBytes = bytes20(address(this));
for (uint256 i = 0; i < 20; i++) {
message[i+c] = contractBytes[i];