From e6633e7595fd06b342c2a5e697cfc9e872b9d27a Mon Sep 17 00:00:00 2001 From: mossid Date: Wed, 31 Jul 2019 03:51:40 +0900 Subject: [PATCH 01/10] add sol, add dohash test --- sol/proof.abi | 1 + sol/proofs.go | 329 +++++++++++++++++++++++++++++++++++++++++++++ sol/proofs.sol | 171 +++++++++++++++++++++++ sol/proofs_test.go | 88 ++++++++++++ 4 files changed, 589 insertions(+) create mode 100644 sol/proof.abi create mode 100644 sol/proofs.go create mode 100644 sol/proofs.sol create mode 100644 sol/proofs_test.go diff --git a/sol/proof.abi b/sol/proof.abi new file mode 100644 index 00000000..f446cd51 --- /dev/null +++ b/sol/proof.abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"preimage","type":"bytes"}],"name":"doHashOrNoop","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.LengthOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"doLength","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes","name":"s","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"name":"hasprefix","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"preimage","type":"bytes"}],"name":"doHash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"hashop","type":"uint8"},{"internalType":"enum Proofs.LengthOp","name":"lengthop","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"prepareLeafData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"}] diff --git a/sol/proofs.go b/sol/proofs.go new file mode 100644 index 00000000..f0ae17d0 --- /dev/null +++ b/sol/proofs.go @@ -0,0 +1,329 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package proofs + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = abi.U256 + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// ProofsABI is the input ABI used to generate the binding from. +const ProofsABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" + +// ProofsFuncSigs maps the 4-byte function signature to its string representation. +var ProofsFuncSigs = map[string]string{ + "d48f1e4f": "doHash(uint8,bytes)", + "03801174": "doHashOrNoop(uint8,bytes)", + "67bb8e81": "doLength(uint8,bytes)", + "901d0e15": "hasprefix(bytes,bytes)", + "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", +} + +// ProofsBin is the compiled bytecode used for deploying new contracts. +var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091610061919081610076565b50505034801561007057600080fd5b50610111565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b757805160ff19168380011785556100e4565b828001600101855582156100e4579182015b828111156100e45782518255916020019190600101906100c9565b506100f09291506100f4565b5090565b61010e91905b808211156100f057600081556001016100fa565b90565b610ac9806101206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063038011741461005c57806367bb8e811461017f578063901d0e151461022d578063d48f1e4f1461036a578063fd29e20a14610418575b600080fd5b61010a6004803603604081101561007257600080fd5b60ff8235169190810190604081016020820135600160201b81111561009657600080fd5b8201836020820111156100a857600080fd5b803590602001918460018302840111600160201b831117156100c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010a6004803603604081101561019557600080fd5b60ff8235169190810190604081016020820135600160201b8111156101b957600080fd5b8201836020820111156101cb57600080fd5b803590602001918460018302840111600160201b831117156101ec57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104ff945050505050565b6103566004803603604081101561024357600080fd5b810190602081018135600160201b81111561025d57600080fd5b82018360208201111561026f57600080fd5b803590602001918460018302840111600160201b8311171561029057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102e257600080fd5b8201836020820111156102f457600080fd5b803590602001918460018302840111600160201b8311171561031557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106da945050505050565b604080519115158252519081900360200190f35b61010a6004803603604081101561038057600080fd5b60ff8235169190810190604081016020820135600160201b8111156103a457600080fd5b8201836020820111156103b657600080fd5b803590602001918460018302840111600160201b831117156103d757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610744945050505050565b61010a6004803603606081101561042e57600080fd5b60ff8235811692602081013590911691810190606081016040820135600160201b81111561045b57600080fd5b82018360208201111561046d57600080fd5b803590602001918460018302840111600160201b8311171561048e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a23945050505050565b606060008360058111156104df57fe5b14156104ec5750806104f9565b6104f68383610744565b90505b92915050565b6060600083600881111561050f57fe5b141561051c5750806104f9565b600183600881111561052a57fe5b1415610658578151608081106105d85780607f16608017600782901c91508184604051602001808460ff1660ff1660f81b81526001018360ff1660ff1660f81b815260010182805190602001908083835b6020831061059a5780518252601f19909201916020918201910161057b565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040529150506104f9565b8083604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061061b5780518252601f1990920191602091820191016105fc565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506104f9565b600783600881111561066657fe5b141561068157815160201461067a57600080fd5b50806104f9565b600883600881111561068f57fe5b14156106a357815160401461067a57600080fd5b60405162461bcd60e51b8152600401808060200182810382526027815260200180610a496027913960400191505060405180910390fd5b6000805b825181101561073a578281815181106106f357fe5b602001015160f81c60f81b6001600160f81b03191684828151811061071457fe5b01602001516001600160f81b031916146107325760009150506104f9565b6001016106de565b5060019392505050565b6060600383600581111561075457fe5b14156107885781805190602001206040516020018082815260200191505060405160208183030381529060405290506104f9565b600183600581111561079657fe5b1415610846576002826040518082805190602001908083835b602083106107ce5780518252601f1990920191602091820191016107af565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561080d573d6000803e3d6000fd5b5050506040513d602081101561082257600080fd5b505160408051602081810193909352815180820390930183528101905290506104f9565b600483600581111561085457fe5b1415610905576003826040518082805190602001908083835b6020831061088c5780518252601f19909201916020918201910161086d565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108cb573d6000803e3d6000fd5b505060408051805160601b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915291506104f99050565b600583600581111561091357fe5b14156109ec5760036002836040518082805190602001908083835b6020831061094d5780518252601f19909201916020918201910161092e565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098c573d6000803e3d6000fd5b5050506040513d60208110156109a157600080fd5b50516040805160208181019390935281518082038401815290820191829052805190928291908401908083836020831061088c5780518252601f19909201916020918201910161086d565b60405162461bcd60e51b8152600401808060200182810382526025815260200180610a706025913960400191505060405180910390fd5b606080610a3085846104cf565b90506060610a3e85836104ff565b969550505050505056fe696e76616c6964206f7220756e737570706f72746564206c656e677468206f7065726174696f6e696e76616c6964206f7220756e737570706f727465642068617368206f7065726174696f6ea265627a7a723058207ae67b115238b964a92a002d2a782c470e7bdc5cc2e63c45ba8219638aa2d46464736f6c63430005090032" + +// DeployProofs deploys a new Ethereum contract, binding an instance of Proofs to it. +func DeployProofs(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Proofs, error) { + parsed, err := abi.JSON(strings.NewReader(ProofsABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ProofsBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil +} + +// Proofs is an auto generated Go binding around an Ethereum contract. +type Proofs struct { + ProofsCaller // Read-only binding to the contract + ProofsTransactor // Write-only binding to the contract + ProofsFilterer // Log filterer for contract events +} + +// ProofsCaller is an auto generated read-only Go binding around an Ethereum contract. +type ProofsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ProofsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ProofsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ProofsSession struct { + Contract *Proofs // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProofsCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ProofsCallerSession struct { + Contract *ProofsCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ProofsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ProofsTransactorSession struct { + Contract *ProofsTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProofsRaw is an auto generated low-level Go binding around an Ethereum contract. +type ProofsRaw struct { + Contract *Proofs // Generic contract binding to access the raw methods on +} + +// ProofsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ProofsCallerRaw struct { + Contract *ProofsCaller // Generic read-only contract binding to access the raw methods on +} + +// ProofsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ProofsTransactorRaw struct { + Contract *ProofsTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewProofs creates a new instance of Proofs, bound to a specific deployed contract. +func NewProofs(address common.Address, backend bind.ContractBackend) (*Proofs, error) { + contract, err := bindProofs(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil +} + +// NewProofsCaller creates a new read-only instance of Proofs, bound to a specific deployed contract. +func NewProofsCaller(address common.Address, caller bind.ContractCaller) (*ProofsCaller, error) { + contract, err := bindProofs(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ProofsCaller{contract: contract}, nil +} + +// NewProofsTransactor creates a new write-only instance of Proofs, bound to a specific deployed contract. +func NewProofsTransactor(address common.Address, transactor bind.ContractTransactor) (*ProofsTransactor, error) { + contract, err := bindProofs(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ProofsTransactor{contract: contract}, nil +} + +// NewProofsFilterer creates a new log filterer instance of Proofs, bound to a specific deployed contract. +func NewProofsFilterer(address common.Address, filterer bind.ContractFilterer) (*ProofsFilterer, error) { + contract, err := bindProofs(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ProofsFilterer{contract: contract}, nil +} + +// bindProofs binds a generic wrapper to an already deployed contract. +func bindProofs(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ProofsABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Proofs *ProofsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Proofs.Contract.ProofsCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Proofs *ProofsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Proofs.Contract.ProofsTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Proofs *ProofsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Proofs.Contract.ProofsTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Proofs *ProofsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Proofs.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Proofs *ProofsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Proofs.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Proofs *ProofsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Proofs.Contract.contract.Transact(opts, method, params...) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCaller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doHash", op, preimage) + return *ret0, err +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsSession) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCaller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doHashOrNoop", op, preimage) + return *ret0, err +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsCaller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doLength", op, data) + return *ret0, err +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsSession) DoLength(op uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoLength(op uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsCaller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "hasprefix", s, prefix) + return *ret0, err +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsSession) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsCallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsCaller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) + return *ret0, err +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsCallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) +} diff --git a/sol/proofs.sol b/sol/proofs.sol new file mode 100644 index 00000000..73425094 --- /dev/null +++ b/sol/proofs.sol @@ -0,0 +1,171 @@ +pragma solidity ^0.5.1; + +contract Proofs { + enum HashOp{NO_HASH, SHA256, SHA512, KECCAK, RIPEMD160, BITCOIN} + enum LengthOp{NO_PREFIX, VAR_PROTO, VAR_RLP, FIXED32_BIG, FIXED32_LITTLE, FIXED64_BIG, FIXED64_LITTLE, REQUIRE_32_BYTES, REQUIRE_64_BYTES} + + struct ExistenceProof { + bytes key; + bytes value; + LeafOp leaf; + InnerOp[] path; + } + + struct LeafOp { + HashOp hash; + HashOp prehash_key; + HashOp prehash_value; + LengthOp len; + bytes prefix; + } + + struct InnerOp { + HashOp hash; + bytes prefix; + bytes suffix; + } + + LeafOp iavlSpec = LeafOp( + HashOp.SHA256, + HashOp.NO_HASH, + HashOp.SHA256, + LengthOp.VAR_PROTO, + hex"00" + ); + + function decodeExistenceProof( + // ExistenceProof basic info + bytes memory key, bytes memory value, + // LeafOp info + HashOp leaf_hash, HashOp prehash_key, HashOp prehash_value, LengthOp leaf_len, bytes memory leaf_prefix, + // InnerOp info + bytes memory inner_hashes_encoded, bytes memory inner_prefixes_encoded, bytes memory inner_suffixes_encoded + ) internal pure returns (ExistenceProof memory) { + HashOp[] memory inner_hashes = abi.decode(inner_hashes_encoded, (HashOp[])); + bytes[] memory inner_prefixes = abi.decode(inner_prefixes_encoded, (bytes[])); + bytes[] memory inner_suffixes = abi.decode(inner_suffixes_encoded, (bytes[])); + require(inner_hashes.length == inner_prefixes.length && inner_prefixes.length == inner_suffixes.length); + + uint inners = inner_hashes.length; + InnerOp[] memory innerops = new InnerOp[](inners); + for (uint i = 0; i < inners; i++) { + innerops[i] = InnerOp ( + inner_hashes[i], + inner_prefixes[i], + inner_suffixes[i] + ); + } + + return ExistenceProof ( + key, + value, + LeafOp( + leaf_hash, + prehash_key, + prehash_value, + leaf_len, + leaf_prefix + ), + innerops + ); + } + + function doHashOrNoop(HashOp op, bytes memory preimage) public pure returns (bytes memory) { + if (op == HashOp.NO_HASH) { + return preimage; + } + return doHash(op, preimage); + } + + function doHash(HashOp op, bytes memory preimage) public pure returns (bytes memory) { + if (op == HashOp.KECCAK) { + return abi.encodePacked(keccak256(preimage)); + } + if (op == HashOp.SHA256) { + return abi.encodePacked(sha256(preimage)); + } + if (op == HashOp.RIPEMD160) { + return abi.encodePacked(ripemd160(preimage)); + } + if (op == HashOp.BITCOIN) { + return abi.encodePacked(ripemd160(abi.encodePacked(sha256(preimage)))); + } + revert("invalid or unsupported hash operation"); + } + + function doLength(LengthOp op, bytes memory data) public pure returns (bytes memory) { + if (op == LengthOp.NO_PREFIX) { + return data; + } + if (op == LengthOp.VAR_PROTO) { + uint l = data.length; + if (l >= 1<<7) { + return abi.encodePacked(uint8(l&0x7f|0x80), uint8(l>>=7), data); + } + return abi.encodePacked(uint8(l), data); + } + if (op == LengthOp.REQUIRE_32_BYTES) { + require(data.length == 32); + return data; + } + if (op == LengthOp.REQUIRE_64_BYTES) { + require(data.length == 64); + return data; + } + revert("invalid or unsupported length operation"); + } + + function prepareLeafData(HashOp hashop, LengthOp lengthop, bytes memory data) public pure returns (bytes memory) { + bytes memory hashed = doHashOrNoop(hashop, data); + bytes memory result = doLength(lengthop, hashed); + return result; + } + + function applyLeaf(LeafOp memory op, bytes memory key, bytes memory value) internal pure returns (bytes memory) { + require(key.length != 0); + require(value.length != 0); + + bytes memory pkey = prepareLeafData(op.prehash_key, op.len, key); + bytes memory pvalue = prepareLeafData(op.prehash_value, op.len, value); + + bytes memory data = abi.encodePacked(op.prefix, pkey, pvalue); + return doHash(op.hash, data); + } + + function applyInner(InnerOp memory op, bytes memory child) internal pure returns (bytes memory) { + require(child.length == 0); + bytes memory preimage = abi.encodePacked(op.prefix, child, op.suffix); + return doHash(op.hash, preimage); + } + + function hasprefix(bytes memory s, bytes memory prefix) public pure returns (bool) { + for (uint i = 0; i < prefix.length; i++) { + if (s[i] != prefix[i]) { + return false; + } + } + return true; + } + + function checkAgainstSpec(ExistenceProof memory proof, LeafOp memory spec) internal pure { + require(proof.leaf.hash == spec.hash); + require(proof.leaf.prehash_key == spec.prehash_key); + require(proof.leaf.prehash_value == spec.prehash_value); + require(proof.leaf.len == spec.len); + require(hasprefix(proof.leaf.prefix, spec.prefix)); + + for (uint i = 0; i < proof.path.length; i++) { + require(hasprefix(proof.path[i].prefix, spec.prefix)); + } + } + + function calculate(ExistenceProof memory proof) internal pure returns (bytes memory) { + bytes memory res = applyLeaf(proof.leaf, proof.key, proof.value); + for (uint i = 0; i < proof.path.length; i++) { + res = applyInner(proof.path[i], res); + } + return res; + } + + +} diff --git a/sol/proofs_test.go b/sol/proofs_test.go new file mode 100644 index 00000000..88aa8550 --- /dev/null +++ b/sol/proofs_test.go @@ -0,0 +1,88 @@ +package proofs + +import ( + "crypto/sha256" + "math/big" + "math/rand" + "testing" + + "golang.org/x/crypto/ripemd160" + + "github.com/stretchr/testify/require" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/crypto" +) + +func testDoHash(t *testing.T, cont ProofsSession) { + for i := 0; i < 1000; i++ { + image := make([]byte, 64) + rand.Read(image) + + // NO_HASH + hashed, err := cont.DoHashOrNoop(0, image) + require.NoError(t, err) + require.Equal(t, image, hashed) + + // SHA256 + hashed, err = cont.DoHash(1, image) + require.NoError(t, err) + exp32 := sha256.Sum256(image) + require.Equal(t, exp32[:], hashed) + + // SHA512 + hashed, err = cont.DoHash(2, image) + //require.NoError(t, err) + //exp64 := sha512.Sum512(image) + //require.Equal(t, exp64[:], hashed) + require.Error(t, err) + + // KECCAK + hashed, err = cont.DoHash(3, image) + require.NoError(t, err) + exp32 = crypto.Keccak256Hash(image) + require.Equal(t, exp32[:], hashed) + + // RIPEMD160 + hashed, err = cont.DoHash(4, image) + require.NoError(t, err) + hash := ripemd160.New() + hash.Write(image) + require.Equal(t, hash.Sum(nil)[:], hashed) + + // BITCOIN + hashed, err = cont.DoHash(5, image) + require.NoError(t, err) + sha := sha256.Sum256(image) + hash = ripemd160.New() + hash.Write(sha[:]) + require.Equal(t, hash.Sum(nil)[:], hashed) + + // INVALID + _, err = cont.DoHash(6, image) + require.Error(t, err) + } +} + +func TestHelperFunctions(t *testing.T) { + key, _ := crypto.GenerateKey() + auth := bind.NewKeyedTransactor(key) + address := auth.From + gAlloc := map[common.Address]core.GenesisAccount{ + address: {Balance: big.NewInt(100000000000)}, + } + sim := backends.NewSimulatedBackend(gAlloc, 100000000000) + + _, _, cont, err := DeployProofs(auth, sim) + + require.NoError(t, err) + + session := ProofsSession{cont, bind.CallOpts{}, bind.TransactOpts{}} + + sim.Commit() + + testDoHash(t, session) +} From 5a7942ebc562a9bfa000a58a13884c8d2968283b Mon Sep 17 00:00:00 2001 From: mossid Date: Wed, 31 Jul 2019 04:38:59 +0900 Subject: [PATCH 02/10] add abi encoding --- sol/proofs_test.go | 51 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sol/proofs_test.go b/sol/proofs_test.go index 88aa8550..34dcae97 100644 --- a/sol/proofs_test.go +++ b/sol/proofs_test.go @@ -5,11 +5,13 @@ import ( "math/big" "math/rand" "testing" + "fmt" "golang.org/x/crypto/ripemd160" "github.com/stretchr/testify/require" + "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" @@ -86,3 +88,52 @@ func TestHelperFunctions(t *testing.T) { testDoHash(t, session) } + +func TestABIEncoding(t *testing.T) { + ty := new(abi.Argument) + err := ty.UnmarshalJSON([]byte(` +{ + "Name": "LeafOp", + "Type": "tuple", + "Components": [ + { + "Name": "hash", + "Type": "uint8" + }, + { + "Name": "prehash_key", + "Type": "uint8" + }, + { + "Name": "prehash_value", + "Type": "uint8" + }, + { + "Name": "len", + "Type": "uint8" + }, + { + "Name": "prefix", + "Type": "bytes" + } + ] +}`)) + require.NoError(t, err) + + tys := abi.Arguments{*ty} + bz, err := tys.Pack(struct { + Hash uint8 + PrehashKey uint8 + PrehashValue uint8 + Len uint8 + Prefix []byte + }{ + 1, + 1, + 1, + 0, + []byte{0x00}, + }) + require.NoError(t, err) + fmt.Println(bz) +} From 839f0b3f67b897939afb81da00900747793f81b7 Mon Sep 17 00:00:00 2001 From: mconcat Date: Mon, 8 Mar 2021 16:01:26 +0900 Subject: [PATCH 03/10] in prog --- go.mod | 33 ++++++++++- go.sum | 157 ++++++++++++++++++++++++++++++++++++++++++++++++- sol/proofs.go | 2 +- sol/proofs.sol | 60 ++++++++----------- 4 files changed, 212 insertions(+), 40 deletions(-) diff --git a/go.mod b/go.mod index 381190c9..269a15ae 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,35 @@ module github.com/confio/ics23 go 1.14 -require github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d // indirect +require ( + github.com/allegro/bigcache v1.2.1 // indirect + github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015 // indirect + github.com/btcsuite/btcd v0.21.0-beta // indirect + github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d // indirect + github.com/deckarep/golang-set v1.7.1 // indirect + github.com/edsrzf/mmap-go v1.0.0 // indirect + github.com/elastic/gosigar v0.10.4 // indirect + github.com/ethereum/go-ethereum v1.9.1 + github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect + github.com/golang/protobuf v1.3.2 // indirect + github.com/gorilla/websocket v1.4.0 // indirect + github.com/hashicorp/golang-lru v0.5.3 // indirect + github.com/huin/goupnp v1.0.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.1 // indirect + github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 // indirect + github.com/mattn/go-runewidth v0.0.4 // indirect + github.com/olekukonko/tablewriter v0.0.1 // indirect + github.com/pborman/uuid v1.2.0 // indirect + github.com/prometheus/tsdb v0.10.0 // indirect + github.com/rjeczalik/notify v0.9.2 // indirect + github.com/rs/cors v1.6.0 // indirect + github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 // indirect + github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect + github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect + github.com/stretchr/testify v1.3.0 + github.com/syndtr/goleveldb v1.0.0 // indirect + github.com/tyler-smith/go-bip39 v1.0.0 // indirect + github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect + golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 + gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect +) diff --git a/go.sum b/go.sum index 46e80447..07d83182 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,169 @@ -github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d h1:VbtIIE3NDC6/aIRUR9FdmRE4l0B5IDgYHiFi8pw0QOc= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= +github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015 h1:7ABPr1+uJdqESAdlVevnc/2FJGiC/K3uMg1JiELeF+0= +github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= +github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= +github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= +github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= +github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= +github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= +github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= +github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= +github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= +github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= +github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= +github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= +github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/gosigar v0.10.4 h1:6jfw75dsoflhBMRdO6QPzQUgLqUYTsQQQRkkcsHsuPo= +github.com/elastic/gosigar v0.10.4/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= +github.com/ethereum/go-ethereum v1.9.1 h1:MrdTRvKIa3apdx6NW1azzSgl8BQB1eTBVSUmFhuztaU= +github.com/ethereum/go-ethereum v1.9.1/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= +github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= +github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= +github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 h1:S8kWZLXHpcOq3nGAvIs0oDgd4CXxkxE3hkDVRjTu7ro= +github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= +github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= +github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= +github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= +github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= +github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= +github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= +github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= +github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw= +github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639dk2kqnCPPv+wNjq7Xb6EfUxe/oX0/NM= +github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tyler-smith/go-bip39 v1.0.0 h1:FOHg9gaQLeBBRbHE/QrTLfEiBHy5pQ/yXzf9JG5pYFM= +github.com/tyler-smith/go-bip39 v1.0.0/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= +github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= +golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= +gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sol/proofs.go b/sol/proofs.go index f0ae17d0..72ace7f2 100644 --- a/sol/proofs.go +++ b/sol/proofs.go @@ -40,7 +40,7 @@ var ProofsFuncSigs = map[string]string{ } // ProofsBin is the compiled bytecode used for deploying new contracts. -var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091610061919081610076565b50505034801561007057600080fd5b50610111565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b757805160ff19168380011785556100e4565b828001600101855582156100e4579182015b828111156100e45782518255916020019190600101906100c9565b506100f09291506100f4565b5090565b61010e91905b808211156100f057600081556001016100fa565b90565b610ac9806101206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063038011741461005c57806367bb8e811461017f578063901d0e151461022d578063d48f1e4f1461036a578063fd29e20a14610418575b600080fd5b61010a6004803603604081101561007257600080fd5b60ff8235169190810190604081016020820135600160201b81111561009657600080fd5b8201836020820111156100a857600080fd5b803590602001918460018302840111600160201b831117156100c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010a6004803603604081101561019557600080fd5b60ff8235169190810190604081016020820135600160201b8111156101b957600080fd5b8201836020820111156101cb57600080fd5b803590602001918460018302840111600160201b831117156101ec57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104ff945050505050565b6103566004803603604081101561024357600080fd5b810190602081018135600160201b81111561025d57600080fd5b82018360208201111561026f57600080fd5b803590602001918460018302840111600160201b8311171561029057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102e257600080fd5b8201836020820111156102f457600080fd5b803590602001918460018302840111600160201b8311171561031557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106da945050505050565b604080519115158252519081900360200190f35b61010a6004803603604081101561038057600080fd5b60ff8235169190810190604081016020820135600160201b8111156103a457600080fd5b8201836020820111156103b657600080fd5b803590602001918460018302840111600160201b831117156103d757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610744945050505050565b61010a6004803603606081101561042e57600080fd5b60ff8235811692602081013590911691810190606081016040820135600160201b81111561045b57600080fd5b82018360208201111561046d57600080fd5b803590602001918460018302840111600160201b8311171561048e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a23945050505050565b606060008360058111156104df57fe5b14156104ec5750806104f9565b6104f68383610744565b90505b92915050565b6060600083600881111561050f57fe5b141561051c5750806104f9565b600183600881111561052a57fe5b1415610658578151608081106105d85780607f16608017600782901c91508184604051602001808460ff1660ff1660f81b81526001018360ff1660ff1660f81b815260010182805190602001908083835b6020831061059a5780518252601f19909201916020918201910161057b565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040529150506104f9565b8083604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061061b5780518252601f1990920191602091820191016105fc565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506104f9565b600783600881111561066657fe5b141561068157815160201461067a57600080fd5b50806104f9565b600883600881111561068f57fe5b14156106a357815160401461067a57600080fd5b60405162461bcd60e51b8152600401808060200182810382526027815260200180610a496027913960400191505060405180910390fd5b6000805b825181101561073a578281815181106106f357fe5b602001015160f81c60f81b6001600160f81b03191684828151811061071457fe5b01602001516001600160f81b031916146107325760009150506104f9565b6001016106de565b5060019392505050565b6060600383600581111561075457fe5b14156107885781805190602001206040516020018082815260200191505060405160208183030381529060405290506104f9565b600183600581111561079657fe5b1415610846576002826040518082805190602001908083835b602083106107ce5780518252601f1990920191602091820191016107af565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561080d573d6000803e3d6000fd5b5050506040513d602081101561082257600080fd5b505160408051602081810193909352815180820390930183528101905290506104f9565b600483600581111561085457fe5b1415610905576003826040518082805190602001908083835b6020831061088c5780518252601f19909201916020918201910161086d565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108cb573d6000803e3d6000fd5b505060408051805160601b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915291506104f99050565b600583600581111561091357fe5b14156109ec5760036002836040518082805190602001908083835b6020831061094d5780518252601f19909201916020918201910161092e565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098c573d6000803e3d6000fd5b5050506040513d60208110156109a157600080fd5b50516040805160208181019390935281518082038401815290820191829052805190928291908401908083836020831061088c5780518252601f19909201916020918201910161086d565b60405162461bcd60e51b8152600401808060200182810382526025815260200180610a706025913960400191505060405180910390fd5b606080610a3085846104cf565b90506060610a3e85836104ff565b969550505050505056fe696e76616c6964206f7220756e737570706f72746564206c656e677468206f7065726174696f6e696e76616c6964206f7220756e737570706f727465642068617368206f7065726174696f6ea265627a7a723058207ae67b115238b964a92a002d2a782c470e7bdc5cc2e63c45ba8219638aa2d46464736f6c63430005090032" +var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091610061919081610076565b50505034801561007057600080fd5b50610111565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b757805160ff19168380011785556100e4565b828001600101855582156100e4579182015b828111156100e45782518255916020019190600101906100c9565b506100f09291506100f4565b5090565b61010e91905b808211156100f057600081556001016100fa565b90565b610ac9806101206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063038011741461005c57806367bb8e811461017f578063901d0e151461022d578063d48f1e4f1461036a578063fd29e20a14610418575b600080fd5b61010a6004803603604081101561007257600080fd5b60ff8235169190810190604081016020820135600160201b81111561009657600080fd5b8201836020820111156100a857600080fd5b803590602001918460018302840111600160201b831117156100c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010a6004803603604081101561019557600080fd5b60ff8235169190810190604081016020820135600160201b8111156101b957600080fd5b8201836020820111156101cb57600080fd5b803590602001918460018302840111600160201b831117156101ec57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104ff945050505050565b6103566004803603604081101561024357600080fd5b810190602081018135600160201b81111561025d57600080fd5b82018360208201111561026f57600080fd5b803590602001918460018302840111600160201b8311171561029057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102e257600080fd5b8201836020820111156102f457600080fd5b803590602001918460018302840111600160201b8311171561031557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106da945050505050565b604080519115158252519081900360200190f35b61010a6004803603604081101561038057600080fd5b60ff8235169190810190604081016020820135600160201b8111156103a457600080fd5b8201836020820111156103b657600080fd5b803590602001918460018302840111600160201b831117156103d757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610744945050505050565b61010a6004803603606081101561042e57600080fd5b60ff8235811692602081013590911691810190606081016040820135600160201b81111561045b57600080fd5b82018360208201111561046d57600080fd5b803590602001918460018302840111600160201b8311171561048e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a23945050505050565b606060008360058111156104df57fe5b14156104ec5750806104f9565b6104f68383610744565b90505b92915050565b6060600083600881111561050f57fe5b141561051c5750806104f9565b600183600881111561052a57fe5b1415610658578151608081106105d85780607f16608017600782901c91508184604051602001808460ff1660ff1660f81b81526001018360ff1660ff1660f81b815260010182805190602001908083835b6020831061059a5780518252601f19909201916020918201910161057b565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040529150506104f9565b8083604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061061b5780518252601f1990920191602091820191016105fc565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506104f9565b600783600881111561066657fe5b141561068157815160201461067a57600080fd5b50806104f9565b600883600881111561068f57fe5b14156106a357815160401461067a57600080fd5b60405162461bcd60e51b8152600401808060200182810382526027815260200180610a496027913960400191505060405180910390fd5b6000805b825181101561073a578281815181106106f357fe5b602001015160f81c60f81b6001600160f81b03191684828151811061071457fe5b01602001516001600160f81b031916146107325760009150506104f9565b6001016106de565b5060019392505050565b6060600383600581111561075457fe5b14156107885781805190602001206040516020018082815260200191505060405160208183030381529060405290506104f9565b600183600581111561079657fe5b1415610846576002826040518082805190602001908083835b602083106107ce5780518252601f1990920191602091820191016107af565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561080d573d6000803e3d6000fd5b5050506040513d602081101561082257600080fd5b505160408051602081810193909352815180820390930183528101905290506104f9565b600483600581111561085457fe5b1415610905576003826040518082805190602001908083835b6020831061088c5780518252601f19909201916020918201910161086d565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108cb573d6000803e3d6000fd5b505060408051805160601b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915291506104f99050565b600583600581111561091357fe5b14156109ec5760036002836040518082805190602001908083835b6020831061094d5780518252601f19909201916020918201910161092e565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098c573d6000803e3d6000fd5b5050506040513d60208110156109a157600080fd5b50516040805160208181019390935281518082038401815290820191829052805190928291908401908083836020831061088c5780518252601f19909201916020918201910161086d565b60405162461bcd60e51b8152600401808060200182810382526025815260200180610a706025913960400191505060405180910390fd5b606080610a3085846104cf565b90506060610a3e85836104ff565b969550505050505056fe696e76616c6964206f7220756e737570706f72746564206c656e677468206f7065726174696f6e696e76616c6964206f7220756e737570706f727465642068617368206f7065726174696f6ea265627a7a72305820c33c19623256e13565ca6123c410ad5b2fc0206db20620c463f4a62233e0cb7564736f6c63430005090032" // DeployProofs deploys a new Ethereum contract, binding an instance of Proofs to it. func DeployProofs(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Proofs, error) { diff --git a/sol/proofs.sol b/sol/proofs.sol index 73425094..303d7555 100644 --- a/sol/proofs.sol +++ b/sol/proofs.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.1; +pragma solidity ^0.5.3; contract Proofs { enum HashOp{NO_HASH, SHA256, SHA512, KECCAK, RIPEMD160, BITCOIN} @@ -32,42 +32,30 @@ contract Proofs { LengthOp.VAR_PROTO, hex"00" ); + + function decodeExistenceProof( + bytes memory key, bytes memory value, + bytes memory leafOpEncoded, bytes memory pathEncodedEncoded + ) + internal pure returns (ExistenceProof memory) { + (HashOp leafHash, HashOp prehashKey, HashOp prehashValue, LengthOp len, bytes memory leafPrefix) = abi.decode(leafOpEncoded, (HashOp, HashOp, HashOp, LengthOp, bytes)); + LeafOp memory leaf = LeafOp(leafHash, prehashKey, prehashValue, len, leafPrefix); + bytes[] memory pathEncoded = abi.decode(pathEncodedEncoded, (bytes[])); + InnerOp[] memory path = new InnerOp[](pathEncoded.length); + for (uint i = 0; i < pathEncoded.length; i++) { + (HashOp hash, bytes memory prefix, bytes memory suffix) = abi.decode(pathEncoded[i], (HashOp, bytes, bytes)); + path[i] = InnerOp(hash, prefix, suffix); + } + + return ExistenceProof(key, value, leaf, path); + } + + function encodeLeafOp(HashOp hash, HashOp phkey, HashOp phval, LengthOp len, bytes memory prefix) public pure returns (bytes memory) { + return abi.encode(hash, phkey, phval, len, prefix); + } - function decodeExistenceProof( - // ExistenceProof basic info - bytes memory key, bytes memory value, - // LeafOp info - HashOp leaf_hash, HashOp prehash_key, HashOp prehash_value, LengthOp leaf_len, bytes memory leaf_prefix, - // InnerOp info - bytes memory inner_hashes_encoded, bytes memory inner_prefixes_encoded, bytes memory inner_suffixes_encoded - ) internal pure returns (ExistenceProof memory) { - HashOp[] memory inner_hashes = abi.decode(inner_hashes_encoded, (HashOp[])); - bytes[] memory inner_prefixes = abi.decode(inner_prefixes_encoded, (bytes[])); - bytes[] memory inner_suffixes = abi.decode(inner_suffixes_encoded, (bytes[])); - require(inner_hashes.length == inner_prefixes.length && inner_prefixes.length == inner_suffixes.length); - - uint inners = inner_hashes.length; - InnerOp[] memory innerops = new InnerOp[](inners); - for (uint i = 0; i < inners; i++) { - innerops[i] = InnerOp ( - inner_hashes[i], - inner_prefixes[i], - inner_suffixes[i] - ); - } - - return ExistenceProof ( - key, - value, - LeafOp( - leaf_hash, - prehash_key, - prehash_value, - leaf_len, - leaf_prefix - ), - innerops - ); + function encodeInnerOp(HashOp hash, bytes memory prefix, bytes memory suffix) public pure returns (bytes memory) { + return abi.encode(hash, prefix, suffix); } function doHashOrNoop(HashOp op, bytes memory preimage) public pure returns (bytes memory) { From e3c12b8d1519f7cec3bd7fe3fa8c8ac81d262b85 Mon Sep 17 00:00:00 2001 From: mossid Date: Thu, 29 Aug 2019 18:25:20 +0200 Subject: [PATCH 04/10] move to ABIEncoderV2, extract data from go tests, working test --- go/ops_test.go | 184 ++------------- go/ops_test_data.go | 179 ++++++++++++++ go/proof_test.go | 212 +---------------- go/proof_test_data.go | 290 +++++++++++++++++++++++ sol/ops_test.go | 165 +++++++++++++ sol/proofs.go | 340 +++------------------------ sol/proofs.sol | 78 ++++--- sol/proofs_contract.go | 515 +++++++++++++++++++++++++++++++++++++++++ sol/proofs_test.go | 157 +++---------- 9 files changed, 1277 insertions(+), 843 deletions(-) create mode 100644 go/ops_test_data.go create mode 100644 go/proof_test_data.go create mode 100644 sol/ops_test.go create mode 100644 sol/proofs_contract.go diff --git a/go/ops_test.go b/go/ops_test.go index 6f3c71ff..5de1f1ce 100644 --- a/go/ops_test.go +++ b/go/ops_test.go @@ -7,92 +7,13 @@ import ( ) func TestLeafOp(t *testing.T) { - cases := map[string]struct { - op *LeafOp - key []byte - value []byte - isErr bool - expected []byte - }{ - "hash foobar": { - op: &LeafOp{ - Hash: HashOp_SHA256, - // no prehash, no length prefix - }, - key: []byte("foo"), - value: []byte("bar"), - // echo -n foobar | sha256sum - expected: fromHex("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"), - }, - "hash foobaz, sha-512": { - op: &LeafOp{ - Hash: HashOp_SHA512, - // no prehash, no length prefix - }, - key: []byte("foo"), - value: []byte("baz"), - // echo -n foobaz | sha512sum - expected: fromHex("4f79f191298ec7461d60136c60f77c2ae8ddd85dbf6168bb925092d51bfb39b559219b39ae5385ba04946c87f64741385bef90578ea6fe6dac85dbf7ad3f79e1"), - }, - "hash foobar (different break)": { - op: &LeafOp{ - Hash: HashOp_SHA256, - // no prehash, no length prefix - }, - key: []byte("f"), - value: []byte("oobar"), - // echo -n foobar | sha256sum - expected: fromHex("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"), - }, - "requires key": { - op: &LeafOp{ - Hash: HashOp_SHA256, - // no prehash, no length prefix - }, - key: []byte("foo"), - isErr: true, - }, - "requires value": { - op: &LeafOp{ - Hash: HashOp_SHA256, - // no prehash, no length prefix - }, - value: []byte("bar"), - isErr: true, - }, - "hash with length prefix": { - op: &LeafOp{ - Hash: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - // no prehash - }, - // echo -n food | xxs -ps - // and manually compute length byte - key: []byte("food"), // 04666f6f64 - value: []byte("some longer text"), // 10736f6d65206c6f6e6765722074657874 - // echo -n 04666f6f6410736f6d65206c6f6e6765722074657874 | xxd -r -p | sha256sum - expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), - }, - "hash with prehash and length prefix": { - op: &LeafOp{ - Hash: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - PrehashValue: HashOp_SHA256, - }, - key: []byte("food"), // 04666f6f64 - // TODO: this is hash, then length.... - // echo -n yet another long string | sha256sum - value: []byte("yet another long string"), // 20a48c2d4f67b9f80374938535285ed285819d8a5a8fc1fccd1e3244e437cf290d - // echo -n 04666f6f6420a48c2d4f67b9f80374938535285ed285819d8a5a8fc1fccd1e3244e437cf290d | xxd -r -p | sha256sum - expected: fromHex("87e0483e8fb624aef2e2f7b13f4166cda485baa8e39f437c83d74c94bedb148f"), - }, - } + cases := LeafOpTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { - res, err := tc.op.Apply(tc.key, tc.value) + res, err := tc.Op.Apply(tc.Key, tc.Value) // short-circuit with error case - if tc.isErr { + if tc.IsErr { if err == nil { t.Fatal("Expected error, but got none") } @@ -102,63 +23,21 @@ func TestLeafOp(t *testing.T) { if err != nil { t.Fatal(err) } - if !bytes.Equal(res, tc.expected) { - t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.expected)) + if !bytes.Equal(res, tc.Expected) { + t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.Expected)) } }) } } func TestInnerOp(t *testing.T) { - cases := map[string]struct { - op *InnerOp - child []byte - isErr bool - expected []byte - }{ - "requires child": { - op: &InnerOp{ - Hash: HashOp_SHA256, - Prefix: fromHex("0123456789"), - Suffix: fromHex("deadbeef"), - }, - isErr: true, - }, - "hash child with prefix and suffix": { - op: &InnerOp{ - Hash: HashOp_SHA256, - Prefix: fromHex("0123456789"), - Suffix: fromHex("deadbeef"), - }, - child: fromHex("00cafe00"), - // echo -n 012345678900cafe00deadbeef | xxd -r -p | sha256sum - expected: fromHex("0339f76086684506a6d42a60da4b5a719febd4d96d8b8d85ae92849e3a849a5e"), - }, - "hash child with only prefix": { - op: &InnerOp{ - Hash: HashOp_SHA256, - Prefix: fromHex("00204080a0c0e0"), - }, - child: fromHex("ffccbb997755331100"), - // echo -n 00204080a0c0e0ffccbb997755331100 | xxd -r -p | sha256sum - expected: fromHex("45bece1678cf2e9f4f2ae033e546fc35a2081b2415edcb13121a0e908dca1927"), - }, - "hash child with only suffix": { - op: &InnerOp{ - Hash: HashOp_SHA256, - Suffix: []byte(" just kidding!"), - }, - child: []byte("this is a sha256 hash, really...."), - // echo -n 'this is a sha256 hash, really.... just kidding!' | sha256sum - expected: fromHex("79ef671d27e42a53fba2201c1bbc529a099af578ee8a38df140795db0ae2184b"), - }, - } + cases := InnerOpTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { - res, err := tc.op.Apply(tc.child) + res, err := tc.Op.Apply(tc.Child) // short-circuit with error case - if tc.isErr { + if tc.IsErr { if err == nil { t.Fatal("Expected error, but got none") } @@ -168,61 +47,26 @@ func TestInnerOp(t *testing.T) { if err != nil { t.Fatal(err) } - if !bytes.Equal(res, tc.expected) { - t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.expected)) + if !bytes.Equal(res, tc.Expected) { + t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.Expected)) } }) } } func TestDoHash(t *testing.T) { - cases := map[string]struct { - hashOp HashOp - preimage string - expectedHash string - }{ - "sha256": { - hashOp: HashOp_SHA256, - preimage: "food", - // echo -n food | sha256sum - expectedHash: "c1f026582fe6e8cb620d0c85a72fe421ddded756662a8ec00ed4c297ad10676b", - }, - "ripemd160": { - hashOp: HashOp_RIPEMD160, - preimage: "food", - // echo -n food | openssl dgst -rmd160 -hex | cut -d' ' -f2 - expectedHash: "b1ab9988c7c7c5ec4b2b291adfeeee10e77cdd46", - }, - "bitcoin": { - hashOp: HashOp_BITCOIN, - preimage: "food", - // echo -n c1f026582fe6e8cb620d0c85a72fe421ddded756662a8ec00ed4c297ad10676b | xxd -r -p | openssl dgst -rmd160 -hex - expectedHash: "0bcb587dfb4fc10b36d57f2bba1878f139b75d24", - }, - } + cases := DoHashTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { - res, err := doHash(tc.hashOp, []byte(tc.preimage)) + res, err := doHash(tc.HashOp, []byte(tc.Preimage)) if err != nil { t.Fatal(err) } hexRes := hex.EncodeToString(res) - if hexRes != tc.expectedHash { - t.Fatalf("Expected %s got %s", tc.expectedHash, hexRes) + if hexRes != tc.ExpectedHash { + t.Fatalf("Expected %s got %s", tc.ExpectedHash, hexRes) } }) } } - -func fromHex(data string) []byte { - res, err := hex.DecodeString(data) - if err != nil { - panic(err) - } - return res -} - -func toHex(data []byte) string { - return hex.EncodeToString(data) -} diff --git a/go/ops_test_data.go b/go/ops_test_data.go new file mode 100644 index 00000000..bfae91e7 --- /dev/null +++ b/go/ops_test_data.go @@ -0,0 +1,179 @@ +package proofs + +import ( + "encoding/hex" +) + +type LeafOpTestStruct struct { + Op *LeafOp + Key []byte + Value []byte + IsErr bool + Expected []byte +} + +func LeafOpTestData() map[string]LeafOpTestStruct { + return map[string]LeafOpTestStruct{ + "hash foobar": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + // no prehash, no length prefix + }, + Key: []byte("foo"), + Value: []byte("bar"), + // echo -n foobar | sha256sum + Expected: fromHex("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"), + }, + "hash foobaz, sha-512": { + Op: &LeafOp{ + Hash: HashOp_SHA512, + // no prehash, no length prefix + }, + Key: []byte("foo"), + Value: []byte("baz"), + // echo -n foobaz | sha512sum + Expected: fromHex("4f79f191298ec7461d60136c60f77c2ae8ddd85dbf6168bb925092d51bfb39b559219b39ae5385ba04946c87f64741385bef90578ea6fe6dac85dbf7ad3f79e1"), + }, + "hash foobar (different break)": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + // no prehash, no length prefix + }, + Key: []byte("f"), + Value: []byte("oobar"), + // echo -n foobar | sha256sum + Expected: fromHex("c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"), + }, + "requires key": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + // no prehash, no length prefix + }, + Key: []byte("foo"), + IsErr: true, + }, + "requires value": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + // no prehash, no length prefix + }, + Value: []byte("bar"), + IsErr: true, + }, + "hash with length prefix": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + // no prehash + }, + // echo -n food | xxs -ps + // and manually compute length byte + Key: []byte("food"), // 04666f6f64 + Value: []byte("some longer text"), // 10736f6d65206c6f6e6765722074657874 + // echo -n 04666f6f6410736f6d65206c6f6e6765722074657874 | xxd -r -p | sha256sum + Expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), + }, + "hash with prehash and length prefix": { + Op: &LeafOp{ + Hash: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + PrehashValue: HashOp_SHA256, + }, + Key: []byte("food"), // 04666f6f64 + // TODO: this is hash, then length.... + // echo -n yet another long string | sha256sum + Value: []byte("yet another long string"), // 20a48c2d4f67b9f80374938535285ed285819d8a5a8fc1fccd1e3244e437cf290d + // echo -n 04666f6f6420a48c2d4f67b9f80374938535285ed285819d8a5a8fc1fccd1e3244e437cf290d | xxd -r -p | sha256sum + Expected: fromHex("87e0483e8fb624aef2e2f7b13f4166cda485baa8e39f437c83d74c94bedb148f"), + }, + } +} + +type InnerOpTestStruct struct { + Op *InnerOp + Child []byte + IsErr bool + Expected []byte +} + +func InnerOpTestData() map[string]InnerOpTestStruct { + return map[string]InnerOpTestStruct{ + "requires child": { + Op: &InnerOp{ + Hash: HashOp_SHA256, + Prefix: fromHex("0123456789"), + Suffix: fromHex("deadbeef"), + }, + IsErr: true, + }, + "hash child with prefix and suffix": { + Op: &InnerOp{ + Hash: HashOp_SHA256, + Prefix: fromHex("0123456789"), + Suffix: fromHex("deadbeef"), + }, + Child: fromHex("00cafe00"), + // echo -n 012345678900cafe00deadbeef | xxd -r -p | sha256sum + Expected: fromHex("0339f76086684506a6d42a60da4b5a719febd4d96d8b8d85ae92849e3a849a5e"), + }, + "hash child with only prefix": { + Op: &InnerOp{ + Hash: HashOp_SHA256, + Prefix: fromHex("00204080a0c0e0"), + }, + Child: fromHex("ffccbb997755331100"), + // echo -n 00204080a0c0e0ffccbb997755331100 | xxd -r -p | sha256sum + Expected: fromHex("45bece1678cf2e9f4f2ae033e546fc35a2081b2415edcb13121a0e908dca1927"), + }, + "hash child with only suffix": { + Op: &InnerOp{ + Hash: HashOp_SHA256, + Suffix: []byte(" just kidding!"), + }, + Child: []byte("this is a sha256 hash, really...."), + // echo -n 'this is a sha256 hash, really.... just kidding!' | sha256sum + Expected: fromHex("79ef671d27e42a53fba2201c1bbc529a099af578ee8a38df140795db0ae2184b"), + }, + } +} + +type DoHashTestStruct struct { + HashOp HashOp + Preimage string + ExpectedHash string +} + +func DoHashTestData() map[string]DoHashTestStruct { + return map[string]DoHashTestStruct{ + "sha256": { + HashOp: HashOp_SHA256, + Preimage: "food", + // echo -n food | sha256sum + ExpectedHash: "c1f026582fe6e8cb620d0c85a72fe421ddded756662a8ec00ed4c297ad10676b", + }, + "ripemd160": { + HashOp: HashOp_RIPEMD160, + Preimage: "food", + // echo -n food | openssl dgst -rmd160 -hex | cut -d' ' -f2 + ExpectedHash: "b1ab9988c7c7c5ec4b2b291adfeeee10e77cdd46", + }, + "bitcoin": { + HashOp: HashOp_BITCOIN, + Preimage: "food", + // echo -n c1f026582fe6e8cb620d0c85a72fe421ddded756662a8ec00ed4c297ad10676b | xxd -r -p | openssl dgst -rmd160 -hex + ExpectedHash: "0bcb587dfb4fc10b36d57f2bba1878f139b75d24", + }, + } +} + +func fromHex(data string) []byte { + res, err := hex.DecodeString(data) + if err != nil { + panic(err) + } + return res +} + +func toHex(data []byte) string { + return hex.EncodeToString(data) +} diff --git a/go/proof_test.go b/go/proof_test.go index 1a85c6e5..c5814a0c 100644 --- a/go/proof_test.go +++ b/go/proof_test.go @@ -6,92 +6,13 @@ import ( ) func TestExistenceProof(t *testing.T) { - cases := map[string]struct { - proof *ExistenceProof - isErr bool - expected []byte - }{ - "must have at least one step": { - proof: &ExistenceProof{ - Key: []byte("foo"), - Value: []byte("bar"), - }, - isErr: true, - }, - // copied from ops_test / TestLeafOp - "executes one leaf step": { - proof: &ExistenceProof{ - Key: []byte("food"), - Value: []byte("some longer text"), - Leaf: &LeafOp{ - Hash: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - }, - expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), - }, - // iavl leaf: start with 0, length 3 - // inner prefix: !start with 0, length >= 4 - "demonstrate maliability of leaf if we change leaf algorithm": { - proof: &ExistenceProof{ - Key: append([]byte{4}, []byte("food")...), - Value: append([]byte{16}, []byte("some longer text")...), - Leaf: &LeafOp{ - Hash: HashOp_SHA256, - }, - }, - expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), - }, - "demonstrate maliability of leaf if we change leaf prefix": { - proof: &ExistenceProof{ - Key: append([]byte("od"), byte(16)), - Value: []byte("some longer text"), - Leaf: &LeafOp{ - Prefix: []byte{4, 'f', 'o'}, - Hash: HashOp_SHA256, - }, - }, - expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), - }, - "cannot execute inner first": { - proof: &ExistenceProof{ - Key: []byte("food"), - Value: []byte("some longer text"), - Path: []*InnerOp{ - &InnerOp{ - Hash: HashOp_SHA256, - Prefix: fromHex("deadbeef00cafe00"), - }, - }, - }, - isErr: true, - }, - "executes leaf then inner op": { - proof: &ExistenceProof{ - Key: []byte("food"), - Value: []byte("some longer text"), - Leaf: &LeafOp{ - Hash: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - // output: b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265 - Path: []*InnerOp{ - &InnerOp{ - Hash: HashOp_SHA256, - Prefix: fromHex("deadbeef00cafe00"), - }, - // echo -n deadbeef00cafe00b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265 | xxd -r -p | sha256sum - }, - }, - expected: fromHex("836ea236a6902a665c2a004c920364f24cad52ded20b1e4f22c3179bfe25b2a9"), - }, - } + cases := ExistenceProofTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { - res, err := tc.proof.Calculate() + res, err := tc.Proof.Calculate() // short-circuit with error case - if tc.isErr { + if tc.IsErr { if err == nil { t.Fatal("Expected error, but got none") } @@ -101,134 +22,21 @@ func TestExistenceProof(t *testing.T) { if err != nil { t.Fatal(err) } - if !bytes.Equal(res, tc.expected) { - t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.expected)) + if !bytes.Equal(res, tc.Expected) { + t.Errorf("Bad result: %s vs %s", toHex(res), toHex(tc.Expected)) } }) } } func TestCheckLeaf(t *testing.T) { - cases := map[string]struct { - leaf *LeafOp - spec *LeafOp - isErr bool - }{ - "empty spec, empty leaf": { - leaf: &LeafOp{}, - spec: &LeafOp{}, - }, - "empty spec allows prefix": { - leaf: &LeafOp{Prefix: fromHex("aabb")}, - spec: &LeafOp{}, - }, - "empty spec doesn't allow hashop": { - leaf: &LeafOp{Hash: HashOp_SHA256}, - spec: &LeafOp{}, - isErr: true, - }, - "spec with different prefixes": { - leaf: &LeafOp{Prefix: fromHex("aabb")}, - spec: &LeafOp{Prefix: fromHex("bb")}, - isErr: true, - }, - "leaf with empty prefix (but spec has one)": { - leaf: &LeafOp{}, - spec: &LeafOp{Prefix: fromHex("bb")}, - isErr: true, - }, - "leaf and spec match, all fields full": { - leaf: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - spec: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - }, - "leaf and spec differ on hash": { - leaf: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA256, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - spec: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - isErr: true, - }, - "leaf and spec differ on length": { - leaf: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_NO_PREFIX, - }, - spec: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - isErr: true, - }, - "leaf and spec differ on prehash key": { - leaf: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_SHA256, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - spec: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - isErr: true, - }, - "leaf and spec differ on prehash value": { - leaf: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_NO_HASH, - Length: LengthOp_VAR_PROTO, - }, - spec: &LeafOp{ - Prefix: fromHex("00"), - Hash: HashOp_SHA512, - PrehashKey: HashOp_NO_HASH, - PrehashValue: HashOp_SHA256, - Length: LengthOp_VAR_PROTO, - }, - isErr: true, - }, - } - + cases := CheckLeafTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { err := tc.leaf.CheckAgainstSpec(&ProofSpec{LeafSpec: tc.spec}) if tc.isErr && err == nil { t.Fatal("Expected error, but got nil") - } else if !tc.isErr && err != nil { + } else if !tc.IsErr && err != nil { t.Fatalf("Unexpected error: %v", err) } }) @@ -400,10 +208,10 @@ func TestCheckAgainstSpec(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - err := tc.proof.CheckAgainstSpec(tc.spec) - if tc.isErr && err == nil { + err := tc.Proof.CheckAgainstSpec(tc.Spec) + if tc.IsErr && err == nil { t.Fatal("Expected error, but got nil") - } else if !tc.isErr && err != nil { + } else if !tc.IsErr && err != nil { t.Fatalf("Unexpected error: %v", err) } }) diff --git a/go/proof_test_data.go b/go/proof_test_data.go new file mode 100644 index 00000000..5a93e8ca --- /dev/null +++ b/go/proof_test_data.go @@ -0,0 +1,290 @@ +package proofs + +type ExistenceProofTestStruct struct { + Proof *ExistenceProof + IsErr bool + Expected []byte +} + +func ExistenceProofTestData() map[string]ExistenceProofTestStruct { + return map[string]ExistenceProofTestStruct{ + "must have at least one step": { + Proof: &ExistenceProof{ + Key: []byte("foo"), + Value: []byte("bar"), + }, + IsErr: true, + }, + // copied from ops_test / TestLeafOp + "executes one leaf step": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("some longer text"), + Leaf: &LeafOp{ + Hash: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + }, + Expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), + }, + // iavl Leaf: start with 0, length 3 + // inner prefix: !start with 0, length >= 4 + "demonstrate maliability of leaf if we change leaf algorithm": { + Proof: &ExistenceProof{ + Key: append([]byte{4}, []byte("food")...), + Value: append([]byte{16}, []byte("some longer text")...), + Leaf: &LeafOp{ + Hash: HashOp_SHA256, + }, + }, + Expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), + }, + "demonstrate maliability of leaf if we change leaf prefix": { + Proof: &ExistenceProof{ + Key: append([]byte("od"), byte(16)), + Value: []byte("some longer text"), + Leaf: &LeafOp{ + Prefix: []byte{4, 'f', 'o'}, + Hash: HashOp_SHA256, + }, + }, + Expected: fromHex("b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265"), + }, + "cannot execute inner first": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("some longer text"), + Path: []*InnerOp{ + &InnerOp{ + Hash: HashOp_SHA256, + Prefix: fromHex("deadbeef00cafe00"), + }, + }, + }, + IsErr: true, + }, + "executes leaf then inner op": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("some longer text"), + Leaf: &LeafOp{ + Hash: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + // output: b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265 + Path: []*InnerOp{ + &InnerOp{ + Hash: HashOp_SHA256, + Prefix: fromHex("deadbeef00cafe00"), + }, + // echo -n deadbeef00cafe00b68f5d298e915ae1753dd333da1f9cf605411a5f2e12516be6758f365e6db265 | xxd -r -p | sha256sum + }, + }, + Expected: fromHex("836ea236a6902a665c2a004c920364f24cad52ded20b1e4f22c3179bfe25b2a9"), + }, + } +} + +type CheckLeafTestStruct struct { + Leaf *LeafOp + Spec *LeafOp + IsErr bool +} + +func CheckLeafTestData() map[string]CheckLeafTestStruct { + return map[string]CheckLeafTestStruct{ + "empty spec, empty leaf": { + Leaf: &LeafOp{}, + Spec: &LeafOp{}, + }, + "empty spec allows prefix": { + Leaf: &LeafOp{Prefix: fromHex("aabb")}, + Spec: &LeafOp{}, + }, + "empty spec doesn't allow hashop": { + Leaf: &LeafOp{Hash: HashOp_SHA256}, + Spec: &LeafOp{}, + IsErr: true, + }, + "spec with different prefixes": { + Leaf: &LeafOp{Prefix: fromHex("aabb")}, + Spec: &LeafOp{Prefix: fromHex("bb")}, + IsErr: true, + }, + "leaf with empty prefix (but spec has one)": { + Leaf: &LeafOp{}, + Spec: &LeafOp{Prefix: fromHex("bb")}, + IsErr: true, + }, + "leaf and spec match, all fields full": { + Leaf: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + Spec: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + }, + "leaf and spec differ on hash": { + Leaf: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA256, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + Spec: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + IsErr: true, + }, + "leaf and spec differ on length": { + Leaf: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_NO_PREFIX, + }, + Spec: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + IsErr: true, + }, + "leaf and spec differ on prehash key": { + Leaf: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_SHA256, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + Spec: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + IsErr: true, + }, + "leaf and spec differ on prehash value": { + Leaf: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_NO_HASH, + Length: LengthOp_VAR_PROTO, + }, + Spec: &LeafOp{ + Prefix: fromHex("00"), + Hash: HashOp_SHA512, + PrehashKey: HashOp_NO_HASH, + PrehashValue: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + IsErr: true, + }, + } +} + +type CheckAgainstSpecTestStruct struct { + Proof *ExistenceProof + Spec *ProofSpec + IsErr bool +} + +func CheckAgainstSpecTestData() map[string]CheckAgainstSpecTestStruct { + validInner := &InnerOp{ + Prefix: fromHex("aa"), + } + invalidInner := &InnerOp{ + Prefix: fromHex("00aa"), + Suffix: fromHex("bb"), + } + + return map[string]CheckAgainstSpecTestStruct{ + "empty proof fails": { + Proof: &ExistenceProof{ + Key: []byte("foo"), + Value: []byte("bar"), + }, + Spec: IavlSpec, + IsErr: true, + }, + "accepts one proper leaf": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("bar"), + Leaf: IavlSpec.LeafSpec, + }, + Spec: IavlSpec, + }, + "rejects invalid leaf": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("bar"), + Leaf: &LeafOp{ + Prefix: []byte{0}, + Hash: HashOp_SHA256, + Length: LengthOp_VAR_PROTO, + }, + }, + Spec: IavlSpec, + IsErr: true, + }, + "rejects only inner proof": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("bar"), + Path: []*InnerOp{ + validInner, + }, + }, + Spec: IavlSpec, + IsErr: true, + }, + "accepts leaf with valid inner proofs": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("bar"), + Leaf: IavlSpec.LeafSpec, + Path: []*InnerOp{ + validInner, + validInner, + }, + }, + Spec: IavlSpec, + }, + "rejects leaf with invalid inner proofs": { + Proof: &ExistenceProof{ + Key: []byte("food"), + Value: []byte("bar"), + Leaf: IavlSpec.LeafSpec, + Path: []*InnerOp{ + validInner, + invalidInner, + validInner, + }, + }, + Spec: IavlSpec, + IsErr: true, + }, + } + +} diff --git a/sol/ops_test.go b/sol/ops_test.go new file mode 100644 index 00000000..75ccac7a --- /dev/null +++ b/sol/ops_test.go @@ -0,0 +1,165 @@ +package proofs + +import ( + "crypto/sha256" + "encoding/hex" + "math/big" + "math/rand" + "testing" + + "golang.org/x/crypto/ripemd160" + + proofs "github.com/confio/proofs/go" + "github.com/stretchr/testify/require" + + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/crypto" +) + +func testDoHash(t *testing.T, cont ProofsSession) { + for i := 0; i < 1000; i++ { + image := make([]byte, 64) + rand.Read(image) + + // NO_HASH + hashed, err := cont.DoHashOrNoop(0, image) + require.NoError(t, err) + require.Equal(t, image, hashed) + + // SHA256 + hashed, err = cont.DoHash(1, image) + require.NoError(t, err) + exp32 := sha256.Sum256(image) + require.Equal(t, exp32[:], hashed) + + // Not supported in solidity + // SHA512 + hashed, err = cont.DoHash(2, image) + //require.NoError(t, err) + //exp64 := sha512.Sum512(image) + //require.Equal(t, exp64[:], hashed) + require.Error(t, err) + + // KECCAK + hashed, err = cont.DoHash(3, image) + require.NoError(t, err) + exp32 = crypto.Keccak256Hash(image) + require.Equal(t, exp32[:], hashed) + + // RIPEMD160 + hashed, err = cont.DoHash(4, image) + require.NoError(t, err) + hash := ripemd160.New() + hash.Write(image) + require.Equal(t, hash.Sum(nil)[:], hashed) + + // BITCOIN + hashed, err = cont.DoHash(5, image) + require.NoError(t, err) + sha := sha256.Sum256(image) + hash = ripemd160.New() + hash.Write(sha[:]) + require.Equal(t, hash.Sum(nil)[:], hashed) + + // INVALID + _, err = cont.DoHash(6, image) + require.Error(t, err) + } +} + +func Initialize(t *testing.T) ProofsSession { + key, _ := crypto.GenerateKey() + auth := bind.NewKeyedTransactor(key) + address := auth.From + gAlloc := map[common.Address]core.GenesisAccount{ + address: {Balance: big.NewInt(100000000000)}, + } + sim := backends.NewSimulatedBackend(gAlloc, 100000000000) + + _, _, cont, err := DeployProofs(auth, sim) + + require.NoError(t, err) + + session := ProofsSession{cont, bind.CallOpts{}, bind.TransactOpts{}} + + sim.Commit() + + return session +} + +func TestHelperFunctions(t *testing.T) { + session := Initialize(t) + + testDoHash(t, session) +} + +func TestLeafOp(t *testing.T) { + session := Initialize(t) + + cases := proofs.LeafOpTestData() + + // Set IsErr = true for all SHA512 + for name, tc := range cases { + if tc.Op.Hash == proofs.HashOp_SHA512 { + tc.IsErr = true + cases[name] = tc + } + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + res, err := session.ApplyLeaf(LeafOpToABI(tc.Op), tc.Key, tc.Value) + if tc.IsErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, res, tc.Expected) + } + }) + } +} + +func TestInnerOp(t *testing.T) { + session := Initialize(t) + + cases := proofs.InnerOpTestData() + + for name, tc := range cases { + if tc.IsErr { + delete(cases, name) + } + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + res, err := session.ApplyInner(InnerOpToABI(tc.Op), tc.Child) + if tc.IsErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, res, tc.Expected) + } + }) + } +} + +func TestDoHash(t *testing.T) { + session := Initialize(t) + + cases := proofs.DoHashTestData() + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + res, err := session.DoHash(uint8(tc.HashOp), []byte(tc.Preimage)) + if tc.HashOp == proofs.HashOp_SHA512 { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.ExpectedHash, hex.EncodeToString(res)) + } + }) + } +} diff --git a/sol/proofs.go b/sol/proofs.go index 72ace7f2..ac97cc9e 100644 --- a/sol/proofs.go +++ b/sol/proofs.go @@ -1,329 +1,41 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - package proofs import ( - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = abi.U256 - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription + proofs "github.com/confio/proofs/go" ) -// ProofsABI is the input ABI used to generate the binding from. -const ProofsABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" - -// ProofsFuncSigs maps the 4-byte function signature to its string representation. -var ProofsFuncSigs = map[string]string{ - "d48f1e4f": "doHash(uint8,bytes)", - "03801174": "doHashOrNoop(uint8,bytes)", - "67bb8e81": "doLength(uint8,bytes)", - "901d0e15": "hasprefix(bytes,bytes)", - "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", -} - -// ProofsBin is the compiled bytecode used for deploying new contracts. -var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091610061919081610076565b50505034801561007057600080fd5b50610111565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100b757805160ff19168380011785556100e4565b828001600101855582156100e4579182015b828111156100e45782518255916020019190600101906100c9565b506100f09291506100f4565b5090565b61010e91905b808211156100f057600081556001016100fa565b90565b610ac9806101206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063038011741461005c57806367bb8e811461017f578063901d0e151461022d578063d48f1e4f1461036a578063fd29e20a14610418575b600080fd5b61010a6004803603604081101561007257600080fd5b60ff8235169190810190604081016020820135600160201b81111561009657600080fd5b8201836020820111156100a857600080fd5b803590602001918460018302840111600160201b831117156100c957600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104cf945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010a6004803603604081101561019557600080fd5b60ff8235169190810190604081016020820135600160201b8111156101b957600080fd5b8201836020820111156101cb57600080fd5b803590602001918460018302840111600160201b831117156101ec57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104ff945050505050565b6103566004803603604081101561024357600080fd5b810190602081018135600160201b81111561025d57600080fd5b82018360208201111561026f57600080fd5b803590602001918460018302840111600160201b8311171561029057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102e257600080fd5b8201836020820111156102f457600080fd5b803590602001918460018302840111600160201b8311171561031557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106da945050505050565b604080519115158252519081900360200190f35b61010a6004803603604081101561038057600080fd5b60ff8235169190810190604081016020820135600160201b8111156103a457600080fd5b8201836020820111156103b657600080fd5b803590602001918460018302840111600160201b831117156103d757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610744945050505050565b61010a6004803603606081101561042e57600080fd5b60ff8235811692602081013590911691810190606081016040820135600160201b81111561045b57600080fd5b82018360208201111561046d57600080fd5b803590602001918460018302840111600160201b8311171561048e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610a23945050505050565b606060008360058111156104df57fe5b14156104ec5750806104f9565b6104f68383610744565b90505b92915050565b6060600083600881111561050f57fe5b141561051c5750806104f9565b600183600881111561052a57fe5b1415610658578151608081106105d85780607f16608017600782901c91508184604051602001808460ff1660ff1660f81b81526001018360ff1660ff1660f81b815260010182805190602001908083835b6020831061059a5780518252601f19909201916020918201910161057b565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040529150506104f9565b8083604051602001808360ff1660ff1660f81b815260010182805190602001908083835b6020831061061b5780518252601f1990920191602091820191016105fc565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506104f9565b600783600881111561066657fe5b141561068157815160201461067a57600080fd5b50806104f9565b600883600881111561068f57fe5b14156106a357815160401461067a57600080fd5b60405162461bcd60e51b8152600401808060200182810382526027815260200180610a496027913960400191505060405180910390fd5b6000805b825181101561073a578281815181106106f357fe5b602001015160f81c60f81b6001600160f81b03191684828151811061071457fe5b01602001516001600160f81b031916146107325760009150506104f9565b6001016106de565b5060019392505050565b6060600383600581111561075457fe5b14156107885781805190602001206040516020018082815260200191505060405160208183030381529060405290506104f9565b600183600581111561079657fe5b1415610846576002826040518082805190602001908083835b602083106107ce5780518252601f1990920191602091820191016107af565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561080d573d6000803e3d6000fd5b5050506040513d602081101561082257600080fd5b505160408051602081810193909352815180820390930183528101905290506104f9565b600483600581111561085457fe5b1415610905576003826040518082805190602001908083835b6020831061088c5780518252601f19909201916020918201910161086d565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa1580156108cb573d6000803e3d6000fd5b505060408051805160601b6bffffffffffffffffffffffff1916602082015281516014818303018152603490910190915291506104f99050565b600583600581111561091357fe5b14156109ec5760036002836040518082805190602001908083835b6020831061094d5780518252601f19909201916020918201910161092e565b51815160209384036101000a60001901801990921691161790526040519190930194509192505080830381855afa15801561098c573d6000803e3d6000fd5b5050506040513d60208110156109a157600080fd5b50516040805160208181019390935281518082038401815290820191829052805190928291908401908083836020831061088c5780518252601f19909201916020918201910161086d565b60405162461bcd60e51b8152600401808060200182810382526025815260200180610a706025913960400191505060405180910390fd5b606080610a3085846104cf565b90506060610a3e85836104ff565b969550505050505056fe696e76616c6964206f7220756e737570706f72746564206c656e677468206f7065726174696f6e696e76616c6964206f7220756e737570706f727465642068617368206f7065726174696f6ea265627a7a72305820c33c19623256e13565ca6123c410ad5b2fc0206db20620c463f4a62233e0cb7564736f6c63430005090032" - -// DeployProofs deploys a new Ethereum contract, binding an instance of Proofs to it. -func DeployProofs(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Proofs, error) { - parsed, err := abi.JSON(strings.NewReader(ProofsABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ProofsBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil -} - -// Proofs is an auto generated Go binding around an Ethereum contract. -type Proofs struct { - ProofsCaller // Read-only binding to the contract - ProofsTransactor // Write-only binding to the contract - ProofsFilterer // Log filterer for contract events -} - -// ProofsCaller is an auto generated read-only Go binding around an Ethereum contract. -type ProofsCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ProofsTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ProofsFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ProofsSession struct { - Contract *Proofs // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProofsCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ProofsCallerSession struct { - Contract *ProofsCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ProofsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ProofsTransactorSession struct { - Contract *ProofsTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProofsRaw is an auto generated low-level Go binding around an Ethereum contract. -type ProofsRaw struct { - Contract *Proofs // Generic contract binding to access the raw methods on -} - -// ProofsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ProofsCallerRaw struct { - Contract *ProofsCaller // Generic read-only contract binding to access the raw methods on -} - -// ProofsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ProofsTransactorRaw struct { - Contract *ProofsTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewProofs creates a new instance of Proofs, bound to a specific deployed contract. -func NewProofs(address common.Address, backend bind.ContractBackend) (*Proofs, error) { - contract, err := bindProofs(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil -} - -// NewProofsCaller creates a new read-only instance of Proofs, bound to a specific deployed contract. -func NewProofsCaller(address common.Address, caller bind.ContractCaller) (*ProofsCaller, error) { - contract, err := bindProofs(address, caller, nil, nil) - if err != nil { - return nil, err +type LeafOp = Struct0 +type InnerOp = Struct1 +type ExistenceProof = Struct2 + +func LeafOpToABI(op *proofs.LeafOp) LeafOp { + return LeafOp{ + Hash: uint8(op.Hash), + PrehashKey: uint8(op.PrehashKey), + PrehashValue: uint8(op.PrehashValue), + Len: uint8(op.Length), + Prefix: op.Prefix, } - return &ProofsCaller{contract: contract}, nil } -// NewProofsTransactor creates a new write-only instance of Proofs, bound to a specific deployed contract. -func NewProofsTransactor(address common.Address, transactor bind.ContractTransactor) (*ProofsTransactor, error) { - contract, err := bindProofs(address, nil, transactor, nil) - if err != nil { - return nil, err +func InnerOpToABI(op *proofs.InnerOp) InnerOp { + return InnerOp{ + Hash: uint8(op.Hash), + Prefix: op.Prefix, + Suffix: op.Suffix, } - return &ProofsTransactor{contract: contract}, nil } -// NewProofsFilterer creates a new log filterer instance of Proofs, bound to a specific deployed contract. -func NewProofsFilterer(address common.Address, filterer bind.ContractFilterer) (*ProofsFilterer, error) { - contract, err := bindProofs(address, nil, nil, filterer) - if err != nil { - return nil, err +func ExistenceProofToABI(op *proofs.ExistenceProof) ExistenceProof { + path := make([]InnerOp, len(op.Path)) + for i, op := range op.Path { + path[i] = InnerOpToABI(op) } - return &ProofsFilterer{contract: contract}, nil -} - -// bindProofs binds a generic wrapper to an already deployed contract. -func bindProofs(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(ProofsABI)) - if err != nil { - return nil, err + return Struct2{ + Key: op.Key, + Value: op.Value, + Leaf: LeafOpToABI(op.Leaf), + Path: path, } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Proofs *ProofsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Proofs.Contract.ProofsCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Proofs *ProofsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Proofs.Contract.ProofsTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Proofs *ProofsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Proofs.Contract.ProofsTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Proofs *ProofsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Proofs.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Proofs *ProofsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Proofs.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Proofs *ProofsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Proofs.Contract.contract.Transact(opts, method, params...) -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCaller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doHash", op, preimage) - return *ret0, err -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsSession) DoHash(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCaller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doHashOrNoop", op, preimage) - return *ret0, err -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsCaller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doLength", op, data) - return *ret0, err -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsSession) DoLength(op uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoLength(op uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsCaller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "hasprefix", s, prefix) - return *ret0, err -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsSession) Hasprefix(s []byte, prefix []byte) (bool, error) { - return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsCallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { - return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsCaller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) - return *ret0, err -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsCallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) } diff --git a/sol/proofs.sol b/sol/proofs.sol index 303d7555..882f920b 100644 --- a/sol/proofs.sol +++ b/sol/proofs.sol @@ -1,5 +1,7 @@ pragma solidity ^0.5.3; +pragma experimental ABIEncoderV2; + contract Proofs { enum HashOp{NO_HASH, SHA256, SHA512, KECCAK, RIPEMD160, BITCOIN} enum LengthOp{NO_PREFIX, VAR_PROTO, VAR_RLP, FIXED32_BIG, FIXED32_LITTLE, FIXED64_BIG, FIXED64_LITTLE, REQUIRE_32_BYTES, REQUIRE_64_BYTES} @@ -33,31 +35,6 @@ contract Proofs { hex"00" ); - function decodeExistenceProof( - bytes memory key, bytes memory value, - bytes memory leafOpEncoded, bytes memory pathEncodedEncoded - ) - internal pure returns (ExistenceProof memory) { - (HashOp leafHash, HashOp prehashKey, HashOp prehashValue, LengthOp len, bytes memory leafPrefix) = abi.decode(leafOpEncoded, (HashOp, HashOp, HashOp, LengthOp, bytes)); - LeafOp memory leaf = LeafOp(leafHash, prehashKey, prehashValue, len, leafPrefix); - bytes[] memory pathEncoded = abi.decode(pathEncodedEncoded, (bytes[])); - InnerOp[] memory path = new InnerOp[](pathEncoded.length); - for (uint i = 0; i < pathEncoded.length; i++) { - (HashOp hash, bytes memory prefix, bytes memory suffix) = abi.decode(pathEncoded[i], (HashOp, bytes, bytes)); - path[i] = InnerOp(hash, prefix, suffix); - } - - return ExistenceProof(key, value, leaf, path); - } - - function encodeLeafOp(HashOp hash, HashOp phkey, HashOp phval, LengthOp len, bytes memory prefix) public pure returns (bytes memory) { - return abi.encode(hash, phkey, phval, len, prefix); - } - - function encodeInnerOp(HashOp hash, bytes memory prefix, bytes memory suffix) public pure returns (bytes memory) { - return abi.encode(hash, prefix, suffix); - } - function doHashOrNoop(HashOp op, bytes memory preimage) public pure returns (bytes memory) { if (op == HashOp.NO_HASH) { return preimage; @@ -109,7 +86,7 @@ contract Proofs { return result; } - function applyLeaf(LeafOp memory op, bytes memory key, bytes memory value) internal pure returns (bytes memory) { + function applyLeaf(LeafOp memory op, bytes memory key, bytes memory value) public pure returns (bytes memory) { require(key.length != 0); require(value.length != 0); @@ -120,8 +97,8 @@ contract Proofs { return doHash(op.hash, data); } - function applyInner(InnerOp memory op, bytes memory child) internal pure returns (bytes memory) { - require(child.length == 0); + function applyInner(InnerOp memory op, bytes memory child) public pure returns (bytes memory) { + require(child.length != 0); bytes memory preimage = abi.encodePacked(op.prefix, child, op.suffix); return doHash(op.hash, preimage); } @@ -135,25 +112,52 @@ contract Proofs { return true; } - function checkAgainstSpec(ExistenceProof memory proof, LeafOp memory spec) internal pure { - require(proof.leaf.hash == spec.hash); - require(proof.leaf.prehash_key == spec.prehash_key); - require(proof.leaf.prehash_value == spec.prehash_value); - require(proof.leaf.len == spec.len); - require(hasprefix(proof.leaf.prefix, spec.prefix)); + function checkAgainstSpec(ExistenceProof memory proof, LeafOp memory spec) public pure returns (bool) { + if (!( + proof.leaf.hash == spec.hash && + proof.leaf.prehash_key == spec.prehash_key && + proof.leaf.prehash_value == spec.prehash_value && + proof.leaf.len == spec.len && + hasprefix(proof.leaf.prefix, spec.prefix) + )) { + return false; + } for (uint i = 0; i < proof.path.length; i++) { - require(hasprefix(proof.path[i].prefix, spec.prefix)); + if (hasprefix(proof.path[i].prefix, spec.prefix)) { + return false; + } } + + return true; } - function calculate(ExistenceProof memory proof) internal pure returns (bytes memory) { + function calculate(ExistenceProof memory proof) public pure returns (bytes memory) { bytes memory res = applyLeaf(proof.leaf, proof.key, proof.value); for (uint i = 0; i < proof.path.length; i++) { res = applyInner(proof.path[i], res); } return res; } + + function verifyExistence(ExistenceProof memory proof, LeafOp memory spec, bytes memory root, bytes memory key, bytes memory value) public pure returns (bool) { + return ( + checkAgainstSpec(proof, spec) && + equalBytes(key, proof.key) && + equalBytes(value, proof.value) && + equalBytes(calculate(proof), root) + ); + } - + function equalBytes(bytes memory bz1, bytes memory bz2) public pure returns (bool) { + if (bz1.length != bz2.length) { + return false; + } + for (uint i = 0; i < bz1.length; i++) { + if (bz1[i] != bz2[i]) { + return false; + } + } + return true; + } } diff --git a/sol/proofs_contract.go b/sol/proofs_contract.go new file mode 100644 index 00000000..89341149 --- /dev/null +++ b/sol/proofs_contract.go @@ -0,0 +1,515 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package proofs + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = abi.U256 + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// ProofsABI is the input ABI used to generate the binding from. +const ProofsABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" + +// ProofsFuncSigs maps the 4-byte function signature to its string representation. +var ProofsFuncSigs = map[string]string{ + "3d4a397d": "applyInner((uint8,bytes,bytes),bytes)", + "f6747d82": "applyLeaf((uint8,uint8,uint8,uint8,bytes),bytes,bytes)", + "7e1fd3bc": "calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]))", + "f10e9a9c": "checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes))", + "d48f1e4f": "doHash(uint8,bytes)", + "03801174": "doHashOrNoop(uint8,bytes)", + "67bb8e81": "doLength(uint8,bytes)", + "4cac70ff": "equalBytes(bytes,bytes)", + "901d0e15": "hasprefix(bytes,bytes)", + "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", + "2e3098a9": "verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", +} + +// ProofsBin is the compiled bytecode used for deploying new contracts. +var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b6111bf806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637e1fd3bc116100715780637e1fd3bc14610130578063901d0e1514610143578063d48f1e4f14610156578063f10e9a9c14610169578063f6747d821461017c578063fd29e20a1461018f576100a9565b806303801174146100ae5780632e3098a9146100d75780633d4a397d146100f75780634cac70ff1461010a57806367bb8e811461011d575b600080fd5b6100c16100bc366004610b82565b6101a2565b6040516100ce9190611024565b60405180910390f35b6100ea6100e5366004610cb5565b6101d2565b6040516100ce9190611016565b6100c1610105366004610d9c565b61022b565b6100ea610118366004610b1b565b610282565b6100c161012b366004610c05565b6102fe565b6100c161013e366004610c24565b6103f1565b6100ea610151366004610b1b565b61044f565b6100c1610164366004610b82565b6104af565b6100ea610177366004610c58565b610668565b6100c161018a366004610dd1565b61078a565b6100c161019d366004610ba1565b610819565b606060008360058111156101b257fe5b14156101bf5750806101cc565b6101c983836104af565b90505b92915050565b60006101de8686610668565b80156101f357506101f3838760000151610282565b80156102085750610208828760200151610282565b8015610221575061022161021b876103f1565b85610282565b9695505050505050565b606081516000141561023c57600080fd5b6060836020015183856040015160405160200161025b93929190610fa1565b604051602081830303815290604052905061027a8460000151826104af565b949350505050565b60008151835114610295575060006101cc565b60005b83518110156102f4578281815181106102ad57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ce57fe5b01602001516001600160f81b031916146102ec5760009150506101cc565b600101610298565b5060019392505050565b6060600083600881111561030e57fe5b141561031b5750806101cc565b600183600881111561032957fe5b1415610385578151608081106103725780607f16608017600782901c9150818460405160200161035b93929190610fea565b6040516020818303038152906040529150506101cc565b808360405160200161035b929190610fce565b600783600881111561039357fe5b14156103ae5781516020146103a757600080fd5b50806101cc565b60088360088111156103bc57fe5b14156103d05781516040146103a757600080fd5b60405162461bcd60e51b81526004016103e890611035565b60405180910390fd5b60608061040b83604001518460000151856020015161078a565b905060005b8360600151518110156104485761043e8460600151828151811061043057fe5b60200260200101518361022b565b9150600101610410565b5092915050565b6000805b82518110156102f45782818151811061046857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061048957fe5b01602001516001600160f81b031916146104a75760009150506101cc565b600101610453565b606060038360058111156104bf57fe5b14156104f35781805190602001206040516020016104dd9190610f79565b60405160208183030381529060405290506101cc565b600183600581111561050157fe5b1415610567576002826040516105179190610f8e565b602060405180830381855afa158015610534573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105579190810190610afd565b6040516020016104dd9190610f79565b600483600581111561057557fe5b14156105c05760038260405161058b9190610f8e565b602060405180830381855afa1580156105a8573d6000803e3d6000fd5b505060405180516104dd925060601b90602001610f64565b60058360058111156105ce57fe5b14156106505760036002836040516105e69190610f8e565b602060405180830381855afa158015610603573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106269190810190610afd565b6040516020016106369190610f79565b60408051601f198184030181529082905261058b91610f8e565b60405162461bcd60e51b81526004016103e890611045565b8051600090600581111561067857fe5b604084015151600581111561068957fe5b1480156106b75750816020015160058111156106a157fe5b83604001516020015160058111156106b557fe5b145b80156106e45750816040015160058111156106ce57fe5b83604001516040015160058111156106e257fe5b145b80156107115750816060015160088111156106fb57fe5b836040015160600151600881111561070f57fe5b145b801561072e575061072e836040015160800151836080015161044f565b61073a575060006101cc565b60005b8360600151518110156102f4576107738460600151828151811061075d57fe5b602002602001015160200151846080015161044f565b156107825760009150506101cc565b60010161073d565b606082516000141561079b57600080fd5b81516107a657600080fd5b60606107bb8560200151866060015186610819565b905060606107d28660400151876060015186610819565b90506060866080015183836040516020016107ef93929190610fa1565b604051602081830303815290604052905061080e8760000151826104af565b979650505050505050565b60608061082685846101a2565b9050606061022185836102fe565b600082601f83011261084557600080fd5b81356108586108538261107b565b611055565b81815260209384019390925082018360005b83811015610896578135860161088088826109da565b845250602092830192919091019060010161086a565b5050505092915050565b80516101cc8161114b565b600082601f8301126108bc57600080fd5b81356108ca6108538261109b565b915080825260208301602083018583830111156108e657600080fd5b6108f18382846110f4565b50505092915050565b80356101cc81611162565b80356101cc8161116f565b60006080828403121561092257600080fd5b61092c6080611055565b905081356001600160401b0381111561094457600080fd5b610950848285016108ab565b82525060208201356001600160401b0381111561096c57600080fd5b610978848285016108ab565b60208301525060408201356001600160401b0381111561099757600080fd5b6109a384828501610a63565b60408301525060608201356001600160401b038111156109c257600080fd5b6109ce84828501610834565b60608301525092915050565b6000606082840312156109ec57600080fd5b6109f66060611055565b90506000610a0484846108fa565b82525060208201356001600160401b03811115610a2057600080fd5b610a2c848285016108ab565b60208301525060408201356001600160401b03811115610a4b57600080fd5b610a57848285016108ab565b60408301525092915050565b600060a08284031215610a7557600080fd5b610a7f60a0611055565b90506000610a8d84846108fa565b8252506020610a9e848483016108fa565b6020830152506040610ab2848285016108fa565b6040830152506060610ac684828501610905565b60608301525060808201356001600160401b03811115610ae557600080fd5b610af1848285016108ab565b60808301525092915050565b600060208284031215610b0f57600080fd5b600061027a84846108a0565b60008060408385031215610b2e57600080fd5b82356001600160401b03811115610b4457600080fd5b610b50858286016108ab565b92505060208301356001600160401b03811115610b6c57600080fd5b610b78858286016108ab565b9150509250929050565b60008060408385031215610b9557600080fd5b6000610b5085856108fa565b600080600060608486031215610bb657600080fd5b6000610bc286866108fa565b9350506020610bd386828701610905565b92505060408401356001600160401b03811115610bef57600080fd5b610bfb868287016108ab565b9150509250925092565b60008060408385031215610c1857600080fd5b6000610b508585610905565b600060208284031215610c3657600080fd5b81356001600160401b03811115610c4c57600080fd5b61027a84828501610910565b60008060408385031215610c6b57600080fd5b82356001600160401b03811115610c8157600080fd5b610c8d85828601610910565b92505060208301356001600160401b03811115610ca957600080fd5b610b7885828601610a63565b600080600080600060a08688031215610ccd57600080fd5b85356001600160401b03811115610ce357600080fd5b610cef88828901610910565b95505060208601356001600160401b03811115610d0b57600080fd5b610d1788828901610a63565b94505060408601356001600160401b03811115610d3357600080fd5b610d3f888289016108ab565b93505060608601356001600160401b03811115610d5b57600080fd5b610d67888289016108ab565b92505060808601356001600160401b03811115610d8357600080fd5b610d8f888289016108ab565b9150509295509295909350565b60008060408385031215610daf57600080fd5b82356001600160401b03811115610dc557600080fd5b610b50858286016109da565b600080600060608486031215610de657600080fd5b83356001600160401b03811115610dfc57600080fd5b610e0886828701610a63565b93505060208401356001600160401b03811115610e2457600080fd5b610bd3868287016108ab565b610e39816110d4565b82525050565b610e39610e4b826110d9565b6110eb565b610e39610e4b826110eb565b6000610e67826110c2565b610e7181856110c6565b9350610e81818560208601611100565b610e8a8161113b565b9093019392505050565b6000610e9f826110c2565b610ea981856110cf565b9350610eb9818560208601611100565b9290920192915050565b6000610ed06027836110c6565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610f196025836110c6565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610e39610f5f826110ee565b611130565b6000610f708284610e3f565b50601401919050565b6000610f858284610e50565b50602001919050565b6000610f9a8284610e94565b9392505050565b6000610fad8286610e94565b9150610fb98285610e94565b9150610fc58284610e94565b95945050505050565b6000610fda8285610f53565b60018201915061027a8284610e94565b6000610ff68286610f53565b6001820191506110068285610f53565b600182019150610fc58284610e94565b602081016101cc8284610e30565b602080825281016101c98184610e5c565b602080825281016101cc81610ec3565b602080825281016101cc81610f0c565b6040518181016001600160401b038111828210171561107357600080fd5b604052919050565b60006001600160401b0382111561109157600080fd5b5060209081020190565b60006001600160401b038211156110b157600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b8381101561111b578181015183820152602001611103565b8381111561112a576000848401525b50505050565b60006101cc82611145565b601f01601f191690565b60f81b90565b611154816110eb565b811461115f57600080fd5b50565b6006811061115f57600080fd5b6009811061115f57600080fdfea365627a7a723058207cad5ea356d3ce2231365cdc70196253a06927f855a325198ead8ef2746d58136c6578706572696d656e74616cf564736f6c63430005090040" + +// DeployProofs deploys a new Ethereum contract, binding an instance of Proofs to it. +func DeployProofs(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Proofs, error) { + parsed, err := abi.JSON(strings.NewReader(ProofsABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ProofsBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil +} + +// Proofs is an auto generated Go binding around an Ethereum contract. +type Proofs struct { + ProofsCaller // Read-only binding to the contract + ProofsTransactor // Write-only binding to the contract + ProofsFilterer // Log filterer for contract events +} + +// ProofsCaller is an auto generated read-only Go binding around an Ethereum contract. +type ProofsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ProofsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ProofsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ProofsSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ProofsSession struct { + Contract *Proofs // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProofsCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ProofsCallerSession struct { + Contract *ProofsCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ProofsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ProofsTransactorSession struct { + Contract *ProofsTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ProofsRaw is an auto generated low-level Go binding around an Ethereum contract. +type ProofsRaw struct { + Contract *Proofs // Generic contract binding to access the raw methods on +} + +// ProofsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ProofsCallerRaw struct { + Contract *ProofsCaller // Generic read-only contract binding to access the raw methods on +} + +// ProofsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ProofsTransactorRaw struct { + Contract *ProofsTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewProofs creates a new instance of Proofs, bound to a specific deployed contract. +func NewProofs(address common.Address, backend bind.ContractBackend) (*Proofs, error) { + contract, err := bindProofs(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil +} + +// NewProofsCaller creates a new read-only instance of Proofs, bound to a specific deployed contract. +func NewProofsCaller(address common.Address, caller bind.ContractCaller) (*ProofsCaller, error) { + contract, err := bindProofs(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ProofsCaller{contract: contract}, nil +} + +// NewProofsTransactor creates a new write-only instance of Proofs, bound to a specific deployed contract. +func NewProofsTransactor(address common.Address, transactor bind.ContractTransactor) (*ProofsTransactor, error) { + contract, err := bindProofs(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ProofsTransactor{contract: contract}, nil +} + +// NewProofsFilterer creates a new log filterer instance of Proofs, bound to a specific deployed contract. +func NewProofsFilterer(address common.Address, filterer bind.ContractFilterer) (*ProofsFilterer, error) { + contract, err := bindProofs(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ProofsFilterer{contract: contract}, nil +} + +// bindProofs binds a generic wrapper to an already deployed contract. +func bindProofs(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ProofsABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Proofs *ProofsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Proofs.Contract.ProofsCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Proofs *ProofsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Proofs.Contract.ProofsTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Proofs *ProofsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Proofs.Contract.ProofsTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Proofs *ProofsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Proofs.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Proofs *ProofsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Proofs.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Proofs *ProofsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Proofs.Contract.contract.Transact(opts, method, params...) +} + +// Struct2 is an auto generated low-level Go binding around an user-defined struct. +type Struct2 struct { + Key []byte + Value []byte + Leaf Struct0 + Path []Struct1 +} + +// Struct1 is an auto generated low-level Go binding around an user-defined struct. +type Struct1 struct { + Hash uint8 + Prefix []byte + Suffix []byte +} + +// Struct0 is an auto generated low-level Go binding around an user-defined struct. +type Struct0 struct { + Hash uint8 + PrehashKey uint8 + PrehashValue uint8 + Len uint8 + Prefix []byte +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_Proofs *ProofsCaller) ApplyInner(opts *bind.CallOpts, op Struct1, child []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "applyInner", op, child) + return *ret0, err +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_Proofs *ProofsSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { + return _Proofs.Contract.ApplyInner(&_Proofs.CallOpts, op, child) +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_Proofs *ProofsCallerSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { + return _Proofs.Contract.ApplyInner(&_Proofs.CallOpts, op, child) +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_Proofs *ProofsCaller) ApplyLeaf(opts *bind.CallOpts, op Struct0, key []byte, value []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "applyLeaf", op, key, value) + return *ret0, err +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_Proofs *ProofsSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { + return _Proofs.Contract.ApplyLeaf(&_Proofs.CallOpts, op, key, value) +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_Proofs *ProofsCallerSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { + return _Proofs.Contract.ApplyLeaf(&_Proofs.CallOpts, op, key, value) +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_Proofs *ProofsCaller) Calculate(opts *bind.CallOpts, proof Struct2) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "calculate", proof) + return *ret0, err +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_Proofs *ProofsSession) Calculate(proof Struct2) ([]byte, error) { + return _Proofs.Contract.Calculate(&_Proofs.CallOpts, proof) +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_Proofs *ProofsCallerSession) Calculate(proof Struct2) ([]byte, error) { + return _Proofs.Contract.Calculate(&_Proofs.CallOpts, proof) +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_Proofs *ProofsCaller) CheckAgainstSpec(opts *bind.CallOpts, proof Struct2, spec Struct0) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "checkAgainstSpec", proof, spec) + return *ret0, err +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_Proofs *ProofsSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { + return _Proofs.Contract.CheckAgainstSpec(&_Proofs.CallOpts, proof, spec) +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_Proofs *ProofsCallerSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { + return _Proofs.Contract.CheckAgainstSpec(&_Proofs.CallOpts, proof, spec) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCaller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doHash", op, preimage) + return *ret0, err +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsSession) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCaller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doHashOrNoop", op, preimage) + return *ret0, err +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsCaller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "doLength", op, data) + return *ret0, err +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsSession) DoLength(op uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_Proofs *ProofsCallerSession) DoLength(op uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_Proofs *ProofsCaller) EqualBytes(opts *bind.CallOpts, bz1 []byte, bz2 []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "equalBytes", bz1, bz2) + return *ret0, err +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_Proofs *ProofsSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { + return _Proofs.Contract.EqualBytes(&_Proofs.CallOpts, bz1, bz2) +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_Proofs *ProofsCallerSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { + return _Proofs.Contract.EqualBytes(&_Proofs.CallOpts, bz1, bz2) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsCaller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "hasprefix", s, prefix) + return *ret0, err +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsSession) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_Proofs *ProofsCallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsCaller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) + return *ret0, err +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_Proofs *ProofsCallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_Proofs *ProofsCaller) VerifyExistence(opts *bind.CallOpts, proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _Proofs.contract.Call(opts, out, "verifyExistence", proof, spec, root, key, value) + return *ret0, err +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_Proofs *ProofsSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + return _Proofs.Contract.VerifyExistence(&_Proofs.CallOpts, proof, spec, root, key, value) +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_Proofs *ProofsCallerSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + return _Proofs.Contract.VerifyExistence(&_Proofs.CallOpts, proof, spec, root, key, value) +} diff --git a/sol/proofs_test.go b/sol/proofs_test.go index 34dcae97..564f9716 100644 --- a/sol/proofs_test.go +++ b/sol/proofs_test.go @@ -1,139 +1,56 @@ package proofs import ( - "crypto/sha256" - "math/big" - "math/rand" "testing" - "fmt" - - "golang.org/x/crypto/ripemd160" + proofs "github.com/confio/proofs/go" "github.com/stretchr/testify/require" - - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" ) -func testDoHash(t *testing.T, cont ProofsSession) { - for i := 0; i < 1000; i++ { - image := make([]byte, 64) - rand.Read(image) - - // NO_HASH - hashed, err := cont.DoHashOrNoop(0, image) - require.NoError(t, err) - require.Equal(t, image, hashed) - - // SHA256 - hashed, err = cont.DoHash(1, image) - require.NoError(t, err) - exp32 := sha256.Sum256(image) - require.Equal(t, exp32[:], hashed) +func TestExistenceProof(t *testing.T) { + session := Initialize(t) - // SHA512 - hashed, err = cont.DoHash(2, image) - //require.NoError(t, err) - //exp64 := sha512.Sum512(image) - //require.Equal(t, exp64[:], hashed) - require.Error(t, err) + cases := proofs.ExistenceProofTestData() - // KECCAK - hashed, err = cont.DoHash(3, image) - require.NoError(t, err) - exp32 = crypto.Keccak256Hash(image) - require.Equal(t, exp32[:], hashed) - - // RIPEMD160 - hashed, err = cont.DoHash(4, image) - require.NoError(t, err) - hash := ripemd160.New() - hash.Write(image) - require.Equal(t, hash.Sum(nil)[:], hashed) - - // BITCOIN - hashed, err = cont.DoHash(5, image) - require.NoError(t, err) - sha := sha256.Sum256(image) - hash = ripemd160.New() - hash.Write(sha[:]) - require.Equal(t, hash.Sum(nil)[:], hashed) - - // INVALID - _, err = cont.DoHash(6, image) - require.Error(t, err) + for name, tc := range cases { + if tc.Proof.Leaf == nil { + delete(cases, name) + } } -} -func TestHelperFunctions(t *testing.T) { - key, _ := crypto.GenerateKey() - auth := bind.NewKeyedTransactor(key) - address := auth.From - gAlloc := map[common.Address]core.GenesisAccount{ - address: {Balance: big.NewInt(100000000000)}, + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + res, err := session.Calculate(ExistenceProofToABI(tc.Proof)) + if tc.IsErr { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, res, tc.Expected) + } + }) } - sim := backends.NewSimulatedBackend(gAlloc, 100000000000) - - _, _, cont, err := DeployProofs(auth, sim) - - require.NoError(t, err) - - session := ProofsSession{cont, bind.CallOpts{}, bind.TransactOpts{}} +} - sim.Commit() +func TestCheckAgainstSpec(t *testing.T) { + session := Initialize(t) - testDoHash(t, session) -} + cases := proofs.CheckAgainstSpecTestData() -func TestABIEncoding(t *testing.T) { - ty := new(abi.Argument) - err := ty.UnmarshalJSON([]byte(` -{ - "Name": "LeafOp", - "Type": "tuple", - "Components": [ - { - "Name": "hash", - "Type": "uint8" - }, - { - "Name": "prehash_key", - "Type": "uint8" - }, - { - "Name": "prehash_value", - "Type": "uint8" - }, - { - "Name": "len", - "Type": "uint8" - }, - { - "Name": "prefix", - "Type": "bytes" + for name, tc := range cases { + if tc.Proof.Leaf == nil { + delete(cases, name) } - ] -}`)) - require.NoError(t, err) + } - tys := abi.Arguments{*ty} - bz, err := tys.Pack(struct { - Hash uint8 - PrehashKey uint8 - PrehashValue uint8 - Len uint8 - Prefix []byte - }{ - 1, - 1, - 1, - 0, - []byte{0x00}, - }) - require.NoError(t, err) - fmt.Println(bz) + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + ok, err := session.CheckAgainstSpec(ExistenceProofToABI(tc.Proof), LeafOpToABI(tc.Spec.LeafSpec)) + require.NoError(t, err) + if tc.IsErr { + require.False(t, ok) + } else { + require.True(t, ok) + } + }) + } } From 834f2eff670091ff1ec9108786008681e0341c01 Mon Sep 17 00:00:00 2001 From: mossid Date: Thu, 29 Aug 2019 19:15:16 +0200 Subject: [PATCH 05/10] rm vendor --- go.sum | 8 ++++++++ go/go.mod | 9 --------- go/go.sum | 14 -------------- 3 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 go/go.mod delete mode 100644 go/go.sum diff --git a/go.sum b/go.sum index 07d83182..3414c0bc 100644 --- a/go.sum +++ b/go.sum @@ -22,7 +22,14 @@ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +<<<<<<< HEAD github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= +======= +github.com/confio/ics23/go v0.0.0-20190827163309-7909e7dd24d5 h1:AvLi3VD3ie5Ucps0nmb0VYLiddNOPphQwx9eWRQQs3E= +github.com/confio/ics23/go v0.0.0-20190827163309-7909e7dd24d5/go.mod h1:rWOCtymU+x3jM2Uib0aszytidui3pfpffvjCfNwATaE= +github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e h1:yhvB+Wg9rCnUQvdAx65iIrpqRjh3VGFCFdl779IvRjY= +github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e/go.mod h1:rWOCtymU+x3jM2Uib0aszytidui3pfpffvjCfNwATaE= +>>>>>>> c0c0388 (rm vendor) github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -94,6 +101,7 @@ github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5 github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/go/go.mod b/go/go.mod deleted file mode 100644 index adde1916..00000000 --- a/go/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/confio/ics23/go - -go 1.14 - -require ( - github.com/gogo/protobuf v1.3.1 - github.com/pkg/errors v0.8.1 - golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 -) diff --git a/go/go.sum b/go/go.sum deleted file mode 100644 index 8f7d866c..00000000 --- a/go/go.sum +++ /dev/null @@ -1,14 +0,0 @@ -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 8c15d92dfdce14fa3ba5d831dc7f8efa7b1085d5 Mon Sep 17 00:00:00 2001 From: mconcat Date: Mon, 8 Mar 2021 16:06:56 +0900 Subject: [PATCH 06/10] uncomment test --- sol/ops_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sol/ops_test.go b/sol/ops_test.go index 75ccac7a..242ec4df 100644 --- a/sol/ops_test.go +++ b/sol/ops_test.go @@ -99,11 +99,11 @@ func TestHelperFunctions(t *testing.T) { func TestLeafOp(t *testing.T) { session := Initialize(t) - cases := proofs.LeafOpTestData() + cases := ics23.LeafOpTestData() // Set IsErr = true for all SHA512 for name, tc := range cases { - if tc.Op.Hash == proofs.HashOp_SHA512 { + if tc.Op.Hash == ics23.HashOp_SHA512 { tc.IsErr = true cases[name] = tc } @@ -125,7 +125,7 @@ func TestLeafOp(t *testing.T) { func TestInnerOp(t *testing.T) { session := Initialize(t) - cases := proofs.InnerOpTestData() + cases := ics23.InnerOpTestData() for name, tc := range cases { if tc.IsErr { @@ -149,12 +149,12 @@ func TestInnerOp(t *testing.T) { func TestDoHash(t *testing.T) { session := Initialize(t) - cases := proofs.DoHashTestData() + cases := ics23.DoHashTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { res, err := session.DoHash(uint8(tc.HashOp), []byte(tc.Preimage)) - if tc.HashOp == proofs.HashOp_SHA512 { + if tc.HashOp == ics23.HashOp_SHA512 { require.Error(t, err) } else { require.NoError(t, err) From c74cbad3139b0b206d7e509bef98909a302dff06 Mon Sep 17 00:00:00 2001 From: mossid Date: Sat, 14 Sep 2019 13:37:33 +0200 Subject: [PATCH 07/10] rename proofs -> ics23 --- sol/{proofs.go => ics23.go} | 2 +- sol/{proofs.sol => ics23.sol} | 2 +- sol/ics23_contract.go | 515 ++++++++++++++++++++++++++++++++++ sol/ops_test.go | 12 +- sol/proof.abi | 1 - sol/proofs_contract.go | 515 ---------------------------------- sol/proofs_test.go | 2 +- 7 files changed, 524 insertions(+), 525 deletions(-) rename sol/{proofs.go => ics23.go} (98%) rename sol/{proofs.sol => ics23.sol} (99%) create mode 100644 sol/ics23_contract.go delete mode 100644 sol/proof.abi delete mode 100644 sol/proofs_contract.go diff --git a/sol/proofs.go b/sol/ics23.go similarity index 98% rename from sol/proofs.go rename to sol/ics23.go index ac97cc9e..d4672f1d 100644 --- a/sol/proofs.go +++ b/sol/ics23.go @@ -1,4 +1,4 @@ -package proofs +package ics23 import ( diff --git a/sol/proofs.sol b/sol/ics23.sol similarity index 99% rename from sol/proofs.sol rename to sol/ics23.sol index 882f920b..448e91c4 100644 --- a/sol/proofs.sol +++ b/sol/ics23.sol @@ -2,7 +2,7 @@ pragma solidity ^0.5.3; pragma experimental ABIEncoderV2; -contract Proofs { +contract ICS23 { enum HashOp{NO_HASH, SHA256, SHA512, KECCAK, RIPEMD160, BITCOIN} enum LengthOp{NO_PREFIX, VAR_PROTO, VAR_RLP, FIXED32_BIG, FIXED32_LITTLE, FIXED64_BIG, FIXED64_LITTLE, REQUIRE_32_BYTES, REQUIRE_64_BYTES} diff --git a/sol/ics23_contract.go b/sol/ics23_contract.go new file mode 100644 index 00000000..7b01b8fb --- /dev/null +++ b/sol/ics23_contract.go @@ -0,0 +1,515 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package ics23 + +import ( + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = abi.U256 + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription +) + +// ICS23ABI is the input ABI used to generate the binding from. +const ICS23ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" + +// ICS23FuncSigs maps the 4-byte function signature to its string representation. +var ICS23FuncSigs = map[string]string{ + "3d4a397d": "applyInner((uint8,bytes,bytes),bytes)", + "f6747d82": "applyLeaf((uint8,uint8,uint8,uint8,bytes),bytes,bytes)", + "7e1fd3bc": "calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]))", + "f10e9a9c": "checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes))", + "d48f1e4f": "doHash(uint8,bytes)", + "03801174": "doHashOrNoop(uint8,bytes)", + "67bb8e81": "doLength(uint8,bytes)", + "4cac70ff": "equalBytes(bytes,bytes)", + "901d0e15": "hasprefix(bytes,bytes)", + "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", + "2e3098a9": "verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", +} + +// ICS23Bin is the compiled bytecode used for deploying new contracts. +var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b6111bf806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637e1fd3bc116100715780637e1fd3bc14610130578063901d0e1514610143578063d48f1e4f14610156578063f10e9a9c14610169578063f6747d821461017c578063fd29e20a1461018f576100a9565b806303801174146100ae5780632e3098a9146100d75780633d4a397d146100f75780634cac70ff1461010a57806367bb8e811461011d575b600080fd5b6100c16100bc366004610b82565b6101a2565b6040516100ce9190611024565b60405180910390f35b6100ea6100e5366004610cb5565b6101d2565b6040516100ce9190611016565b6100c1610105366004610d9c565b61022b565b6100ea610118366004610b1b565b610282565b6100c161012b366004610c05565b6102fe565b6100c161013e366004610c24565b6103f1565b6100ea610151366004610b1b565b61044f565b6100c1610164366004610b82565b6104af565b6100ea610177366004610c58565b610668565b6100c161018a366004610dd1565b61078a565b6100c161019d366004610ba1565b610819565b606060008360058111156101b257fe5b14156101bf5750806101cc565b6101c983836104af565b90505b92915050565b60006101de8686610668565b80156101f357506101f3838760000151610282565b80156102085750610208828760200151610282565b8015610221575061022161021b876103f1565b85610282565b9695505050505050565b606081516000141561023c57600080fd5b6060836020015183856040015160405160200161025b93929190610fa1565b604051602081830303815290604052905061027a8460000151826104af565b949350505050565b60008151835114610295575060006101cc565b60005b83518110156102f4578281815181106102ad57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ce57fe5b01602001516001600160f81b031916146102ec5760009150506101cc565b600101610298565b5060019392505050565b6060600083600881111561030e57fe5b141561031b5750806101cc565b600183600881111561032957fe5b1415610385578151608081106103725780607f16608017600782901c9150818460405160200161035b93929190610fea565b6040516020818303038152906040529150506101cc565b808360405160200161035b929190610fce565b600783600881111561039357fe5b14156103ae5781516020146103a757600080fd5b50806101cc565b60088360088111156103bc57fe5b14156103d05781516040146103a757600080fd5b60405162461bcd60e51b81526004016103e890611035565b60405180910390fd5b60608061040b83604001518460000151856020015161078a565b905060005b8360600151518110156104485761043e8460600151828151811061043057fe5b60200260200101518361022b565b9150600101610410565b5092915050565b6000805b82518110156102f45782818151811061046857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061048957fe5b01602001516001600160f81b031916146104a75760009150506101cc565b600101610453565b606060038360058111156104bf57fe5b14156104f35781805190602001206040516020016104dd9190610f79565b60405160208183030381529060405290506101cc565b600183600581111561050157fe5b1415610567576002826040516105179190610f8e565b602060405180830381855afa158015610534573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105579190810190610afd565b6040516020016104dd9190610f79565b600483600581111561057557fe5b14156105c05760038260405161058b9190610f8e565b602060405180830381855afa1580156105a8573d6000803e3d6000fd5b505060405180516104dd925060601b90602001610f64565b60058360058111156105ce57fe5b14156106505760036002836040516105e69190610f8e565b602060405180830381855afa158015610603573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106269190810190610afd565b6040516020016106369190610f79565b60408051601f198184030181529082905261058b91610f8e565b60405162461bcd60e51b81526004016103e890611045565b8051600090600581111561067857fe5b604084015151600581111561068957fe5b1480156106b75750816020015160058111156106a157fe5b83604001516020015160058111156106b557fe5b145b80156106e45750816040015160058111156106ce57fe5b83604001516040015160058111156106e257fe5b145b80156107115750816060015160088111156106fb57fe5b836040015160600151600881111561070f57fe5b145b801561072e575061072e836040015160800151836080015161044f565b61073a575060006101cc565b60005b8360600151518110156102f4576107738460600151828151811061075d57fe5b602002602001015160200151846080015161044f565b156107825760009150506101cc565b60010161073d565b606082516000141561079b57600080fd5b81516107a657600080fd5b60606107bb8560200151866060015186610819565b905060606107d28660400151876060015186610819565b90506060866080015183836040516020016107ef93929190610fa1565b604051602081830303815290604052905061080e8760000151826104af565b979650505050505050565b60608061082685846101a2565b9050606061022185836102fe565b600082601f83011261084557600080fd5b81356108586108538261107b565b611055565b81815260209384019390925082018360005b83811015610896578135860161088088826109da565b845250602092830192919091019060010161086a565b5050505092915050565b80516101cc8161114b565b600082601f8301126108bc57600080fd5b81356108ca6108538261109b565b915080825260208301602083018583830111156108e657600080fd5b6108f18382846110f4565b50505092915050565b80356101cc81611162565b80356101cc8161116f565b60006080828403121561092257600080fd5b61092c6080611055565b905081356001600160401b0381111561094457600080fd5b610950848285016108ab565b82525060208201356001600160401b0381111561096c57600080fd5b610978848285016108ab565b60208301525060408201356001600160401b0381111561099757600080fd5b6109a384828501610a63565b60408301525060608201356001600160401b038111156109c257600080fd5b6109ce84828501610834565b60608301525092915050565b6000606082840312156109ec57600080fd5b6109f66060611055565b90506000610a0484846108fa565b82525060208201356001600160401b03811115610a2057600080fd5b610a2c848285016108ab565b60208301525060408201356001600160401b03811115610a4b57600080fd5b610a57848285016108ab565b60408301525092915050565b600060a08284031215610a7557600080fd5b610a7f60a0611055565b90506000610a8d84846108fa565b8252506020610a9e848483016108fa565b6020830152506040610ab2848285016108fa565b6040830152506060610ac684828501610905565b60608301525060808201356001600160401b03811115610ae557600080fd5b610af1848285016108ab565b60808301525092915050565b600060208284031215610b0f57600080fd5b600061027a84846108a0565b60008060408385031215610b2e57600080fd5b82356001600160401b03811115610b4457600080fd5b610b50858286016108ab565b92505060208301356001600160401b03811115610b6c57600080fd5b610b78858286016108ab565b9150509250929050565b60008060408385031215610b9557600080fd5b6000610b5085856108fa565b600080600060608486031215610bb657600080fd5b6000610bc286866108fa565b9350506020610bd386828701610905565b92505060408401356001600160401b03811115610bef57600080fd5b610bfb868287016108ab565b9150509250925092565b60008060408385031215610c1857600080fd5b6000610b508585610905565b600060208284031215610c3657600080fd5b81356001600160401b03811115610c4c57600080fd5b61027a84828501610910565b60008060408385031215610c6b57600080fd5b82356001600160401b03811115610c8157600080fd5b610c8d85828601610910565b92505060208301356001600160401b03811115610ca957600080fd5b610b7885828601610a63565b600080600080600060a08688031215610ccd57600080fd5b85356001600160401b03811115610ce357600080fd5b610cef88828901610910565b95505060208601356001600160401b03811115610d0b57600080fd5b610d1788828901610a63565b94505060408601356001600160401b03811115610d3357600080fd5b610d3f888289016108ab565b93505060608601356001600160401b03811115610d5b57600080fd5b610d67888289016108ab565b92505060808601356001600160401b03811115610d8357600080fd5b610d8f888289016108ab565b9150509295509295909350565b60008060408385031215610daf57600080fd5b82356001600160401b03811115610dc557600080fd5b610b50858286016109da565b600080600060608486031215610de657600080fd5b83356001600160401b03811115610dfc57600080fd5b610e0886828701610a63565b93505060208401356001600160401b03811115610e2457600080fd5b610bd3868287016108ab565b610e39816110d4565b82525050565b610e39610e4b826110d9565b6110eb565b610e39610e4b826110eb565b6000610e67826110c2565b610e7181856110c6565b9350610e81818560208601611100565b610e8a8161113b565b9093019392505050565b6000610e9f826110c2565b610ea981856110cf565b9350610eb9818560208601611100565b9290920192915050565b6000610ed06027836110c6565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610f196025836110c6565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610e39610f5f826110ee565b611130565b6000610f708284610e3f565b50601401919050565b6000610f858284610e50565b50602001919050565b6000610f9a8284610e94565b9392505050565b6000610fad8286610e94565b9150610fb98285610e94565b9150610fc58284610e94565b95945050505050565b6000610fda8285610f53565b60018201915061027a8284610e94565b6000610ff68286610f53565b6001820191506110068285610f53565b600182019150610fc58284610e94565b602081016101cc8284610e30565b602080825281016101c98184610e5c565b602080825281016101cc81610ec3565b602080825281016101cc81610f0c565b6040518181016001600160401b038111828210171561107357600080fd5b604052919050565b60006001600160401b0382111561109157600080fd5b5060209081020190565b60006001600160401b038211156110b157600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b8381101561111b578181015183820152602001611103565b8381111561112a576000848401525b50505050565b60006101cc82611145565b601f01601f191690565b60f81b90565b611154816110eb565b811461115f57600080fd5b50565b6006811061115f57600080fd5b6009811061115f57600080fdfea365627a7a7230582081c7271a2c9df296c011171cf29e0f68b9a046fb3a8fb80c1eca748d141b7e596c6578706572696d656e74616cf564736f6c63430005090040" + +// DeployICS23 deploys a new Ethereum contract, binding an instance of ICS23 to it. +func DeployICS23(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ICS23, error) { + parsed, err := abi.JSON(strings.NewReader(ICS23ABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ICS23Bin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &ICS23{ICS23Caller: ICS23Caller{contract: contract}, ICS23Transactor: ICS23Transactor{contract: contract}, ICS23Filterer: ICS23Filterer{contract: contract}}, nil +} + +// ICS23 is an auto generated Go binding around an Ethereum contract. +type ICS23 struct { + ICS23Caller // Read-only binding to the contract + ICS23Transactor // Write-only binding to the contract + ICS23Filterer // Log filterer for contract events +} + +// ICS23Caller is an auto generated read-only Go binding around an Ethereum contract. +type ICS23Caller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ICS23Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ICS23Transactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ICS23Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ICS23Filterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ICS23Session is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ICS23Session struct { + Contract *ICS23 // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ICS23CallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ICS23CallerSession struct { + Contract *ICS23Caller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ICS23TransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ICS23TransactorSession struct { + Contract *ICS23Transactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ICS23Raw is an auto generated low-level Go binding around an Ethereum contract. +type ICS23Raw struct { + Contract *ICS23 // Generic contract binding to access the raw methods on +} + +// ICS23CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ICS23CallerRaw struct { + Contract *ICS23Caller // Generic read-only contract binding to access the raw methods on +} + +// ICS23TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ICS23TransactorRaw struct { + Contract *ICS23Transactor // Generic write-only contract binding to access the raw methods on +} + +// NewICS23 creates a new instance of ICS23, bound to a specific deployed contract. +func NewICS23(address common.Address, backend bind.ContractBackend) (*ICS23, error) { + contract, err := bindICS23(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &ICS23{ICS23Caller: ICS23Caller{contract: contract}, ICS23Transactor: ICS23Transactor{contract: contract}, ICS23Filterer: ICS23Filterer{contract: contract}}, nil +} + +// NewICS23Caller creates a new read-only instance of ICS23, bound to a specific deployed contract. +func NewICS23Caller(address common.Address, caller bind.ContractCaller) (*ICS23Caller, error) { + contract, err := bindICS23(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ICS23Caller{contract: contract}, nil +} + +// NewICS23Transactor creates a new write-only instance of ICS23, bound to a specific deployed contract. +func NewICS23Transactor(address common.Address, transactor bind.ContractTransactor) (*ICS23Transactor, error) { + contract, err := bindICS23(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ICS23Transactor{contract: contract}, nil +} + +// NewICS23Filterer creates a new log filterer instance of ICS23, bound to a specific deployed contract. +func NewICS23Filterer(address common.Address, filterer bind.ContractFilterer) (*ICS23Filterer, error) { + contract, err := bindICS23(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ICS23Filterer{contract: contract}, nil +} + +// bindICS23 binds a generic wrapper to an already deployed contract. +func bindICS23(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ICS23ABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ICS23 *ICS23Raw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _ICS23.Contract.ICS23Caller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ICS23 *ICS23Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ICS23.Contract.ICS23Transactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ICS23 *ICS23Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ICS23.Contract.ICS23Transactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_ICS23 *ICS23CallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _ICS23.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_ICS23 *ICS23TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ICS23.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_ICS23 *ICS23TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ICS23.Contract.contract.Transact(opts, method, params...) +} + +// Struct2 is an auto generated low-level Go binding around an user-defined struct. +type Struct2 struct { + Key []byte + Value []byte + Leaf Struct0 + Path []Struct1 +} + +// Struct1 is an auto generated low-level Go binding around an user-defined struct. +type Struct1 struct { + Hash uint8 + Prefix []byte + Suffix []byte +} + +// Struct0 is an auto generated low-level Go binding around an user-defined struct. +type Struct0 struct { + Hash uint8 + PrehashKey uint8 + PrehashValue uint8 + Len uint8 + Prefix []byte +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_ICS23 *ICS23Caller) ApplyInner(opts *bind.CallOpts, op Struct1, child []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "applyInner", op, child) + return *ret0, err +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_ICS23 *ICS23Session) ApplyInner(op Struct1, child []byte) ([]byte, error) { + return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) +} + +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { + return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_ICS23 *ICS23Caller) ApplyLeaf(opts *bind.CallOpts, op Struct0, key []byte, value []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "applyLeaf", op, key, value) + return *ret0, err +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_ICS23 *ICS23Session) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { + return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) +} + +// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// +// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { + return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_ICS23 *ICS23Caller) Calculate(opts *bind.CallOpts, proof Struct2) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "calculate", proof) + return *ret0, err +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_ICS23 *ICS23Session) Calculate(proof Struct2) ([]byte, error) { + return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) +} + +// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// +// Solidity: function calculate(Struct2 proof) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) Calculate(proof Struct2) ([]byte, error) { + return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_ICS23 *ICS23Caller) CheckAgainstSpec(opts *bind.CallOpts, proof Struct2, spec Struct0) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "checkAgainstSpec", proof, spec) + return *ret0, err +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_ICS23 *ICS23Session) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { + return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) +} + +// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// +// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) +func (_ICS23 *ICS23CallerSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { + return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23Caller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "doHash", op, preimage) + return *ret0, err +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23Session) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _ICS23.Contract.DoHash(&_ICS23.CallOpts, op, preimage) +} + +// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. +// +// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { + return _ICS23.Contract.DoHash(&_ICS23.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23Caller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "doHashOrNoop", op, preimage) + return *ret0, err +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23Session) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _ICS23.Contract.DoHashOrNoop(&_ICS23.CallOpts, op, preimage) +} + +// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. +// +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { + return _ICS23.Contract.DoHashOrNoop(&_ICS23.CallOpts, op, preimage) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_ICS23 *ICS23Caller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "doLength", op, data) + return *ret0, err +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_ICS23 *ICS23Session) DoLength(op uint8, data []byte) ([]byte, error) { + return _ICS23.Contract.DoLength(&_ICS23.CallOpts, op, data) +} + +// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. +// +// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) DoLength(op uint8, data []byte) ([]byte, error) { + return _ICS23.Contract.DoLength(&_ICS23.CallOpts, op, data) +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_ICS23 *ICS23Caller) EqualBytes(opts *bind.CallOpts, bz1 []byte, bz2 []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "equalBytes", bz1, bz2) + return *ret0, err +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_ICS23 *ICS23Session) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { + return _ICS23.Contract.EqualBytes(&_ICS23.CallOpts, bz1, bz2) +} + +// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. +// +// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +func (_ICS23 *ICS23CallerSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { + return _ICS23.Contract.EqualBytes(&_ICS23.CallOpts, bz1, bz2) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_ICS23 *ICS23Caller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "hasprefix", s, prefix) + return *ret0, err +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_ICS23 *ICS23Session) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _ICS23.Contract.Hasprefix(&_ICS23.CallOpts, s, prefix) +} + +// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. +// +// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +func (_ICS23 *ICS23CallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { + return _ICS23.Contract.Hasprefix(&_ICS23.CallOpts, s, prefix) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_ICS23 *ICS23Caller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + var ( + ret0 = new([]byte) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) + return *ret0, err +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_ICS23 *ICS23Session) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _ICS23.Contract.PrepareLeafData(&_ICS23.CallOpts, hashop, lengthop, data) +} + +// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. +// +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +func (_ICS23 *ICS23CallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { + return _ICS23.Contract.PrepareLeafData(&_ICS23.CallOpts, hashop, lengthop, data) +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23Caller) VerifyExistence(opts *bind.CallOpts, proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "verifyExistence", proof, spec, root, key, value) + return *ret0, err +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23Session) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) +} + +// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// +// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { + return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) +} diff --git a/sol/ops_test.go b/sol/ops_test.go index 242ec4df..7b372a2a 100644 --- a/sol/ops_test.go +++ b/sol/ops_test.go @@ -1,4 +1,4 @@ -package proofs +package ics23 import ( "crypto/sha256" @@ -9,7 +9,7 @@ import ( "golang.org/x/crypto/ripemd160" - proofs "github.com/confio/proofs/go" + ics23 "github.com/confio/ics23/go" "github.com/stretchr/testify/require" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -19,7 +19,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) -func testDoHash(t *testing.T, cont ProofsSession) { +func testDoHash(t *testing.T, cont ICS23Session) { for i := 0; i < 1000; i++ { image := make([]byte, 64) rand.Read(image) @@ -70,7 +70,7 @@ func testDoHash(t *testing.T, cont ProofsSession) { } } -func Initialize(t *testing.T) ProofsSession { +func Initialize(t *testing.T) ICS23Session { key, _ := crypto.GenerateKey() auth := bind.NewKeyedTransactor(key) address := auth.From @@ -79,11 +79,11 @@ func Initialize(t *testing.T) ProofsSession { } sim := backends.NewSimulatedBackend(gAlloc, 100000000000) - _, _, cont, err := DeployProofs(auth, sim) + _, _, cont, err := DeployICS23(auth, sim) require.NoError(t, err) - session := ProofsSession{cont, bind.CallOpts{}, bind.TransactOpts{}} + session := ICS23Session{cont, bind.CallOpts{}, bind.TransactOpts{}} sim.Commit() diff --git a/sol/proof.abi b/sol/proof.abi deleted file mode 100644 index f446cd51..00000000 --- a/sol/proof.abi +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"preimage","type":"bytes"}],"name":"doHashOrNoop","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.LengthOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"doLength","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes","name":"s","type":"bytes"},{"internalType":"bytes","name":"prefix","type":"bytes"}],"name":"hasprefix","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"op","type":"uint8"},{"internalType":"bytes","name":"preimage","type":"bytes"}],"name":"doHash","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"internalType":"enum Proofs.HashOp","name":"hashop","type":"uint8"},{"internalType":"enum Proofs.LengthOp","name":"lengthop","type":"uint8"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"prepareLeafData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"payable":false,"stateMutability":"pure","type":"function"}] diff --git a/sol/proofs_contract.go b/sol/proofs_contract.go deleted file mode 100644 index 89341149..00000000 --- a/sol/proofs_contract.go +++ /dev/null @@ -1,515 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package proofs - -import ( - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = abi.U256 - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription -) - -// ProofsABI is the input ABI used to generate the binding from. -const ProofsABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" - -// ProofsFuncSigs maps the 4-byte function signature to its string representation. -var ProofsFuncSigs = map[string]string{ - "3d4a397d": "applyInner((uint8,bytes,bytes),bytes)", - "f6747d82": "applyLeaf((uint8,uint8,uint8,uint8,bytes),bytes,bytes)", - "7e1fd3bc": "calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]))", - "f10e9a9c": "checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes))", - "d48f1e4f": "doHash(uint8,bytes)", - "03801174": "doHashOrNoop(uint8,bytes)", - "67bb8e81": "doLength(uint8,bytes)", - "4cac70ff": "equalBytes(bytes,bytes)", - "901d0e15": "hasprefix(bytes,bytes)", - "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", - "2e3098a9": "verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", -} - -// ProofsBin is the compiled bytecode used for deploying new contracts. -var ProofsBin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b6111bf806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637e1fd3bc116100715780637e1fd3bc14610130578063901d0e1514610143578063d48f1e4f14610156578063f10e9a9c14610169578063f6747d821461017c578063fd29e20a1461018f576100a9565b806303801174146100ae5780632e3098a9146100d75780633d4a397d146100f75780634cac70ff1461010a57806367bb8e811461011d575b600080fd5b6100c16100bc366004610b82565b6101a2565b6040516100ce9190611024565b60405180910390f35b6100ea6100e5366004610cb5565b6101d2565b6040516100ce9190611016565b6100c1610105366004610d9c565b61022b565b6100ea610118366004610b1b565b610282565b6100c161012b366004610c05565b6102fe565b6100c161013e366004610c24565b6103f1565b6100ea610151366004610b1b565b61044f565b6100c1610164366004610b82565b6104af565b6100ea610177366004610c58565b610668565b6100c161018a366004610dd1565b61078a565b6100c161019d366004610ba1565b610819565b606060008360058111156101b257fe5b14156101bf5750806101cc565b6101c983836104af565b90505b92915050565b60006101de8686610668565b80156101f357506101f3838760000151610282565b80156102085750610208828760200151610282565b8015610221575061022161021b876103f1565b85610282565b9695505050505050565b606081516000141561023c57600080fd5b6060836020015183856040015160405160200161025b93929190610fa1565b604051602081830303815290604052905061027a8460000151826104af565b949350505050565b60008151835114610295575060006101cc565b60005b83518110156102f4578281815181106102ad57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ce57fe5b01602001516001600160f81b031916146102ec5760009150506101cc565b600101610298565b5060019392505050565b6060600083600881111561030e57fe5b141561031b5750806101cc565b600183600881111561032957fe5b1415610385578151608081106103725780607f16608017600782901c9150818460405160200161035b93929190610fea565b6040516020818303038152906040529150506101cc565b808360405160200161035b929190610fce565b600783600881111561039357fe5b14156103ae5781516020146103a757600080fd5b50806101cc565b60088360088111156103bc57fe5b14156103d05781516040146103a757600080fd5b60405162461bcd60e51b81526004016103e890611035565b60405180910390fd5b60608061040b83604001518460000151856020015161078a565b905060005b8360600151518110156104485761043e8460600151828151811061043057fe5b60200260200101518361022b565b9150600101610410565b5092915050565b6000805b82518110156102f45782818151811061046857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061048957fe5b01602001516001600160f81b031916146104a75760009150506101cc565b600101610453565b606060038360058111156104bf57fe5b14156104f35781805190602001206040516020016104dd9190610f79565b60405160208183030381529060405290506101cc565b600183600581111561050157fe5b1415610567576002826040516105179190610f8e565b602060405180830381855afa158015610534573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105579190810190610afd565b6040516020016104dd9190610f79565b600483600581111561057557fe5b14156105c05760038260405161058b9190610f8e565b602060405180830381855afa1580156105a8573d6000803e3d6000fd5b505060405180516104dd925060601b90602001610f64565b60058360058111156105ce57fe5b14156106505760036002836040516105e69190610f8e565b602060405180830381855afa158015610603573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106269190810190610afd565b6040516020016106369190610f79565b60408051601f198184030181529082905261058b91610f8e565b60405162461bcd60e51b81526004016103e890611045565b8051600090600581111561067857fe5b604084015151600581111561068957fe5b1480156106b75750816020015160058111156106a157fe5b83604001516020015160058111156106b557fe5b145b80156106e45750816040015160058111156106ce57fe5b83604001516040015160058111156106e257fe5b145b80156107115750816060015160088111156106fb57fe5b836040015160600151600881111561070f57fe5b145b801561072e575061072e836040015160800151836080015161044f565b61073a575060006101cc565b60005b8360600151518110156102f4576107738460600151828151811061075d57fe5b602002602001015160200151846080015161044f565b156107825760009150506101cc565b60010161073d565b606082516000141561079b57600080fd5b81516107a657600080fd5b60606107bb8560200151866060015186610819565b905060606107d28660400151876060015186610819565b90506060866080015183836040516020016107ef93929190610fa1565b604051602081830303815290604052905061080e8760000151826104af565b979650505050505050565b60608061082685846101a2565b9050606061022185836102fe565b600082601f83011261084557600080fd5b81356108586108538261107b565b611055565b81815260209384019390925082018360005b83811015610896578135860161088088826109da565b845250602092830192919091019060010161086a565b5050505092915050565b80516101cc8161114b565b600082601f8301126108bc57600080fd5b81356108ca6108538261109b565b915080825260208301602083018583830111156108e657600080fd5b6108f18382846110f4565b50505092915050565b80356101cc81611162565b80356101cc8161116f565b60006080828403121561092257600080fd5b61092c6080611055565b905081356001600160401b0381111561094457600080fd5b610950848285016108ab565b82525060208201356001600160401b0381111561096c57600080fd5b610978848285016108ab565b60208301525060408201356001600160401b0381111561099757600080fd5b6109a384828501610a63565b60408301525060608201356001600160401b038111156109c257600080fd5b6109ce84828501610834565b60608301525092915050565b6000606082840312156109ec57600080fd5b6109f66060611055565b90506000610a0484846108fa565b82525060208201356001600160401b03811115610a2057600080fd5b610a2c848285016108ab565b60208301525060408201356001600160401b03811115610a4b57600080fd5b610a57848285016108ab565b60408301525092915050565b600060a08284031215610a7557600080fd5b610a7f60a0611055565b90506000610a8d84846108fa565b8252506020610a9e848483016108fa565b6020830152506040610ab2848285016108fa565b6040830152506060610ac684828501610905565b60608301525060808201356001600160401b03811115610ae557600080fd5b610af1848285016108ab565b60808301525092915050565b600060208284031215610b0f57600080fd5b600061027a84846108a0565b60008060408385031215610b2e57600080fd5b82356001600160401b03811115610b4457600080fd5b610b50858286016108ab565b92505060208301356001600160401b03811115610b6c57600080fd5b610b78858286016108ab565b9150509250929050565b60008060408385031215610b9557600080fd5b6000610b5085856108fa565b600080600060608486031215610bb657600080fd5b6000610bc286866108fa565b9350506020610bd386828701610905565b92505060408401356001600160401b03811115610bef57600080fd5b610bfb868287016108ab565b9150509250925092565b60008060408385031215610c1857600080fd5b6000610b508585610905565b600060208284031215610c3657600080fd5b81356001600160401b03811115610c4c57600080fd5b61027a84828501610910565b60008060408385031215610c6b57600080fd5b82356001600160401b03811115610c8157600080fd5b610c8d85828601610910565b92505060208301356001600160401b03811115610ca957600080fd5b610b7885828601610a63565b600080600080600060a08688031215610ccd57600080fd5b85356001600160401b03811115610ce357600080fd5b610cef88828901610910565b95505060208601356001600160401b03811115610d0b57600080fd5b610d1788828901610a63565b94505060408601356001600160401b03811115610d3357600080fd5b610d3f888289016108ab565b93505060608601356001600160401b03811115610d5b57600080fd5b610d67888289016108ab565b92505060808601356001600160401b03811115610d8357600080fd5b610d8f888289016108ab565b9150509295509295909350565b60008060408385031215610daf57600080fd5b82356001600160401b03811115610dc557600080fd5b610b50858286016109da565b600080600060608486031215610de657600080fd5b83356001600160401b03811115610dfc57600080fd5b610e0886828701610a63565b93505060208401356001600160401b03811115610e2457600080fd5b610bd3868287016108ab565b610e39816110d4565b82525050565b610e39610e4b826110d9565b6110eb565b610e39610e4b826110eb565b6000610e67826110c2565b610e7181856110c6565b9350610e81818560208601611100565b610e8a8161113b565b9093019392505050565b6000610e9f826110c2565b610ea981856110cf565b9350610eb9818560208601611100565b9290920192915050565b6000610ed06027836110c6565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610f196025836110c6565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610e39610f5f826110ee565b611130565b6000610f708284610e3f565b50601401919050565b6000610f858284610e50565b50602001919050565b6000610f9a8284610e94565b9392505050565b6000610fad8286610e94565b9150610fb98285610e94565b9150610fc58284610e94565b95945050505050565b6000610fda8285610f53565b60018201915061027a8284610e94565b6000610ff68286610f53565b6001820191506110068285610f53565b600182019150610fc58284610e94565b602081016101cc8284610e30565b602080825281016101c98184610e5c565b602080825281016101cc81610ec3565b602080825281016101cc81610f0c565b6040518181016001600160401b038111828210171561107357600080fd5b604052919050565b60006001600160401b0382111561109157600080fd5b5060209081020190565b60006001600160401b038211156110b157600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b8381101561111b578181015183820152602001611103565b8381111561112a576000848401525b50505050565b60006101cc82611145565b601f01601f191690565b60f81b90565b611154816110eb565b811461115f57600080fd5b50565b6006811061115f57600080fd5b6009811061115f57600080fdfea365627a7a723058207cad5ea356d3ce2231365cdc70196253a06927f855a325198ead8ef2746d58136c6578706572696d656e74616cf564736f6c63430005090040" - -// DeployProofs deploys a new Ethereum contract, binding an instance of Proofs to it. -func DeployProofs(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Proofs, error) { - parsed, err := abi.JSON(strings.NewReader(ProofsABI)) - if err != nil { - return common.Address{}, nil, nil, err - } - - address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ProofsBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil -} - -// Proofs is an auto generated Go binding around an Ethereum contract. -type Proofs struct { - ProofsCaller // Read-only binding to the contract - ProofsTransactor // Write-only binding to the contract - ProofsFilterer // Log filterer for contract events -} - -// ProofsCaller is an auto generated read-only Go binding around an Ethereum contract. -type ProofsCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsTransactor is an auto generated write-only Go binding around an Ethereum contract. -type ProofsTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type ProofsFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// ProofsSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type ProofsSession struct { - Contract *Proofs // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProofsCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type ProofsCallerSession struct { - Contract *ProofsCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// ProofsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type ProofsTransactorSession struct { - Contract *ProofsTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// ProofsRaw is an auto generated low-level Go binding around an Ethereum contract. -type ProofsRaw struct { - Contract *Proofs // Generic contract binding to access the raw methods on -} - -// ProofsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type ProofsCallerRaw struct { - Contract *ProofsCaller // Generic read-only contract binding to access the raw methods on -} - -// ProofsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type ProofsTransactorRaw struct { - Contract *ProofsTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewProofs creates a new instance of Proofs, bound to a specific deployed contract. -func NewProofs(address common.Address, backend bind.ContractBackend) (*Proofs, error) { - contract, err := bindProofs(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Proofs{ProofsCaller: ProofsCaller{contract: contract}, ProofsTransactor: ProofsTransactor{contract: contract}, ProofsFilterer: ProofsFilterer{contract: contract}}, nil -} - -// NewProofsCaller creates a new read-only instance of Proofs, bound to a specific deployed contract. -func NewProofsCaller(address common.Address, caller bind.ContractCaller) (*ProofsCaller, error) { - contract, err := bindProofs(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &ProofsCaller{contract: contract}, nil -} - -// NewProofsTransactor creates a new write-only instance of Proofs, bound to a specific deployed contract. -func NewProofsTransactor(address common.Address, transactor bind.ContractTransactor) (*ProofsTransactor, error) { - contract, err := bindProofs(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &ProofsTransactor{contract: contract}, nil -} - -// NewProofsFilterer creates a new log filterer instance of Proofs, bound to a specific deployed contract. -func NewProofsFilterer(address common.Address, filterer bind.ContractFilterer) (*ProofsFilterer, error) { - contract, err := bindProofs(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &ProofsFilterer{contract: contract}, nil -} - -// bindProofs binds a generic wrapper to an already deployed contract. -func bindProofs(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(ProofsABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Proofs *ProofsRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Proofs.Contract.ProofsCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Proofs *ProofsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Proofs.Contract.ProofsTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Proofs *ProofsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Proofs.Contract.ProofsTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Proofs *ProofsCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { - return _Proofs.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Proofs *ProofsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Proofs.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Proofs *ProofsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Proofs.Contract.contract.Transact(opts, method, params...) -} - -// Struct2 is an auto generated low-level Go binding around an user-defined struct. -type Struct2 struct { - Key []byte - Value []byte - Leaf Struct0 - Path []Struct1 -} - -// Struct1 is an auto generated low-level Go binding around an user-defined struct. -type Struct1 struct { - Hash uint8 - Prefix []byte - Suffix []byte -} - -// Struct0 is an auto generated low-level Go binding around an user-defined struct. -type Struct0 struct { - Hash uint8 - PrehashKey uint8 - PrehashValue uint8 - Len uint8 - Prefix []byte -} - -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. -// -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_Proofs *ProofsCaller) ApplyInner(opts *bind.CallOpts, op Struct1, child []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "applyInner", op, child) - return *ret0, err -} - -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. -// -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_Proofs *ProofsSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { - return _Proofs.Contract.ApplyInner(&_Proofs.CallOpts, op, child) -} - -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. -// -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_Proofs *ProofsCallerSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { - return _Proofs.Contract.ApplyInner(&_Proofs.CallOpts, op, child) -} - -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. -// -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_Proofs *ProofsCaller) ApplyLeaf(opts *bind.CallOpts, op Struct0, key []byte, value []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "applyLeaf", op, key, value) - return *ret0, err -} - -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. -// -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_Proofs *ProofsSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { - return _Proofs.Contract.ApplyLeaf(&_Proofs.CallOpts, op, key, value) -} - -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. -// -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_Proofs *ProofsCallerSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { - return _Proofs.Contract.ApplyLeaf(&_Proofs.CallOpts, op, key, value) -} - -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. -// -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_Proofs *ProofsCaller) Calculate(opts *bind.CallOpts, proof Struct2) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "calculate", proof) - return *ret0, err -} - -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. -// -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_Proofs *ProofsSession) Calculate(proof Struct2) ([]byte, error) { - return _Proofs.Contract.Calculate(&_Proofs.CallOpts, proof) -} - -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. -// -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_Proofs *ProofsCallerSession) Calculate(proof Struct2) ([]byte, error) { - return _Proofs.Contract.Calculate(&_Proofs.CallOpts, proof) -} - -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. -// -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_Proofs *ProofsCaller) CheckAgainstSpec(opts *bind.CallOpts, proof Struct2, spec Struct0) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "checkAgainstSpec", proof, spec) - return *ret0, err -} - -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. -// -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_Proofs *ProofsSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { - return _Proofs.Contract.CheckAgainstSpec(&_Proofs.CallOpts, proof, spec) -} - -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. -// -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_Proofs *ProofsCallerSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { - return _Proofs.Contract.CheckAgainstSpec(&_Proofs.CallOpts, proof, spec) -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCaller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doHash", op, preimage) - return *ret0, err -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsSession) DoHash(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) -} - -// DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. -// -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHash(&_Proofs.CallOpts, op, preimage) -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCaller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doHashOrNoop", op, preimage) - return *ret0, err -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) -} - -// DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. -// -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { - return _Proofs.Contract.DoHashOrNoop(&_Proofs.CallOpts, op, preimage) -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsCaller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "doLength", op, data) - return *ret0, err -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsSession) DoLength(op uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) -} - -// DoLength is a free data retrieval call binding the contract method 0x67bb8e81. -// -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) -func (_Proofs *ProofsCallerSession) DoLength(op uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.DoLength(&_Proofs.CallOpts, op, data) -} - -// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. -// -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) -func (_Proofs *ProofsCaller) EqualBytes(opts *bind.CallOpts, bz1 []byte, bz2 []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "equalBytes", bz1, bz2) - return *ret0, err -} - -// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. -// -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) -func (_Proofs *ProofsSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { - return _Proofs.Contract.EqualBytes(&_Proofs.CallOpts, bz1, bz2) -} - -// EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. -// -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) -func (_Proofs *ProofsCallerSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { - return _Proofs.Contract.EqualBytes(&_Proofs.CallOpts, bz1, bz2) -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsCaller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "hasprefix", s, prefix) - return *ret0, err -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsSession) Hasprefix(s []byte, prefix []byte) (bool, error) { - return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) -} - -// Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. -// -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) -func (_Proofs *ProofsCallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { - return _Proofs.Contract.Hasprefix(&_Proofs.CallOpts, s, prefix) -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsCaller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) - return *ret0, err -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) -} - -// PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. -// -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) -func (_Proofs *ProofsCallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - return _Proofs.Contract.PrepareLeafData(&_Proofs.CallOpts, hashop, lengthop, data) -} - -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. -// -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_Proofs *ProofsCaller) VerifyExistence(opts *bind.CallOpts, proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _Proofs.contract.Call(opts, out, "verifyExistence", proof, spec, root, key, value) - return *ret0, err -} - -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. -// -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_Proofs *ProofsSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { - return _Proofs.Contract.VerifyExistence(&_Proofs.CallOpts, proof, spec, root, key, value) -} - -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. -// -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_Proofs *ProofsCallerSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { - return _Proofs.Contract.VerifyExistence(&_Proofs.CallOpts, proof, spec, root, key, value) -} diff --git a/sol/proofs_test.go b/sol/proofs_test.go index 564f9716..2c0ecb17 100644 --- a/sol/proofs_test.go +++ b/sol/proofs_test.go @@ -1,4 +1,4 @@ -package proofs +package ics23 import ( "testing" From f71fafc9572dd93e7b9d9d4be53adc5345675b03 Mon Sep 17 00:00:00 2001 From: mossid Date: Sat, 14 Sep 2019 13:47:30 +0200 Subject: [PATCH 08/10] add verifyMembership function --- sol/ics23.sol | 12 ++++++++++++ sol/ics23_contract.go | 31 +++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/sol/ics23.sol b/sol/ics23.sol index 448e91c4..9c27921b 100644 --- a/sol/ics23.sol +++ b/sol/ics23.sol @@ -2,7 +2,12 @@ pragma solidity ^0.5.3; pragma experimental ABIEncoderV2; +// Current solidity ICS23 implementation only supports Existence +// NonExistence is planned to be supported, Batch and Compressed are not + contract ICS23 { + // Data structures and helper functions + enum HashOp{NO_HASH, SHA256, SHA512, KECCAK, RIPEMD160, BITCOIN} enum LengthOp{NO_PREFIX, VAR_PROTO, VAR_RLP, FIXED32_BIG, FIXED32_LITTLE, FIXED64_BIG, FIXED64_LITTLE, REQUIRE_32_BYTES, REQUIRE_64_BYTES} @@ -160,4 +165,11 @@ contract ICS23 { } return true; } + + // ICS23 interface implementation + + // verifyMembership is synonym for verifyExistence + function verifyMembership(LeafOp memory spec, bytes memory root, ExistenceProof memory proof, bytes memory key, bytes memory value) public pure returns (bool) { + return verifyExistence(proof, spec, root, key, value); + } } diff --git a/sol/ics23_contract.go b/sol/ics23_contract.go index 7b01b8fb..1d8ba8c5 100644 --- a/sol/ics23_contract.go +++ b/sol/ics23_contract.go @@ -28,7 +28,7 @@ var ( ) // ICS23ABI is the input ABI used to generate the binding from. -const ICS23ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" +const ICS23ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyMembership\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" // ICS23FuncSigs maps the 4-byte function signature to its string representation. var ICS23FuncSigs = map[string]string{ @@ -43,10 +43,11 @@ var ICS23FuncSigs = map[string]string{ "901d0e15": "hasprefix(bytes,bytes)", "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", "2e3098a9": "verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", + "a04f1008": "verifyMembership((uint8,uint8,uint8,uint8,bytes),bytes,(bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),bytes,bytes)", } // ICS23Bin is the compiled bytecode used for deploying new contracts. -var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b6111bf806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80637e1fd3bc116100715780637e1fd3bc14610130578063901d0e1514610143578063d48f1e4f14610156578063f10e9a9c14610169578063f6747d821461017c578063fd29e20a1461018f576100a9565b806303801174146100ae5780632e3098a9146100d75780633d4a397d146100f75780634cac70ff1461010a57806367bb8e811461011d575b600080fd5b6100c16100bc366004610b82565b6101a2565b6040516100ce9190611024565b60405180910390f35b6100ea6100e5366004610cb5565b6101d2565b6040516100ce9190611016565b6100c1610105366004610d9c565b61022b565b6100ea610118366004610b1b565b610282565b6100c161012b366004610c05565b6102fe565b6100c161013e366004610c24565b6103f1565b6100ea610151366004610b1b565b61044f565b6100c1610164366004610b82565b6104af565b6100ea610177366004610c58565b610668565b6100c161018a366004610dd1565b61078a565b6100c161019d366004610ba1565b610819565b606060008360058111156101b257fe5b14156101bf5750806101cc565b6101c983836104af565b90505b92915050565b60006101de8686610668565b80156101f357506101f3838760000151610282565b80156102085750610208828760200151610282565b8015610221575061022161021b876103f1565b85610282565b9695505050505050565b606081516000141561023c57600080fd5b6060836020015183856040015160405160200161025b93929190610fa1565b604051602081830303815290604052905061027a8460000151826104af565b949350505050565b60008151835114610295575060006101cc565b60005b83518110156102f4578281815181106102ad57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ce57fe5b01602001516001600160f81b031916146102ec5760009150506101cc565b600101610298565b5060019392505050565b6060600083600881111561030e57fe5b141561031b5750806101cc565b600183600881111561032957fe5b1415610385578151608081106103725780607f16608017600782901c9150818460405160200161035b93929190610fea565b6040516020818303038152906040529150506101cc565b808360405160200161035b929190610fce565b600783600881111561039357fe5b14156103ae5781516020146103a757600080fd5b50806101cc565b60088360088111156103bc57fe5b14156103d05781516040146103a757600080fd5b60405162461bcd60e51b81526004016103e890611035565b60405180910390fd5b60608061040b83604001518460000151856020015161078a565b905060005b8360600151518110156104485761043e8460600151828151811061043057fe5b60200260200101518361022b565b9150600101610410565b5092915050565b6000805b82518110156102f45782818151811061046857fe5b602001015160f81c60f81b6001600160f81b03191684828151811061048957fe5b01602001516001600160f81b031916146104a75760009150506101cc565b600101610453565b606060038360058111156104bf57fe5b14156104f35781805190602001206040516020016104dd9190610f79565b60405160208183030381529060405290506101cc565b600183600581111561050157fe5b1415610567576002826040516105179190610f8e565b602060405180830381855afa158015610534573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105579190810190610afd565b6040516020016104dd9190610f79565b600483600581111561057557fe5b14156105c05760038260405161058b9190610f8e565b602060405180830381855afa1580156105a8573d6000803e3d6000fd5b505060405180516104dd925060601b90602001610f64565b60058360058111156105ce57fe5b14156106505760036002836040516105e69190610f8e565b602060405180830381855afa158015610603573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106269190810190610afd565b6040516020016106369190610f79565b60408051601f198184030181529082905261058b91610f8e565b60405162461bcd60e51b81526004016103e890611045565b8051600090600581111561067857fe5b604084015151600581111561068957fe5b1480156106b75750816020015160058111156106a157fe5b83604001516020015160058111156106b557fe5b145b80156106e45750816040015160058111156106ce57fe5b83604001516040015160058111156106e257fe5b145b80156107115750816060015160088111156106fb57fe5b836040015160600151600881111561070f57fe5b145b801561072e575061072e836040015160800151836080015161044f565b61073a575060006101cc565b60005b8360600151518110156102f4576107738460600151828151811061075d57fe5b602002602001015160200151846080015161044f565b156107825760009150506101cc565b60010161073d565b606082516000141561079b57600080fd5b81516107a657600080fd5b60606107bb8560200151866060015186610819565b905060606107d28660400151876060015186610819565b90506060866080015183836040516020016107ef93929190610fa1565b604051602081830303815290604052905061080e8760000151826104af565b979650505050505050565b60608061082685846101a2565b9050606061022185836102fe565b600082601f83011261084557600080fd5b81356108586108538261107b565b611055565b81815260209384019390925082018360005b83811015610896578135860161088088826109da565b845250602092830192919091019060010161086a565b5050505092915050565b80516101cc8161114b565b600082601f8301126108bc57600080fd5b81356108ca6108538261109b565b915080825260208301602083018583830111156108e657600080fd5b6108f18382846110f4565b50505092915050565b80356101cc81611162565b80356101cc8161116f565b60006080828403121561092257600080fd5b61092c6080611055565b905081356001600160401b0381111561094457600080fd5b610950848285016108ab565b82525060208201356001600160401b0381111561096c57600080fd5b610978848285016108ab565b60208301525060408201356001600160401b0381111561099757600080fd5b6109a384828501610a63565b60408301525060608201356001600160401b038111156109c257600080fd5b6109ce84828501610834565b60608301525092915050565b6000606082840312156109ec57600080fd5b6109f66060611055565b90506000610a0484846108fa565b82525060208201356001600160401b03811115610a2057600080fd5b610a2c848285016108ab565b60208301525060408201356001600160401b03811115610a4b57600080fd5b610a57848285016108ab565b60408301525092915050565b600060a08284031215610a7557600080fd5b610a7f60a0611055565b90506000610a8d84846108fa565b8252506020610a9e848483016108fa565b6020830152506040610ab2848285016108fa565b6040830152506060610ac684828501610905565b60608301525060808201356001600160401b03811115610ae557600080fd5b610af1848285016108ab565b60808301525092915050565b600060208284031215610b0f57600080fd5b600061027a84846108a0565b60008060408385031215610b2e57600080fd5b82356001600160401b03811115610b4457600080fd5b610b50858286016108ab565b92505060208301356001600160401b03811115610b6c57600080fd5b610b78858286016108ab565b9150509250929050565b60008060408385031215610b9557600080fd5b6000610b5085856108fa565b600080600060608486031215610bb657600080fd5b6000610bc286866108fa565b9350506020610bd386828701610905565b92505060408401356001600160401b03811115610bef57600080fd5b610bfb868287016108ab565b9150509250925092565b60008060408385031215610c1857600080fd5b6000610b508585610905565b600060208284031215610c3657600080fd5b81356001600160401b03811115610c4c57600080fd5b61027a84828501610910565b60008060408385031215610c6b57600080fd5b82356001600160401b03811115610c8157600080fd5b610c8d85828601610910565b92505060208301356001600160401b03811115610ca957600080fd5b610b7885828601610a63565b600080600080600060a08688031215610ccd57600080fd5b85356001600160401b03811115610ce357600080fd5b610cef88828901610910565b95505060208601356001600160401b03811115610d0b57600080fd5b610d1788828901610a63565b94505060408601356001600160401b03811115610d3357600080fd5b610d3f888289016108ab565b93505060608601356001600160401b03811115610d5b57600080fd5b610d67888289016108ab565b92505060808601356001600160401b03811115610d8357600080fd5b610d8f888289016108ab565b9150509295509295909350565b60008060408385031215610daf57600080fd5b82356001600160401b03811115610dc557600080fd5b610b50858286016109da565b600080600060608486031215610de657600080fd5b83356001600160401b03811115610dfc57600080fd5b610e0886828701610a63565b93505060208401356001600160401b03811115610e2457600080fd5b610bd3868287016108ab565b610e39816110d4565b82525050565b610e39610e4b826110d9565b6110eb565b610e39610e4b826110eb565b6000610e67826110c2565b610e7181856110c6565b9350610e81818560208601611100565b610e8a8161113b565b9093019392505050565b6000610e9f826110c2565b610ea981856110cf565b9350610eb9818560208601611100565b9290920192915050565b6000610ed06027836110c6565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610f196025836110c6565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610e39610f5f826110ee565b611130565b6000610f708284610e3f565b50601401919050565b6000610f858284610e50565b50602001919050565b6000610f9a8284610e94565b9392505050565b6000610fad8286610e94565b9150610fb98285610e94565b9150610fc58284610e94565b95945050505050565b6000610fda8285610f53565b60018201915061027a8284610e94565b6000610ff68286610f53565b6001820191506110068285610f53565b600182019150610fc58284610e94565b602081016101cc8284610e30565b602080825281016101c98184610e5c565b602080825281016101cc81610ec3565b602080825281016101cc81610f0c565b6040518181016001600160401b038111828210171561107357600080fd5b604052919050565b60006001600160401b0382111561109157600080fd5b5060209081020190565b60006001600160401b038211156110b157600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b8381101561111b578181015183820152602001611103565b8381111561112a576000848401525b50505050565b60006101cc82611145565b601f01601f191690565b60f81b90565b611154816110eb565b811461115f57600080fd5b50565b6006811061115f57600080fd5b6009811061115f57600080fdfea365627a7a7230582081c7271a2c9df296c011171cf29e0f68b9a046fb3a8fb80c1eca748d141b7e596c6578706572696d656e74616cf564736f6c63430005090040" +var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b611276806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063901d0e1511610071578063901d0e151461014e578063a04f100814610161578063d48f1e4f14610174578063f10e9a9c14610187578063f6747d821461019a578063fd29e20a146101ad576100b4565b806303801174146100b95780632e3098a9146100e25780633d4a397d146101025780634cac70ff1461011557806367bb8e81146101285780637e1fd3bc1461013b575b600080fd5b6100cc6100c7366004610baf565b6101c0565b6040516100d991906110db565b60405180910390f35b6100f56100f0366004610ce2565b6101f0565b6040516100d991906110cd565b6100cc610110366004610dc9565b610249565b6100f5610123366004610b48565b6102a0565b6100cc610136366004610c32565b61031c565b6100cc610149366004610c51565b61040f565b6100f561015c366004610b48565b61046d565b6100f561016f366004610e5d565b6104cd565b6100cc610182366004610baf565b6104dc565b6100f5610195366004610c85565b610695565b6100cc6101a8366004610dfe565b6107b7565b6100cc6101bb366004610bce565b610846565b606060008360058111156101d057fe5b14156101dd5750806101ea565b6101e783836104dc565b90505b92915050565b60006101fc8686610695565b801561021157506102118387600001516102a0565b801561022657506102268287602001516102a0565b801561023f575061023f6102398761040f565b856102a0565b9695505050505050565b606081516000141561025a57600080fd5b6060836020015183856040015160405160200161027993929190611058565b60405160208183030381529060405290506102988460000151826104dc565b949350505050565b600081518351146102b3575060006101ea565b60005b8351811015610312578281815181106102cb57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ec57fe5b01602001516001600160f81b0319161461030a5760009150506101ea565b6001016102b6565b5060019392505050565b6060600083600881111561032c57fe5b14156103395750806101ea565b600183600881111561034757fe5b14156103a3578151608081106103905780607f16608017600782901c91508184604051602001610379939291906110a1565b6040516020818303038152906040529150506101ea565b8083604051602001610379929190611085565b60078360088111156103b157fe5b14156103cc5781516020146103c557600080fd5b50806101ea565b60088360088111156103da57fe5b14156103ee5781516040146103c557600080fd5b60405162461bcd60e51b8152600401610406906110ec565b60405180910390fd5b6060806104298360400151846000015185602001516107b7565b905060005b8360600151518110156104665761045c8460600151828151811061044e57fe5b602002602001015183610249565b915060010161042e565b5092915050565b6000805b82518110156103125782818151811061048657fe5b602001015160f81c60f81b6001600160f81b0319168482815181106104a757fe5b01602001516001600160f81b031916146104c55760009150506101ea565b600101610471565b600061023f84878786866101f0565b606060038360058111156104ec57fe5b141561052057818051906020012060405160200161050a9190611030565b60405160208183030381529060405290506101ea565b600183600581111561052e57fe5b1415610594576002826040516105449190611045565b602060405180830381855afa158015610561573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105849190810190610b2a565b60405160200161050a9190611030565b60048360058111156105a257fe5b14156105ed576003826040516105b89190611045565b602060405180830381855afa1580156105d5573d6000803e3d6000fd5b5050604051805161050a925060601b9060200161101b565b60058360058111156105fb57fe5b141561067d5760036002836040516106139190611045565b602060405180830381855afa158015610630573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106539190810190610b2a565b6040516020016106639190611030565b60408051601f19818403018152908290526105b891611045565b60405162461bcd60e51b8152600401610406906110fc565b805160009060058111156106a557fe5b60408401515160058111156106b657fe5b1480156106e45750816020015160058111156106ce57fe5b83604001516020015160058111156106e257fe5b145b80156107115750816040015160058111156106fb57fe5b836040015160400151600581111561070f57fe5b145b801561073e57508160600151600881111561072857fe5b836040015160600151600881111561073c57fe5b145b801561075b575061075b836040015160800151836080015161046d565b610767575060006101ea565b60005b836060015151811015610312576107a08460600151828151811061078a57fe5b602002602001015160200151846080015161046d565b156107af5760009150506101ea565b60010161076a565b60608251600014156107c857600080fd5b81516107d357600080fd5b60606107e88560200151866060015186610846565b905060606107ff8660400151876060015186610846565b905060608660800151838360405160200161081c93929190611058565b604051602081830303815290604052905061083b8760000151826104dc565b979650505050505050565b60608061085385846101c0565b9050606061023f858361031c565b600082601f83011261087257600080fd5b813561088561088082611132565b61110c565b81815260209384019390925082018360005b838110156108c357813586016108ad8882610a07565b8452506020928301929190910190600101610897565b5050505092915050565b80516101ea81611202565b600082601f8301126108e957600080fd5b81356108f761088082611152565b9150808252602083016020830185838301111561091357600080fd5b61091e8382846111ab565b50505092915050565b80356101ea81611219565b80356101ea81611226565b60006080828403121561094f57600080fd5b610959608061110c565b905081356001600160401b0381111561097157600080fd5b61097d848285016108d8565b82525060208201356001600160401b0381111561099957600080fd5b6109a5848285016108d8565b60208301525060408201356001600160401b038111156109c457600080fd5b6109d084828501610a90565b60408301525060608201356001600160401b038111156109ef57600080fd5b6109fb84828501610861565b60608301525092915050565b600060608284031215610a1957600080fd5b610a23606061110c565b90506000610a318484610927565b82525060208201356001600160401b03811115610a4d57600080fd5b610a59848285016108d8565b60208301525060408201356001600160401b03811115610a7857600080fd5b610a84848285016108d8565b60408301525092915050565b600060a08284031215610aa257600080fd5b610aac60a061110c565b90506000610aba8484610927565b8252506020610acb84848301610927565b6020830152506040610adf84828501610927565b6040830152506060610af384828501610932565b60608301525060808201356001600160401b03811115610b1257600080fd5b610b1e848285016108d8565b60808301525092915050565b600060208284031215610b3c57600080fd5b600061029884846108cd565b60008060408385031215610b5b57600080fd5b82356001600160401b03811115610b7157600080fd5b610b7d858286016108d8565b92505060208301356001600160401b03811115610b9957600080fd5b610ba5858286016108d8565b9150509250929050565b60008060408385031215610bc257600080fd5b6000610b7d8585610927565b600080600060608486031215610be357600080fd5b6000610bef8686610927565b9350506020610c0086828701610932565b92505060408401356001600160401b03811115610c1c57600080fd5b610c28868287016108d8565b9150509250925092565b60008060408385031215610c4557600080fd5b6000610b7d8585610932565b600060208284031215610c6357600080fd5b81356001600160401b03811115610c7957600080fd5b6102988482850161093d565b60008060408385031215610c9857600080fd5b82356001600160401b03811115610cae57600080fd5b610cba8582860161093d565b92505060208301356001600160401b03811115610cd657600080fd5b610ba585828601610a90565b600080600080600060a08688031215610cfa57600080fd5b85356001600160401b03811115610d1057600080fd5b610d1c8882890161093d565b95505060208601356001600160401b03811115610d3857600080fd5b610d4488828901610a90565b94505060408601356001600160401b03811115610d6057600080fd5b610d6c888289016108d8565b93505060608601356001600160401b03811115610d8857600080fd5b610d94888289016108d8565b92505060808601356001600160401b03811115610db057600080fd5b610dbc888289016108d8565b9150509295509295909350565b60008060408385031215610ddc57600080fd5b82356001600160401b03811115610df257600080fd5b610b7d85828601610a07565b600080600060608486031215610e1357600080fd5b83356001600160401b03811115610e2957600080fd5b610e3586828701610a90565b93505060208401356001600160401b03811115610e5157600080fd5b610c00868287016108d8565b600080600080600060a08688031215610e7557600080fd5b85356001600160401b03811115610e8b57600080fd5b610e9788828901610a90565b95505060208601356001600160401b03811115610eb357600080fd5b610ebf888289016108d8565b94505060408601356001600160401b03811115610edb57600080fd5b610d6c8882890161093d565b610ef08161118b565b82525050565b610ef0610f0282611190565b6111a2565b610ef0610f02826111a2565b6000610f1e82611179565b610f28818561117d565b9350610f388185602086016111b7565b610f41816111f2565b9093019392505050565b6000610f5682611179565b610f608185611186565b9350610f708185602086016111b7565b9290920192915050565b6000610f8760278361117d565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610fd060258361117d565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610ef0611016826111a5565b6111e7565b60006110278284610ef6565b50601401919050565b600061103c8284610f07565b50602001919050565b60006110518284610f4b565b9392505050565b60006110648286610f4b565b91506110708285610f4b565b915061107c8284610f4b565b95945050505050565b6000611091828561100a565b6001820191506102988284610f4b565b60006110ad828661100a565b6001820191506110bd828561100a565b60018201915061107c8284610f4b565b602081016101ea8284610ee7565b602080825281016101e78184610f13565b602080825281016101ea81610f7a565b602080825281016101ea81610fc3565b6040518181016001600160401b038111828210171561112a57600080fd5b604052919050565b60006001600160401b0382111561114857600080fd5b5060209081020190565b60006001600160401b0382111561116857600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b838110156111d25781810151838201526020016111ba565b838111156111e1576000848401525b50505050565b60006101ea826111fc565b601f01601f191690565b60f81b90565b61120b816111a2565b811461121657600080fd5b50565b6006811061121657600080fd5b6009811061121657600080fdfea365627a7a7230582021e845f87264315bcfe13337b935b2d08290e3ad34917bca35059566373a87896c6578706572696d656e74616cf564736f6c63430005090040" // DeployICS23 deploys a new Ethereum contract, binding an instance of ICS23 to it. func DeployICS23(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ICS23, error) { @@ -513,3 +514,29 @@ func (_ICS23 *ICS23Session) VerifyExistence(proof Struct2, spec Struct0, root [] func (_ICS23 *ICS23CallerSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) } + +// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// +// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23Caller) VerifyMembership(opts *bind.CallOpts, spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { + var ( + ret0 = new(bool) + ) + out := ret0 + err := _ICS23.contract.Call(opts, out, "verifyMembership", spec, root, proof, key, value) + return *ret0, err +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// +// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23Session) VerifyMembership(spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { + return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) +} + +// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// +// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyMembership(spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { + return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) +} From adf3454c965bc29a3d679fd6687d587369cf1923 Mon Sep 17 00:00:00 2001 From: mconcat Date: Mon, 8 Mar 2021 19:05:47 +0900 Subject: [PATCH 09/10] cleanup --- go.mod | 35 +-- go.sum | 544 +++++++++++++++++++++++++++++++++++++++++- go/ops_test_data.go | 2 +- go/proof_test.go | 10 +- go/proof_test_data.go | 2 +- sol/ics23.go | 21 +- sol/ics23.sol | 2 +- sol/ics23_contract.go | 367 ++++++++++++++++------------ sol/proofs_test.go | 6 +- 9 files changed, 772 insertions(+), 217 deletions(-) diff --git a/go.mod b/go.mod index 269a15ae..a3f8dd2d 100644 --- a/go.mod +++ b/go.mod @@ -3,34 +3,9 @@ module github.com/confio/ics23 go 1.14 require ( - github.com/allegro/bigcache v1.2.1 // indirect - github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015 // indirect - github.com/btcsuite/btcd v0.21.0-beta // indirect - github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d // indirect - github.com/deckarep/golang-set v1.7.1 // indirect - github.com/edsrzf/mmap-go v1.0.0 // indirect - github.com/elastic/gosigar v0.10.4 // indirect - github.com/ethereum/go-ethereum v1.9.1 - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect - github.com/golang/protobuf v1.3.2 // indirect - github.com/gorilla/websocket v1.4.0 // indirect - github.com/hashicorp/golang-lru v0.5.3 // indirect - github.com/huin/goupnp v1.0.0 // indirect - github.com/jackpal/go-nat-pmp v1.0.1 // indirect - github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 // indirect - github.com/mattn/go-runewidth v0.0.4 // indirect - github.com/olekukonko/tablewriter v0.0.1 // indirect - github.com/pborman/uuid v1.2.0 // indirect - github.com/prometheus/tsdb v0.10.0 // indirect - github.com/rjeczalik/notify v0.9.2 // indirect - github.com/rs/cors v1.6.0 // indirect - github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 // indirect - github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect - github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect - github.com/stretchr/testify v1.3.0 - github.com/syndtr/goleveldb v1.0.0 // indirect - github.com/tyler-smith/go-bip39 v1.0.0 // indirect - github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect - golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 - gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + github.com/ethereum/go-ethereum v1.10.0 + github.com/gogo/protobuf v1.3.2 + github.com/pkg/errors v0.8.1 + github.com/stretchr/testify v1.7.0 + golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 ) diff --git a/go.sum b/go.sum index 3414c0bc..29d10764 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,69 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= +github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= +github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= +github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= +github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= +github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= +github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= +github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= +github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= +github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= +github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= +github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/VictoriaMetrics/fastcache v1.5.7 h1:4y6y0G8PRzszQUYIQHHssv/jgPHAb5qQuuDNdCbyAgw= +github.com/VictoriaMetrics/fastcache v1.5.7/go.mod h1:ptDBkNMQI4RtmVo8VS/XwRY6RoTu1dAWCbrk+6WsEM8= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= +github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= +github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= +github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015 h1:7ABPr1+uJdqESAdlVevnc/2FJGiC/K3uMg1JiELeF+0= github.com/aristanetworks/goarista v0.0.0-20190712234253-ed1100a1c015/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ= +github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta h1:At9hIZdJW0s9E/fAz28nrz6AmcNlSVucCH796ZteX1M= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= @@ -21,107 +77,353 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= +github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -<<<<<<< HEAD +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U= +github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d h1:VbtIIE3NDC6/aIRUR9FdmRE4l0B5IDgYHiFi8pw0QOc= github.com/confio/ics23/go v0.0.0-20200804135649-a9fbc744ca3d/go.mod h1:E45NqnlpxGnpfTWL/xauN7MRwEE28T4Dd4uraToOaKg= -======= -github.com/confio/ics23/go v0.0.0-20190827163309-7909e7dd24d5 h1:AvLi3VD3ie5Ucps0nmb0VYLiddNOPphQwx9eWRQQs3E= -github.com/confio/ics23/go v0.0.0-20190827163309-7909e7dd24d5/go.mod h1:rWOCtymU+x3jM2Uib0aszytidui3pfpffvjCfNwATaE= -github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e h1:yhvB+Wg9rCnUQvdAx65iIrpqRjh3VGFCFdl779IvRjY= -github.com/confio/ics23/go v0.0.0-20190827163738-67deea06493e/go.mod h1:rWOCtymU+x3jM2Uib0aszytidui3pfpffvjCfNwATaE= ->>>>>>> c0c0388 (rm vendor) +github.com/consensys/bavard v0.1.8-0.20210105233146-c16790d2aa8b/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= +github.com/consensys/goff v0.3.10/go.mod h1:xTldOBEHmFiYS0gPXd3NsaEqZWlnmeWcRLWgD3ba3xc= +github.com/consensys/gurvy v0.3.8/go.mod h1:sN75xnsiD593XnhbhvG2PkOy194pZBzqShWF/kwuW/g= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea h1:j4317fAZh7X6GqbFowYdYdI0L9bwxL07jyPZIdepyZ0= +github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= +github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw= +github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= +github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/gosigar v0.10.4 h1:6jfw75dsoflhBMRdO6QPzQUgLqUYTsQQQRkkcsHsuPo= github.com/elastic/gosigar v0.10.4/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ethereum/go-ethereum v1.9.1 h1:MrdTRvKIa3apdx6NW1azzSgl8BQB1eTBVSUmFhuztaU= github.com/ethereum/go-ethereum v1.9.1/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= +github.com/ethereum/go-ethereum v1.9.25/go.mod h1:vMkFiYLHI4tgPw4k2j4MHKoovchFE8plZ0M9VMk4/oM= +github.com/ethereum/go-ethereum v1.10.0 h1:EBZuZYjk1DHboBJb2YkBN8xItELRY6mtZEiYJKuH0+M= +github.com/ethereum/go-ethereum v1.10.0/go.mod h1:E5e/zvdfUVr91JZ0AwjyuJM3x+no51zZJRz61orLLSk= +github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= +github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= +github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 h1:ur2rms48b3Ep1dxh7aUV2FZEQ8jEVO2F6ILKx8ofkAg= +github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= +github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk= github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= +github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= +github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= +github.com/holiman/uint256 v1.1.1 h1:4JywC80b+/hSfljFlEBLHrrh+CIONLDz9NuFl0af4Mw= +github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huin/goupnp v1.0.0 h1:wg75sLpL6DZqwHQN6E1Cfk6mtfzS45z8OV+ic+DtHRo= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= +github.com/huin/goupnp v1.0.1-0.20200620063722-49508fba0031 h1:HarGZ5h9HD9LgEg1yRVMXyfiw4wlXiLiYM2oMjeA/SE= +github.com/huin/goupnp v1.0.1-0.20200620063722-49508fba0031/go.mod h1:nNs7wvRfN1eKaMknBydLNQU6146XQim8t4h+q90biWo= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= +github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= +github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= +github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= +github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= +github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= +github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= +github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= +github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= github.com/jackpal/go-nat-pmp v1.0.1 h1:i0LektDkO1QlrTm/cSuP+PyBCDnYvjPLGl4LdWEMiaA= github.com/jackpal/go-nat-pmp v1.0.1/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 h1:6OvNmYgJyexcZ3pYbTI9jWx5tHo1Dee/tWbLMfPe2TA= +github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= +github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 h1:S8kWZLXHpcOq3nGAvIs0oDgd4CXxkxE3hkDVRjTu7ro= github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= +github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= +github.com/kilic/bls12-381 v0.0.0-20201226121925-69dacb279461/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= +github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/leanovate/gopter v0.2.8/go.mod h1:gNcbPWNEWRe4lm+bycKqxUYoH5uoVje5SkOJ3uoLer8= +github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= +github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c h1:1RHs3tNxjXGHeul8z2t6H2N2TlAqpKe5yryJztRx4Jk= +github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= +github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= +github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/prometheus/tsdb v0.10.0 h1:If5rVCMTp6W2SiRAQFlbpJNgVlgMEd+U2GZckwK38ic= github.com/prometheus/tsdb v0.10.0/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4= +github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= +github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= +github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I= +github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= +github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 h1:ju5UTwk5Odtm4trrY+4Ca4RMj5OyXbmVeDAVad2T0Jw= github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE= @@ -130,48 +432,272 @@ github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639 github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= +github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tyler-smith/go-bip39 v1.0.0 h1:FOHg9gaQLeBBRbHE/QrTLfEiBHy5pQ/yXzf9JG5pYFM= github.com/tyler-smith/go-bip39 v1.0.0/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= +github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= +github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 h1:1cngl9mPEoITZG8s8cVcUy5CeIBYhEESkOB7m6Gmkrk= github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mobile v0.0.0-20200801112145-973feb4309de/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210105210732-16f7687f5001/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117012304-6edc0a871e69/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= +gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/go/ops_test_data.go b/go/ops_test_data.go index bfae91e7..71f80016 100644 --- a/go/ops_test_data.go +++ b/go/ops_test_data.go @@ -1,4 +1,4 @@ -package proofs +package ics23 import ( "encoding/hex" diff --git a/go/proof_test.go b/go/proof_test.go index c5814a0c..2729c396 100644 --- a/go/proof_test.go +++ b/go/proof_test.go @@ -33,8 +33,8 @@ func TestCheckLeaf(t *testing.T) { cases := CheckLeafTestData() for name, tc := range cases { t.Run(name, func(t *testing.T) { - err := tc.leaf.CheckAgainstSpec(&ProofSpec{LeafSpec: tc.spec}) - if tc.isErr && err == nil { + err := tc.Leaf.CheckAgainstSpec(&ProofSpec{LeafSpec: tc.Spec}) + if tc.IsErr && err == nil { t.Fatal("Expected error, but got nil") } else if !tc.IsErr && err != nil { t.Fatalf("Unexpected error: %v", err) @@ -208,10 +208,10 @@ func TestCheckAgainstSpec(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - err := tc.Proof.CheckAgainstSpec(tc.Spec) - if tc.IsErr && err == nil { + err := tc.proof.CheckAgainstSpec(tc.spec) + if tc.isErr && err == nil { t.Fatal("Expected error, but got nil") - } else if !tc.IsErr && err != nil { + } else if !tc.isErr && err != nil { t.Fatalf("Unexpected error: %v", err) } }) diff --git a/go/proof_test_data.go b/go/proof_test_data.go index 5a93e8ca..3634db4a 100644 --- a/go/proof_test_data.go +++ b/go/proof_test_data.go @@ -1,4 +1,4 @@ -package proofs +package ics23 type ExistenceProofTestStruct struct { Proof *ExistenceProof diff --git a/sol/ics23.go b/sol/ics23.go index d4672f1d..c54c0409 100644 --- a/sol/ics23.go +++ b/sol/ics23.go @@ -1,16 +1,11 @@ package ics23 import ( - - proofs "github.com/confio/proofs/go" + ics23 "github.com/confio/ics23/go" ) -type LeafOp = Struct0 -type InnerOp = Struct1 -type ExistenceProof = Struct2 - -func LeafOpToABI(op *proofs.LeafOp) LeafOp { - return LeafOp{ +func LeafOpToABI(op *ics23.LeafOp) ICS23LeafOp { + return ICS23LeafOp{ Hash: uint8(op.Hash), PrehashKey: uint8(op.PrehashKey), PrehashValue: uint8(op.PrehashValue), @@ -19,20 +14,20 @@ func LeafOpToABI(op *proofs.LeafOp) LeafOp { } } -func InnerOpToABI(op *proofs.InnerOp) InnerOp { - return InnerOp{ +func InnerOpToABI(op *ics23.InnerOp) ICS23InnerOp { + return ICS23InnerOp{ Hash: uint8(op.Hash), Prefix: op.Prefix, Suffix: op.Suffix, } } -func ExistenceProofToABI(op *proofs.ExistenceProof) ExistenceProof { - path := make([]InnerOp, len(op.Path)) +func ExistenceProofToABI(op *ics23.ExistenceProof) ICS23ExistenceProof { + path := make([]ICS23InnerOp, len(op.Path)) for i, op := range op.Path { path[i] = InnerOpToABI(op) } - return Struct2{ + return ICS23ExistenceProof{ Key: op.Key, Value: op.Value, Leaf: LeafOpToABI(op.Leaf), diff --git a/sol/ics23.sol b/sol/ics23.sol index 9c27921b..1e474a34 100644 --- a/sol/ics23.sol +++ b/sol/ics23.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.3; +pragma solidity >=0.8.0; pragma experimental ABIEncoderV2; diff --git a/sol/ics23_contract.go b/sol/ics23_contract.go index 1d8ba8c5..2d68d2a3 100644 --- a/sol/ics23_contract.go +++ b/sol/ics23_contract.go @@ -20,15 +20,38 @@ var ( _ = big.NewInt _ = strings.NewReader _ = ethereum.NotFound - _ = abi.U256 _ = bind.Bind _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription ) +// ICS23ExistenceProof is an auto generated low-level Go binding around an user-defined struct. +type ICS23ExistenceProof struct { + Key []byte + Value []byte + Leaf ICS23LeafOp + Path []ICS23InnerOp +} + +// ICS23InnerOp is an auto generated low-level Go binding around an user-defined struct. +type ICS23InnerOp struct { + Hash uint8 + Prefix []byte + Suffix []byte +} + +// ICS23LeafOp is an auto generated low-level Go binding around an user-defined struct. +type ICS23LeafOp struct { + Hash uint8 + PrehashKey uint8 + PrehashValue uint8 + Len uint8 + Prefix []byte +} + // ICS23ABI is the input ABI used to generate the binding from. -const ICS23ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"bz1\",\"type\":\"bytes\"},{\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"s\",\"type\":\"bytes\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"},{\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyMembership\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"op\",\"type\":\"uint8\"},{\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"},{\"name\":\"suffix\",\"type\":\"bytes\"}],\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"hash\",\"type\":\"uint8\"},{\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"name\":\"len\",\"type\":\"uint8\"},{\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"op\",\"type\":\"tuple\"},{\"name\":\"key\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"hashop\",\"type\":\"uint8\"},{\"name\":\"lengthop\",\"type\":\"uint8\"},{\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}]" +const ICS23ABI = "[{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"bz1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"s\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hashop\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"lengthop\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]" // ICS23FuncSigs maps the 4-byte function signature to its string representation. var ICS23FuncSigs = map[string]string{ @@ -47,7 +70,7 @@ var ICS23FuncSigs = map[string]string{ } // ICS23Bin is the compiled bytecode used for deploying new contracts. -var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200011f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620000bd57805160ff1916838001178555620000ed565b82800160010185558215620000ed579182015b82811115620000ed578251825591602001919060010190620000d0565b50620000fb929150620000ff565b5090565b6200011c91905b80821115620000fb576000815560010162000106565b90565b611276806200012f6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063901d0e1511610071578063901d0e151461014e578063a04f100814610161578063d48f1e4f14610174578063f10e9a9c14610187578063f6747d821461019a578063fd29e20a146101ad576100b4565b806303801174146100b95780632e3098a9146100e25780633d4a397d146101025780634cac70ff1461011557806367bb8e81146101285780637e1fd3bc1461013b575b600080fd5b6100cc6100c7366004610baf565b6101c0565b6040516100d991906110db565b60405180910390f35b6100f56100f0366004610ce2565b6101f0565b6040516100d991906110cd565b6100cc610110366004610dc9565b610249565b6100f5610123366004610b48565b6102a0565b6100cc610136366004610c32565b61031c565b6100cc610149366004610c51565b61040f565b6100f561015c366004610b48565b61046d565b6100f561016f366004610e5d565b6104cd565b6100cc610182366004610baf565b6104dc565b6100f5610195366004610c85565b610695565b6100cc6101a8366004610dfe565b6107b7565b6100cc6101bb366004610bce565b610846565b606060008360058111156101d057fe5b14156101dd5750806101ea565b6101e783836104dc565b90505b92915050565b60006101fc8686610695565b801561021157506102118387600001516102a0565b801561022657506102268287602001516102a0565b801561023f575061023f6102398761040f565b856102a0565b9695505050505050565b606081516000141561025a57600080fd5b6060836020015183856040015160405160200161027993929190611058565b60405160208183030381529060405290506102988460000151826104dc565b949350505050565b600081518351146102b3575060006101ea565b60005b8351811015610312578281815181106102cb57fe5b602001015160f81c60f81b6001600160f81b0319168482815181106102ec57fe5b01602001516001600160f81b0319161461030a5760009150506101ea565b6001016102b6565b5060019392505050565b6060600083600881111561032c57fe5b14156103395750806101ea565b600183600881111561034757fe5b14156103a3578151608081106103905780607f16608017600782901c91508184604051602001610379939291906110a1565b6040516020818303038152906040529150506101ea565b8083604051602001610379929190611085565b60078360088111156103b157fe5b14156103cc5781516020146103c557600080fd5b50806101ea565b60088360088111156103da57fe5b14156103ee5781516040146103c557600080fd5b60405162461bcd60e51b8152600401610406906110ec565b60405180910390fd5b6060806104298360400151846000015185602001516107b7565b905060005b8360600151518110156104665761045c8460600151828151811061044e57fe5b602002602001015183610249565b915060010161042e565b5092915050565b6000805b82518110156103125782818151811061048657fe5b602001015160f81c60f81b6001600160f81b0319168482815181106104a757fe5b01602001516001600160f81b031916146104c55760009150506101ea565b600101610471565b600061023f84878786866101f0565b606060038360058111156104ec57fe5b141561052057818051906020012060405160200161050a9190611030565b60405160208183030381529060405290506101ea565b600183600581111561052e57fe5b1415610594576002826040516105449190611045565b602060405180830381855afa158015610561573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506105849190810190610b2a565b60405160200161050a9190611030565b60048360058111156105a257fe5b14156105ed576003826040516105b89190611045565b602060405180830381855afa1580156105d5573d6000803e3d6000fd5b5050604051805161050a925060601b9060200161101b565b60058360058111156105fb57fe5b141561067d5760036002836040516106139190611045565b602060405180830381855afa158015610630573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052506106539190810190610b2a565b6040516020016106639190611030565b60408051601f19818403018152908290526105b891611045565b60405162461bcd60e51b8152600401610406906110fc565b805160009060058111156106a557fe5b60408401515160058111156106b657fe5b1480156106e45750816020015160058111156106ce57fe5b83604001516020015160058111156106e257fe5b145b80156107115750816040015160058111156106fb57fe5b836040015160400151600581111561070f57fe5b145b801561073e57508160600151600881111561072857fe5b836040015160600151600881111561073c57fe5b145b801561075b575061075b836040015160800151836080015161046d565b610767575060006101ea565b60005b836060015151811015610312576107a08460600151828151811061078a57fe5b602002602001015160200151846080015161046d565b156107af5760009150506101ea565b60010161076a565b60608251600014156107c857600080fd5b81516107d357600080fd5b60606107e88560200151866060015186610846565b905060606107ff8660400151876060015186610846565b905060608660800151838360405160200161081c93929190611058565b604051602081830303815290604052905061083b8760000151826104dc565b979650505050505050565b60608061085385846101c0565b9050606061023f858361031c565b600082601f83011261087257600080fd5b813561088561088082611132565b61110c565b81815260209384019390925082018360005b838110156108c357813586016108ad8882610a07565b8452506020928301929190910190600101610897565b5050505092915050565b80516101ea81611202565b600082601f8301126108e957600080fd5b81356108f761088082611152565b9150808252602083016020830185838301111561091357600080fd5b61091e8382846111ab565b50505092915050565b80356101ea81611219565b80356101ea81611226565b60006080828403121561094f57600080fd5b610959608061110c565b905081356001600160401b0381111561097157600080fd5b61097d848285016108d8565b82525060208201356001600160401b0381111561099957600080fd5b6109a5848285016108d8565b60208301525060408201356001600160401b038111156109c457600080fd5b6109d084828501610a90565b60408301525060608201356001600160401b038111156109ef57600080fd5b6109fb84828501610861565b60608301525092915050565b600060608284031215610a1957600080fd5b610a23606061110c565b90506000610a318484610927565b82525060208201356001600160401b03811115610a4d57600080fd5b610a59848285016108d8565b60208301525060408201356001600160401b03811115610a7857600080fd5b610a84848285016108d8565b60408301525092915050565b600060a08284031215610aa257600080fd5b610aac60a061110c565b90506000610aba8484610927565b8252506020610acb84848301610927565b6020830152506040610adf84828501610927565b6040830152506060610af384828501610932565b60608301525060808201356001600160401b03811115610b1257600080fd5b610b1e848285016108d8565b60808301525092915050565b600060208284031215610b3c57600080fd5b600061029884846108cd565b60008060408385031215610b5b57600080fd5b82356001600160401b03811115610b7157600080fd5b610b7d858286016108d8565b92505060208301356001600160401b03811115610b9957600080fd5b610ba5858286016108d8565b9150509250929050565b60008060408385031215610bc257600080fd5b6000610b7d8585610927565b600080600060608486031215610be357600080fd5b6000610bef8686610927565b9350506020610c0086828701610932565b92505060408401356001600160401b03811115610c1c57600080fd5b610c28868287016108d8565b9150509250925092565b60008060408385031215610c4557600080fd5b6000610b7d8585610932565b600060208284031215610c6357600080fd5b81356001600160401b03811115610c7957600080fd5b6102988482850161093d565b60008060408385031215610c9857600080fd5b82356001600160401b03811115610cae57600080fd5b610cba8582860161093d565b92505060208301356001600160401b03811115610cd657600080fd5b610ba585828601610a90565b600080600080600060a08688031215610cfa57600080fd5b85356001600160401b03811115610d1057600080fd5b610d1c8882890161093d565b95505060208601356001600160401b03811115610d3857600080fd5b610d4488828901610a90565b94505060408601356001600160401b03811115610d6057600080fd5b610d6c888289016108d8565b93505060608601356001600160401b03811115610d8857600080fd5b610d94888289016108d8565b92505060808601356001600160401b03811115610db057600080fd5b610dbc888289016108d8565b9150509295509295909350565b60008060408385031215610ddc57600080fd5b82356001600160401b03811115610df257600080fd5b610b7d85828601610a07565b600080600060608486031215610e1357600080fd5b83356001600160401b03811115610e2957600080fd5b610e3586828701610a90565b93505060208401356001600160401b03811115610e5157600080fd5b610c00868287016108d8565b600080600080600060a08688031215610e7557600080fd5b85356001600160401b03811115610e8b57600080fd5b610e9788828901610a90565b95505060208601356001600160401b03811115610eb357600080fd5b610ebf888289016108d8565b94505060408601356001600160401b03811115610edb57600080fd5b610d6c8882890161093d565b610ef08161118b565b82525050565b610ef0610f0282611190565b6111a2565b610ef0610f02826111a2565b6000610f1e82611179565b610f28818561117d565b9350610f388185602086016111b7565b610f41816111f2565b9093019392505050565b6000610f5682611179565b610f608185611186565b9350610f708185602086016111b7565b9290920192915050565b6000610f8760278361117d565b7f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7081526632b930ba34b7b760c91b602082015260400192915050565b6000610fd060258361117d565b7f696e76616c6964206f7220756e737570706f727465642068617368206f70657281526430ba34b7b760d91b602082015260400192915050565b610ef0611016826111a5565b6111e7565b60006110278284610ef6565b50601401919050565b600061103c8284610f07565b50602001919050565b60006110518284610f4b565b9392505050565b60006110648286610f4b565b91506110708285610f4b565b915061107c8284610f4b565b95945050505050565b6000611091828561100a565b6001820191506102988284610f4b565b60006110ad828661100a565b6001820191506110bd828561100a565b60018201915061107c8284610f4b565b602081016101ea8284610ee7565b602080825281016101e78184610f13565b602080825281016101ea81610f7a565b602080825281016101ea81610fc3565b6040518181016001600160401b038111828210171561112a57600080fd5b604052919050565b60006001600160401b0382111561114857600080fd5b5060209081020190565b60006001600160401b0382111561116857600080fd5b506020601f91909101601f19160190565b5190565b90815260200190565b919050565b151590565b6bffffffffffffffffffffffff191690565b90565b60ff1690565b82818337506000910152565b60005b838110156111d25781810151838201526020016111ba565b838111156111e1576000848401525b50505050565b60006101ea826111fc565b601f01601f191690565b60f81b90565b61120b816111a2565b811461121657600080fd5b50565b6006811061121657600080fd5b6009811061121657600080fdfea365627a7a7230582021e845f87264315bcfe13337b935b2d08290e3ad34917bca35059566373a87896c6578706572696d656e74616cf564736f6c63430005090040" +var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200015d565b828054620000889062000120565b90600052602060002090601f016020900481019282620000ac5760008555620000f7565b82601f10620000c757805160ff1916838001178555620000f7565b82800160010185558215620000f7579182015b82811115620000f7578251825591602001919060010190620000da565b506200010592915062000109565b5090565b5b808211156200010557600081556001016200010a565b6002810460018216806200013557607f821691505b602082108114156200015757634e487b7160e01b600052602260045260246000fd5b50919050565b61132e806200016d6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063901d0e1511610071578063901d0e1514610151578063a04f100814610164578063d48f1e4f14610177578063f10e9a9c1461018a578063f6747d821461019d578063fd29e20a146101b0576100b4565b806303801174146100b95780632e3098a9146100e25780633d4a397d146101055780634cac70ff1461011857806367bb8e811461012b5780637e1fd3bc1461013e575b600080fd5b6100cc6100c7366004610e2b565b6101c3565b6040516100d99190611228565b60405180910390f35b6100f56100f0366004610f6a565b610207565b60405190151581526020016100d9565b6100cc610113366004611035565b610260565b6100f5610126366004610dcb565b6102b7565b6100cc610139366004610ec7565b610365565b6100cc61014c366004610ee2565b6104e4565b6100f561015f366004610dcb565b610563565b6100f56101723660046110e2565b6105f5565b6100cc610185366004610e2b565b610604565b6100f5610198366004610f14565b610861565b6100cc6101ab366004611069565b610a41565b6100cc6101be366004610e6c565b610ad0565b606060008360058111156101e757634e487b7160e01b600052602160045260246000fd5b14156101f4575080610201565b6101fe8383610604565b90505b92915050565b60006102138686610861565b801561022857506102288387600001516102b7565b801561023d575061023d8287602001516102b7565b80156102565750610256610250876104e4565b856102b7565b9695505050505050565b606081516000141561027157600080fd5b6000836020015183856040015160405160200161029093929190611179565b60405160208183030381529060405290506102af846000015182610604565b949350505050565b600081518351146102ca57506000610201565b60005b835181101561035b578281815181106102f657634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b03191684828151811061032b57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191614610349576000915050610201565b80610353816112bb565b9150506102cd565b5060019392505050565b6060600083600881111561038957634e487b7160e01b600052602160045260246000fd5b1415610396575080610201565b60018360088111156103b857634e487b7160e01b600052602160045260246000fd5b1415610414578151608081106104015780607f16608017600782901c915081846040516020016103ea939291906111eb565b604051602081830303815290604052915050610201565b80836040516020016103ea9291906111bc565b600783600881111561043657634e487b7160e01b600052602160045260246000fd5b141561045157815160201461044a57600080fd5b5080610201565b600883600881111561047357634e487b7160e01b600052602160045260246000fd5b141561048757815160401461044a57600080fd5b60405162461bcd60e51b815260206004820152602760248201527f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7060448201526632b930ba34b7b760c91b60648201526084015b60405180910390fd5b606060006104ff836040015184600001518560200151610a41565b905060005b83606001515181101561055a576105468460600151828151811061053857634e487b7160e01b600052603260045260246000fd5b602002602001015183610260565b915080610552816112bb565b915050610504565b5090505b919050565b6000805b825181101561035b5782818151811061059057634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b0319168482815181106105c557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916146105e3576000915050610201565b806105ed816112bb565b915050610567565b60006102568487878686610207565b6060600383600581111561062857634e487b7160e01b600052602160045260246000fd5b141561065e57818051906020012060405160200161064891815260200190565b6040516020818303038152906040529050610201565b600183600581111561068057634e487b7160e01b600052602160045260246000fd5b14156106e857600282604051610696919061115d565b602060405180830381855afa1580156106b3573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106d69190610db3565b60405160200161064891815260200190565b600483600581111561070a57634e487b7160e01b600052602160045260246000fd5b141561076557600382604051610720919061115d565b602060405180830381855afa15801561073d573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff191660208201526034019050610648565b600583600581111561078757634e487b7160e01b600052602160045260246000fd5b141561080b57600360028360405161079f919061115d565b602060405180830381855afa1580156107bc573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107df9190610db3565b6040516020016107f191815260200190565b60408051601f19818403018152908290526107209161115d565b60405162461bcd60e51b815260206004820152602560248201527f696e76616c6964206f7220756e737570706f727465642068617368206f70657260448201526430ba34b7b760d91b60648201526084016104db565b8051600090600581111561088557634e487b7160e01b600052602160045260246000fd5b60408401515160058111156108aa57634e487b7160e01b600052602160045260246000fd5b1480156109005750816020015160058111156108d657634e487b7160e01b600052602160045260246000fd5b83604001516020015160058111156108fe57634e487b7160e01b600052602160045260246000fd5b145b801561095557508160400151600581111561092b57634e487b7160e01b600052602160045260246000fd5b836040015160400151600581111561095357634e487b7160e01b600052602160045260246000fd5b145b80156109aa57508160600151600881111561098057634e487b7160e01b600052602160045260246000fd5b83604001516060015160088111156109a857634e487b7160e01b600052602160045260246000fd5b145b80156109c757506109c78360400151608001518360800151610563565b6109d357506000610201565b60005b83606001515181101561035b57610a2084606001518281518110610a0a57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518460800151610563565b15610a2f576000915050610201565b80610a39816112bb565b9150506109d6565b6060825160001415610a5257600080fd5b8151610a5d57600080fd5b6000610a728560200151866060015186610ad0565b90506000610a898660400151876060015186610ad0565b9050600086608001518383604051602001610aa693929190611179565b6040516020818303038152906040529050610ac5876000015182610604565b979650505050505050565b60606000610ade85846101c3565b905060006102568583610365565b600082601f830112610afc578081fd5b813560206001600160401b03821115610b1757610b176112e2565b610b24818284020161125b565b82815281810190858301855b85811015610b5957610b47898684358b0101610ca7565b84529284019290840190600101610b30565b5090979650505050505050565b600082601f830112610b76578081fd5b81356001600160401b03811115610b8f57610b8f6112e2565b610ba2601f8201601f191660200161125b565b818152846020838601011115610bb6578283fd5b816020850160208301379081016020019190915292915050565b80356006811061055e57600080fd5b80356009811061055e57600080fd5b600060808284031215610bff578081fd5b610c09608061125b565b905081356001600160401b0380821115610c2257600080fd5b610c2e85838601610b66565b83526020840135915080821115610c4457600080fd5b610c5085838601610b66565b60208401526040840135915080821115610c6957600080fd5b610c7585838601610d27565b60408401526060840135915080821115610c8e57600080fd5b50610c9b84828501610aec565b60608301525092915050565b600060608284031215610cb8578081fd5b610cc2606061125b565b9050610ccd82610bd0565b815260208201356001600160401b0380821115610ce957600080fd5b610cf585838601610b66565b60208401526040840135915080821115610d0e57600080fd5b50610d1b84828501610b66565b60408301525092915050565b600060a08284031215610d38578081fd5b610d4260a061125b565b9050610d4d82610bd0565b8152610d5b60208301610bd0565b6020820152610d6c60408301610bd0565b6040820152610d7d60608301610bdf565b606082015260808201356001600160401b03811115610d9b57600080fd5b610da784828501610b66565b60808301525092915050565b600060208284031215610dc4578081fd5b5051919050565b60008060408385031215610ddd578081fd5b82356001600160401b0380821115610df3578283fd5b610dff86838701610b66565b93506020850135915080821115610e14578283fd5b50610e2185828601610b66565b9150509250929050565b60008060408385031215610e3d578182fd5b610e4683610bd0565b915060208301356001600160401b03811115610e60578182fd5b610e2185828601610b66565b600080600060608486031215610e80578081fd5b610e8984610bd0565b9250610e9760208501610bdf565b915060408401356001600160401b03811115610eb1578182fd5b610ebd86828701610b66565b9150509250925092565b60008060408385031215610ed9578182fd5b610e4683610bdf565b600060208284031215610ef3578081fd5b81356001600160401b03811115610f08578182fd5b6102af84828501610bee565b60008060408385031215610f26578182fd5b82356001600160401b0380821115610f3c578384fd5b610f4886838701610bee565b93506020850135915080821115610f5d578283fd5b50610e2185828601610d27565b600080600080600060a08688031215610f81578081fd5b85356001600160401b0380821115610f97578283fd5b610fa389838a01610bee565b96506020880135915080821115610fb8578283fd5b610fc489838a01610d27565b95506040880135915080821115610fd9578283fd5b610fe589838a01610b66565b94506060880135915080821115610ffa578283fd5b61100689838a01610b66565b9350608088013591508082111561101b578283fd5b5061102888828901610b66565b9150509295509295909350565b60008060408385031215611047578182fd5b82356001600160401b038082111561105d578384fd5b610dff86838701610ca7565b60008060006060848603121561107d578283fd5b83356001600160401b0380821115611093578485fd5b61109f87838801610d27565b945060208601359150808211156110b4578384fd5b6110c087838801610b66565b935060408601359150808211156110d5578283fd5b50610ebd86828701610b66565b600080600080600060a086880312156110f9578283fd5b85356001600160401b038082111561110f578485fd5b61111b89838a01610d27565b96506020880135915080821115611130578485fd5b61113c89838a01610b66565b95506040880135915080821115611151578485fd5b610fe589838a01610bee565b6000825161116f81846020870161128b565b9190910192915050565b6000845161118b81846020890161128b565b84519083019061119f81836020890161128b565b84519101906111b281836020880161128b565b0195945050505050565b600060ff60f81b8460f81b16825282516111dd81600185016020870161128b565b919091016001019392505050565b600060ff60f81b808660f81b168352808560f81b16600184015250825161121981600285016020870161128b565b91909101600201949350505050565b600060208252825180602084015261124781604085016020870161128b565b601f01601f19169190910160400192915050565b604051601f8201601f191681016001600160401b0381118282101715611283576112836112e2565b604052919050565b60005b838110156112a657818101518382015260200161128e565b838111156112b5576000848401525b50505050565b60006000198214156112db57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220bef6fd28c4a83952ebfa43369489377a0393358642b37d0a4eb2434c06a3d90964736f6c63430008020033" // DeployICS23 deploys a new Ethereum contract, binding an instance of ICS23 to it. func DeployICS23(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ICS23, error) { @@ -171,7 +194,7 @@ func bindICS23(address common.Address, caller bind.ContractCaller, transactor bi // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_ICS23 *ICS23Raw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { +func (_ICS23 *ICS23Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { return _ICS23.Contract.ICS23Caller.contract.Call(opts, result, method, params...) } @@ -190,7 +213,7 @@ func (_ICS23 *ICS23Raw) Transact(opts *bind.TransactOpts, method string, params // sets the output to result. The result type might be a single field for simple // returns, a slice of interfaces for anonymous returns and a struct for named // returns. -func (_ICS23 *ICS23CallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { +func (_ICS23 *ICS23CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { return _ICS23.Contract.contract.Call(opts, result, method, params...) } @@ -205,338 +228,374 @@ func (_ICS23 *ICS23TransactorRaw) Transact(opts *bind.TransactOpts, method strin return _ICS23.Contract.contract.Transact(opts, method, params...) } -// Struct2 is an auto generated low-level Go binding around an user-defined struct. -type Struct2 struct { - Key []byte - Value []byte - Leaf Struct0 - Path []Struct1 -} +// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// +// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +func (_ICS23 *ICS23Caller) ApplyInner(opts *bind.CallOpts, op ICS23InnerOp, child []byte) ([]byte, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "applyInner", op, child) -// Struct1 is an auto generated low-level Go binding around an user-defined struct. -type Struct1 struct { - Hash uint8 - Prefix []byte - Suffix []byte -} + if err != nil { + return *new([]byte), err + } -// Struct0 is an auto generated low-level Go binding around an user-defined struct. -type Struct0 struct { - Hash uint8 - PrehashKey uint8 - PrehashValue uint8 - Len uint8 - Prefix []byte -} + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. -// -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_ICS23 *ICS23Caller) ApplyInner(opts *bind.CallOpts, op Struct1, child []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "applyInner", op, child) - return *ret0, err } // ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. // -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_ICS23 *ICS23Session) ApplyInner(op Struct1, child []byte) ([]byte, error) { +// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +func (_ICS23 *ICS23Session) ApplyInner(op ICS23InnerOp, child []byte) ([]byte, error) { return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) } // ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. // -// Solidity: function applyInner(Struct1 op, bytes child) constant returns(bytes) -func (_ICS23 *ICS23CallerSession) ApplyInner(op Struct1, child []byte) ([]byte, error) { +// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +func (_ICS23 *ICS23CallerSession) ApplyInner(op ICS23InnerOp, child []byte) ([]byte, error) { return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) } // ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. // -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_ICS23 *ICS23Caller) ApplyLeaf(opts *bind.CallOpts, op Struct0, key []byte, value []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "applyLeaf", op, key, value) - return *ret0, err +// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +func (_ICS23 *ICS23Caller) ApplyLeaf(opts *bind.CallOpts, op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "applyLeaf", op, key, value) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. // -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_ICS23 *ICS23Session) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { +// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +func (_ICS23 *ICS23Session) ApplyLeaf(op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) } // ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. // -// Solidity: function applyLeaf(Struct0 op, bytes key, bytes value) constant returns(bytes) -func (_ICS23 *ICS23CallerSession) ApplyLeaf(op Struct0, key []byte, value []byte) ([]byte, error) { +// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +func (_ICS23 *ICS23CallerSession) ApplyLeaf(op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) } // Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. // -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_ICS23 *ICS23Caller) Calculate(opts *bind.CallOpts, proof Struct2) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "calculate", proof) - return *ret0, err +// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +func (_ICS23 *ICS23Caller) Calculate(opts *bind.CallOpts, proof ICS23ExistenceProof) ([]byte, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "calculate", proof) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. // -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_ICS23 *ICS23Session) Calculate(proof Struct2) ([]byte, error) { +// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +func (_ICS23 *ICS23Session) Calculate(proof ICS23ExistenceProof) ([]byte, error) { return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) } // Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. // -// Solidity: function calculate(Struct2 proof) constant returns(bytes) -func (_ICS23 *ICS23CallerSession) Calculate(proof Struct2) ([]byte, error) { +// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +func (_ICS23 *ICS23CallerSession) Calculate(proof ICS23ExistenceProof) ([]byte, error) { return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) } // CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. // -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_ICS23 *ICS23Caller) CheckAgainstSpec(opts *bind.CallOpts, proof Struct2, spec Struct0) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "checkAgainstSpec", proof, spec) - return *ret0, err +// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +func (_ICS23 *ICS23Caller) CheckAgainstSpec(opts *bind.CallOpts, proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "checkAgainstSpec", proof, spec) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } // CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. // -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_ICS23 *ICS23Session) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { +// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +func (_ICS23 *ICS23Session) CheckAgainstSpec(proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) } // CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. // -// Solidity: function checkAgainstSpec(Struct2 proof, Struct0 spec) constant returns(bool) -func (_ICS23 *ICS23CallerSession) CheckAgainstSpec(proof Struct2, spec Struct0) (bool, error) { +// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +func (_ICS23 *ICS23CallerSession) CheckAgainstSpec(proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) } // DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. // -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHash(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23Caller) DoHash(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "doHash", op, preimage) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "doHash", op, preimage) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. // -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHash(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23Session) DoHash(op uint8, preimage []byte) ([]byte, error) { return _ICS23.Contract.DoHash(&_ICS23.CallOpts, op, preimage) } // DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. // -// Solidity: function doHash(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHash(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23CallerSession) DoHash(op uint8, preimage []byte) ([]byte, error) { return _ICS23.Contract.DoHash(&_ICS23.CallOpts, op, preimage) } // DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. // -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23Caller) DoHashOrNoop(opts *bind.CallOpts, op uint8, preimage []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "doHashOrNoop", op, preimage) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "doHashOrNoop", op, preimage) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. // -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23Session) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { return _ICS23.Contract.DoHashOrNoop(&_ICS23.CallOpts, op, preimage) } // DoHashOrNoop is a free data retrieval call binding the contract method 0x03801174. // -// Solidity: function doHashOrNoop(uint8 op, bytes preimage) constant returns(bytes) +// Solidity: function doHashOrNoop(uint8 op, bytes preimage) pure returns(bytes) func (_ICS23 *ICS23CallerSession) DoHashOrNoop(op uint8, preimage []byte) ([]byte, error) { return _ICS23.Contract.DoHashOrNoop(&_ICS23.CallOpts, op, preimage) } // DoLength is a free data retrieval call binding the contract method 0x67bb8e81. // -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +// Solidity: function doLength(uint8 op, bytes data) pure returns(bytes) func (_ICS23 *ICS23Caller) DoLength(opts *bind.CallOpts, op uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "doLength", op, data) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "doLength", op, data) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // DoLength is a free data retrieval call binding the contract method 0x67bb8e81. // -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +// Solidity: function doLength(uint8 op, bytes data) pure returns(bytes) func (_ICS23 *ICS23Session) DoLength(op uint8, data []byte) ([]byte, error) { return _ICS23.Contract.DoLength(&_ICS23.CallOpts, op, data) } // DoLength is a free data retrieval call binding the contract method 0x67bb8e81. // -// Solidity: function doLength(uint8 op, bytes data) constant returns(bytes) +// Solidity: function doLength(uint8 op, bytes data) pure returns(bytes) func (_ICS23 *ICS23CallerSession) DoLength(op uint8, data []byte) ([]byte, error) { return _ICS23.Contract.DoLength(&_ICS23.CallOpts, op, data) } // EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. // -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +// Solidity: function equalBytes(bytes bz1, bytes bz2) pure returns(bool) func (_ICS23 *ICS23Caller) EqualBytes(opts *bind.CallOpts, bz1 []byte, bz2 []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "equalBytes", bz1, bz2) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "equalBytes", bz1, bz2) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } // EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. // -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +// Solidity: function equalBytes(bytes bz1, bytes bz2) pure returns(bool) func (_ICS23 *ICS23Session) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { return _ICS23.Contract.EqualBytes(&_ICS23.CallOpts, bz1, bz2) } // EqualBytes is a free data retrieval call binding the contract method 0x4cac70ff. // -// Solidity: function equalBytes(bytes bz1, bytes bz2) constant returns(bool) +// Solidity: function equalBytes(bytes bz1, bytes bz2) pure returns(bool) func (_ICS23 *ICS23CallerSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, error) { return _ICS23.Contract.EqualBytes(&_ICS23.CallOpts, bz1, bz2) } // Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. // -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +// Solidity: function hasprefix(bytes s, bytes prefix) pure returns(bool) func (_ICS23 *ICS23Caller) Hasprefix(opts *bind.CallOpts, s []byte, prefix []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "hasprefix", s, prefix) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "hasprefix", s, prefix) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } // Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. // -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +// Solidity: function hasprefix(bytes s, bytes prefix) pure returns(bool) func (_ICS23 *ICS23Session) Hasprefix(s []byte, prefix []byte) (bool, error) { return _ICS23.Contract.Hasprefix(&_ICS23.CallOpts, s, prefix) } // Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. // -// Solidity: function hasprefix(bytes s, bytes prefix) constant returns(bool) +// Solidity: function hasprefix(bytes s, bytes prefix) pure returns(bool) func (_ICS23 *ICS23CallerSession) Hasprefix(s []byte, prefix []byte) (bool, error) { return _ICS23.Contract.Hasprefix(&_ICS23.CallOpts, s, prefix) } // PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. // -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) pure returns(bytes) func (_ICS23 *ICS23Caller) PrepareLeafData(opts *bind.CallOpts, hashop uint8, lengthop uint8, data []byte) ([]byte, error) { - var ( - ret0 = new([]byte) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "prepareLeafData", hashop, lengthop, data) - return *ret0, err + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "prepareLeafData", hashop, lengthop, data) + + if err != nil { + return *new([]byte), err + } + + out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) + + return out0, err + } // PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. // -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) pure returns(bytes) func (_ICS23 *ICS23Session) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { return _ICS23.Contract.PrepareLeafData(&_ICS23.CallOpts, hashop, lengthop, data) } // PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. // -// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) constant returns(bytes) +// Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) pure returns(bytes) func (_ICS23 *ICS23CallerSession) PrepareLeafData(hashop uint8, lengthop uint8, data []byte) ([]byte, error) { return _ICS23.Contract.PrepareLeafData(&_ICS23.CallOpts, hashop, lengthop, data) } // VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. // -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23Caller) VerifyExistence(opts *bind.CallOpts, proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "verifyExistence", proof, spec, root, key, value) - return *ret0, err +// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23Caller) VerifyExistence(opts *bind.CallOpts, proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "verifyExistence", proof, spec, root, key, value) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } // VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. // -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23Session) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { +// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23Session) VerifyExistence(proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) } // VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. // -// Solidity: function verifyExistence(Struct2 proof, Struct0 spec, bytes root, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23CallerSession) VerifyExistence(proof Struct2, spec Struct0, root []byte, key []byte, value []byte) (bool, error) { +// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyExistence(proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) } // VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. // -// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23Caller) VerifyMembership(opts *bind.CallOpts, spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { - var ( - ret0 = new(bool) - ) - out := ret0 - err := _ICS23.contract.Call(opts, out, "verifyMembership", spec, root, proof, key, value) - return *ret0, err +// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23Caller) VerifyMembership(opts *bind.CallOpts, spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "verifyMembership", spec, root, proof, key, value) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + } // VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. // -// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23Session) VerifyMembership(spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { +// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23Session) VerifyMembership(spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) } // VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. // -// Solidity: function verifyMembership(Struct0 spec, bytes root, Struct2 proof, bytes key, bytes value) constant returns(bool) -func (_ICS23 *ICS23CallerSession) VerifyMembership(spec Struct0, root []byte, proof Struct2, key []byte, value []byte) (bool, error) { +// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyMembership(spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) } diff --git a/sol/proofs_test.go b/sol/proofs_test.go index 2c0ecb17..25a39cf2 100644 --- a/sol/proofs_test.go +++ b/sol/proofs_test.go @@ -3,14 +3,14 @@ package ics23 import ( "testing" - proofs "github.com/confio/proofs/go" + ics23 "github.com/confio/ics23/go" "github.com/stretchr/testify/require" ) func TestExistenceProof(t *testing.T) { session := Initialize(t) - cases := proofs.ExistenceProofTestData() + cases := ics23.ExistenceProofTestData() for name, tc := range cases { if tc.Proof.Leaf == nil { @@ -34,7 +34,7 @@ func TestExistenceProof(t *testing.T) { func TestCheckAgainstSpec(t *testing.T) { session := Initialize(t) - cases := proofs.CheckAgainstSpecTestData() + cases := ics23.CheckAgainstSpecTestData() for name, tc := range cases { if tc.Proof.Leaf == nil { From 56c49d1a0f5c40df7ec07b22956b70bbabbce296 Mon Sep 17 00:00:00 2001 From: mconcat Date: Wed, 10 Mar 2021 02:46:18 +0900 Subject: [PATCH 10/10] add nonexistence, left working --- sol/ics23.go | 47 +++++ sol/ics23.sol | 200 +++++++++++++++++- sol/ics23_contract.go | 471 ++++++++++++++++++++++++++++++++++++++---- sol/vectors_test.go | 129 ++++++++++++ 4 files changed, 796 insertions(+), 51 deletions(-) create mode 100644 sol/vectors_test.go diff --git a/sol/ics23.go b/sol/ics23.go index c54c0409..ad93b874 100644 --- a/sol/ics23.go +++ b/sol/ics23.go @@ -1,11 +1,17 @@ package ics23 import ( + "math/big" + ics23 "github.com/confio/ics23/go" ) func LeafOpToABI(op *ics23.LeafOp) ICS23LeafOp { + if op == nil { + return ICS23LeafOp{} + } return ICS23LeafOp{ + Valid: true, Hash: uint8(op.Hash), PrehashKey: uint8(op.PrehashKey), PrehashValue: uint8(op.PrehashValue), @@ -15,7 +21,11 @@ func LeafOpToABI(op *ics23.LeafOp) ICS23LeafOp { } func InnerOpToABI(op *ics23.InnerOp) ICS23InnerOp { + if op == nil { + return ICS23InnerOp{} + } return ICS23InnerOp{ + Valid: true, Hash: uint8(op.Hash), Prefix: op.Prefix, Suffix: op.Suffix, @@ -23,14 +33,51 @@ func InnerOpToABI(op *ics23.InnerOp) ICS23InnerOp { } func ExistenceProofToABI(op *ics23.ExistenceProof) ICS23ExistenceProof { + if op == nil { + return ICS23ExistenceProof{} + } path := make([]ICS23InnerOp, len(op.Path)) for i, op := range op.Path { path[i] = InnerOpToABI(op) } return ICS23ExistenceProof{ + Valid: true, Key: op.Key, Value: op.Value, Leaf: LeafOpToABI(op.Leaf), Path: path, } } + +func NonExistenceProofToABI(op *ics23.NonExistenceProof) ICS23NonExistenceProof { + if op == nil { + return ICS23NonExistenceProof{} + } + return ICS23NonExistenceProof{ + Valid: true, + Key: op.Key, + Left: ExistenceProofToABI(op.Left), + Right: ExistenceProofToABI(op.Right), + } +} + +func ProofSpecToABI(spec *ics23.ProofSpec) ICS23ProofSpec { + childOrder := make([]*big.Int, len(spec.InnerSpec.ChildOrder)) + for i, x := range spec.InnerSpec.ChildOrder { + childOrder[i] = big.NewInt(int64(x)) + } + + return ICS23ProofSpec{ + LeafSpec: LeafOpToABI(spec.LeafSpec), + InnerSpec: ICS23InnerSpec{ + ChildOrder: childOrder, + ChildSize: big.NewInt(int64(spec.InnerSpec.ChildSize)), + MinPrefixLength: big.NewInt(int64(spec.InnerSpec.MinPrefixLength)), + MaxPrefixLength: big.NewInt(int64(spec.InnerSpec.MaxPrefixLength)), + EmptyChild: spec.InnerSpec.EmptyChild, + Hash: uint8(spec.InnerSpec.Hash), + }, + MaxDepth: big.NewInt(int64(spec.MaxDepth)), + MinDepth: big.NewInt(int64(spec.MinDepth)), + } +} diff --git a/sol/ics23.sol b/sol/ics23.sol index 1e474a34..b35d173f 100644 --- a/sol/ics23.sol +++ b/sol/ics23.sol @@ -1,10 +1,5 @@ pragma solidity >=0.8.0; -pragma experimental ABIEncoderV2; - -// Current solidity ICS23 implementation only supports Existence -// NonExistence is planned to be supported, Batch and Compressed are not - contract ICS23 { // Data structures and helper functions @@ -12,13 +7,22 @@ contract ICS23 { enum LengthOp{NO_PREFIX, VAR_PROTO, VAR_RLP, FIXED32_BIG, FIXED32_LITTLE, FIXED64_BIG, FIXED64_LITTLE, REQUIRE_32_BYTES, REQUIRE_64_BYTES} struct ExistenceProof { + bool valid; bytes key; bytes value; LeafOp leaf; InnerOp[] path; } + struct NonExistenceProof { + bool valid; + bytes key; + ExistenceProof left; + ExistenceProof right; + } + struct LeafOp { + bool valid; HashOp hash; HashOp prehash_key; HashOp prehash_value; @@ -27,19 +31,39 @@ contract ICS23 { } struct InnerOp { + bool valid; HashOp hash; bytes prefix; bytes suffix; } + struct ProofSpec { + LeafOp leafSpec; + InnerSpec innerSpec; + uint maxDepth; + uint minDepth; + } + + struct InnerSpec { + uint[] childOrder; + uint childSize; + uint minPrefixLength; + uint maxPrefixLength; + bytes emptyChild; + HashOp hash; + } + LeafOp iavlSpec = LeafOp( + true, HashOp.SHA256, HashOp.NO_HASH, HashOp.SHA256, LengthOp.VAR_PROTO, hex"00" ); - + + enum Ordering {LT, EQ, GT} + function doHashOrNoop(HashOp op, bytes memory preimage) public pure returns (bytes memory) { if (op == HashOp.NO_HASH) { return preimage; @@ -154,6 +178,143 @@ contract ICS23 { ); } + function verifyNonExistence(NonExistenceProof memory proof, ProofSpec memory spec, bytes memory root, bytes memory key) public pure returns (bool) { + if (!proof.left.valid && !proof.right.valid) { + return false; + } + if (proof.left.valid) { + if (!verifyExistence(proof.left, spec.leafSpec, root, proof.left.key, proof.left.value)) { + return false; + } + if (compareBytes(key, proof.right.key) != Ordering.LT) { + return false; + } + } + if (proof.right.valid) { + if (!verifyExistence(proof.right, spec.leafSpec, root, proof.right.key, proof.right.value)) { + return false; + } + if (compareBytes(key, proof.left.key) != Ordering.GT) { + return false; + } + } + + if (!proof.left.valid) { + if (!isLeftMost(spec.innerSpec, proof.right.path)) { + return false; + } + } else if (!proof.right.valid) { + if (!isRightMost(spec.innerSpec, proof.left.path)) { + return false; + } + } else { + if (!isLeftNeighbor(spec.innerSpec, proof.left.path, proof.right.path)) { + return false; + } + } + + return true; + } + + function orderFromPadding(InnerSpec memory spec, InnerOp memory op) public pure returns (uint) { + uint maxBranch = spec.childOrder.length; + + for (uint branch = 0; branch < maxBranch; branch++) { + (uint minPrefix, uint maxPrefix, uint suffix) = getPadding(spec, branch); + if (hasPadding(op, minPrefix, maxPrefix, suffix)) { + return branch; + } + } + + revert(); + } + + function isLeftStep(InnerSpec memory spec, InnerOp memory left, InnerOp memory right) public pure returns (bool) { + uint leftidx = orderFromPadding(spec, left); + uint rightidx = orderFromPadding(spec, right); + return leftidx + 1 == rightidx; + } + + function isLeftMost(InnerSpec memory spec, InnerOp[] memory path) public pure returns (bool) { + (uint minPrefix, uint maxPrefix, uint suffix) = getPadding(spec, 0); + + for (uint i = 0; i < path.length; i++) { + if (!hasPadding(path[i], minPrefix, maxPrefix, suffix)) { + return false; + } + } + return true; + } + + function isRightMost(InnerSpec memory spec, InnerOp[] memory path) public pure returns (bool) { + uint last = spec.childOrder.length - 1; + (uint minPrefix, uint maxPrefix, uint suffix) = getPadding(spec, last); + + for (uint i = 0; i < path.length; i++) { + if (!hasPadding(path[i], minPrefix, maxPrefix, suffix)) { + return false; + } + } + return true; + + } + + function isLeftNeighbor(InnerSpec memory spec, InnerOp[] memory left, InnerOp[] memory right) public pure returns (bool) { + uint top = 1; + for ( ; + equalBytes(left[left.length-top].prefix, right[right.length-top].prefix) && equalBytes(left[left.length-top].suffix, right[right.length-top].suffix); + top++) {} + + InnerOp memory topLeft = left[left.length-top]; + InnerOp memory topRight = right[right.length-top]; + + if (!isLeftStep(spec, topLeft, topRight)) { + return false; + } + + if (!isRightMost(spec, left)) { + return false; + } + + if (!isLeftMost(spec, right)) { + return false; + } + + return true; + } + + function getPosition(uint[] memory order, uint branch) public pure returns (uint) { + require(branch < order.length); + for (uint i = 0; i < order.length; i++) { + if (order[i] == branch) { + return i; + } + } + revert(); + } + + function hasPadding(InnerOp memory op, uint minPrefix, uint maxPrefix, uint suffix) public pure returns (bool) { + if (op.prefix.length < minPrefix) { + return false; + } + if (op.prefix.length > maxPrefix) { + return false; + } + return op.suffix.length == suffix; + } + + function getPadding(InnerSpec memory spec, uint branch) public pure returns (uint, uint, uint) { + uint idx = getPosition(spec.childOrder, branch); + + uint prefix = idx * spec.childSize; + uint minPrefix = prefix + spec.minPrefixLength; + uint maxPrefix = prefix + spec.maxPrefixLength; + + uint suffix = (spec.childOrder.length - 1 - idx) * spec.childSize; + + return (minPrefix, maxPrefix, suffix); + } + function equalBytes(bytes memory bz1, bytes memory bz2) public pure returns (bool) { if (bz1.length != bz2.length) { return false; @@ -165,11 +326,36 @@ contract ICS23 { } return true; } - + + function compareBytes(bytes memory bz1, bytes memory bz2) public pure returns (Ordering) { + for (uint i = 0; i < bz1.length && i < bz2.length; i++) { + if (bz1[i] < bz2[i]) { + return Ordering.LT; + } + if (bz1[i] > bz2[i]) { + return Ordering.GT; + } + } + if (bz1.length == bz2.length) { + return Ordering.EQ; + } + if (bz1.length < bz2.length) { + return Ordering.LT; + } + if (bz1.length > bz2.length) { + return Ordering.GT; + } + revert("should not reach this line"); + } + // ICS23 interface implementation // verifyMembership is synonym for verifyExistence function verifyMembership(LeafOp memory spec, bytes memory root, ExistenceProof memory proof, bytes memory key, bytes memory value) public pure returns (bool) { return verifyExistence(proof, spec, root, key, value); } + + function verifyNonMembership(ProofSpec memory spec, bytes memory root, NonExistenceProof memory proof, bytes memory key) public pure returns (bool) { + return verifyNonExistence(proof, spec, root, key); + } } diff --git a/sol/ics23_contract.go b/sol/ics23_contract.go index 2d68d2a3..6e44d3f3 100644 --- a/sol/ics23_contract.go +++ b/sol/ics23_contract.go @@ -28,6 +28,7 @@ var ( // ICS23ExistenceProof is an auto generated low-level Go binding around an user-defined struct. type ICS23ExistenceProof struct { + Valid bool Key []byte Value []byte Leaf ICS23LeafOp @@ -36,13 +37,25 @@ type ICS23ExistenceProof struct { // ICS23InnerOp is an auto generated low-level Go binding around an user-defined struct. type ICS23InnerOp struct { + Valid bool Hash uint8 Prefix []byte Suffix []byte } +// ICS23InnerSpec is an auto generated low-level Go binding around an user-defined struct. +type ICS23InnerSpec struct { + ChildOrder []*big.Int + ChildSize *big.Int + MinPrefixLength *big.Int + MaxPrefixLength *big.Int + EmptyChild []byte + Hash uint8 +} + // ICS23LeafOp is an auto generated low-level Go binding around an user-defined struct. type ICS23LeafOp struct { + Valid bool Hash uint8 PrehashKey uint8 PrehashValue uint8 @@ -50,27 +63,54 @@ type ICS23LeafOp struct { Prefix []byte } +// ICS23NonExistenceProof is an auto generated low-level Go binding around an user-defined struct. +type ICS23NonExistenceProof struct { + Valid bool + Key []byte + Left ICS23ExistenceProof + Right ICS23ExistenceProof +} + +// ICS23ProofSpec is an auto generated low-level Go binding around an user-defined struct. +type ICS23ProofSpec struct { + LeafSpec ICS23LeafOp + InnerSpec ICS23InnerSpec + MaxDepth *big.Int + MinDepth *big.Int +} + // ICS23ABI is the input ABI used to generate the binding from. -const ICS23ABI = "[{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"bz1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"s\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hashop\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"lengthop\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]" +const ICS23ABI = "[{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"child\",\"type\":\"bytes\"}],\"name\":\"applyInner\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"applyLeaf\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"}],\"name\":\"calculate\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"}],\"name\":\"checkAgainstSpec\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"bz1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"compareBytes\",\"outputs\":[{\"internalType\":\"enumICS23.Ordering\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHash\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"preimage\",\"type\":\"bytes\"}],\"name\":\"doHashOrNoop\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"op\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"doLength\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"bz1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"bz2\",\"type\":\"bytes\"}],\"name\":\"equalBytes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"branch\",\"type\":\"uint256\"}],\"name\":\"getPadding\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"order\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"branch\",\"type\":\"uint256\"}],\"name\":\"getPosition\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"minPrefix\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefix\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"suffix\",\"type\":\"uint256\"}],\"name\":\"hasPadding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"s\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"name\":\"hasprefix\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"isLeftMost\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"left\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"right\",\"type\":\"tuple[]\"}],\"name\":\"isLeftNeighbor\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"left\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"right\",\"type\":\"tuple\"}],\"name\":\"isLeftStep\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"name\":\"isRightMost\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp\",\"name\":\"op\",\"type\":\"tuple\"}],\"name\":\"orderFromPadding\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hashop\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"lengthop\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"prepareLeafData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyExistence\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"}],\"name\":\"verifyMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"left\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"right\",\"type\":\"tuple\"}],\"internalType\":\"structICS23.NonExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"components\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leafSpec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"innerSpec\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"maxDepth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDepth\",\"type\":\"uint256\"}],\"internalType\":\"structICS23.ProofSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"verifyNonExistence\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leafSpec\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256[]\",\"name\":\"childOrder\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"childSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPrefixLength\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"emptyChild\",\"type\":\"bytes\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"}],\"internalType\":\"structICS23.InnerSpec\",\"name\":\"innerSpec\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"maxDepth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minDepth\",\"type\":\"uint256\"}],\"internalType\":\"structICS23.ProofSpec\",\"name\":\"spec\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"root\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"left\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"value\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_key\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"prehash_value\",\"type\":\"uint8\"},{\"internalType\":\"enumICS23.LengthOp\",\"name\":\"len\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.LeafOp\",\"name\":\"leaf\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bool\",\"name\":\"valid\",\"type\":\"bool\"},{\"internalType\":\"enumICS23.HashOp\",\"name\":\"hash\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"prefix\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"suffix\",\"type\":\"bytes\"}],\"internalType\":\"structICS23.InnerOp[]\",\"name\":\"path\",\"type\":\"tuple[]\"}],\"internalType\":\"structICS23.ExistenceProof\",\"name\":\"right\",\"type\":\"tuple\"}],\"internalType\":\"structICS23.NonExistenceProof\",\"name\":\"proof\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"key\",\"type\":\"bytes\"}],\"name\":\"verifyNonMembership\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]" // ICS23FuncSigs maps the 4-byte function signature to its string representation. var ICS23FuncSigs = map[string]string{ - "3d4a397d": "applyInner((uint8,bytes,bytes),bytes)", - "f6747d82": "applyLeaf((uint8,uint8,uint8,uint8,bytes),bytes,bytes)", - "7e1fd3bc": "calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]))", - "f10e9a9c": "checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes))", + "72aaf3df": "applyInner((bool,uint8,bytes,bytes),bytes)", + "af630bb1": "applyLeaf((bool,uint8,uint8,uint8,uint8,bytes),bytes,bytes)", + "e5c341e2": "calculate((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]))", + "9d18a115": "checkAgainstSpec((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,uint8,uint8,uint8,uint8,bytes))", + "d259183d": "compareBytes(bytes,bytes)", "d48f1e4f": "doHash(uint8,bytes)", "03801174": "doHashOrNoop(uint8,bytes)", "67bb8e81": "doLength(uint8,bytes)", "4cac70ff": "equalBytes(bytes,bytes)", + "0d4383f4": "getPadding((uint256[],uint256,uint256,uint256,bytes,uint8),uint256)", + "1e63e931": "getPosition(uint256[],uint256)", + "9c854fbe": "hasPadding((bool,uint8,bytes,bytes),uint256,uint256,uint256)", "901d0e15": "hasprefix(bytes,bytes)", + "951c0b90": "isLeftMost((uint256[],uint256,uint256,uint256,bytes,uint8),(bool,uint8,bytes,bytes)[])", + "2f1cf262": "isLeftNeighbor((uint256[],uint256,uint256,uint256,bytes,uint8),(bool,uint8,bytes,bytes)[],(bool,uint8,bytes,bytes)[])", + "b4219c6f": "isLeftStep((uint256[],uint256,uint256,uint256,bytes,uint8),(bool,uint8,bytes,bytes),(bool,uint8,bytes,bytes))", + "83ead07c": "isRightMost((uint256[],uint256,uint256,uint256,bytes,uint8),(bool,uint8,bytes,bytes)[])", + "356e77ff": "orderFromPadding((uint256[],uint256,uint256,uint256,bytes,uint8),(bool,uint8,bytes,bytes))", "fd29e20a": "prepareLeafData(uint8,uint8,bytes)", - "2e3098a9": "verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),(uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", - "a04f1008": "verifyMembership((uint8,uint8,uint8,uint8,bytes),bytes,(bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]),bytes,bytes)", + "452e99a3": "verifyExistence((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,uint8,uint8,uint8,uint8,bytes),bytes,bytes,bytes)", + "3e339c30": "verifyMembership((bool,uint8,uint8,uint8,uint8,bytes),bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),bytes,bytes)", + "b6446a5f": "verifyNonExistence((bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])),((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256),bytes,bytes)", + "fbc2674d": "verifyNonMembership(((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256),bytes,(bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])),bytes)", } // ICS23Bin is the compiled bytecode used for deploying new contracts. -var ICS23Bin = "0x60016080818152600060a081905260c083905260e083905261016060405261012083815261014082815261010091909152815460ff1916841762ffff001916620100001763ff0000001916630100000017825591929091620000639190816200007a565b5050503480156200007357600080fd5b506200015d565b828054620000889062000120565b90600052602060002090601f016020900481019282620000ac5760008555620000f7565b82601f10620000c757805160ff1916838001178555620000f7565b82800160010185558215620000f7579182015b82811115620000f7578251825591602001919060010190620000da565b506200010592915062000109565b5090565b5b808211156200010557600081556001016200010a565b6002810460018216806200013557607f821691505b602082108114156200015757634e487b7160e01b600052602260045260246000fd5b50919050565b61132e806200016d6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063901d0e1511610071578063901d0e1514610151578063a04f100814610164578063d48f1e4f14610177578063f10e9a9c1461018a578063f6747d821461019d578063fd29e20a146101b0576100b4565b806303801174146100b95780632e3098a9146100e25780633d4a397d146101055780634cac70ff1461011857806367bb8e811461012b5780637e1fd3bc1461013e575b600080fd5b6100cc6100c7366004610e2b565b6101c3565b6040516100d99190611228565b60405180910390f35b6100f56100f0366004610f6a565b610207565b60405190151581526020016100d9565b6100cc610113366004611035565b610260565b6100f5610126366004610dcb565b6102b7565b6100cc610139366004610ec7565b610365565b6100cc61014c366004610ee2565b6104e4565b6100f561015f366004610dcb565b610563565b6100f56101723660046110e2565b6105f5565b6100cc610185366004610e2b565b610604565b6100f5610198366004610f14565b610861565b6100cc6101ab366004611069565b610a41565b6100cc6101be366004610e6c565b610ad0565b606060008360058111156101e757634e487b7160e01b600052602160045260246000fd5b14156101f4575080610201565b6101fe8383610604565b90505b92915050565b60006102138686610861565b801561022857506102288387600001516102b7565b801561023d575061023d8287602001516102b7565b80156102565750610256610250876104e4565b856102b7565b9695505050505050565b606081516000141561027157600080fd5b6000836020015183856040015160405160200161029093929190611179565b60405160208183030381529060405290506102af846000015182610604565b949350505050565b600081518351146102ca57506000610201565b60005b835181101561035b578281815181106102f657634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b03191684828151811061032b57634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191614610349576000915050610201565b80610353816112bb565b9150506102cd565b5060019392505050565b6060600083600881111561038957634e487b7160e01b600052602160045260246000fd5b1415610396575080610201565b60018360088111156103b857634e487b7160e01b600052602160045260246000fd5b1415610414578151608081106104015780607f16608017600782901c915081846040516020016103ea939291906111eb565b604051602081830303815290604052915050610201565b80836040516020016103ea9291906111bc565b600783600881111561043657634e487b7160e01b600052602160045260246000fd5b141561045157815160201461044a57600080fd5b5080610201565b600883600881111561047357634e487b7160e01b600052602160045260246000fd5b141561048757815160401461044a57600080fd5b60405162461bcd60e51b815260206004820152602760248201527f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7060448201526632b930ba34b7b760c91b60648201526084015b60405180910390fd5b606060006104ff836040015184600001518560200151610a41565b905060005b83606001515181101561055a576105468460600151828151811061053857634e487b7160e01b600052603260045260246000fd5b602002602001015183610260565b915080610552816112bb565b915050610504565b5090505b919050565b6000805b825181101561035b5782818151811061059057634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b0319168482815181106105c557634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916146105e3576000915050610201565b806105ed816112bb565b915050610567565b60006102568487878686610207565b6060600383600581111561062857634e487b7160e01b600052602160045260246000fd5b141561065e57818051906020012060405160200161064891815260200190565b6040516020818303038152906040529050610201565b600183600581111561068057634e487b7160e01b600052602160045260246000fd5b14156106e857600282604051610696919061115d565b602060405180830381855afa1580156106b3573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106d69190610db3565b60405160200161064891815260200190565b600483600581111561070a57634e487b7160e01b600052602160045260246000fd5b141561076557600382604051610720919061115d565b602060405180830381855afa15801561073d573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff191660208201526034019050610648565b600583600581111561078757634e487b7160e01b600052602160045260246000fd5b141561080b57600360028360405161079f919061115d565b602060405180830381855afa1580156107bc573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107df9190610db3565b6040516020016107f191815260200190565b60408051601f19818403018152908290526107209161115d565b60405162461bcd60e51b815260206004820152602560248201527f696e76616c6964206f7220756e737570706f727465642068617368206f70657260448201526430ba34b7b760d91b60648201526084016104db565b8051600090600581111561088557634e487b7160e01b600052602160045260246000fd5b60408401515160058111156108aa57634e487b7160e01b600052602160045260246000fd5b1480156109005750816020015160058111156108d657634e487b7160e01b600052602160045260246000fd5b83604001516020015160058111156108fe57634e487b7160e01b600052602160045260246000fd5b145b801561095557508160400151600581111561092b57634e487b7160e01b600052602160045260246000fd5b836040015160400151600581111561095357634e487b7160e01b600052602160045260246000fd5b145b80156109aa57508160600151600881111561098057634e487b7160e01b600052602160045260246000fd5b83604001516060015160088111156109a857634e487b7160e01b600052602160045260246000fd5b145b80156109c757506109c78360400151608001518360800151610563565b6109d357506000610201565b60005b83606001515181101561035b57610a2084606001518281518110610a0a57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518460800151610563565b15610a2f576000915050610201565b80610a39816112bb565b9150506109d6565b6060825160001415610a5257600080fd5b8151610a5d57600080fd5b6000610a728560200151866060015186610ad0565b90506000610a898660400151876060015186610ad0565b9050600086608001518383604051602001610aa693929190611179565b6040516020818303038152906040529050610ac5876000015182610604565b979650505050505050565b60606000610ade85846101c3565b905060006102568583610365565b600082601f830112610afc578081fd5b813560206001600160401b03821115610b1757610b176112e2565b610b24818284020161125b565b82815281810190858301855b85811015610b5957610b47898684358b0101610ca7565b84529284019290840190600101610b30565b5090979650505050505050565b600082601f830112610b76578081fd5b81356001600160401b03811115610b8f57610b8f6112e2565b610ba2601f8201601f191660200161125b565b818152846020838601011115610bb6578283fd5b816020850160208301379081016020019190915292915050565b80356006811061055e57600080fd5b80356009811061055e57600080fd5b600060808284031215610bff578081fd5b610c09608061125b565b905081356001600160401b0380821115610c2257600080fd5b610c2e85838601610b66565b83526020840135915080821115610c4457600080fd5b610c5085838601610b66565b60208401526040840135915080821115610c6957600080fd5b610c7585838601610d27565b60408401526060840135915080821115610c8e57600080fd5b50610c9b84828501610aec565b60608301525092915050565b600060608284031215610cb8578081fd5b610cc2606061125b565b9050610ccd82610bd0565b815260208201356001600160401b0380821115610ce957600080fd5b610cf585838601610b66565b60208401526040840135915080821115610d0e57600080fd5b50610d1b84828501610b66565b60408301525092915050565b600060a08284031215610d38578081fd5b610d4260a061125b565b9050610d4d82610bd0565b8152610d5b60208301610bd0565b6020820152610d6c60408301610bd0565b6040820152610d7d60608301610bdf565b606082015260808201356001600160401b03811115610d9b57600080fd5b610da784828501610b66565b60808301525092915050565b600060208284031215610dc4578081fd5b5051919050565b60008060408385031215610ddd578081fd5b82356001600160401b0380821115610df3578283fd5b610dff86838701610b66565b93506020850135915080821115610e14578283fd5b50610e2185828601610b66565b9150509250929050565b60008060408385031215610e3d578182fd5b610e4683610bd0565b915060208301356001600160401b03811115610e60578182fd5b610e2185828601610b66565b600080600060608486031215610e80578081fd5b610e8984610bd0565b9250610e9760208501610bdf565b915060408401356001600160401b03811115610eb1578182fd5b610ebd86828701610b66565b9150509250925092565b60008060408385031215610ed9578182fd5b610e4683610bdf565b600060208284031215610ef3578081fd5b81356001600160401b03811115610f08578182fd5b6102af84828501610bee565b60008060408385031215610f26578182fd5b82356001600160401b0380821115610f3c578384fd5b610f4886838701610bee565b93506020850135915080821115610f5d578283fd5b50610e2185828601610d27565b600080600080600060a08688031215610f81578081fd5b85356001600160401b0380821115610f97578283fd5b610fa389838a01610bee565b96506020880135915080821115610fb8578283fd5b610fc489838a01610d27565b95506040880135915080821115610fd9578283fd5b610fe589838a01610b66565b94506060880135915080821115610ffa578283fd5b61100689838a01610b66565b9350608088013591508082111561101b578283fd5b5061102888828901610b66565b9150509295509295909350565b60008060408385031215611047578182fd5b82356001600160401b038082111561105d578384fd5b610dff86838701610ca7565b60008060006060848603121561107d578283fd5b83356001600160401b0380821115611093578485fd5b61109f87838801610d27565b945060208601359150808211156110b4578384fd5b6110c087838801610b66565b935060408601359150808211156110d5578283fd5b50610ebd86828701610b66565b600080600080600060a086880312156110f9578283fd5b85356001600160401b038082111561110f578485fd5b61111b89838a01610d27565b96506020880135915080821115611130578485fd5b61113c89838a01610b66565b95506040880135915080821115611151578485fd5b610fe589838a01610bee565b6000825161116f81846020870161128b565b9190910192915050565b6000845161118b81846020890161128b565b84519083019061119f81836020890161128b565b84519101906111b281836020880161128b565b0195945050505050565b600060ff60f81b8460f81b16825282516111dd81600185016020870161128b565b919091016001019392505050565b600060ff60f81b808660f81b168352808560f81b16600184015250825161121981600285016020870161128b565b91909101600201949350505050565b600060208252825180602084015261124781604085016020870161128b565b601f01601f19169190910160400192915050565b604051601f8201601f191681016001600160401b0381118282101715611283576112836112e2565b604052919050565b60005b838110156112a657818101518382015260200161128e565b838111156112b5576000848401525b50505050565b60006000198214156112db57634e487b7160e01b81526011600452602481fd5b5060010190565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220bef6fd28c4a83952ebfa43369489377a0393358642b37d0a4eb2434c06a3d90964736f6c63430008020033" +var ICS23Bin = "0x6001608081815260a0829052600060c081905260e083905261010083815261018060405261014084815261016083815261012091909152825460ff1916851761ff00191690911763ffff0000191663010000001760ff60201b191664010000000017825591929091620000749190816200008b565b5050503480156200008457600080fd5b506200016e565b828054620000999062000131565b90600052602060002090601f016020900481019282620000bd576000855562000108565b82601f10620000d857805160ff191683800117855562000108565b8280016001018555821562000108579182015b8281111562000108578251825591602001919060010190620000eb565b50620001169291506200011a565b5090565b5b808211156200011657600081556001016200011b565b6002810460018216806200014657607f821691505b602082108114156200016857634e487b7160e01b600052602260045260246000fd5b50919050565b612330806200017e6000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c8063901d0e15116100c3578063b6446a5f1161007c578063b6446a5f146102e4578063d259183d146102f7578063d48f1e4f14610317578063e5c341e21461032a578063fbc2674d1461033d578063fd29e20a146103505761014d565b8063901d0e1514610272578063951c0b90146102855780639c854fbe146102985780639d18a115146102ab578063af630bb1146102be578063b4219c6f146102d15761014d565b80633e339c30116101155780633e339c3014610200578063452e99a3146102135780634cac70ff1461022657806367bb8e811461023957806372aaf3df1461024c57806383ead07c1461025f5761014d565b806303801174146101525780630d4383f41461017b5780631e63e931146101a95780632f1cf262146101ca578063356e77ff146101ed575b600080fd5b610165610160366004611a48565b610363565b6040516101729190612187565b60405180910390f35b61018e610189366004611e75565b6103a7565b60408051938452602084019290925290820152606001610172565b6101bc6101b736600461198e565b610438565b604051908152602001610172565b6101dd6101d8366004611d2d565b6104a1565b6040519015158152602001610172565b6101bc6101fb366004611da6565b610682565b6101dd61020e366004611f21565b6106db565b6101dd610221366004611b87565b6106f4565b6101dd6102343660046119e8565b61073f565b610165610247366004611ae4565b6107ed565b61016561025a366004611c52565b61096c565b6101dd61026d366004611cd7565b6109c3565b6101dd6102803660046119e8565b610a60565b6101dd610293366004611cd7565b610af2565b6101dd6102a6366004611c86565b610b68565b6101dd6102b9366004611b31565b610ba5565b6101656102cc366004611ea8565b610d8a565b6101dd6102df366004611dfc565b610e19565b6101dd6102f2366004611f9c565b610e4d565b61030a6103053660046119e8565b610fe2565b60405161017291906121ba565b610165610325366004611a48565b611174565b610165610338366004611aff565b6113d1565b6101dd61034b366004612043565b611450565b61016561035e366004611a89565b611467565b6060600083600581111561038757634e487b7160e01b600052602160045260246000fd5b14156103945750806103a1565b61039e8383611174565b90505b92915050565b6000806000806103bb866000015186610438565b905060008660200151826103cf919061224d565b905060008760400151826103e39190612235565b905060008860600151836103f79190612235565b9050600089602001518560018c6000015151610413919061226c565b61041d919061226c565b610427919061224d565b929a91995091975095505050505050565b60008251821061044757600080fd5b60005b835181101561049b578284828151811061047457634e487b7160e01b600052603260045260246000fd5b602002602001015114156104895790506103a1565b80610493816122b3565b91505061044a565b50600080fd5b600060015b61051e848286516104b7919061226c565b815181106104d557634e487b7160e01b600052603260045260246000fd5b602002602001015160400151848386516104ef919061226c565b8151811061050d57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015161073f565b801561059d575061059d84828651610536919061226c565b8151811061055457634e487b7160e01b600052603260045260246000fd5b6020026020010151606001518483865161056e919061226c565b8151811061058c57634e487b7160e01b600052603260045260246000fd5b60200260200101516060015161073f565b156105b457806105ac816122b3565b9150506104a6565b6000848286516105c4919061226c565b815181106105e257634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848386516105fc919061226c565b8151811061061a57634e487b7160e01b600052603260045260246000fd5b6020026020010151905061062f878383610e19565b61063f576000935050505061067b565b61064987876109c3565b610659576000935050505061067b565b6106638786610af2565b610673576000935050505061067b565b600193505050505b9392505050565b815151600090815b8181101561049b5760008060006106a188856103a7565b9250925092506106b387848484610b68565b156106c55783955050505050506103a1565b50505080806106d3906122b3565b91505061068a565b60006106ea84878786866106f4565b9695505050505050565b60006107008686610ba5565b8015610715575061071583876020015161073f565b801561072a575061072a82876040015161073f565b80156106ea57506106ea61073d876113d1565b855b60008151835114610752575060006103a1565b60005b83518110156107e35782818151811061077e57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b0319168482815181106107b357634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916146107d15760009150506103a1565b806107db816122b3565b915050610755565b5060019392505050565b6060600083600881111561081157634e487b7160e01b600052602160045260246000fd5b141561081e5750806103a1565b600183600881111561084057634e487b7160e01b600052602160045260246000fd5b141561089c578151608081106108895780607f16608017600782901c915081846040516020016108729392919061214a565b6040516020818303038152906040529150506103a1565b808360405160200161087292919061211b565b60078360088111156108be57634e487b7160e01b600052602160045260246000fd5b14156108d95781516020146108d257600080fd5b50806103a1565b60088360088111156108fb57634e487b7160e01b600052602160045260246000fd5b141561090f5781516040146108d257600080fd5b60405162461bcd60e51b815260206004820152602760248201527f696e76616c6964206f7220756e737570706f72746564206c656e677468206f7060448201526632b930ba34b7b760c91b60648201526084015b60405180910390fd5b606081516000141561097d57600080fd5b6000836040015183856060015160405160200161099c939291906120d8565b60405160208183030381529060405290506109bb846020015182611174565b949350505050565b60008060018460000151516109d8919061226c565b905060008060006109e987856103a7565b92509250925060005b8651811015610a5257610a2e878281518110610a1e57634e487b7160e01b600052603260045260246000fd5b6020026020010151858585610b68565b610a40576000955050505050506103a1565b80610a4a816122b3565b9150506109f2565b506001979650505050505050565b6000805b82518110156107e357828181518110610a8d57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b031916848281518110610ac257634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191614610ae05760009150506103a1565b80610aea816122b3565b915050610a64565b600080600080610b038660006103a7565b92509250925060005b8551811015610b5b57610b38868281518110610a1e57634e487b7160e01b600052603260045260246000fd5b610b495760009450505050506103a1565b80610b53816122b3565b915050610b0c565b5060019695505050505050565b6000838560400151511015610b7f575060006109bb565b828560400151511115610b94575060006109bb565b506060840151518114949350505050565b600081602001516005811115610bcb57634e487b7160e01b600052602160045260246000fd5b8360600151602001516005811115610bf357634e487b7160e01b600052602160045260246000fd5b148015610c49575081604001516005811115610c1f57634e487b7160e01b600052602160045260246000fd5b8360600151604001516005811115610c4757634e487b7160e01b600052602160045260246000fd5b145b8015610c9e575081606001516005811115610c7457634e487b7160e01b600052602160045260246000fd5b8360600151606001516005811115610c9c57634e487b7160e01b600052602160045260246000fd5b145b8015610cf3575081608001516008811115610cc957634e487b7160e01b600052602160045260246000fd5b8360600151608001516008811115610cf157634e487b7160e01b600052602160045260246000fd5b145b8015610d105750610d10836060015160a001518360a00151610a60565b610d1c575060006103a1565b60005b8360800151518110156107e357610d6984608001518281518110610d5357634e487b7160e01b600052603260045260246000fd5b6020026020010151604001518460a00151610a60565b15610d785760009150506103a1565b80610d82816122b3565b915050610d1f565b6060825160001415610d9b57600080fd5b8151610da657600080fd5b6000610dbb8560400151866080015186611467565b90506000610dd28660600151876080015186611467565b905060008660a001518383604051602001610def939291906120d8565b6040516020818303038152906040529050610e0e876020015182611174565b979650505050505050565b600080610e268585610682565b90506000610e348685610682565b905080610e42836001612235565b149695505050505050565b604084015151600090158015610e665750606085015151155b15610e73575060006109bb565b60408501515115610ee6576040808601518551602082015192820151610e9a9387916106f4565b610ea6575060006109bb565b6000610eba83876060015160200151610fe2565b6002811115610ed957634e487b7160e01b600052602160045260246000fd5b14610ee6575060006109bb565b60608501515115610f5b576060850151845160208201516040830151610f0f93929187916106f4565b610f1b575060006109bb565b6002610f2f83876040015160200151610fe2565b6002811115610f4e57634e487b7160e01b600052602160045260246000fd5b14610f5b575060006109bb565b604085015151610f8c57610f7b8460200151866060015160800151610af2565b610f87575060006109bb565b610fd7565b606085015151610fac57610f7b84602001518660400151608001516109c3565b610fcb84602001518660400151608001518760600151608001516104a1565b610fd7575060006109bb565b506001949350505050565b6000805b835181108015610ff65750825181105b156110f55782818151811061101b57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b03191684828151811061105057634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b031916101561106f5760009150506103a1565b82818151811061108f57634e487b7160e01b600052603260045260246000fd5b602001015160f81c60f81b6001600160f81b0319168482815181106110c457634e487b7160e01b600052603260045260246000fd5b01602001516001600160f81b03191611156110e35760029150506103a1565b806110ed816122b3565b915050610fe6565b50815183511415611108575060016103a1565b81518351101561111a575060006103a1565b81518351111561112c575060026103a1565b60405162461bcd60e51b815260206004820152601a60248201527f73686f756c64206e6f742072656163682074686973206c696e650000000000006044820152606401610963565b6060600383600581111561119857634e487b7160e01b600052602160045260246000fd5b14156111ce5781805190602001206040516020016111b891815260200190565b60405160208183030381529060405290506103a1565b60018360058111156111f057634e487b7160e01b600052602160045260246000fd5b14156112585760028260405161120691906120bc565b602060405180830381855afa158015611223573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061124691906119d0565b6040516020016111b891815260200190565b600483600581111561127a57634e487b7160e01b600052602160045260246000fd5b14156112d55760038260405161129091906120bc565b602060405180830381855afa1580156112ad573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff1916602082015260340190506111b8565b60058360058111156112f757634e487b7160e01b600052602160045260246000fd5b141561137b57600360028360405161130f91906120bc565b602060405180830381855afa15801561132c573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061134f91906119d0565b60405160200161136191815260200190565b60408051601f1981840301815290829052611290916120bc565b60405162461bcd60e51b815260206004820152602560248201527f696e76616c6964206f7220756e737570706f727465642068617368206f70657260448201526430ba34b7b760d91b6064820152608401610963565b606060006113ec836060015184602001518560400151610d8a565b905060005b836080015151811015611447576114338460800151828151811061142557634e487b7160e01b600052603260045260246000fd5b60200260200101518361096c565b91508061143f816122b3565b9150506113f1565b5090505b919050565b600061145e83868685610e4d565b95945050505050565b606060006114758584610363565b905060006106ea85836107ed565b600082601f830112611493578081fd5b813560206114a86114a383612212565b6121e2565b82815281810190858301855b858110156114dd576114cb898684358b01016116a6565b845292840192908401906001016114b4565b5090979650505050505050565b600082601f8301126114fa578081fd5b8135602061150a6114a383612212565b8281528181019085830183850287018401881015611526578586fd5b855b858110156114dd57813584529284019290840190600101611528565b8035801515811461144b57600080fd5b600082601f830112611564578081fd5b81356001600160401b0381111561157d5761157d6122e4565b611590601f8201601f19166020016121e2565b8181528460208386010111156115a4578283fd5b816020850160208301379081016020019190915292915050565b80356006811061144b57600080fd5b80356009811061144b57600080fd5b600060a082840312156115ed578081fd5b6115f760a06121e2565b905061160282611544565b815260208201356001600160401b038082111561161e57600080fd5b61162a85838601611554565b6020840152604084013591508082111561164357600080fd5b61164f85838601611554565b6040840152606084013591508082111561166857600080fd5b611674858386016117d5565b6060840152608084013591508082111561168d57600080fd5b5061169a84828501611483565b60808301525092915050565b6000608082840312156116b7578081fd5b6116c160806121e2565b90506116cc82611544565b81526116da602083016115be565b602082015260408201356001600160401b03808211156116f957600080fd5b61170585838601611554565b6040840152606084013591508082111561171e57600080fd5b5061172b84828501611554565b60608301525092915050565b600060c08284031215611748578081fd5b61175260c06121e2565b905081356001600160401b038082111561176b57600080fd5b611777858386016114ea565b835260208401356020840152604084013560408401526060840135606084015260808401359150808211156117ab57600080fd5b506117b884828501611554565b6080830152506117ca60a083016115be565b60a082015292915050565b600060c082840312156117e6578081fd5b6117f060c06121e2565b90506117fb82611544565b8152611809602083016115be565b602082015261181a604083016115be565b604082015261182b606083016115be565b606082015261183c608083016115cd565b608082015260a08201356001600160401b0381111561185a57600080fd5b61186684828501611554565b60a08301525092915050565b600060808284031215611883578081fd5b61188d60806121e2565b905061189882611544565b815260208201356001600160401b03808211156118b457600080fd5b6118c085838601611554565b602084015260408401359150808211156118d957600080fd5b6118e5858386016115dc565b604084015260608401359150808211156118fe57600080fd5b5061172b848285016115dc565b60006080828403121561191c578081fd5b61192660806121e2565b905081356001600160401b038082111561193f57600080fd5b61194b858386016117d5565b8352602084013591508082111561196157600080fd5b5061196e84828501611737565b602083015250604082013560408201526060820135606082015292915050565b600080604083850312156119a0578182fd5b82356001600160401b038111156119b5578283fd5b6119c1858286016114ea565b95602094909401359450505050565b6000602082840312156119e1578081fd5b5051919050565b600080604083850312156119fa578182fd5b82356001600160401b0380821115611a10578384fd5b611a1c86838701611554565b93506020850135915080821115611a31578283fd5b50611a3e85828601611554565b9150509250929050565b60008060408385031215611a5a578182fd5b611a63836115be565b915060208301356001600160401b03811115611a7d578182fd5b611a3e85828601611554565b600080600060608486031215611a9d578081fd5b611aa6846115be565b9250611ab4602085016115cd565b915060408401356001600160401b03811115611ace578182fd5b611ada86828701611554565b9150509250925092565b60008060408385031215611af6578182fd5b611a63836115cd565b600060208284031215611b10578081fd5b81356001600160401b03811115611b25578182fd5b6109bb848285016115dc565b60008060408385031215611b43578182fd5b82356001600160401b0380821115611b59578384fd5b611b65868387016115dc565b93506020850135915080821115611b7a578283fd5b50611a3e858286016117d5565b600080600080600060a08688031215611b9e578283fd5b85356001600160401b0380821115611bb4578485fd5b611bc089838a016115dc565b96506020880135915080821115611bd5578485fd5b611be189838a016117d5565b95506040880135915080821115611bf6578485fd5b611c0289838a01611554565b94506060880135915080821115611c17578283fd5b611c2389838a01611554565b93506080880135915080821115611c38578283fd5b50611c4588828901611554565b9150509295509295909350565b60008060408385031215611c64578182fd5b82356001600160401b0380821115611c7a578384fd5b611a1c868387016116a6565b60008060008060808587031215611c9b578182fd5b84356001600160401b03811115611cb0578283fd5b611cbc878288016116a6565b97602087013597506040870135966060013595509350505050565b60008060408385031215611ce9578182fd5b82356001600160401b0380821115611cff578384fd5b611d0b86838701611737565b93506020850135915080821115611d20578283fd5b50611a3e85828601611483565b600080600060608486031215611d41578081fd5b83356001600160401b0380821115611d57578283fd5b611d6387838801611737565b94506020860135915080821115611d78578283fd5b611d8487838801611483565b93506040860135915080821115611d99578283fd5b50611ada86828701611483565b60008060408385031215611db8578182fd5b82356001600160401b0380821115611dce578384fd5b611dda86838701611737565b93506020850135915080821115611def578283fd5b50611a3e858286016116a6565b600080600060608486031215611e10578081fd5b83356001600160401b0380821115611e26578283fd5b611e3287838801611737565b94506020860135915080821115611e47578283fd5b611e53878388016116a6565b93506040860135915080821115611e68578283fd5b50611ada868287016116a6565b60008060408385031215611e87578182fd5b82356001600160401b03811115611e9c578283fd5b6119c185828601611737565b600080600060608486031215611ebc578081fd5b83356001600160401b0380821115611ed2578283fd5b611ede878388016117d5565b94506020860135915080821115611ef3578283fd5b611eff87838801611554565b93506040860135915080821115611f14578283fd5b50611ada86828701611554565b600080600080600060a08688031215611f38578283fd5b85356001600160401b0380821115611f4e578485fd5b611f5a89838a016117d5565b96506020880135915080821115611f6f578485fd5b611f7b89838a01611554565b95506040880135915080821115611f90578485fd5b611c0289838a016115dc565b60008060008060808587031215611fb1578182fd5b84356001600160401b0380821115611fc7578384fd5b611fd388838901611872565b95506020870135915080821115611fe8578384fd5b611ff48883890161190b565b94506040870135915080821115612009578384fd5b61201588838901611554565b9350606087013591508082111561202a578283fd5b5061203787828801611554565b91505092959194509250565b60008060008060808587031215612058578182fd5b84356001600160401b038082111561206e578384fd5b61207a8883890161190b565b9550602087013591508082111561208f578384fd5b61209b88838901611554565b945060408701359150808211156120b0578384fd5b61201588838901611872565b600082516120ce818460208701612283565b9190910192915050565b600084516120ea818460208901612283565b8451908301906120fe818360208901612283565b8451910190612111818360208801612283565b0195945050505050565b600060ff60f81b8460f81b168252825161213c816001850160208701612283565b919091016001019392505050565b600060ff60f81b808660f81b168352808560f81b166001840152508251612178816002850160208701612283565b91909101600201949350505050565b60006020825282518060208401526121a6816040850160208701612283565b601f01601f19169190910160400192915050565b60208101600383106121dc57634e487b7160e01b600052602160045260246000fd5b91905290565b604051601f8201601f191681016001600160401b038111828210171561220a5761220a6122e4565b604052919050565b60006001600160401b0382111561222b5761222b6122e4565b5060209081020190565b60008219821115612248576122486122ce565b500190565b6000816000190483118215151615612267576122676122ce565b500290565b60008282101561227e5761227e6122ce565b500390565b60005b8381101561229e578181015183820152602001612286565b838111156122ad576000848401525b50505050565b60006000198214156122c7576122c76122ce565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea264697066735822122009f5f964c8d1a95c87007ce8be83d929c9b3b7d97d2fe150b7a385d931ce4b2764736f6c63430008020033" // DeployICS23 deploys a new Ethereum contract, binding an instance of ICS23 to it. func DeployICS23(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *ICS23, error) { @@ -228,9 +268,9 @@ func (_ICS23 *ICS23TransactorRaw) Transact(opts *bind.TransactOpts, method strin return _ICS23.Contract.contract.Transact(opts, method, params...) } -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// ApplyInner is a free data retrieval call binding the contract method 0x72aaf3df. // -// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +// Solidity: function applyInner((bool,uint8,bytes,bytes) op, bytes child) pure returns(bytes) func (_ICS23 *ICS23Caller) ApplyInner(opts *bind.CallOpts, op ICS23InnerOp, child []byte) ([]byte, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "applyInner", op, child) @@ -245,23 +285,23 @@ func (_ICS23 *ICS23Caller) ApplyInner(opts *bind.CallOpts, op ICS23InnerOp, chil } -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// ApplyInner is a free data retrieval call binding the contract method 0x72aaf3df. // -// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +// Solidity: function applyInner((bool,uint8,bytes,bytes) op, bytes child) pure returns(bytes) func (_ICS23 *ICS23Session) ApplyInner(op ICS23InnerOp, child []byte) ([]byte, error) { return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) } -// ApplyInner is a free data retrieval call binding the contract method 0x3d4a397d. +// ApplyInner is a free data retrieval call binding the contract method 0x72aaf3df. // -// Solidity: function applyInner((uint8,bytes,bytes) op, bytes child) pure returns(bytes) +// Solidity: function applyInner((bool,uint8,bytes,bytes) op, bytes child) pure returns(bytes) func (_ICS23 *ICS23CallerSession) ApplyInner(op ICS23InnerOp, child []byte) ([]byte, error) { return _ICS23.Contract.ApplyInner(&_ICS23.CallOpts, op, child) } -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// ApplyLeaf is a free data retrieval call binding the contract method 0xaf630bb1. // -// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +// Solidity: function applyLeaf((bool,uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) func (_ICS23 *ICS23Caller) ApplyLeaf(opts *bind.CallOpts, op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "applyLeaf", op, key, value) @@ -276,23 +316,23 @@ func (_ICS23 *ICS23Caller) ApplyLeaf(opts *bind.CallOpts, op ICS23LeafOp, key [] } -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// ApplyLeaf is a free data retrieval call binding the contract method 0xaf630bb1. // -// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +// Solidity: function applyLeaf((bool,uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) func (_ICS23 *ICS23Session) ApplyLeaf(op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) } -// ApplyLeaf is a free data retrieval call binding the contract method 0xf6747d82. +// ApplyLeaf is a free data retrieval call binding the contract method 0xaf630bb1. // -// Solidity: function applyLeaf((uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) +// Solidity: function applyLeaf((bool,uint8,uint8,uint8,uint8,bytes) op, bytes key, bytes value) pure returns(bytes) func (_ICS23 *ICS23CallerSession) ApplyLeaf(op ICS23LeafOp, key []byte, value []byte) ([]byte, error) { return _ICS23.Contract.ApplyLeaf(&_ICS23.CallOpts, op, key, value) } -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// Calculate is a free data retrieval call binding the contract method 0xe5c341e2. // -// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +// Solidity: function calculate((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof) pure returns(bytes) func (_ICS23 *ICS23Caller) Calculate(opts *bind.CallOpts, proof ICS23ExistenceProof) ([]byte, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "calculate", proof) @@ -307,23 +347,23 @@ func (_ICS23 *ICS23Caller) Calculate(opts *bind.CallOpts, proof ICS23ExistencePr } -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// Calculate is a free data retrieval call binding the contract method 0xe5c341e2. // -// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +// Solidity: function calculate((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof) pure returns(bytes) func (_ICS23 *ICS23Session) Calculate(proof ICS23ExistenceProof) ([]byte, error) { return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) } -// Calculate is a free data retrieval call binding the contract method 0x7e1fd3bc. +// Calculate is a free data retrieval call binding the contract method 0xe5c341e2. // -// Solidity: function calculate((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof) pure returns(bytes) +// Solidity: function calculate((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof) pure returns(bytes) func (_ICS23 *ICS23CallerSession) Calculate(proof ICS23ExistenceProof) ([]byte, error) { return _ICS23.Contract.Calculate(&_ICS23.CallOpts, proof) } -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// CheckAgainstSpec is a free data retrieval call binding the contract method 0x9d18a115. // -// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +// Solidity: function checkAgainstSpec((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) func (_ICS23 *ICS23Caller) CheckAgainstSpec(opts *bind.CallOpts, proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "checkAgainstSpec", proof, spec) @@ -338,20 +378,51 @@ func (_ICS23 *ICS23Caller) CheckAgainstSpec(opts *bind.CallOpts, proof ICS23Exis } -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// CheckAgainstSpec is a free data retrieval call binding the contract method 0x9d18a115. // -// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +// Solidity: function checkAgainstSpec((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) func (_ICS23 *ICS23Session) CheckAgainstSpec(proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) } -// CheckAgainstSpec is a free data retrieval call binding the contract method 0xf10e9a9c. +// CheckAgainstSpec is a free data retrieval call binding the contract method 0x9d18a115. // -// Solidity: function checkAgainstSpec((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) +// Solidity: function checkAgainstSpec((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec) pure returns(bool) func (_ICS23 *ICS23CallerSession) CheckAgainstSpec(proof ICS23ExistenceProof, spec ICS23LeafOp) (bool, error) { return _ICS23.Contract.CheckAgainstSpec(&_ICS23.CallOpts, proof, spec) } +// CompareBytes is a free data retrieval call binding the contract method 0xd259183d. +// +// Solidity: function compareBytes(bytes bz1, bytes bz2) pure returns(uint8) +func (_ICS23 *ICS23Caller) CompareBytes(opts *bind.CallOpts, bz1 []byte, bz2 []byte) (uint8, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "compareBytes", bz1, bz2) + + if err != nil { + return *new(uint8), err + } + + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) + + return out0, err + +} + +// CompareBytes is a free data retrieval call binding the contract method 0xd259183d. +// +// Solidity: function compareBytes(bytes bz1, bytes bz2) pure returns(uint8) +func (_ICS23 *ICS23Session) CompareBytes(bz1 []byte, bz2 []byte) (uint8, error) { + return _ICS23.Contract.CompareBytes(&_ICS23.CallOpts, bz1, bz2) +} + +// CompareBytes is a free data retrieval call binding the contract method 0xd259183d. +// +// Solidity: function compareBytes(bytes bz1, bytes bz2) pure returns(uint8) +func (_ICS23 *ICS23CallerSession) CompareBytes(bz1 []byte, bz2 []byte) (uint8, error) { + return _ICS23.Contract.CompareBytes(&_ICS23.CallOpts, bz1, bz2) +} + // DoHash is a free data retrieval call binding the contract method 0xd48f1e4f. // // Solidity: function doHash(uint8 op, bytes preimage) pure returns(bytes) @@ -476,6 +547,101 @@ func (_ICS23 *ICS23CallerSession) EqualBytes(bz1 []byte, bz2 []byte) (bool, erro return _ICS23.Contract.EqualBytes(&_ICS23.CallOpts, bz1, bz2) } +// GetPadding is a free data retrieval call binding the contract method 0x0d4383f4. +// +// Solidity: function getPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, uint256 branch) pure returns(uint256, uint256, uint256) +func (_ICS23 *ICS23Caller) GetPadding(opts *bind.CallOpts, spec ICS23InnerSpec, branch *big.Int) (*big.Int, *big.Int, *big.Int, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "getPadding", spec, branch) + + if err != nil { + return *new(*big.Int), *new(*big.Int), *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + out1 := *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) + out2 := *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) + + return out0, out1, out2, err + +} + +// GetPadding is a free data retrieval call binding the contract method 0x0d4383f4. +// +// Solidity: function getPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, uint256 branch) pure returns(uint256, uint256, uint256) +func (_ICS23 *ICS23Session) GetPadding(spec ICS23InnerSpec, branch *big.Int) (*big.Int, *big.Int, *big.Int, error) { + return _ICS23.Contract.GetPadding(&_ICS23.CallOpts, spec, branch) +} + +// GetPadding is a free data retrieval call binding the contract method 0x0d4383f4. +// +// Solidity: function getPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, uint256 branch) pure returns(uint256, uint256, uint256) +func (_ICS23 *ICS23CallerSession) GetPadding(spec ICS23InnerSpec, branch *big.Int) (*big.Int, *big.Int, *big.Int, error) { + return _ICS23.Contract.GetPadding(&_ICS23.CallOpts, spec, branch) +} + +// GetPosition is a free data retrieval call binding the contract method 0x1e63e931. +// +// Solidity: function getPosition(uint256[] order, uint256 branch) pure returns(uint256) +func (_ICS23 *ICS23Caller) GetPosition(opts *bind.CallOpts, order []*big.Int, branch *big.Int) (*big.Int, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "getPosition", order, branch) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// GetPosition is a free data retrieval call binding the contract method 0x1e63e931. +// +// Solidity: function getPosition(uint256[] order, uint256 branch) pure returns(uint256) +func (_ICS23 *ICS23Session) GetPosition(order []*big.Int, branch *big.Int) (*big.Int, error) { + return _ICS23.Contract.GetPosition(&_ICS23.CallOpts, order, branch) +} + +// GetPosition is a free data retrieval call binding the contract method 0x1e63e931. +// +// Solidity: function getPosition(uint256[] order, uint256 branch) pure returns(uint256) +func (_ICS23 *ICS23CallerSession) GetPosition(order []*big.Int, branch *big.Int) (*big.Int, error) { + return _ICS23.Contract.GetPosition(&_ICS23.CallOpts, order, branch) +} + +// HasPadding is a free data retrieval call binding the contract method 0x9c854fbe. +// +// Solidity: function hasPadding((bool,uint8,bytes,bytes) op, uint256 minPrefix, uint256 maxPrefix, uint256 suffix) pure returns(bool) +func (_ICS23 *ICS23Caller) HasPadding(opts *bind.CallOpts, op ICS23InnerOp, minPrefix *big.Int, maxPrefix *big.Int, suffix *big.Int) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "hasPadding", op, minPrefix, maxPrefix, suffix) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// HasPadding is a free data retrieval call binding the contract method 0x9c854fbe. +// +// Solidity: function hasPadding((bool,uint8,bytes,bytes) op, uint256 minPrefix, uint256 maxPrefix, uint256 suffix) pure returns(bool) +func (_ICS23 *ICS23Session) HasPadding(op ICS23InnerOp, minPrefix *big.Int, maxPrefix *big.Int, suffix *big.Int) (bool, error) { + return _ICS23.Contract.HasPadding(&_ICS23.CallOpts, op, minPrefix, maxPrefix, suffix) +} + +// HasPadding is a free data retrieval call binding the contract method 0x9c854fbe. +// +// Solidity: function hasPadding((bool,uint8,bytes,bytes) op, uint256 minPrefix, uint256 maxPrefix, uint256 suffix) pure returns(bool) +func (_ICS23 *ICS23CallerSession) HasPadding(op ICS23InnerOp, minPrefix *big.Int, maxPrefix *big.Int, suffix *big.Int) (bool, error) { + return _ICS23.Contract.HasPadding(&_ICS23.CallOpts, op, minPrefix, maxPrefix, suffix) +} + // Hasprefix is a free data retrieval call binding the contract method 0x901d0e15. // // Solidity: function hasprefix(bytes s, bytes prefix) pure returns(bool) @@ -507,6 +673,161 @@ func (_ICS23 *ICS23CallerSession) Hasprefix(s []byte, prefix []byte) (bool, erro return _ICS23.Contract.Hasprefix(&_ICS23.CallOpts, s, prefix) } +// IsLeftMost is a free data retrieval call binding the contract method 0x951c0b90. +// +// Solidity: function isLeftMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23Caller) IsLeftMost(opts *bind.CallOpts, spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "isLeftMost", spec, path) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsLeftMost is a free data retrieval call binding the contract method 0x951c0b90. +// +// Solidity: function isLeftMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23Session) IsLeftMost(spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftMost(&_ICS23.CallOpts, spec, path) +} + +// IsLeftMost is a free data retrieval call binding the contract method 0x951c0b90. +// +// Solidity: function isLeftMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23CallerSession) IsLeftMost(spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftMost(&_ICS23.CallOpts, spec, path) +} + +// IsLeftNeighbor is a free data retrieval call binding the contract method 0x2f1cf262. +// +// Solidity: function isLeftNeighbor((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] left, (bool,uint8,bytes,bytes)[] right) pure returns(bool) +func (_ICS23 *ICS23Caller) IsLeftNeighbor(opts *bind.CallOpts, spec ICS23InnerSpec, left []ICS23InnerOp, right []ICS23InnerOp) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "isLeftNeighbor", spec, left, right) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsLeftNeighbor is a free data retrieval call binding the contract method 0x2f1cf262. +// +// Solidity: function isLeftNeighbor((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] left, (bool,uint8,bytes,bytes)[] right) pure returns(bool) +func (_ICS23 *ICS23Session) IsLeftNeighbor(spec ICS23InnerSpec, left []ICS23InnerOp, right []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftNeighbor(&_ICS23.CallOpts, spec, left, right) +} + +// IsLeftNeighbor is a free data retrieval call binding the contract method 0x2f1cf262. +// +// Solidity: function isLeftNeighbor((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] left, (bool,uint8,bytes,bytes)[] right) pure returns(bool) +func (_ICS23 *ICS23CallerSession) IsLeftNeighbor(spec ICS23InnerSpec, left []ICS23InnerOp, right []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftNeighbor(&_ICS23.CallOpts, spec, left, right) +} + +// IsLeftStep is a free data retrieval call binding the contract method 0xb4219c6f. +// +// Solidity: function isLeftStep((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) left, (bool,uint8,bytes,bytes) right) pure returns(bool) +func (_ICS23 *ICS23Caller) IsLeftStep(opts *bind.CallOpts, spec ICS23InnerSpec, left ICS23InnerOp, right ICS23InnerOp) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "isLeftStep", spec, left, right) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsLeftStep is a free data retrieval call binding the contract method 0xb4219c6f. +// +// Solidity: function isLeftStep((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) left, (bool,uint8,bytes,bytes) right) pure returns(bool) +func (_ICS23 *ICS23Session) IsLeftStep(spec ICS23InnerSpec, left ICS23InnerOp, right ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftStep(&_ICS23.CallOpts, spec, left, right) +} + +// IsLeftStep is a free data retrieval call binding the contract method 0xb4219c6f. +// +// Solidity: function isLeftStep((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) left, (bool,uint8,bytes,bytes) right) pure returns(bool) +func (_ICS23 *ICS23CallerSession) IsLeftStep(spec ICS23InnerSpec, left ICS23InnerOp, right ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsLeftStep(&_ICS23.CallOpts, spec, left, right) +} + +// IsRightMost is a free data retrieval call binding the contract method 0x83ead07c. +// +// Solidity: function isRightMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23Caller) IsRightMost(opts *bind.CallOpts, spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "isRightMost", spec, path) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsRightMost is a free data retrieval call binding the contract method 0x83ead07c. +// +// Solidity: function isRightMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23Session) IsRightMost(spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsRightMost(&_ICS23.CallOpts, spec, path) +} + +// IsRightMost is a free data retrieval call binding the contract method 0x83ead07c. +// +// Solidity: function isRightMost((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes)[] path) pure returns(bool) +func (_ICS23 *ICS23CallerSession) IsRightMost(spec ICS23InnerSpec, path []ICS23InnerOp) (bool, error) { + return _ICS23.Contract.IsRightMost(&_ICS23.CallOpts, spec, path) +} + +// OrderFromPadding is a free data retrieval call binding the contract method 0x356e77ff. +// +// Solidity: function orderFromPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) op) pure returns(uint256) +func (_ICS23 *ICS23Caller) OrderFromPadding(opts *bind.CallOpts, spec ICS23InnerSpec, op ICS23InnerOp) (*big.Int, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "orderFromPadding", spec, op) + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// OrderFromPadding is a free data retrieval call binding the contract method 0x356e77ff. +// +// Solidity: function orderFromPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) op) pure returns(uint256) +func (_ICS23 *ICS23Session) OrderFromPadding(spec ICS23InnerSpec, op ICS23InnerOp) (*big.Int, error) { + return _ICS23.Contract.OrderFromPadding(&_ICS23.CallOpts, spec, op) +} + +// OrderFromPadding is a free data retrieval call binding the contract method 0x356e77ff. +// +// Solidity: function orderFromPadding((uint256[],uint256,uint256,uint256,bytes,uint8) spec, (bool,uint8,bytes,bytes) op) pure returns(uint256) +func (_ICS23 *ICS23CallerSession) OrderFromPadding(spec ICS23InnerSpec, op ICS23InnerOp) (*big.Int, error) { + return _ICS23.Contract.OrderFromPadding(&_ICS23.CallOpts, spec, op) +} + // PrepareLeafData is a free data retrieval call binding the contract method 0xfd29e20a. // // Solidity: function prepareLeafData(uint8 hashop, uint8 lengthop, bytes data) pure returns(bytes) @@ -538,9 +859,9 @@ func (_ICS23 *ICS23CallerSession) PrepareLeafData(hashop uint8, lengthop uint8, return _ICS23.Contract.PrepareLeafData(&_ICS23.CallOpts, hashop, lengthop, data) } -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// VerifyExistence is a free data retrieval call binding the contract method 0x452e99a3. // -// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyExistence((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23Caller) VerifyExistence(opts *bind.CallOpts, proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "verifyExistence", proof, spec, root, key, value) @@ -555,23 +876,23 @@ func (_ICS23 *ICS23Caller) VerifyExistence(opts *bind.CallOpts, proof ICS23Exist } -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// VerifyExistence is a free data retrieval call binding the contract method 0x452e99a3. // -// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyExistence((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23Session) VerifyExistence(proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) } -// VerifyExistence is a free data retrieval call binding the contract method 0x2e3098a9. +// VerifyExistence is a free data retrieval call binding the contract method 0x452e99a3. // -// Solidity: function verifyExistence((bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, (uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyExistence((bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, (bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23CallerSession) VerifyExistence(proof ICS23ExistenceProof, spec ICS23LeafOp, root []byte, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyExistence(&_ICS23.CallOpts, proof, spec, root, key, value) } -// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// VerifyMembership is a free data retrieval call binding the contract method 0x3e339c30. // -// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyMembership((bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23Caller) VerifyMembership(opts *bind.CallOpts, spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { var out []interface{} err := _ICS23.contract.Call(opts, &out, "verifyMembership", spec, root, proof, key, value) @@ -586,16 +907,78 @@ func (_ICS23 *ICS23Caller) VerifyMembership(opts *bind.CallOpts, spec ICS23LeafO } -// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// VerifyMembership is a free data retrieval call binding the contract method 0x3e339c30. // -// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyMembership((bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23Session) VerifyMembership(spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) } -// VerifyMembership is a free data retrieval call binding the contract method 0xa04f1008. +// VerifyMembership is a free data retrieval call binding the contract method 0x3e339c30. // -// Solidity: function verifyMembership((uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bytes,bytes,(uint8,uint8,uint8,uint8,bytes),(uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) +// Solidity: function verifyMembership((bool,uint8,uint8,uint8,uint8,bytes) spec, bytes root, (bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]) proof, bytes key, bytes value) pure returns(bool) func (_ICS23 *ICS23CallerSession) VerifyMembership(spec ICS23LeafOp, root []byte, proof ICS23ExistenceProof, key []byte, value []byte) (bool, error) { return _ICS23.Contract.VerifyMembership(&_ICS23.CallOpts, spec, root, proof, key, value) } + +// VerifyNonExistence is a free data retrieval call binding the contract method 0xb6446a5f. +// +// Solidity: function verifyNonExistence((bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, ((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, bytes key) pure returns(bool) +func (_ICS23 *ICS23Caller) VerifyNonExistence(opts *bind.CallOpts, proof ICS23NonExistenceProof, spec ICS23ProofSpec, root []byte, key []byte) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "verifyNonExistence", proof, spec, root, key) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyNonExistence is a free data retrieval call binding the contract method 0xb6446a5f. +// +// Solidity: function verifyNonExistence((bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, ((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, bytes key) pure returns(bool) +func (_ICS23 *ICS23Session) VerifyNonExistence(proof ICS23NonExistenceProof, spec ICS23ProofSpec, root []byte, key []byte) (bool, error) { + return _ICS23.Contract.VerifyNonExistence(&_ICS23.CallOpts, proof, spec, root, key) +} + +// VerifyNonExistence is a free data retrieval call binding the contract method 0xb6446a5f. +// +// Solidity: function verifyNonExistence((bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, ((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, bytes key) pure returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyNonExistence(proof ICS23NonExistenceProof, spec ICS23ProofSpec, root []byte, key []byte) (bool, error) { + return _ICS23.Contract.VerifyNonExistence(&_ICS23.CallOpts, proof, spec, root, key) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0xfbc2674d. +// +// Solidity: function verifyNonMembership(((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, (bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, bytes key) pure returns(bool) +func (_ICS23 *ICS23Caller) VerifyNonMembership(opts *bind.CallOpts, spec ICS23ProofSpec, root []byte, proof ICS23NonExistenceProof, key []byte) (bool, error) { + var out []interface{} + err := _ICS23.contract.Call(opts, &out, "verifyNonMembership", spec, root, proof, key) + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0xfbc2674d. +// +// Solidity: function verifyNonMembership(((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, (bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, bytes key) pure returns(bool) +func (_ICS23 *ICS23Session) VerifyNonMembership(spec ICS23ProofSpec, root []byte, proof ICS23NonExistenceProof, key []byte) (bool, error) { + return _ICS23.Contract.VerifyNonMembership(&_ICS23.CallOpts, spec, root, proof, key) +} + +// VerifyNonMembership is a free data retrieval call binding the contract method 0xfbc2674d. +// +// Solidity: function verifyNonMembership(((bool,uint8,uint8,uint8,uint8,bytes),(uint256[],uint256,uint256,uint256,bytes,uint8),uint256,uint256) spec, bytes root, (bool,bytes,(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[]),(bool,bytes,bytes,(bool,uint8,uint8,uint8,uint8,bytes),(bool,uint8,bytes,bytes)[])) proof, bytes key) pure returns(bool) +func (_ICS23 *ICS23CallerSession) VerifyNonMembership(spec ICS23ProofSpec, root []byte, proof ICS23NonExistenceProof, key []byte) (bool, error) { + return _ICS23.Contract.VerifyNonMembership(&_ICS23.CallOpts, spec, root, proof, key) +} diff --git a/sol/vectors_test.go b/sol/vectors_test.go new file mode 100644 index 00000000..47f88a22 --- /dev/null +++ b/sol/vectors_test.go @@ -0,0 +1,129 @@ +package ics23 + +import ( + "bytes" + "encoding/hex" + "encoding/json" + "fmt" + "io/ioutil" + "path/filepath" + "testing" + + ics23 "github.com/confio/ics23/go" + "github.com/stretchr/testify/require" +) + +// TestVector is what is stored in the file +type TestVector struct { + RootHash string `json:"root"` + Proof string `json:"proof"` + Key string `json:"key"` + Value string `json:"value"` +} + +// RefData is parsed version of everything except the CommitmentProof itself +type RefData struct { + RootHash []byte + Key []byte + Value []byte +} + +func TestVectors(t *testing.T) { + + iavl := filepath.Join("..", "testdata", "iavl") + tendermint := filepath.Join("..", "testdata", "tendermint") + cases := []struct { + dir string + filename string + spec *ics23.ProofSpec + }{ +// {dir: iavl, filename: "exist_left.json", spec: ics23.IavlSpec}, +// {dir: iavl, filename: "exist_right.json", spec: ics23.IavlSpec}, +// {dir: iavl, filename: "exist_middle.json", spec: ics23.IavlSpec}, + {dir: iavl, filename: "nonexist_left.json", spec: ics23.IavlSpec}, + {dir: iavl, filename: "nonexist_right.json", spec: ics23.IavlSpec}, + {dir: iavl, filename: "nonexist_middle.json", spec: ics23.IavlSpec}, + {dir: tendermint, filename: "exist_left.json", spec: ics23.TendermintSpec}, + {dir: tendermint, filename: "exist_right.json", spec: ics23.TendermintSpec}, + {dir: tendermint, filename: "exist_middle.json", spec: ics23.TendermintSpec}, + {dir: tendermint, filename: "nonexist_left.json", spec: ics23.TendermintSpec}, + {dir: tendermint, filename: "nonexist_right.json", spec: ics23.TendermintSpec}, + {dir: tendermint, filename: "nonexist_middle.json", spec: ics23.TendermintSpec}, + } + + session := Initialize(t) + + for _, tc := range cases { + tc := tc + name := fmt.Sprintf("%s/%s", tc.dir, tc.filename) + t.Run(name, func(t *testing.T) { + proof, ref := loadFile(t, tc.dir, tc.filename) + // Test Calculate method + calculatedRoot, err := proof.Calculate() + if err != nil { + t.Fatal("proof.Calculate() returned error") + } + if !bytes.Equal(ref.RootHash, calculatedRoot) { + t.Fatalf("calculated root: %X did not match expected root: %X", calculatedRoot, ref.RootHash) + } + + // Test Verify method + if len(ref.Value) == 0 { + // non-existence + valid, err := session.VerifyNonMembership(ProofSpecToABI(tc.spec), ref.RootHash, NonExistenceProofToABI(proof.GetNonexist()), ref.Key) + require.NoError(t, err) + if !valid { + t.Fatal("Invalid proof") + } + } else { + valid, err := session.VerifyMembership(LeafOpToABI(tc.spec.LeafSpec), ref.RootHash, ExistenceProofToABI(proof.GetExist()), ref.Key, ref.Value) + require.NoError(t, err) + + if !valid { + t.Fatal("Invalid proof") + } + } + }) + } +} + +func loadFile(t *testing.T, dir string, filename string) (*ics23.CommitmentProof, *RefData) { + // load the file into a json struct + name := filepath.Join(dir, filename) + bz, err := ioutil.ReadFile(name) + if err != nil { + t.Fatalf("Read file: %+v", err) + } + var data TestVector + err = json.Unmarshal(bz, &data) + if err != nil { + t.Fatalf("Unmarshal json: %+v", err) + } + + // parse the protobuf object + var proof ics23.CommitmentProof + err = proof.Unmarshal(mustHex(t, data.Proof)) + if err != nil { + t.Fatalf("Unmarshal protobuf: %+v", err) + } + + var ref RefData + ref.RootHash = ics23.CommitmentRoot(mustHex(t, data.RootHash)) + ref.Key = mustHex(t, data.Key) + if data.Value != "" { + ref.Value = mustHex(t, data.Value) + } + + return &proof, &ref +} + +func mustHex(t *testing.T, data string) []byte { + if data == "" { + return nil + } + res, err := hex.DecodeString(data) + if err != nil { + t.Fatalf("decoding hex: %v", err) + } + return res +}