From b46210451939e5284ebec6b1ea106c8a58c82332 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Sun, 8 Oct 2023 01:20:24 -0400 Subject: [PATCH 1/3] chore(deps): bump geth to `v1.13.2` (#1193) --- .../governance/governance_wrapper.abigen.go | 2 +- cosmos/go.mod | 2 +- cosmos/go.sum | 4 +- cosmos/x/evm/genesis_test.go | 22 +- cosmos/x/evm/keeper/keeper.go | 8 +- cosmos/x/evm/keeper/processor_test.go | 4 + cosmos/x/evm/plugins/state/plugin.go | 19 +- e2e/localnet/network/node.go | 3 +- e2e/precompile/polard/start-node.sh | 13 + e2e/testapp/app.go | 5 + e2e/testapp/go.mod | 2 +- e2e/testapp/go.sum | 4 +- eth/core/chain_resources.go | 2 +- eth/core/processor.go | 5 +- eth/core/processor_test.go | 66 +- eth/core/state/mock/state.go | 12 +- eth/core/state/statedb.go | 8 +- eth/core/types/transaction.go | 25 - eth/core/types/transaction_test.go | 90 -- eth/core/vm/mock/statedb.go | 20 - eth/core/vm/mock/statedb.mock.go | 918 ------------------ eth/go.mod | 2 +- eth/go.sum | 4 +- go.work.sum | 220 +---- 24 files changed, 95 insertions(+), 1365 deletions(-) delete mode 100644 eth/core/types/transaction_test.go diff --git a/contracts/bindings/testing/governance/governance_wrapper.abigen.go b/contracts/bindings/testing/governance/governance_wrapper.abigen.go index 472dc6db66..741f06ddbe 100644 --- a/contracts/bindings/testing/governance/governance_wrapper.abigen.go +++ b/contracts/bindings/testing/governance/governance_wrapper.abigen.go @@ -80,7 +80,7 @@ type IGovernanceModuleTallyResult struct { // GovernanceWrapperMetaData contains all meta data concerning the GovernanceWrapper contract. var GovernanceWrapperMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governanceModule\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"bank\",\"outputs\":[{\"internalType\":\"contractIBankModule\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"proposalId\",\"type\":\"uint64\"}],\"name\":\"cancelProposal\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"proposalId\",\"type\":\"uint64\"}],\"name\":\"getProposal\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"typeURL\",\"type\":\"string\"},{\"internalType\":\"uint8[]\",\"name\":\"value\",\"type\":\"uint8[]\"}],\"internalType\":\"structCosmos.CodecAny[]\",\"name\":\"messages\",\"type\":\"tuple[]\"},{\"internalType\":\"int32\",\"name\":\"status\",\"type\":\"int32\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"yesCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"abstainCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"noCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"noWithVetoCount\",\"type\":\"string\"}],\"internalType\":\"structIGovernanceModule.TallyResult\",\"name\":\"finalTallyResult\",\"type\":\"tuple\"},{\"internalType\":\"uint64\",\"name\":\"submitTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"depositEndTime\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"totalDeposit\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"votingStartTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"votingEndTime\",\"type\":\"uint64\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"title\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"summary\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"internalType\":\"structIGovernanceModule.Proposal\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int32\",\"name\":\"proposalStatus\",\"type\":\"int32\"}],\"name\":\"getProposals\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"typeURL\",\"type\":\"string\"},{\"internalType\":\"uint8[]\",\"name\":\"value\",\"type\":\"uint8[]\"}],\"internalType\":\"structCosmos.CodecAny[]\",\"name\":\"messages\",\"type\":\"tuple[]\"},{\"internalType\":\"int32\",\"name\":\"status\",\"type\":\"int32\"},{\"components\":[{\"internalType\":\"string\",\"name\":\"yesCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"abstainCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"noCount\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"noWithVetoCount\",\"type\":\"string\"}],\"internalType\":\"structIGovernanceModule.TallyResult\",\"name\":\"finalTallyResult\",\"type\":\"tuple\"},{\"internalType\":\"uint64\",\"name\":\"submitTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"depositEndTime\",\"type\":\"uint64\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"totalDeposit\",\"type\":\"tuple[]\"},{\"internalType\":\"uint64\",\"name\":\"votingStartTime\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"votingEndTime\",\"type\":\"uint64\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"title\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"summary\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"}],\"internalType\":\"structIGovernanceModule.Proposal[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governanceModule\",\"outputs\":[{\"internalType\":\"contractIGovernanceModule\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"string\",\"name\":\"typeURL\",\"type\":\"string\"},{\"internalType\":\"uint8[]\",\"name\":\"value\",\"type\":\"uint8[]\"}],\"internalType\":\"structCosmos.CodecAny[]\",\"name\":\"messages\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"}],\"internalType\":\"structCosmos.Coin[]\",\"name\":\"initialDeposit\",\"type\":\"tuple[]\"},{\"internalType\":\"address\",\"name\":\"proposer\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"title\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"summary\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"expedited\",\"type\":\"bool\"}],\"internalType\":\"structIGovernanceModule.MsgSubmitProposal\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"denom\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"submit\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"proposalId\",\"type\":\"uint64\"},{\"internalType\":\"int32\",\"name\":\"option\",\"type\":\"int32\"},{\"internalType\":\"string\",\"name\":\"metadata\",\"type\":\"string\"}],\"name\":\"vote\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x60a0604052734381dc2ab14285160c808659aee005d51255add773ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff1681525034801562000057575f80fd5b50604051620027773803806200277783398181016040528101906200007d91906200018e565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000e3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050620001be565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f62000158826200012d565b9050919050565b6200016a816200014c565b811462000175575f80fd5b50565b5f8151905062000188816200015f565b92915050565b5f60208284031215620001a657620001a562000129565b5b5f620001b58482850162000178565b91505092915050565b6080516125a0620001d75f395f61036101526125a05ff3fe608060405260043610610073575f3560e01c806376cdb03b1161004d57806376cdb03b146101215780637752e8e41461014b578063b5828df21461017b578063f1610a28146101b75761007a565b806319f7a0fb1461007e5780632b0a7032146100ba57806337a9a59e146100e45761007a565b3661007a57005b5f80fd5b348015610089575f80fd5b506100a4600480360381019061009f919061095c565b6101f3565b6040516100b191906109e2565b60405180910390f35b3480156100c5575f80fd5b506100ce61029a565b6040516100db9190610a75565b60405180910390f35b3480156100ef575f80fd5b5061010a60048036038101906101059190610a8e565b6102bd565b604051610118929190610ac8565b60405180910390f35b34801561012c575f80fd5b5061013561035f565b6040516101429190610b0f565b60405180910390f35b61016560048036038101906101609190610bda565b610383565b6040516101729190610c67565b60405180910390f35b348015610186575f80fd5b506101a1600480360381019061019c9190610c80565b610508565b6040516101ae919061128f565b60405180910390f35b3480156101c2575f80fd5b506101dd60048036038101906101d89190610a8e565b6105bd565b6040516101ea91906113e8565b60405180910390f35b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166319f7a0fb8585856040518463ffffffff1660e01b81526004016102519392919061145f565b6020604051808303815f875af115801561026d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029191906114c5565b90509392505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f805f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166337a9a59e846040518263ffffffff1660e01b81526004016103179190610c67565b60408051808303815f875af1158015610332573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103569190611504565b91509150915091565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f80600167ffffffffffffffff8111156103a05761039f610838565b5b6040519080825280602002602001820160405280156103d957816020015b6103c6610666565b8152602001906001900390816103be5790505b50905084848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050815f8151811061043357610432611542565b5b60200260200101516020018190525082815f8151811061045657610455611542565b5b60200260200101515f0181815250505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4112572876040518263ffffffff1660e01b81526004016104bd9190611b88565b6020604051808303815f875af11580156104d9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104fd9190611ba8565b915050949350505050565b606061051261067f565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663917c9d9285846040518363ffffffff1660e01b815260040161056e929190611c46565b5f60405180830381865afa158015610588573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906105b091906124ad565b5090508092505050919050565b6105c56106c2565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f1610a28836040518263ffffffff1660e01b815260040161061d9190610c67565b5f60405180830381865afa158015610637573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061065f9190612523565b9050919050565b60405180604001604052805f8152602001606081525090565b6040518060a00160405280606081526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff1681526020015f151581526020015f151581525090565b604051806101a001604052805f67ffffffffffffffff168152602001606081526020015f60030b81526020016106f6610774565b81526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff168152602001606081526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff1681526020016060815260200160608152602001606081526020015f73ffffffffffffffffffffffffffffffffffffffff1681525090565b6040518060800160405280606081526020016060815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f67ffffffffffffffff82169050919050565b6107c9816107ad565b81146107d3575f80fd5b50565b5f813590506107e4816107c0565b92915050565b5f8160030b9050919050565b6107ff816107ea565b8114610809575f80fd5b50565b5f8135905061081a816107f6565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61086e82610828565b810181811067ffffffffffffffff8211171561088d5761088c610838565b5b80604052505050565b5f61089f61079c565b90506108ab8282610865565b919050565b5f67ffffffffffffffff8211156108ca576108c9610838565b5b6108d382610828565b9050602081019050919050565b828183375f83830152505050565b5f6109006108fb846108b0565b610896565b90508281526020810184848401111561091c5761091b610824565b5b6109278482856108e0565b509392505050565b5f82601f83011261094357610942610820565b5b81356109538482602086016108ee565b91505092915050565b5f805f60608486031215610973576109726107a5565b5b5f610980868287016107d6565b93505060206109918682870161080c565b925050604084013567ffffffffffffffff8111156109b2576109b16107a9565b5b6109be8682870161092f565b9150509250925092565b5f8115159050919050565b6109dc816109c8565b82525050565b5f6020820190506109f55f8301846109d3565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f610a3d610a38610a33846109fb565b610a1a565b6109fb565b9050919050565b5f610a4e82610a23565b9050919050565b5f610a5f82610a44565b9050919050565b610a6f81610a55565b82525050565b5f602082019050610a885f830184610a66565b92915050565b5f60208284031215610aa357610aa26107a5565b5b5f610ab0848285016107d6565b91505092915050565b610ac2816107ad565b82525050565b5f604082019050610adb5f830185610ab9565b610ae86020830184610ab9565b9392505050565b5f610af982610a44565b9050919050565b610b0981610aef565b82525050565b5f602082019050610b225f830184610b00565b92915050565b5f80fd5b5f60e08284031215610b4157610b40610b28565b5b81905092915050565b5f80fd5b5f80fd5b5f8083601f840112610b6757610b66610820565b5b8235905067ffffffffffffffff811115610b8457610b83610b4a565b5b602083019150836001820283011115610ba057610b9f610b4e565b5b9250929050565b5f819050919050565b610bb981610ba7565b8114610bc3575f80fd5b50565b5f81359050610bd481610bb0565b92915050565b5f805f8060608587031215610bf257610bf16107a5565b5b5f85013567ffffffffffffffff811115610c0f57610c0e6107a9565b5b610c1b87828801610b2c565b945050602085013567ffffffffffffffff811115610c3c57610c3b6107a9565b5b610c4887828801610b52565b93509350506040610c5b87828801610bc6565b91505092959194509250565b5f602082019050610c7a5f830184610ab9565b92915050565b5f60208284031215610c9557610c946107a5565b5b5f610ca28482850161080c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b610cdd816107ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610d43578082015181840152602081019050610d28565b5f8484015250505050565b5f610d5882610d0c565b610d628185610d16565b9350610d72818560208601610d26565b610d7b81610828565b840191505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f60ff82169050919050565b610dc481610daf565b82525050565b5f610dd58383610dbb565b60208301905092915050565b5f602082019050919050565b5f610df782610d86565b610e018185610d90565b9350610e0c83610da0565b805f5b83811015610e3c578151610e238882610dca565b9750610e2e83610de1565b925050600181019050610e0f565b5085935050505092915050565b5f604083015f8301518482035f860152610e638282610d4e565b91505060208301518482036020860152610e7d8282610ded565b9150508091505092915050565b5f610e958383610e49565b905092915050565b5f602082019050919050565b5f610eb382610ce3565b610ebd8185610ced565b935083602082028501610ecf85610cfd565b805f5b85811015610f0a5784840389528151610eeb8582610e8a565b9450610ef683610e9d565b925060208a01995050600181019050610ed2565b50829750879550505050505092915050565b610f25816107ea565b82525050565b5f608083015f8301518482035f860152610f458282610d4e565b91505060208301518482036020860152610f5f8282610d4e565b91505060408301518482036040860152610f798282610d4e565b91505060608301518482036060860152610f938282610d4e565b9150508091505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b610fd281610ba7565b82525050565b5f604083015f830151610fed5f860182610fc9565b50602083015184820360208601526110058282610d4e565b9150508091505092915050565b5f61101d8383610fd8565b905092915050565b5f602082019050919050565b5f61103b82610fa0565b6110458185610faa565b93508360208202850161105785610fba565b805f5b8581101561109257848403895281516110738582611012565b945061107e83611025565b925060208a0199505060018101905061105a565b50829750879550505050505092915050565b5f6110ae826109fb565b9050919050565b6110be816110a4565b82525050565b5f6101a083015f8301516110da5f860182610cd4565b50602083015184820360208601526110f28282610ea9565b91505060408301516111076040860182610f1c565b506060830151848203606086015261111f8282610f2b565b91505060808301516111346080860182610cd4565b5060a083015161114760a0860182610cd4565b5060c083015184820360c086015261115f8282611031565b91505060e083015161117460e0860182610cd4565b50610100830151611189610100860182610cd4565b506101208301518482036101208601526111a38282610d4e565b9150506101408301518482036101408601526111bf8282610d4e565b9150506101608301518482036101608601526111db8282610d4e565b9150506101808301516111f26101808601826110b5565b508091505092915050565b5f61120883836110c4565b905092915050565b5f602082019050919050565b5f61122682610cab565b6112308185610cb5565b93508360208202850161124285610cc5565b805f5b8581101561127d578484038952815161125e85826111fd565b945061126983611210565b925060208a01995050600181019050611245565b50829750879550505050505092915050565b5f6020820190508181035f8301526112a7818461121c565b905092915050565b5f6101a083015f8301516112c55f860182610cd4565b50602083015184820360208601526112dd8282610ea9565b91505060408301516112f26040860182610f1c565b506060830151848203606086015261130a8282610f2b565b915050608083015161131f6080860182610cd4565b5060a083015161133260a0860182610cd4565b5060c083015184820360c086015261134a8282611031565b91505060e083015161135f60e0860182610cd4565b50610100830151611374610100860182610cd4565b5061012083015184820361012086015261138e8282610d4e565b9150506101408301518482036101408601526113aa8282610d4e565b9150506101608301518482036101608601526113c68282610d4e565b9150506101808301516113dd6101808601826110b5565b508091505092915050565b5f6020820190508181035f83015261140081846112af565b905092915050565b611411816107ea565b82525050565b5f82825260208201905092915050565b5f61143182610d0c565b61143b8185611417565b935061144b818560208601610d26565b61145481610828565b840191505092915050565b5f6060820190506114725f830186610ab9565b61147f6020830185611408565b81810360408301526114918184611427565b9050949350505050565b6114a4816109c8565b81146114ae575f80fd5b50565b5f815190506114bf8161149b565b92915050565b5f602082840312156114da576114d96107a5565b5b5f6114e7848285016114b1565b91505092915050565b5f815190506114fe816107c0565b92915050565b5f806040838503121561151a576115196107a5565b5b5f611527858286016114f0565b9250506020611538858286016114f0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f80fd5b5f80fd5b5f80fd5b5f808335600160200384360303811261159757611596611577565b5b83810192508235915060208301925067ffffffffffffffff8211156115bf576115be61156f565b5b6020820236038313156115d5576115d4611573565b5b509250929050565b5f819050919050565b5f808335600160200384360303811261160257611601611577565b5b83810192508235915060208301925067ffffffffffffffff82111561162a5761162961156f565b5b6001820236038313156116405761163f611573565b5b509250929050565b5f6116538385610d16565b93506116608385846108e0565b61166983610828565b840190509392505050565b5f80833560016020038436030381126116905761168f611577565b5b83810192508235915060208301925067ffffffffffffffff8211156116b8576116b761156f565b5b6020820236038313156116ce576116cd611573565b5b509250929050565b5f819050919050565b6116e881610daf565b81146116f2575f80fd5b50565b5f81359050611703816116df565b92915050565b5f61171760208401846116f5565b905092915050565b5f602082019050919050565b5f6117368385610d90565b9350611741826116d6565b805f5b85811015611779576117568284611709565b6117608882610dca565b975061176b8361171f565b925050600181019050611744565b5085925050509392505050565b5f604083016117975f8401846115e6565b8583035f8701526117a9838284611648565b925050506117ba6020840184611674565b85830360208701526117cd83828461172b565b925050508091505092915050565b5f6117e68383611786565b905092915050565b5f8235600160400383360303811261180957611808611577565b5b82810191505092915050565b5f602082019050919050565b5f61182c8385610ced565b93508360208402850161183e846115dd565b805f5b8781101561188157848403895261185882846117ee565b61186285826117db565b945061186d83611815565b925060208a01995050600181019050611841565b50829750879450505050509392505050565b5f80833560016020038436030381126118af576118ae611577565b5b83810192508235915060208301925067ffffffffffffffff8211156118d7576118d661156f565b5b6020820236038313156118ed576118ec611573565b5b509250929050565b5f819050919050565b5f61190c6020840184610bc6565b905092915050565b5f604083016119255f8401846118fe565b6119315f860182610fc9565b5061193f60208401846115e6565b8583036020870152611952838284611648565b925050508091505092915050565b5f61196b8383611914565b905092915050565b5f8235600160400383360303811261198e5761198d611577565b5b82810191505092915050565b5f602082019050919050565b5f6119b18385610faa565b9350836020840285016119c3846118f5565b805f5b87811015611a065784840389526119dd8284611973565b6119e78582611960565b94506119f28361199a565b925060208a019950506001810190506119c6565b50829750879450505050509392505050565b611a21816110a4565b8114611a2b575f80fd5b50565b5f81359050611a3c81611a18565b92915050565b5f611a506020840184611a2e565b905092915050565b5f81359050611a668161149b565b92915050565b5f611a7a6020840184611a58565b905092915050565b611a8b816109c8565b82525050565b5f60e08301611aa25f84018461157b565b8583035f870152611ab4838284611821565b92505050611ac56020840184611893565b8583036020870152611ad88382846119a6565b92505050611ae96040840184611a42565b611af660408601826110b5565b50611b0460608401846115e6565b8583036060870152611b17838284611648565b92505050611b2860808401846115e6565b8583036080870152611b3b838284611648565b92505050611b4c60a08401846115e6565b85830360a0870152611b5f838284611648565b92505050611b7060c0840184611a6c565b611b7d60c0860182611a82565b508091505092915050565b5f6020820190508181035f830152611ba08184611a91565b905092915050565b5f60208284031215611bbd57611bbc6107a5565b5b5f611bca848285016114f0565b91505092915050565b5f60a083015f8301518482035f860152611bed8282610d4e565b9150506020830151611c026020860182610cd4565b506040830151611c156040860182610cd4565b506060830151611c286060860182611a82565b506080830151611c3b6080860182611a82565b508091505092915050565b5f604082019050611c595f830185611408565b8181036020830152611c6b8184611bd3565b90509392505050565b5f67ffffffffffffffff821115611c8e57611c8d610838565b5b602082029050602081019050919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff821115611cc157611cc0610838565b5b602082029050602081019050919050565b5f611ce4611cdf846108b0565b610896565b905082815260208101848484011115611d0057611cff610824565b5b611d0b848285610d26565b509392505050565b5f82601f830112611d2757611d26610820565b5b8151611d37848260208601611cd2565b91505092915050565b5f67ffffffffffffffff821115611d5a57611d59610838565b5b602082029050602081019050919050565b5f81519050611d79816116df565b92915050565b5f611d91611d8c84611d40565b610896565b90508083825260208201905060208402830185811115611db457611db3610b4e565b5b835b81811015611ddd5780611dc98882611d6b565b845260208401935050602081019050611db6565b5050509392505050565b5f82601f830112611dfb57611dfa610820565b5b8151611e0b848260208601611d7f565b91505092915050565b5f60408284031215611e2957611e28611c9f565b5b611e336040610896565b90505f82015167ffffffffffffffff811115611e5257611e51611ca3565b5b611e5e84828501611d13565b5f83015250602082015167ffffffffffffffff811115611e8157611e80611ca3565b5b611e8d84828501611de7565b60208301525092915050565b5f611eab611ea684611ca7565b610896565b90508083825260208201905060208402830185811115611ece57611ecd610b4e565b5b835b81811015611f1557805167ffffffffffffffff811115611ef357611ef2610820565b5b808601611f008982611e14565b85526020850194505050602081019050611ed0565b5050509392505050565b5f82601f830112611f3357611f32610820565b5b8151611f43848260208601611e99565b91505092915050565b5f81519050611f5a816107f6565b92915050565b5f60808284031215611f7557611f74611c9f565b5b611f7f6080610896565b90505f82015167ffffffffffffffff811115611f9e57611f9d611ca3565b5b611faa84828501611d13565b5f83015250602082015167ffffffffffffffff811115611fcd57611fcc611ca3565b5b611fd984828501611d13565b602083015250604082015167ffffffffffffffff811115611ffd57611ffc611ca3565b5b61200984828501611d13565b604083015250606082015167ffffffffffffffff81111561202d5761202c611ca3565b5b61203984828501611d13565b60608301525092915050565b5f67ffffffffffffffff82111561205f5761205e610838565b5b602082029050602081019050919050565b5f8151905061207e81610bb0565b92915050565b5f6040828403121561209957612098611c9f565b5b6120a36040610896565b90505f6120b284828501612070565b5f83015250602082015167ffffffffffffffff8111156120d5576120d4611ca3565b5b6120e184828501611d13565b60208301525092915050565b5f6120ff6120fa84612045565b610896565b9050808382526020820190506020840283018581111561212257612121610b4e565b5b835b8181101561216957805167ffffffffffffffff81111561214757612146610820565b5b8086016121548982612084565b85526020850194505050602081019050612124565b5050509392505050565b5f82601f83011261218757612186610820565b5b81516121978482602086016120ed565b91505092915050565b5f815190506121ae81611a18565b92915050565b5f6101a082840312156121ca576121c9611c9f565b5b6121d56101a0610896565b90505f6121e4848285016114f0565b5f83015250602082015167ffffffffffffffff81111561220757612206611ca3565b5b61221384828501611f1f565b602083015250604061222784828501611f4c565b604083015250606082015167ffffffffffffffff81111561224b5761224a611ca3565b5b61225784828501611f60565b606083015250608061226b848285016114f0565b60808301525060a061227f848285016114f0565b60a08301525060c082015167ffffffffffffffff8111156122a3576122a2611ca3565b5b6122af84828501612173565b60c08301525060e06122c3848285016114f0565b60e0830152506101006122d8848285016114f0565b6101008301525061012082015167ffffffffffffffff8111156122fe576122fd611ca3565b5b61230a84828501611d13565b6101208301525061014082015167ffffffffffffffff8111156123305761232f611ca3565b5b61233c84828501611d13565b6101408301525061016082015167ffffffffffffffff81111561236257612361611ca3565b5b61236e84828501611d13565b61016083015250610180612384848285016121a0565b6101808301525092915050565b5f6123a361239e84611c74565b610896565b905080838252602082019050602084028301858111156123c6576123c5610b4e565b5b835b8181101561240d57805167ffffffffffffffff8111156123eb576123ea610820565b5b8086016123f889826121b4565b855260208501945050506020810190506123c8565b5050509392505050565b5f82601f83011261242b5761242a610820565b5b815161243b848260208601612391565b91505092915050565b5f6040828403121561245957612458611c9f565b5b6124636040610896565b90505f82015167ffffffffffffffff81111561248257612481611ca3565b5b61248e84828501611d13565b5f8301525060206124a1848285016114f0565b60208301525092915050565b5f80604083850312156124c3576124c26107a5565b5b5f83015167ffffffffffffffff8111156124e0576124df6107a9565b5b6124ec85828601612417565b925050602083015167ffffffffffffffff81111561250d5761250c6107a9565b5b61251985828601612444565b9150509250929050565b5f60208284031215612538576125376107a5565b5b5f82015167ffffffffffffffff811115612555576125546107a9565b5b612561848285016121b4565b9150509291505056fea2646970667358221220554dc2c37553bc0c3484f8e62c856c95748dbeda5dedd2502876b8010ddf6a2264736f6c63430008150033", + Bin: "0x60a0604052734381dc2ab14285160c808659aee005d51255add773ffffffffffffffffffffffffffffffffffffffff1660809073ffffffffffffffffffffffffffffffffffffffff1681525034801562000057575f80fd5b50604051620027773803806200277783398181016040528101906200007d91906200018e565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603620000e3576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050620001be565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f62000158826200012d565b9050919050565b6200016a816200014c565b811462000175575f80fd5b50565b5f8151905062000188816200015f565b92915050565b5f60208284031215620001a657620001a562000129565b5b5f620001b58482850162000178565b91505092915050565b6080516125a0620001d75f395f61036101526125a05ff3fe608060405260043610610073575f3560e01c806376cdb03b1161004d57806376cdb03b146101215780637752e8e41461014b578063b5828df21461017b578063f1610a28146101b75761007a565b806319f7a0fb1461007e5780632b0a7032146100ba57806337a9a59e146100e45761007a565b3661007a57005b5f80fd5b348015610089575f80fd5b506100a4600480360381019061009f919061095c565b6101f3565b6040516100b191906109e2565b60405180910390f35b3480156100c5575f80fd5b506100ce61029a565b6040516100db9190610a75565b60405180910390f35b3480156100ef575f80fd5b5061010a60048036038101906101059190610a8e565b6102bd565b604051610118929190610ac8565b60405180910390f35b34801561012c575f80fd5b5061013561035f565b6040516101429190610b0f565b60405180910390f35b61016560048036038101906101609190610bda565b610383565b6040516101729190610c67565b60405180910390f35b348015610186575f80fd5b506101a1600480360381019061019c9190610c80565b610508565b6040516101ae919061128f565b60405180910390f35b3480156101c2575f80fd5b506101dd60048036038101906101d89190610a8e565b6105bd565b6040516101ea91906113e8565b60405180910390f35b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166319f7a0fb8585856040518463ffffffff1660e01b81526004016102519392919061145f565b6020604051808303815f875af115801561026d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061029191906114c5565b90509392505050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f805f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166337a9a59e846040518263ffffffff1660e01b81526004016103179190610c67565b60408051808303815f875af1158015610332573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103569190611504565b91509150915091565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f80600167ffffffffffffffff8111156103a05761039f610838565b5b6040519080825280602002602001820160405280156103d957816020015b6103c6610666565b8152602001906001900390816103be5790505b50905084848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f82011690508083019250505050505050815f8151811061043357610432611542565b5b60200260200101516020018190525082815f8151811061045657610455611542565b5b60200260200101515f0181815250505f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e4112572876040518263ffffffff1660e01b81526004016104bd9190611b88565b6020604051808303815f875af11580156104d9573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104fd9190611ba8565b915050949350505050565b606061051261067f565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663917c9d9285846040518363ffffffff1660e01b815260040161056e929190611c46565b5f60405180830381865afa158015610588573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f820116820180604052508101906105b091906124ad565b5090508092505050919050565b6105c56106c2565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f1610a28836040518263ffffffff1660e01b815260040161061d9190610c67565b5f60405180830381865afa158015610637573d5f803e3d5ffd5b505050506040513d5f823e3d601f19601f8201168201806040525081019061065f9190612523565b9050919050565b60405180604001604052805f8152602001606081525090565b6040518060a00160405280606081526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff1681526020015f151581526020015f151581525090565b604051806101a001604052805f67ffffffffffffffff168152602001606081526020015f60030b81526020016106f6610774565b81526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff168152602001606081526020015f67ffffffffffffffff1681526020015f67ffffffffffffffff1681526020016060815260200160608152602001606081526020015f73ffffffffffffffffffffffffffffffffffffffff1681525090565b6040518060800160405280606081526020016060815260200160608152602001606081525090565b5f604051905090565b5f80fd5b5f80fd5b5f67ffffffffffffffff82169050919050565b6107c9816107ad565b81146107d3575f80fd5b50565b5f813590506107e4816107c0565b92915050565b5f8160030b9050919050565b6107ff816107ea565b8114610809575f80fd5b50565b5f8135905061081a816107f6565b92915050565b5f80fd5b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61086e82610828565b810181811067ffffffffffffffff8211171561088d5761088c610838565b5b80604052505050565b5f61089f61079c565b90506108ab8282610865565b919050565b5f67ffffffffffffffff8211156108ca576108c9610838565b5b6108d382610828565b9050602081019050919050565b828183375f83830152505050565b5f6109006108fb846108b0565b610896565b90508281526020810184848401111561091c5761091b610824565b5b6109278482856108e0565b509392505050565b5f82601f83011261094357610942610820565b5b81356109538482602086016108ee565b91505092915050565b5f805f60608486031215610973576109726107a5565b5b5f610980868287016107d6565b93505060206109918682870161080c565b925050604084013567ffffffffffffffff8111156109b2576109b16107a9565b5b6109be8682870161092f565b9150509250925092565b5f8115159050919050565b6109dc816109c8565b82525050565b5f6020820190506109f55f8301846109d3565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f610a3d610a38610a33846109fb565b610a1a565b6109fb565b9050919050565b5f610a4e82610a23565b9050919050565b5f610a5f82610a44565b9050919050565b610a6f81610a55565b82525050565b5f602082019050610a885f830184610a66565b92915050565b5f60208284031215610aa357610aa26107a5565b5b5f610ab0848285016107d6565b91505092915050565b610ac2816107ad565b82525050565b5f604082019050610adb5f830185610ab9565b610ae86020830184610ab9565b9392505050565b5f610af982610a44565b9050919050565b610b0981610aef565b82525050565b5f602082019050610b225f830184610b00565b92915050565b5f80fd5b5f60e08284031215610b4157610b40610b28565b5b81905092915050565b5f80fd5b5f80fd5b5f8083601f840112610b6757610b66610820565b5b8235905067ffffffffffffffff811115610b8457610b83610b4a565b5b602083019150836001820283011115610ba057610b9f610b4e565b5b9250929050565b5f819050919050565b610bb981610ba7565b8114610bc3575f80fd5b50565b5f81359050610bd481610bb0565b92915050565b5f805f8060608587031215610bf257610bf16107a5565b5b5f85013567ffffffffffffffff811115610c0f57610c0e6107a9565b5b610c1b87828801610b2c565b945050602085013567ffffffffffffffff811115610c3c57610c3b6107a9565b5b610c4887828801610b52565b93509350506040610c5b87828801610bc6565b91505092959194509250565b5f602082019050610c7a5f830184610ab9565b92915050565b5f60208284031215610c9557610c946107a5565b5b5f610ca28482850161080c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b610cdd816107ad565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f5b83811015610d43578082015181840152602081019050610d28565b5f8484015250505050565b5f610d5882610d0c565b610d628185610d16565b9350610d72818560208601610d26565b610d7b81610828565b840191505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f60ff82169050919050565b610dc481610daf565b82525050565b5f610dd58383610dbb565b60208301905092915050565b5f602082019050919050565b5f610df782610d86565b610e018185610d90565b9350610e0c83610da0565b805f5b83811015610e3c578151610e238882610dca565b9750610e2e83610de1565b925050600181019050610e0f565b5085935050505092915050565b5f604083015f8301518482035f860152610e638282610d4e565b91505060208301518482036020860152610e7d8282610ded565b9150508091505092915050565b5f610e958383610e49565b905092915050565b5f602082019050919050565b5f610eb382610ce3565b610ebd8185610ced565b935083602082028501610ecf85610cfd565b805f5b85811015610f0a5784840389528151610eeb8582610e8a565b9450610ef683610e9d565b925060208a01995050600181019050610ed2565b50829750879550505050505092915050565b610f25816107ea565b82525050565b5f608083015f8301518482035f860152610f458282610d4e565b91505060208301518482036020860152610f5f8282610d4e565b91505060408301518482036040860152610f798282610d4e565b91505060608301518482036060860152610f938282610d4e565b9150508091505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b610fd281610ba7565b82525050565b5f604083015f830151610fed5f860182610fc9565b50602083015184820360208601526110058282610d4e565b9150508091505092915050565b5f61101d8383610fd8565b905092915050565b5f602082019050919050565b5f61103b82610fa0565b6110458185610faa565b93508360208202850161105785610fba565b805f5b8581101561109257848403895281516110738582611012565b945061107e83611025565b925060208a0199505060018101905061105a565b50829750879550505050505092915050565b5f6110ae826109fb565b9050919050565b6110be816110a4565b82525050565b5f6101a083015f8301516110da5f860182610cd4565b50602083015184820360208601526110f28282610ea9565b91505060408301516111076040860182610f1c565b506060830151848203606086015261111f8282610f2b565b91505060808301516111346080860182610cd4565b5060a083015161114760a0860182610cd4565b5060c083015184820360c086015261115f8282611031565b91505060e083015161117460e0860182610cd4565b50610100830151611189610100860182610cd4565b506101208301518482036101208601526111a38282610d4e565b9150506101408301518482036101408601526111bf8282610d4e565b9150506101608301518482036101608601526111db8282610d4e565b9150506101808301516111f26101808601826110b5565b508091505092915050565b5f61120883836110c4565b905092915050565b5f602082019050919050565b5f61122682610cab565b6112308185610cb5565b93508360208202850161124285610cc5565b805f5b8581101561127d578484038952815161125e85826111fd565b945061126983611210565b925060208a01995050600181019050611245565b50829750879550505050505092915050565b5f6020820190508181035f8301526112a7818461121c565b905092915050565b5f6101a083015f8301516112c55f860182610cd4565b50602083015184820360208601526112dd8282610ea9565b91505060408301516112f26040860182610f1c565b506060830151848203606086015261130a8282610f2b565b915050608083015161131f6080860182610cd4565b5060a083015161133260a0860182610cd4565b5060c083015184820360c086015261134a8282611031565b91505060e083015161135f60e0860182610cd4565b50610100830151611374610100860182610cd4565b5061012083015184820361012086015261138e8282610d4e565b9150506101408301518482036101408601526113aa8282610d4e565b9150506101608301518482036101608601526113c68282610d4e565b9150506101808301516113dd6101808601826110b5565b508091505092915050565b5f6020820190508181035f83015261140081846112af565b905092915050565b611411816107ea565b82525050565b5f82825260208201905092915050565b5f61143182610d0c565b61143b8185611417565b935061144b818560208601610d26565b61145481610828565b840191505092915050565b5f6060820190506114725f830186610ab9565b61147f6020830185611408565b81810360408301526114918184611427565b9050949350505050565b6114a4816109c8565b81146114ae575f80fd5b50565b5f815190506114bf8161149b565b92915050565b5f602082840312156114da576114d96107a5565b5b5f6114e7848285016114b1565b91505092915050565b5f815190506114fe816107c0565b92915050565b5f806040838503121561151a576115196107a5565b5b5f611527858286016114f0565b9250506020611538858286016114f0565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f80fd5b5f80fd5b5f80fd5b5f808335600160200384360303811261159757611596611577565b5b83810192508235915060208301925067ffffffffffffffff8211156115bf576115be61156f565b5b6020820236038313156115d5576115d4611573565b5b509250929050565b5f819050919050565b5f808335600160200384360303811261160257611601611577565b5b83810192508235915060208301925067ffffffffffffffff82111561162a5761162961156f565b5b6001820236038313156116405761163f611573565b5b509250929050565b5f6116538385610d16565b93506116608385846108e0565b61166983610828565b840190509392505050565b5f80833560016020038436030381126116905761168f611577565b5b83810192508235915060208301925067ffffffffffffffff8211156116b8576116b761156f565b5b6020820236038313156116ce576116cd611573565b5b509250929050565b5f819050919050565b6116e881610daf565b81146116f2575f80fd5b50565b5f81359050611703816116df565b92915050565b5f61171760208401846116f5565b905092915050565b5f602082019050919050565b5f6117368385610d90565b9350611741826116d6565b805f5b85811015611779576117568284611709565b6117608882610dca565b975061176b8361171f565b925050600181019050611744565b5085925050509392505050565b5f604083016117975f8401846115e6565b8583035f8701526117a9838284611648565b925050506117ba6020840184611674565b85830360208701526117cd83828461172b565b925050508091505092915050565b5f6117e68383611786565b905092915050565b5f8235600160400383360303811261180957611808611577565b5b82810191505092915050565b5f602082019050919050565b5f61182c8385610ced565b93508360208402850161183e846115dd565b805f5b8781101561188157848403895261185882846117ee565b61186285826117db565b945061186d83611815565b925060208a01995050600181019050611841565b50829750879450505050509392505050565b5f80833560016020038436030381126118af576118ae611577565b5b83810192508235915060208301925067ffffffffffffffff8211156118d7576118d661156f565b5b6020820236038313156118ed576118ec611573565b5b509250929050565b5f819050919050565b5f61190c6020840184610bc6565b905092915050565b5f604083016119255f8401846118fe565b6119315f860182610fc9565b5061193f60208401846115e6565b8583036020870152611952838284611648565b925050508091505092915050565b5f61196b8383611914565b905092915050565b5f8235600160400383360303811261198e5761198d611577565b5b82810191505092915050565b5f602082019050919050565b5f6119b18385610faa565b9350836020840285016119c3846118f5565b805f5b87811015611a065784840389526119dd8284611973565b6119e78582611960565b94506119f28361199a565b925060208a019950506001810190506119c6565b50829750879450505050509392505050565b611a21816110a4565b8114611a2b575f80fd5b50565b5f81359050611a3c81611a18565b92915050565b5f611a506020840184611a2e565b905092915050565b5f81359050611a668161149b565b92915050565b5f611a7a6020840184611a58565b905092915050565b611a8b816109c8565b82525050565b5f60e08301611aa25f84018461157b565b8583035f870152611ab4838284611821565b92505050611ac56020840184611893565b8583036020870152611ad88382846119a6565b92505050611ae96040840184611a42565b611af660408601826110b5565b50611b0460608401846115e6565b8583036060870152611b17838284611648565b92505050611b2860808401846115e6565b8583036080870152611b3b838284611648565b92505050611b4c60a08401846115e6565b85830360a0870152611b5f838284611648565b92505050611b7060c0840184611a6c565b611b7d60c0860182611a82565b508091505092915050565b5f6020820190508181035f830152611ba08184611a91565b905092915050565b5f60208284031215611bbd57611bbc6107a5565b5b5f611bca848285016114f0565b91505092915050565b5f60a083015f8301518482035f860152611bed8282610d4e565b9150506020830151611c026020860182610cd4565b506040830151611c156040860182610cd4565b506060830151611c286060860182611a82565b506080830151611c3b6080860182611a82565b508091505092915050565b5f604082019050611c595f830185611408565b8181036020830152611c6b8184611bd3565b90509392505050565b5f67ffffffffffffffff821115611c8e57611c8d610838565b5b602082029050602081019050919050565b5f80fd5b5f80fd5b5f67ffffffffffffffff821115611cc157611cc0610838565b5b602082029050602081019050919050565b5f611ce4611cdf846108b0565b610896565b905082815260208101848484011115611d0057611cff610824565b5b611d0b848285610d26565b509392505050565b5f82601f830112611d2757611d26610820565b5b8151611d37848260208601611cd2565b91505092915050565b5f67ffffffffffffffff821115611d5a57611d59610838565b5b602082029050602081019050919050565b5f81519050611d79816116df565b92915050565b5f611d91611d8c84611d40565b610896565b90508083825260208201905060208402830185811115611db457611db3610b4e565b5b835b81811015611ddd5780611dc98882611d6b565b845260208401935050602081019050611db6565b5050509392505050565b5f82601f830112611dfb57611dfa610820565b5b8151611e0b848260208601611d7f565b91505092915050565b5f60408284031215611e2957611e28611c9f565b5b611e336040610896565b90505f82015167ffffffffffffffff811115611e5257611e51611ca3565b5b611e5e84828501611d13565b5f83015250602082015167ffffffffffffffff811115611e8157611e80611ca3565b5b611e8d84828501611de7565b60208301525092915050565b5f611eab611ea684611ca7565b610896565b90508083825260208201905060208402830185811115611ece57611ecd610b4e565b5b835b81811015611f1557805167ffffffffffffffff811115611ef357611ef2610820565b5b808601611f008982611e14565b85526020850194505050602081019050611ed0565b5050509392505050565b5f82601f830112611f3357611f32610820565b5b8151611f43848260208601611e99565b91505092915050565b5f81519050611f5a816107f6565b92915050565b5f60808284031215611f7557611f74611c9f565b5b611f7f6080610896565b90505f82015167ffffffffffffffff811115611f9e57611f9d611ca3565b5b611faa84828501611d13565b5f83015250602082015167ffffffffffffffff811115611fcd57611fcc611ca3565b5b611fd984828501611d13565b602083015250604082015167ffffffffffffffff811115611ffd57611ffc611ca3565b5b61200984828501611d13565b604083015250606082015167ffffffffffffffff81111561202d5761202c611ca3565b5b61203984828501611d13565b60608301525092915050565b5f67ffffffffffffffff82111561205f5761205e610838565b5b602082029050602081019050919050565b5f8151905061207e81610bb0565b92915050565b5f6040828403121561209957612098611c9f565b5b6120a36040610896565b90505f6120b284828501612070565b5f83015250602082015167ffffffffffffffff8111156120d5576120d4611ca3565b5b6120e184828501611d13565b60208301525092915050565b5f6120ff6120fa84612045565b610896565b9050808382526020820190506020840283018581111561212257612121610b4e565b5b835b8181101561216957805167ffffffffffffffff81111561214757612146610820565b5b8086016121548982612084565b85526020850194505050602081019050612124565b5050509392505050565b5f82601f83011261218757612186610820565b5b81516121978482602086016120ed565b91505092915050565b5f815190506121ae81611a18565b92915050565b5f6101a082840312156121ca576121c9611c9f565b5b6121d56101a0610896565b90505f6121e4848285016114f0565b5f83015250602082015167ffffffffffffffff81111561220757612206611ca3565b5b61221384828501611f1f565b602083015250604061222784828501611f4c565b604083015250606082015167ffffffffffffffff81111561224b5761224a611ca3565b5b61225784828501611f60565b606083015250608061226b848285016114f0565b60808301525060a061227f848285016114f0565b60a08301525060c082015167ffffffffffffffff8111156122a3576122a2611ca3565b5b6122af84828501612173565b60c08301525060e06122c3848285016114f0565b60e0830152506101006122d8848285016114f0565b6101008301525061012082015167ffffffffffffffff8111156122fe576122fd611ca3565b5b61230a84828501611d13565b6101208301525061014082015167ffffffffffffffff8111156123305761232f611ca3565b5b61233c84828501611d13565b6101408301525061016082015167ffffffffffffffff81111561236257612361611ca3565b5b61236e84828501611d13565b61016083015250610180612384848285016121a0565b6101808301525092915050565b5f6123a361239e84611c74565b610896565b905080838252602082019050602084028301858111156123c6576123c5610b4e565b5b835b8181101561240d57805167ffffffffffffffff8111156123eb576123ea610820565b5b8086016123f889826121b4565b855260208501945050506020810190506123c8565b5050509392505050565b5f82601f83011261242b5761242a610820565b5b815161243b848260208601612391565b91505092915050565b5f6040828403121561245957612458611c9f565b5b6124636040610896565b90505f82015167ffffffffffffffff81111561248257612481611ca3565b5b61248e84828501611d13565b5f8301525060206124a1848285016114f0565b60208301525092915050565b5f80604083850312156124c3576124c26107a5565b5b5f83015167ffffffffffffffff8111156124e0576124df6107a9565b5b6124ec85828601612417565b925050602083015167ffffffffffffffff81111561250d5761250c6107a9565b5b61251985828601612444565b9150509250929050565b5f60208284031215612538576125376107a5565b5b5f82015167ffffffffffffffff811115612555576125546107a9565b5b612561848285016121b4565b9150509291505056fea2646970667358221220306d2b017ebeaa83c1fae5293a08fd14264774f7f36721a01dc2fb8dd35515ac64736f6c63430008150033", } // GovernanceWrapperABI is the input ABI used to generate the binding from. diff --git a/cosmos/go.mod b/cosmos/go.mod index c4a5f16e7f..ecaca6463a 100644 --- a/cosmos/go.mod +++ b/cosmos/go.mod @@ -4,7 +4,7 @@ go 1.21 replace ( // We replace `go-ethereum` with `polaris-geth` in order include our required changes. - github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 + github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 // Required at the moment until a bug in the comsos-sdk is fixed. github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/cosmos/go.sum b/cosmos/go.sum index 2b195bfdc7..e55d14d582 100644 --- a/cosmos/go.sum +++ b/cosmos/go.sum @@ -112,8 +112,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 h1:t8fKaxVPovG95BUX62QX1DaJld0Uk5Hi9DtDQphIWR0= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 h1:LY4GputrzZf7U2yoDLgt7oQdJc5URRTzQooDnb6igjM= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= diff --git a/cosmos/x/evm/genesis_test.go b/cosmos/x/evm/genesis_test.go index bc18b4d2c8..1c3a3ea4d9 100644 --- a/cosmos/x/evm/genesis_test.go +++ b/cosmos/x/evm/genesis_test.go @@ -35,6 +35,7 @@ import ( "pkg.berachain.dev/polaris/cosmos/config" "pkg.berachain.dev/polaris/cosmos/precompile/staking" + "pkg.berachain.dev/polaris/cosmos/testing/types/mock" testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" "pkg.berachain.dev/polaris/cosmos/x/evm" "pkg.berachain.dev/polaris/cosmos/x/evm/keeper" @@ -65,6 +66,7 @@ var _ = Describe("", func() { BeforeEach(func() { ctx, ak, _, sk = testutil.SetupMinimalKeepers() + ctx = ctx.WithMultiStore(mock.NewMultiStore()) ctx = ctx.WithBlockHeight(0) sc = staking.NewPrecompileContract(ak, &sk) cfg := config.DefaultConfig() @@ -77,7 +79,11 @@ var _ = Describe("", func() { func() *ethprecompile.Injector { return ethprecompile.NewPrecompiles([]ethprecompile.Registrable{sc}...) }, - nil, + func() func(height int64, prove bool) (sdk.Context, error) { + return func(height int64, prove bool) (sdk.Context, error) { + return ctx, nil + } + }, log.NewTestLogger(GinkgoT()), cfg, ) @@ -86,17 +92,6 @@ var _ = Describe("", func() { am = evm.NewAppModule(k, ak) }) - Context("On ValidateGenesis", func() { - BeforeEach(func() { - }) - - When("", func() { - It("", func() { - - }) - }) - }) - Context("On InitGenesis", func() { BeforeEach(func() { }) @@ -110,9 +105,6 @@ var _ = Describe("", func() { }) When("the genesis is valid", func() { - BeforeEach(func() { - - }) It("should succeed without error", func() { Expect(err).ToNot(HaveOccurred()) }) diff --git a/cosmos/x/evm/keeper/keeper.go b/cosmos/x/evm/keeper/keeper.go index ff3eae577e..aefc75ac75 100644 --- a/cosmos/x/evm/keeper/keeper.go +++ b/cosmos/x/evm/keeper/keeper.go @@ -101,11 +101,11 @@ func NewKeeper( // SetupPrecompiles initializes precompiles and the polaris node. func (k *Keeper) SetupPrecompiles() error { - if err := k.host.SetupPrecompiles(); err != nil { - return err - } + return k.host.SetupPrecompiles() +} - // TODO: move this. +// Init calls Init on the underlying polaris struct. +func (k *Keeper) Init() error { return k.polaris.Init() } diff --git a/cosmos/x/evm/keeper/processor_test.go b/cosmos/x/evm/keeper/processor_test.go index 01eb712e1b..d5d1691394 100644 --- a/cosmos/x/evm/keeper/processor_test.go +++ b/cosmos/x/evm/keeper/processor_test.go @@ -105,6 +105,10 @@ var _ = Describe("Processor", func() { ) err = k.SetupPrecompiles() Expect(err).ToNot(HaveOccurred()) + // Init won't work yet due to no multistore existing yet at genesis. + // TODO: probably need to refactor state/plugin.StateAtBlockNumber (its really hood rn). + err = k.Init() + Expect(err).To(HaveOccurred()) ctx = ctx.WithBlockHeight(0) genState := core.DefaultGenesis Expect(k.InitGenesis(ctx, genState)).ToNot(HaveOccurred()) diff --git a/cosmos/x/evm/plugins/state/plugin.go b/cosmos/x/evm/plugins/state/plugin.go index 17b40a9629..4289bb76f6 100644 --- a/cosmos/x/evm/plugins/state/plugin.go +++ b/cosmos/x/evm/plugins/state/plugin.go @@ -540,11 +540,12 @@ func (p *plugin) StateAtBlockNumber(number uint64) (core.StatePlugin, error) { // TODO: the GTE may be hiding a larger issue with the timing of the NewHead channel stuff. // Investigate and hopefully remove this GTE. if int64Number >= p.ctx.BlockHeight() { + // TODO: Manager properly if p.ctx.MultiStore() == nil { - return nil, errors.New("no multi-store set in host chain") + ctx = p.ctx.WithEventManager(sdk.NewEventManager()) + } else { + ctx, _ = p.ctx.CacheContext() } - - ctx, _ = p.ctx.CacheContext() } else { // Get the query context at the given height. var err error @@ -556,7 +557,10 @@ func (p *plugin) StateAtBlockNumber(number uint64) (core.StatePlugin, error) { // Create a State Plugin with the requested chain height. sp := NewPlugin(p.ak, p.storeKey, p.plf) - sp.Reset(ctx) + // TODO: Manager properly + if p.ctx.MultiStore() != nil { + sp.Reset(ctx) + } return sp, nil } @@ -567,8 +571,11 @@ func (p *plugin) StateAtBlockNumber(number uint64) (core.StatePlugin, error) { // Clone implements libtypes.Cloneable. func (p *plugin) Clone() ethstate.Plugin { sp := NewPlugin(p.ak, p.storeKey, p.plf) - cacheCtx, _ := p.ctx.CacheContext() - sp.Reset(cacheCtx) + // TODO: Manager properly + if p.ctx.MultiStore() != nil { + cacheCtx, _ := p.ctx.CacheContext() + sp.Reset(cacheCtx) + } return sp } diff --git a/e2e/localnet/network/node.go b/e2e/localnet/network/node.go index 4fe08647df..5911b7c56e 100644 --- a/e2e/localnet/network/node.go +++ b/e2e/localnet/network/node.go @@ -38,7 +38,8 @@ import ( const ( defaultTimeout = 30 * time.Second - nodeStartTime = 10 * time.Second + // TODO: this is so hood. + nodeStartTime = 15 * time.Second ) // ContainerizedNode is an interface for a containerized network. diff --git a/e2e/precompile/polard/start-node.sh b/e2e/precompile/polard/start-node.sh index 1e542fcf93..2bb37aa1ed 100755 --- a/e2e/precompile/polard/start-node.sh +++ b/e2e/precompile/polard/start-node.sh @@ -115,5 +115,18 @@ if [[ $1 == "pending" ]]; then echo "pending mode is on, please wait for the first block committed." fi +# Adjust timeouts for CometBFT: +# TODO: these values are sensitive due to a race condition in the json-rpc ports opening. +# If the JSON-RPC opens before the first block is committed, hive tests will start failing. +# This needs to be fixed before mainnet as its ghetto af. +sed -i 's/timeout_propose = "3s"/timeout_propose = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_prevote = "1s"/timeout_prevote = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_precommit = "1s"/timeout_precommit = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_commit = "5s"/timeout_commit = "2s"/g' $CONFIG_TOML +sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "2s"/g' $CONFIG_TOML + # Start the node (remove the --pruning=nothing flag if historical queries are not needed)m polard start --pruning=nothing "$TRACE" --log_level $LOGLEVEL --api.enabled-unsafe-cors --api.enable --api.swagger --minimum-gas-prices=0.0001abera --home "$HOMEDIR" diff --git a/e2e/testapp/app.go b/e2e/testapp/app.go index e6610cc89a..eb9c94e6d3 100644 --- a/e2e/testapp/app.go +++ b/e2e/testapp/app.go @@ -200,6 +200,11 @@ func NewPolarisApp( panic(err) } + // Init is used to setup the polaris struct. + if err := app.EVMKeeper.Init(); err != nil { + panic(err) + } + // Setup TxPool Wrapper app.mp = txpool.New(app.EVMKeeper.Polaris().TxPool()) app.SetMempool(app.mp) diff --git a/e2e/testapp/go.mod b/e2e/testapp/go.mod index 9694066580..48c122d0fd 100644 --- a/e2e/testapp/go.mod +++ b/e2e/testapp/go.mod @@ -4,7 +4,7 @@ go 1.21 replace ( // We replace `go-ethereum` with `polaris-geth` in order include our required changes. - github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 + github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 // Required at the moment until a bug in the comsos-sdk is fixed. github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/e2e/testapp/go.sum b/e2e/testapp/go.sum index dea9080586..efad7c0c58 100644 --- a/e2e/testapp/go.sum +++ b/e2e/testapp/go.sum @@ -275,8 +275,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 h1:t8fKaxVPovG95BUX62QX1DaJld0Uk5Hi9DtDQphIWR0= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 h1:LY4GputrzZf7U2yoDLgt7oQdJc5URRTzQooDnb6igjM= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= diff --git a/eth/core/chain_resources.go b/eth/core/chain_resources.go index 4c36a743e7..96f3b43b2a 100644 --- a/eth/core/chain_resources.go +++ b/eth/core/chain_resources.go @@ -38,7 +38,7 @@ type ChainResources interface { // StateAt returns a statedb configured to read what the state of the blockchain is/was at a given. func (bc *blockchain) StateAt(common.Hash) (state.StateDB, error) { - return nil, errors.New("not implemented") + return nil, errors.New("StateAt is not implemented in polaris due state root") } // StateAtBlockNumber returns a statedb configured to read what the state of the blockchain is/was diff --git a/eth/core/processor.go b/eth/core/processor.go index b919729fab..d6130a5501 100644 --- a/eth/core/processor.go +++ b/eth/core/processor.go @@ -27,6 +27,7 @@ import ( "github.com/ethereum/go-ethereum/trie" "pkg.berachain.dev/polaris/eth/common" + "pkg.berachain.dev/polaris/eth/core/state" "pkg.berachain.dev/polaris/eth/core/types" "pkg.berachain.dev/polaris/eth/core/vm" errorslib "pkg.berachain.dev/polaris/lib/errors" @@ -52,7 +53,7 @@ type StateProcessor struct { signer types.Signer // statedb is the state database that is used to mange state during transactions. - statedb vm.PolarStateDB + statedb state.StateDB // vmConfig is the configuration for the EVM. vmConfig *vm.Config @@ -70,7 +71,7 @@ type StateProcessor struct { func NewStateProcessor( cp ConfigurationPlugin, pp PrecompilePlugin, - statedb vm.PolarStateDB, + statedb state.StateDB, vmConfig *vm.Config, ) *StateProcessor { sp := &StateProcessor{ diff --git a/eth/core/processor_test.go b/eth/core/processor_test.go index c370af41a5..5c50cda0af 100644 --- a/eth/core/processor_test.go +++ b/eth/core/processor_test.go @@ -26,13 +26,13 @@ import ( "github.com/ethereum/go-ethereum/consensus" - bindings "pkg.berachain.dev/polaris/contracts/bindings/testing" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" "pkg.berachain.dev/polaris/eth/core/mock" + "pkg.berachain.dev/polaris/eth/core/state" + statemock "pkg.berachain.dev/polaris/eth/core/state/mock" "pkg.berachain.dev/polaris/eth/core/types" "pkg.berachain.dev/polaris/eth/core/vm" - vmmock "pkg.berachain.dev/polaris/eth/core/vm/mock" "pkg.berachain.dev/polaris/eth/crypto" "pkg.berachain.dev/polaris/eth/params" @@ -64,25 +64,24 @@ var ( var _ = Describe("StateProcessor", func() { var ( - sdb *vmmock.PolarStateDBMock + sdb state.StateDB bp *mock.BlockPluginMock cp *mock.ConfigurationPluginMock pp *mock.PrecompilePluginMock + spm *statemock.PluginMock sp *core.StateProcessor ) BeforeEach(func() { - sdb = vmmock.NewEmptyStateDB() + spm = statemock.NewEmptyStatePlugin() + spm.RegistryKeyFunc = func() string { + return "sp" + } + sdb = state.NewStateDB(spm, nil) _, bp, cp, _, _, pp, _ = mock.NewMockHostAndPlugins() bp.GetNewBlockMetadataFunc = func(n uint64) (common.Address, uint64) { return common.BytesToAddress([]byte{2}), uint64(3) } - sdb.GetPrecompileManagerFunc = func() any { - return pp - } - sdb.TxIndexFunc = func() int { - return 0 - } pp.GetActiveFunc = func(params.Rules) []common.Address { return []common.Address{} } @@ -113,8 +112,9 @@ var _ = Describe("StateProcessor", func() { It("should error on an unsigned transaction", func() { gasPool := new(core.GasPool).AddGas(1000002) + tx := types.NewTx(legacyTxData) receipt, err := sp.ProcessTransaction( - context.Background(), &mockChainContext{}, gasPool, types.NewTx(legacyTxData)) + context.Background(), &mockChainContext{}, gasPool, tx) Expect(err).To(HaveOccurred()) Expect(receipt).To(BeNil()) block, receipts, logs, err := sp.Finalize(context.Background()) @@ -126,10 +126,10 @@ var _ = Describe("StateProcessor", func() { It("should not error on a signed transaction", func() { signedTx := types.MustSignNewTx(key, signer, legacyTxData) - sdb.GetBalanceFunc = func(addr common.Address) *big.Int { - return big.NewInt(1000001) - } gasPool := new(core.GasPool).AddGas(1000002) + sender, _ := signer.Sender(signedTx) + val, _ := new(big.Int).SetString("10000000000000000000", 10) + sdb.AddBalance(sender, val) result, err := sp.ProcessTransaction( context.Background(), &mockChainContext{}, gasPool, signedTx) Expect(err).ToNot(HaveOccurred()) @@ -144,28 +144,12 @@ var _ = Describe("StateProcessor", func() { }) It("should handle", func() { - sdb.GetBalanceFunc = func(addr common.Address) *big.Int { - return big.NewInt(1000001) - } - sdb.GetCodeFunc = func(addr common.Address) []byte { - if addr != dummyContract { - return nil - } - return common.Hex2Bytes(bindings.PrecompileConstructorMetaData.Bin) - } - sdb.GetCodeHashFunc = func(addr common.Address) common.Hash { - if addr != dummyContract { - return common.Hash{} - } - return crypto.Keccak256Hash( - common.Hex2Bytes(bindings.PrecompileConstructorMetaData.Bin)) - } - sdb.ExistFunc = func(addr common.Address) bool { - return addr == dummyContract - } legacyTxData.To = nil legacyTxData.Value = new(big.Int) signedTx := types.MustSignNewTx(key, signer, legacyTxData) + sender, _ := signer.Sender(signedTx) + val, _ := new(big.Int).SetString("10000000000000000000", 10) + sdb.AddBalance(sender, val) gasPool := new(core.GasPool).AddGas(1000002) result, err := sp.ProcessTransaction( context.Background(), &mockChainContext{}, gasPool, signedTx) @@ -191,22 +175,6 @@ var _ = Describe("StateProcessor", func() { }) }) -var _ = Describe("No precompile plugin provided", func() { - It("should use the default plugin if none is provided", func() { - _, bp, cp, gp, _, pp, _ := mock.NewMockHostAndPlugins() - gp.SetBlockGasLimit(uint64(blockGasLimit)) - bp.GetNewBlockMetadataFunc = func(n uint64) (common.Address, uint64) { - return common.BytesToAddress([]byte{2}), uint64(3) - } - sp := core.NewStateProcessor(cp, pp, vmmock.NewEmptyStateDB(), &vm.Config{}) - Expect(func() { - sp.Prepare(&types.Header{ - GasLimit: uint64(blockGasLimit), - }) - }).ToNot(Panic()) - }) -}) - type mockChainContext struct{} // Engine retrieves the chain's consensus engine. diff --git a/eth/core/state/mock/state.go b/eth/core/state/mock/state.go index 6da6acb57c..51f89ab578 100644 --- a/eth/core/state/mock/state.go +++ b/eth/core/state/mock/state.go @@ -36,6 +36,7 @@ type Account struct { Balance *big.Int Code []byte CodeHash common.Hash + Nonce uint64 } // NewEmptyStatePlugin returns an empty `StatePluginMock`. @@ -44,7 +45,9 @@ func NewEmptyStatePlugin() *PluginMock { return &PluginMock{ AddBalanceFunc: func(address common.Address, intMoqParam *big.Int) { if _, ok := Accounts[address]; !ok { - panic("acct doesnt exist") + Accounts[address] = &Account{ + Balance: intMoqParam, + } } Accounts[address] = &Account{ Balance: Accounts[address].Balance.Add(Accounts[address].Balance, intMoqParam), @@ -67,7 +70,8 @@ func NewEmptyStatePlugin() *PluginMock { } }, ExistFunc: func(address common.Address) bool { - panic("mock out the Exist method") + _, ok := Accounts[address] + return ok }, EmptyFunc: func(address common.Address) bool { panic("mock out the Empty method") @@ -95,7 +99,7 @@ func NewEmptyStatePlugin() *PluginMock { }, GetCodeHashFunc: func(address common.Address) common.Hash { if _, ok := Accounts[address]; !ok { - panic("acct doesnt exist") + return common.Hash{} } return Accounts[address].CodeHash }, @@ -125,7 +129,7 @@ func NewEmptyStatePlugin() *PluginMock { } }, SetNonceFunc: func(address common.Address, v uint64) { - panic("mock out the SetNonce method") + Accounts[address].Nonce = v }, SetStateFunc: func(address common.Address, hash1 common.Hash, hash2 common.Hash) { panic("mock out the SetState method") diff --git a/eth/core/state/statedb.go b/eth/core/state/statedb.go index 8610636b22..b943bb7b8a 100644 --- a/eth/core/state/statedb.go +++ b/eth/core/state/statedb.go @@ -85,8 +85,6 @@ func newStateDBWithJournals( ) *stateDB { if sp == nil { panic("StatePlugin is nil in newStateDBWithJournals") - } else if pp == nil { - panic("PrecompilePlugin is nil in newStateDBWithJournals") } // Build the controller and register the plugins and journals @@ -224,8 +222,10 @@ func (sdb *stateDB) Preimages() map[common.Hash][]byte { // code associated with the given account. func (sdb *stateDB) GetCode(addr common.Address) []byte { // We return a single byte for client compatibility w/precompiles. - if _, ok := sdb.pp.Get(addr, sdb.rules); ok { - return []byte{0x01} + if sdb.pp != nil { + if _, ok := sdb.pp.Get(addr, sdb.rules); ok { + return []byte{0x01} + } } return sdb.Plugin.GetCode(addr) } diff --git a/eth/core/types/transaction.go b/eth/core/types/transaction.go index 21af383f22..90f20d376a 100644 --- a/eth/core/types/transaction.go +++ b/eth/core/types/transaction.go @@ -24,7 +24,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" "pkg.berachain.dev/polaris/eth/common" - "pkg.berachain.dev/polaris/eth/crypto" ) // TxLookupEntry is a positional metadata to help looking up a transaction by hash. @@ -50,27 +49,3 @@ func (tle *TxLookupEntry) MarshalBinary() ([]byte, error) { } return bz, nil } - -// PubkeyFromTx returns the public key of the signer of the transaction. -func PubkeyFromTx(signedTx *Transaction, signer Signer) ([]byte, error) { - // signer.PubKey returns the uncompressed public key. - uncompressed, err := signer.PubKey(signedTx) - if err != nil { - return nil, err - } - - // We marshal it to a *ecdsa.PublicKey. - pubKey, err := crypto.UnmarshalPubkey(uncompressed) - if err != nil { - return nil, err - } - - // Then we can compress it to adhere to the required format. - return crypto.CompressPubkey(pubKey), nil -} - -// GetSender returns the sender of the transaction. -func GetSender(tx *Transaction) common.Address { - sender, _ := LatestSignerForChainID(tx.ChainId()).Sender(tx) - return sender -} diff --git a/eth/core/types/transaction_test.go b/eth/core/types/transaction_test.go deleted file mode 100644 index a23efd2376..0000000000 --- a/eth/core/types/transaction_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package types - -import ( - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - - ethcrypto "pkg.berachain.dev/polaris/eth/crypto" - - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" -) - -var _ = Describe("signer.PubKey", func() { - var ( - key, _ = ethcrypto.GenerateEthKey() - - signer = types.NewLondonSigner(new(big.Int).SetInt64(420)) - signedTx *types.Transaction - ) - When("we are testing the code in geth", func() { - It("should recover the public key from a valid signature", func() { - txData := &types.LegacyTx{ - Nonce: 0, - Gas: 10000000, - Data: []byte("abcdef"), - } - signedTx = types.MustSignNewTx(key, signer, txData) - Expect(signer.PubKey(signedTx)).To(Equal(ethcrypto.FromECDSAPub(&key.PublicKey))) - }) - - It("should recover the public key from a valid signature", func() { - txData := &types.DynamicFeeTx{ - Nonce: 0, - Gas: 10000000, - Data: []byte("abcdef"), - } - signedTx = types.MustSignNewTx(key, signer, txData) - Expect(signer.PubKey(signedTx)).To(Equal(ethcrypto.FromECDSAPub(&key.PublicKey))) - }) - - It("should recover the public key from a valid signature", func() { - txData := &types.AccessListTx{ - Nonce: 0, - Gas: 10000000, - Data: []byte("abcdef"), - } - signedTx = types.MustSignNewTx(key, signer, txData) - Expect(signer.PubKey(signedTx)).To(Equal(ethcrypto.FromECDSAPub(&key.PublicKey))) - }) - }) - - When("we are testing the cosmos type key", func() { - BeforeEach(func() { - txData := &types.LegacyTx{ - Nonce: 0, - Gas: 10000000, - Data: []byte("abcdef"), - } - signedTx = types.MustSignNewTx(key, signer, txData) - Expect(signer.PubKey(signedTx)).To(Equal(ethcrypto.FromECDSAPub(&key.PublicKey))) - bz, err := signer.PubKey(signedTx) - Expect(err).ToNot(HaveOccurred()) - Expect(bz).To(Equal(ethcrypto.PubkeyToAddress(key.PublicKey))) - bz2, err := PubkeyFromTx(signedTx, signer) - Expect(err).ToNot(HaveOccurred()) - Expect(bz2).To(Equal(bz)) - }) - }) -}) diff --git a/eth/core/vm/mock/statedb.go b/eth/core/vm/mock/statedb.go index e8f47858ea..c48e2a583a 100644 --- a/eth/core/vm/mock/statedb.go +++ b/eth/core/vm/mock/statedb.go @@ -61,15 +61,6 @@ func NewEmptyStateDB() *PolarStateDBMock { EmptyFunc: func(address common.Address) bool { return true }, - ErrorFunc: func() error { - return nil - }, - ExistFunc: func(address common.Address) bool { - return false - }, - FinaliseFunc: func(bool) { - // no-op - }, GetBalanceFunc: func(address common.Address) *big.Int { return big.NewInt(0) }, @@ -85,9 +76,6 @@ func NewEmptyStateDB() *PolarStateDBMock { GetCommittedStateFunc: func(address common.Address, hash common.Hash) common.Hash { return common.Hash{} }, - GetLogsFunc: func(hash common.Hash, blockNumber uint64, blockHash common.Hash) []*types.Log { - return []*types.Log{} - }, GetNonceFunc: func(address common.Address) uint64 { return 0 }, @@ -116,7 +104,6 @@ func NewEmptyStateDB() *PolarStateDBMock { SetStateFunc: func(address common.Address, hash1 common.Hash, hash2 common.Hash) { }, - SetTxContextFunc: func(thash common.Hash, ti int) {}, SlotInAccessListFunc: func(addr common.Address, slot common.Hash) (bool, bool) { return false, false }, @@ -132,12 +119,5 @@ func NewEmptyStateDB() *PolarStateDBMock { SelfDestructFunc: func(address common.Address) { }, } - mockedPolarStateDB.LogsFunc = func() []*types.Log { - logs := []*types.Log{} - for _, l := range mockedPolarStateDB.AddLogCalls() { - logs = append(logs, l.Log) - } - return logs - } return mockedPolarStateDB } diff --git a/eth/core/vm/mock/statedb.mock.go b/eth/core/vm/mock/statedb.mock.go index 48c805663a..160ef03761 100644 --- a/eth/core/vm/mock/statedb.mock.go +++ b/eth/core/vm/mock/statedb.mock.go @@ -6,7 +6,6 @@ package mock import ( "context" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/params" "math/big" @@ -45,36 +44,15 @@ var _ vm.PolarStateDB = &PolarStateDBMock{} // AddressInAccessListFunc: func(addr common.Address) bool { // panic("mock out the AddressInAccessList method") // }, -// CommitFunc: func(v uint64, b bool) (common.Hash, error) { -// panic("mock out the Commit method") -// }, -// CopyFunc: func() state.StateDBI { -// panic("mock out the Copy method") -// }, // CreateAccountFunc: func(address common.Address) { // panic("mock out the CreateAccount method") // }, -// DatabaseFunc: func() state.Database { -// panic("mock out the Database method") -// }, -// DumpFunc: func(opts *state.DumpConfig) []byte { -// panic("mock out the Dump method") -// }, -// DumpToCollectorFunc: func(c state.DumpCollector, conf *state.DumpConfig) []byte { -// panic("mock out the DumpToCollector method") -// }, // EmptyFunc: func(address common.Address) bool { // panic("mock out the Empty method") // }, -// ErrorFunc: func() error { -// panic("mock out the Error method") -// }, // ExistFunc: func(address common.Address) bool { // panic("mock out the Exist method") // }, -// FinaliseFunc: func(deleteEmptyObjects bool) { -// panic("mock out the Finalise method") -// }, // GetBalanceFunc: func(address common.Address) *big.Int { // panic("mock out the GetBalance method") // }, @@ -93,15 +71,9 @@ var _ vm.PolarStateDB = &PolarStateDBMock{} // GetContextFunc: func() context.Context { // panic("mock out the GetContext method") // }, -// GetLogsFunc: func(hash common.Hash, blockNumber uint64, blockHash common.Hash) []*types.Log { -// panic("mock out the GetLogs method") -// }, // GetNonceFunc: func(address common.Address) uint64 { // panic("mock out the GetNonce method") // }, -// GetOrNewStateObjectFunc: func(addr common.Address) *state.StateObject { -// panic("mock out the GetOrNewStateObject method") -// }, // GetPrecompileManagerFunc: func() any { // panic("mock out the GetPrecompileManager method") // }, @@ -111,33 +83,15 @@ var _ vm.PolarStateDB = &PolarStateDBMock{} // GetStateFunc: func(address common.Address, hash common.Hash) common.Hash { // panic("mock out the GetState method") // }, -// GetStorageRootFunc: func(addr common.Address) common.Hash { -// panic("mock out the GetStorageRoot method") -// }, // GetTransientStateFunc: func(addr common.Address, key common.Hash) common.Hash { // panic("mock out the GetTransientState method") // }, // HasSelfDestructedFunc: func(address common.Address) bool { // panic("mock out the HasSelfDestructed method") // }, -// IntermediateRootFunc: func(deleteEmptyObjects bool) common.Hash { -// panic("mock out the IntermediateRoot method") -// }, -// IteratorDumpFunc: func(opts *state.DumpConfig) state.IteratorDump { -// panic("mock out the IteratorDump method") -// }, -// LogsFunc: func() []*types.Log { -// panic("mock out the Logs method") -// }, -// PreimagesFunc: func() map[common.Hash][]byte { -// panic("mock out the Preimages method") -// }, // PrepareFunc: func(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) { // panic("mock out the Prepare method") // }, -// RawDumpFunc: func(opts *state.DumpConfig) state.Dump { -// panic("mock out the RawDump method") -// }, // RevertToSnapshotFunc: func(n int) { // panic("mock out the RevertToSnapshot method") // }, @@ -147,9 +101,6 @@ var _ vm.PolarStateDB = &PolarStateDBMock{} // Selfdestruct6780Func: func(address common.Address) { // panic("mock out the Selfdestruct6780 method") // }, -// SetBalanceFunc: func(addr common.Address, amount *big.Int) { -// panic("mock out the SetBalance method") -// }, // SetCodeFunc: func(address common.Address, bytes []byte) { // panic("mock out the SetCode method") // }, @@ -159,36 +110,21 @@ var _ vm.PolarStateDB = &PolarStateDBMock{} // SetStateFunc: func(address common.Address, hash1 common.Hash, hash2 common.Hash) { // panic("mock out the SetState method") // }, -// SetStorageFunc: func(addr common.Address, storage map[common.Hash]common.Hash) { -// panic("mock out the SetStorage method") -// }, // SetTransientStateFunc: func(addr common.Address, key common.Hash, value common.Hash) { // panic("mock out the SetTransientState method") // }, -// SetTxContextFunc: func(thash common.Hash, ti int) { -// panic("mock out the SetTxContext method") -// }, // SlotInAccessListFunc: func(addr common.Address, slot common.Hash) (bool, bool) { // panic("mock out the SlotInAccessList method") // }, // SnapshotFunc: func() int { // panic("mock out the Snapshot method") // }, -// StartPrefetcherFunc: func(namespace string) { -// panic("mock out the StartPrefetcher method") -// }, -// StopPrefetcherFunc: func() { -// panic("mock out the StopPrefetcher method") -// }, // SubBalanceFunc: func(address common.Address, intMoqParam *big.Int) { // panic("mock out the SubBalance method") // }, // SubRefundFunc: func(v uint64) { // panic("mock out the SubRefund method") // }, -// TxIndexFunc: func() int { -// panic("mock out the TxIndex method") -// }, // } // // // use mockedPolarStateDB in code that requires vm.PolarStateDB @@ -217,36 +153,15 @@ type PolarStateDBMock struct { // AddressInAccessListFunc mocks the AddressInAccessList method. AddressInAccessListFunc func(addr common.Address) bool - // CommitFunc mocks the Commit method. - CommitFunc func(v uint64, b bool) (common.Hash, error) - - // CopyFunc mocks the Copy method. - CopyFunc func() state.StateDBI - // CreateAccountFunc mocks the CreateAccount method. CreateAccountFunc func(address common.Address) - // DatabaseFunc mocks the Database method. - DatabaseFunc func() state.Database - - // DumpFunc mocks the Dump method. - DumpFunc func(opts *state.DumpConfig) []byte - - // DumpToCollectorFunc mocks the DumpToCollector method. - DumpToCollectorFunc func(c state.DumpCollector, conf *state.DumpConfig) []byte - // EmptyFunc mocks the Empty method. EmptyFunc func(address common.Address) bool - // ErrorFunc mocks the Error method. - ErrorFunc func() error - // ExistFunc mocks the Exist method. ExistFunc func(address common.Address) bool - // FinaliseFunc mocks the Finalise method. - FinaliseFunc func(deleteEmptyObjects bool) - // GetBalanceFunc mocks the GetBalance method. GetBalanceFunc func(address common.Address) *big.Int @@ -265,15 +180,9 @@ type PolarStateDBMock struct { // GetContextFunc mocks the GetContext method. GetContextFunc func() context.Context - // GetLogsFunc mocks the GetLogs method. - GetLogsFunc func(hash common.Hash, blockNumber uint64, blockHash common.Hash) []*types.Log - // GetNonceFunc mocks the GetNonce method. GetNonceFunc func(address common.Address) uint64 - // GetOrNewStateObjectFunc mocks the GetOrNewStateObject method. - GetOrNewStateObjectFunc func(addr common.Address) *state.StateObject - // GetPrecompileManagerFunc mocks the GetPrecompileManager method. GetPrecompileManagerFunc func() any @@ -283,33 +192,15 @@ type PolarStateDBMock struct { // GetStateFunc mocks the GetState method. GetStateFunc func(address common.Address, hash common.Hash) common.Hash - // GetStorageRootFunc mocks the GetStorageRoot method. - GetStorageRootFunc func(addr common.Address) common.Hash - // GetTransientStateFunc mocks the GetTransientState method. GetTransientStateFunc func(addr common.Address, key common.Hash) common.Hash // HasSelfDestructedFunc mocks the HasSelfDestructed method. HasSelfDestructedFunc func(address common.Address) bool - // IntermediateRootFunc mocks the IntermediateRoot method. - IntermediateRootFunc func(deleteEmptyObjects bool) common.Hash - - // IteratorDumpFunc mocks the IteratorDump method. - IteratorDumpFunc func(opts *state.DumpConfig) state.IteratorDump - - // LogsFunc mocks the Logs method. - LogsFunc func() []*types.Log - - // PreimagesFunc mocks the Preimages method. - PreimagesFunc func() map[common.Hash][]byte - // PrepareFunc mocks the Prepare method. PrepareFunc func(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) - // RawDumpFunc mocks the RawDump method. - RawDumpFunc func(opts *state.DumpConfig) state.Dump - // RevertToSnapshotFunc mocks the RevertToSnapshot method. RevertToSnapshotFunc func(n int) @@ -319,9 +210,6 @@ type PolarStateDBMock struct { // Selfdestruct6780Func mocks the Selfdestruct6780 method. Selfdestruct6780Func func(address common.Address) - // SetBalanceFunc mocks the SetBalance method. - SetBalanceFunc func(addr common.Address, amount *big.Int) - // SetCodeFunc mocks the SetCode method. SetCodeFunc func(address common.Address, bytes []byte) @@ -331,36 +219,21 @@ type PolarStateDBMock struct { // SetStateFunc mocks the SetState method. SetStateFunc func(address common.Address, hash1 common.Hash, hash2 common.Hash) - // SetStorageFunc mocks the SetStorage method. - SetStorageFunc func(addr common.Address, storage map[common.Hash]common.Hash) - // SetTransientStateFunc mocks the SetTransientState method. SetTransientStateFunc func(addr common.Address, key common.Hash, value common.Hash) - // SetTxContextFunc mocks the SetTxContext method. - SetTxContextFunc func(thash common.Hash, ti int) - // SlotInAccessListFunc mocks the SlotInAccessList method. SlotInAccessListFunc func(addr common.Address, slot common.Hash) (bool, bool) // SnapshotFunc mocks the Snapshot method. SnapshotFunc func() int - // StartPrefetcherFunc mocks the StartPrefetcher method. - StartPrefetcherFunc func(namespace string) - - // StopPrefetcherFunc mocks the StopPrefetcher method. - StopPrefetcherFunc func() - // SubBalanceFunc mocks the SubBalance method. SubBalanceFunc func(address common.Address, intMoqParam *big.Int) // SubRefundFunc mocks the SubRefund method. SubRefundFunc func(v uint64) - // TxIndexFunc mocks the TxIndex method. - TxIndexFunc func() int - // calls tracks calls to the methods. calls struct { // AddAddressToAccessList holds details about calls to the AddAddressToAccessList method. @@ -404,54 +277,21 @@ type PolarStateDBMock struct { // Addr is the addr argument value. Addr common.Address } - // Commit holds details about calls to the Commit method. - Commit []struct { - // V is the v argument value. - V uint64 - // B is the b argument value. - B bool - } - // Copy holds details about calls to the Copy method. - Copy []struct { - } // CreateAccount holds details about calls to the CreateAccount method. CreateAccount []struct { // Address is the address argument value. Address common.Address } - // Database holds details about calls to the Database method. - Database []struct { - } - // Dump holds details about calls to the Dump method. - Dump []struct { - // Opts is the opts argument value. - Opts *state.DumpConfig - } - // DumpToCollector holds details about calls to the DumpToCollector method. - DumpToCollector []struct { - // C is the c argument value. - C state.DumpCollector - // Conf is the conf argument value. - Conf *state.DumpConfig - } // Empty holds details about calls to the Empty method. Empty []struct { // Address is the address argument value. Address common.Address } - // Error holds details about calls to the Error method. - Error []struct { - } // Exist holds details about calls to the Exist method. Exist []struct { // Address is the address argument value. Address common.Address } - // Finalise holds details about calls to the Finalise method. - Finalise []struct { - // DeleteEmptyObjects is the deleteEmptyObjects argument value. - DeleteEmptyObjects bool - } // GetBalance holds details about calls to the GetBalance method. GetBalance []struct { // Address is the address argument value. @@ -482,25 +322,11 @@ type PolarStateDBMock struct { // GetContext holds details about calls to the GetContext method. GetContext []struct { } - // GetLogs holds details about calls to the GetLogs method. - GetLogs []struct { - // Hash is the hash argument value. - Hash common.Hash - // BlockNumber is the blockNumber argument value. - BlockNumber uint64 - // BlockHash is the blockHash argument value. - BlockHash common.Hash - } // GetNonce holds details about calls to the GetNonce method. GetNonce []struct { // Address is the address argument value. Address common.Address } - // GetOrNewStateObject holds details about calls to the GetOrNewStateObject method. - GetOrNewStateObject []struct { - // Addr is the addr argument value. - Addr common.Address - } // GetPrecompileManager holds details about calls to the GetPrecompileManager method. GetPrecompileManager []struct { } @@ -514,11 +340,6 @@ type PolarStateDBMock struct { // Hash is the hash argument value. Hash common.Hash } - // GetStorageRoot holds details about calls to the GetStorageRoot method. - GetStorageRoot []struct { - // Addr is the addr argument value. - Addr common.Address - } // GetTransientState holds details about calls to the GetTransientState method. GetTransientState []struct { // Addr is the addr argument value. @@ -531,22 +352,6 @@ type PolarStateDBMock struct { // Address is the address argument value. Address common.Address } - // IntermediateRoot holds details about calls to the IntermediateRoot method. - IntermediateRoot []struct { - // DeleteEmptyObjects is the deleteEmptyObjects argument value. - DeleteEmptyObjects bool - } - // IteratorDump holds details about calls to the IteratorDump method. - IteratorDump []struct { - // Opts is the opts argument value. - Opts *state.DumpConfig - } - // Logs holds details about calls to the Logs method. - Logs []struct { - } - // Preimages holds details about calls to the Preimages method. - Preimages []struct { - } // Prepare holds details about calls to the Prepare method. Prepare []struct { // Rules is the rules argument value. @@ -562,11 +367,6 @@ type PolarStateDBMock struct { // TxAccesses is the txAccesses argument value. TxAccesses types.AccessList } - // RawDump holds details about calls to the RawDump method. - RawDump []struct { - // Opts is the opts argument value. - Opts *state.DumpConfig - } // RevertToSnapshot holds details about calls to the RevertToSnapshot method. RevertToSnapshot []struct { // N is the n argument value. @@ -582,13 +382,6 @@ type PolarStateDBMock struct { // Address is the address argument value. Address common.Address } - // SetBalance holds details about calls to the SetBalance method. - SetBalance []struct { - // Addr is the addr argument value. - Addr common.Address - // Amount is the amount argument value. - Amount *big.Int - } // SetCode holds details about calls to the SetCode method. SetCode []struct { // Address is the address argument value. @@ -612,13 +405,6 @@ type PolarStateDBMock struct { // Hash2 is the hash2 argument value. Hash2 common.Hash } - // SetStorage holds details about calls to the SetStorage method. - SetStorage []struct { - // Addr is the addr argument value. - Addr common.Address - // Storage is the storage argument value. - Storage map[common.Hash]common.Hash - } // SetTransientState holds details about calls to the SetTransientState method. SetTransientState []struct { // Addr is the addr argument value. @@ -628,13 +414,6 @@ type PolarStateDBMock struct { // Value is the value argument value. Value common.Hash } - // SetTxContext holds details about calls to the SetTxContext method. - SetTxContext []struct { - // Thash is the thash argument value. - Thash common.Hash - // Ti is the ti argument value. - Ti int - } // SlotInAccessList holds details about calls to the SlotInAccessList method. SlotInAccessList []struct { // Addr is the addr argument value. @@ -645,14 +424,6 @@ type PolarStateDBMock struct { // Snapshot holds details about calls to the Snapshot method. Snapshot []struct { } - // StartPrefetcher holds details about calls to the StartPrefetcher method. - StartPrefetcher []struct { - // Namespace is the namespace argument value. - Namespace string - } - // StopPrefetcher holds details about calls to the StopPrefetcher method. - StopPrefetcher []struct { - } // SubBalance holds details about calls to the SubBalance method. SubBalance []struct { // Address is the address argument value. @@ -665,9 +436,6 @@ type PolarStateDBMock struct { // V is the v argument value. V uint64 } - // TxIndex holds details about calls to the TxIndex method. - TxIndex []struct { - } } lockAddAddressToAccessList sync.RWMutex lockAddBalance sync.RWMutex @@ -676,54 +444,33 @@ type PolarStateDBMock struct { lockAddRefund sync.RWMutex lockAddSlotToAccessList sync.RWMutex lockAddressInAccessList sync.RWMutex - lockCommit sync.RWMutex - lockCopy sync.RWMutex lockCreateAccount sync.RWMutex - lockDatabase sync.RWMutex - lockDump sync.RWMutex - lockDumpToCollector sync.RWMutex lockEmpty sync.RWMutex - lockError sync.RWMutex lockExist sync.RWMutex - lockFinalise sync.RWMutex lockGetBalance sync.RWMutex lockGetCode sync.RWMutex lockGetCodeHash sync.RWMutex lockGetCodeSize sync.RWMutex lockGetCommittedState sync.RWMutex lockGetContext sync.RWMutex - lockGetLogs sync.RWMutex lockGetNonce sync.RWMutex - lockGetOrNewStateObject sync.RWMutex lockGetPrecompileManager sync.RWMutex lockGetRefund sync.RWMutex lockGetState sync.RWMutex - lockGetStorageRoot sync.RWMutex lockGetTransientState sync.RWMutex lockHasSelfDestructed sync.RWMutex - lockIntermediateRoot sync.RWMutex - lockIteratorDump sync.RWMutex - lockLogs sync.RWMutex - lockPreimages sync.RWMutex lockPrepare sync.RWMutex - lockRawDump sync.RWMutex lockRevertToSnapshot sync.RWMutex lockSelfDestruct sync.RWMutex lockSelfdestruct6780 sync.RWMutex - lockSetBalance sync.RWMutex lockSetCode sync.RWMutex lockSetNonce sync.RWMutex lockSetState sync.RWMutex - lockSetStorage sync.RWMutex lockSetTransientState sync.RWMutex - lockSetTxContext sync.RWMutex lockSlotInAccessList sync.RWMutex lockSnapshot sync.RWMutex - lockStartPrefetcher sync.RWMutex - lockStopPrefetcher sync.RWMutex lockSubBalance sync.RWMutex lockSubRefund sync.RWMutex - lockTxIndex sync.RWMutex } // AddAddressToAccessList calls AddAddressToAccessListFunc. @@ -962,69 +709,6 @@ func (mock *PolarStateDBMock) AddressInAccessListCalls() []struct { return calls } -// Commit calls CommitFunc. -func (mock *PolarStateDBMock) Commit(v uint64, b bool) (common.Hash, error) { - if mock.CommitFunc == nil { - panic("PolarStateDBMock.CommitFunc: method is nil but PolarStateDB.Commit was just called") - } - callInfo := struct { - V uint64 - B bool - }{ - V: v, - B: b, - } - mock.lockCommit.Lock() - mock.calls.Commit = append(mock.calls.Commit, callInfo) - mock.lockCommit.Unlock() - return mock.CommitFunc(v, b) -} - -// CommitCalls gets all the calls that were made to Commit. -// Check the length with: -// -// len(mockedPolarStateDB.CommitCalls()) -func (mock *PolarStateDBMock) CommitCalls() []struct { - V uint64 - B bool -} { - var calls []struct { - V uint64 - B bool - } - mock.lockCommit.RLock() - calls = mock.calls.Commit - mock.lockCommit.RUnlock() - return calls -} - -// Copy calls CopyFunc. -func (mock *PolarStateDBMock) Copy() state.StateDBI { - if mock.CopyFunc == nil { - panic("PolarStateDBMock.CopyFunc: method is nil but PolarStateDB.Copy was just called") - } - callInfo := struct { - }{} - mock.lockCopy.Lock() - mock.calls.Copy = append(mock.calls.Copy, callInfo) - mock.lockCopy.Unlock() - return mock.CopyFunc() -} - -// CopyCalls gets all the calls that were made to Copy. -// Check the length with: -// -// len(mockedPolarStateDB.CopyCalls()) -func (mock *PolarStateDBMock) CopyCalls() []struct { -} { - var calls []struct { - } - mock.lockCopy.RLock() - calls = mock.calls.Copy - mock.lockCopy.RUnlock() - return calls -} - // CreateAccount calls CreateAccountFunc. func (mock *PolarStateDBMock) CreateAccount(address common.Address) { if mock.CreateAccountFunc == nil { @@ -1057,101 +741,6 @@ func (mock *PolarStateDBMock) CreateAccountCalls() []struct { return calls } -// Database calls DatabaseFunc. -func (mock *PolarStateDBMock) Database() state.Database { - if mock.DatabaseFunc == nil { - panic("PolarStateDBMock.DatabaseFunc: method is nil but PolarStateDB.Database was just called") - } - callInfo := struct { - }{} - mock.lockDatabase.Lock() - mock.calls.Database = append(mock.calls.Database, callInfo) - mock.lockDatabase.Unlock() - return mock.DatabaseFunc() -} - -// DatabaseCalls gets all the calls that were made to Database. -// Check the length with: -// -// len(mockedPolarStateDB.DatabaseCalls()) -func (mock *PolarStateDBMock) DatabaseCalls() []struct { -} { - var calls []struct { - } - mock.lockDatabase.RLock() - calls = mock.calls.Database - mock.lockDatabase.RUnlock() - return calls -} - -// Dump calls DumpFunc. -func (mock *PolarStateDBMock) Dump(opts *state.DumpConfig) []byte { - if mock.DumpFunc == nil { - panic("PolarStateDBMock.DumpFunc: method is nil but PolarStateDB.Dump was just called") - } - callInfo := struct { - Opts *state.DumpConfig - }{ - Opts: opts, - } - mock.lockDump.Lock() - mock.calls.Dump = append(mock.calls.Dump, callInfo) - mock.lockDump.Unlock() - return mock.DumpFunc(opts) -} - -// DumpCalls gets all the calls that were made to Dump. -// Check the length with: -// -// len(mockedPolarStateDB.DumpCalls()) -func (mock *PolarStateDBMock) DumpCalls() []struct { - Opts *state.DumpConfig -} { - var calls []struct { - Opts *state.DumpConfig - } - mock.lockDump.RLock() - calls = mock.calls.Dump - mock.lockDump.RUnlock() - return calls -} - -// DumpToCollector calls DumpToCollectorFunc. -func (mock *PolarStateDBMock) DumpToCollector(c state.DumpCollector, conf *state.DumpConfig) []byte { - if mock.DumpToCollectorFunc == nil { - panic("PolarStateDBMock.DumpToCollectorFunc: method is nil but PolarStateDB.DumpToCollector was just called") - } - callInfo := struct { - C state.DumpCollector - Conf *state.DumpConfig - }{ - C: c, - Conf: conf, - } - mock.lockDumpToCollector.Lock() - mock.calls.DumpToCollector = append(mock.calls.DumpToCollector, callInfo) - mock.lockDumpToCollector.Unlock() - return mock.DumpToCollectorFunc(c, conf) -} - -// DumpToCollectorCalls gets all the calls that were made to DumpToCollector. -// Check the length with: -// -// len(mockedPolarStateDB.DumpToCollectorCalls()) -func (mock *PolarStateDBMock) DumpToCollectorCalls() []struct { - C state.DumpCollector - Conf *state.DumpConfig -} { - var calls []struct { - C state.DumpCollector - Conf *state.DumpConfig - } - mock.lockDumpToCollector.RLock() - calls = mock.calls.DumpToCollector - mock.lockDumpToCollector.RUnlock() - return calls -} - // Empty calls EmptyFunc. func (mock *PolarStateDBMock) Empty(address common.Address) bool { if mock.EmptyFunc == nil { @@ -1184,33 +773,6 @@ func (mock *PolarStateDBMock) EmptyCalls() []struct { return calls } -// Error calls ErrorFunc. -func (mock *PolarStateDBMock) Error() error { - if mock.ErrorFunc == nil { - panic("PolarStateDBMock.ErrorFunc: method is nil but PolarStateDB.Error was just called") - } - callInfo := struct { - }{} - mock.lockError.Lock() - mock.calls.Error = append(mock.calls.Error, callInfo) - mock.lockError.Unlock() - return mock.ErrorFunc() -} - -// ErrorCalls gets all the calls that were made to Error. -// Check the length with: -// -// len(mockedPolarStateDB.ErrorCalls()) -func (mock *PolarStateDBMock) ErrorCalls() []struct { -} { - var calls []struct { - } - mock.lockError.RLock() - calls = mock.calls.Error - mock.lockError.RUnlock() - return calls -} - // Exist calls ExistFunc. func (mock *PolarStateDBMock) Exist(address common.Address) bool { if mock.ExistFunc == nil { @@ -1243,38 +805,6 @@ func (mock *PolarStateDBMock) ExistCalls() []struct { return calls } -// Finalise calls FinaliseFunc. -func (mock *PolarStateDBMock) Finalise(deleteEmptyObjects bool) { - if mock.FinaliseFunc == nil { - panic("PolarStateDBMock.FinaliseFunc: method is nil but PolarStateDB.Finalise was just called") - } - callInfo := struct { - DeleteEmptyObjects bool - }{ - DeleteEmptyObjects: deleteEmptyObjects, - } - mock.lockFinalise.Lock() - mock.calls.Finalise = append(mock.calls.Finalise, callInfo) - mock.lockFinalise.Unlock() - mock.FinaliseFunc(deleteEmptyObjects) -} - -// FinaliseCalls gets all the calls that were made to Finalise. -// Check the length with: -// -// len(mockedPolarStateDB.FinaliseCalls()) -func (mock *PolarStateDBMock) FinaliseCalls() []struct { - DeleteEmptyObjects bool -} { - var calls []struct { - DeleteEmptyObjects bool - } - mock.lockFinalise.RLock() - calls = mock.calls.Finalise - mock.lockFinalise.RUnlock() - return calls -} - // GetBalance calls GetBalanceFunc. func (mock *PolarStateDBMock) GetBalance(address common.Address) *big.Int { if mock.GetBalanceFunc == nil { @@ -1466,46 +996,6 @@ func (mock *PolarStateDBMock) GetContextCalls() []struct { return calls } -// GetLogs calls GetLogsFunc. -func (mock *PolarStateDBMock) GetLogs(hash common.Hash, blockNumber uint64, blockHash common.Hash) []*types.Log { - if mock.GetLogsFunc == nil { - panic("PolarStateDBMock.GetLogsFunc: method is nil but PolarStateDB.GetLogs was just called") - } - callInfo := struct { - Hash common.Hash - BlockNumber uint64 - BlockHash common.Hash - }{ - Hash: hash, - BlockNumber: blockNumber, - BlockHash: blockHash, - } - mock.lockGetLogs.Lock() - mock.calls.GetLogs = append(mock.calls.GetLogs, callInfo) - mock.lockGetLogs.Unlock() - return mock.GetLogsFunc(hash, blockNumber, blockHash) -} - -// GetLogsCalls gets all the calls that were made to GetLogs. -// Check the length with: -// -// len(mockedPolarStateDB.GetLogsCalls()) -func (mock *PolarStateDBMock) GetLogsCalls() []struct { - Hash common.Hash - BlockNumber uint64 - BlockHash common.Hash -} { - var calls []struct { - Hash common.Hash - BlockNumber uint64 - BlockHash common.Hash - } - mock.lockGetLogs.RLock() - calls = mock.calls.GetLogs - mock.lockGetLogs.RUnlock() - return calls -} - // GetNonce calls GetNonceFunc. func (mock *PolarStateDBMock) GetNonce(address common.Address) uint64 { if mock.GetNonceFunc == nil { @@ -1538,38 +1028,6 @@ func (mock *PolarStateDBMock) GetNonceCalls() []struct { return calls } -// GetOrNewStateObject calls GetOrNewStateObjectFunc. -func (mock *PolarStateDBMock) GetOrNewStateObject(addr common.Address) *state.StateObject { - if mock.GetOrNewStateObjectFunc == nil { - panic("PolarStateDBMock.GetOrNewStateObjectFunc: method is nil but PolarStateDB.GetOrNewStateObject was just called") - } - callInfo := struct { - Addr common.Address - }{ - Addr: addr, - } - mock.lockGetOrNewStateObject.Lock() - mock.calls.GetOrNewStateObject = append(mock.calls.GetOrNewStateObject, callInfo) - mock.lockGetOrNewStateObject.Unlock() - return mock.GetOrNewStateObjectFunc(addr) -} - -// GetOrNewStateObjectCalls gets all the calls that were made to GetOrNewStateObject. -// Check the length with: -// -// len(mockedPolarStateDB.GetOrNewStateObjectCalls()) -func (mock *PolarStateDBMock) GetOrNewStateObjectCalls() []struct { - Addr common.Address -} { - var calls []struct { - Addr common.Address - } - mock.lockGetOrNewStateObject.RLock() - calls = mock.calls.GetOrNewStateObject - mock.lockGetOrNewStateObject.RUnlock() - return calls -} - // GetPrecompileManager calls GetPrecompileManagerFunc. func (mock *PolarStateDBMock) GetPrecompileManager() any { if mock.GetPrecompileManagerFunc == nil { @@ -1660,38 +1118,6 @@ func (mock *PolarStateDBMock) GetStateCalls() []struct { return calls } -// GetStorageRoot calls GetStorageRootFunc. -func (mock *PolarStateDBMock) GetStorageRoot(addr common.Address) common.Hash { - if mock.GetStorageRootFunc == nil { - panic("PolarStateDBMock.GetStorageRootFunc: method is nil but PolarStateDB.GetStorageRoot was just called") - } - callInfo := struct { - Addr common.Address - }{ - Addr: addr, - } - mock.lockGetStorageRoot.Lock() - mock.calls.GetStorageRoot = append(mock.calls.GetStorageRoot, callInfo) - mock.lockGetStorageRoot.Unlock() - return mock.GetStorageRootFunc(addr) -} - -// GetStorageRootCalls gets all the calls that were made to GetStorageRoot. -// Check the length with: -// -// len(mockedPolarStateDB.GetStorageRootCalls()) -func (mock *PolarStateDBMock) GetStorageRootCalls() []struct { - Addr common.Address -} { - var calls []struct { - Addr common.Address - } - mock.lockGetStorageRoot.RLock() - calls = mock.calls.GetStorageRoot - mock.lockGetStorageRoot.RUnlock() - return calls -} - // GetTransientState calls GetTransientStateFunc. func (mock *PolarStateDBMock) GetTransientState(addr common.Address, key common.Hash) common.Hash { if mock.GetTransientStateFunc == nil { @@ -1760,124 +1186,6 @@ func (mock *PolarStateDBMock) HasSelfDestructedCalls() []struct { return calls } -// IntermediateRoot calls IntermediateRootFunc. -func (mock *PolarStateDBMock) IntermediateRoot(deleteEmptyObjects bool) common.Hash { - if mock.IntermediateRootFunc == nil { - panic("PolarStateDBMock.IntermediateRootFunc: method is nil but PolarStateDB.IntermediateRoot was just called") - } - callInfo := struct { - DeleteEmptyObjects bool - }{ - DeleteEmptyObjects: deleteEmptyObjects, - } - mock.lockIntermediateRoot.Lock() - mock.calls.IntermediateRoot = append(mock.calls.IntermediateRoot, callInfo) - mock.lockIntermediateRoot.Unlock() - return mock.IntermediateRootFunc(deleteEmptyObjects) -} - -// IntermediateRootCalls gets all the calls that were made to IntermediateRoot. -// Check the length with: -// -// len(mockedPolarStateDB.IntermediateRootCalls()) -func (mock *PolarStateDBMock) IntermediateRootCalls() []struct { - DeleteEmptyObjects bool -} { - var calls []struct { - DeleteEmptyObjects bool - } - mock.lockIntermediateRoot.RLock() - calls = mock.calls.IntermediateRoot - mock.lockIntermediateRoot.RUnlock() - return calls -} - -// IteratorDump calls IteratorDumpFunc. -func (mock *PolarStateDBMock) IteratorDump(opts *state.DumpConfig) state.IteratorDump { - if mock.IteratorDumpFunc == nil { - panic("PolarStateDBMock.IteratorDumpFunc: method is nil but PolarStateDB.IteratorDump was just called") - } - callInfo := struct { - Opts *state.DumpConfig - }{ - Opts: opts, - } - mock.lockIteratorDump.Lock() - mock.calls.IteratorDump = append(mock.calls.IteratorDump, callInfo) - mock.lockIteratorDump.Unlock() - return mock.IteratorDumpFunc(opts) -} - -// IteratorDumpCalls gets all the calls that were made to IteratorDump. -// Check the length with: -// -// len(mockedPolarStateDB.IteratorDumpCalls()) -func (mock *PolarStateDBMock) IteratorDumpCalls() []struct { - Opts *state.DumpConfig -} { - var calls []struct { - Opts *state.DumpConfig - } - mock.lockIteratorDump.RLock() - calls = mock.calls.IteratorDump - mock.lockIteratorDump.RUnlock() - return calls -} - -// Logs calls LogsFunc. -func (mock *PolarStateDBMock) Logs() []*types.Log { - if mock.LogsFunc == nil { - panic("PolarStateDBMock.LogsFunc: method is nil but PolarStateDB.Logs was just called") - } - callInfo := struct { - }{} - mock.lockLogs.Lock() - mock.calls.Logs = append(mock.calls.Logs, callInfo) - mock.lockLogs.Unlock() - return mock.LogsFunc() -} - -// LogsCalls gets all the calls that were made to Logs. -// Check the length with: -// -// len(mockedPolarStateDB.LogsCalls()) -func (mock *PolarStateDBMock) LogsCalls() []struct { -} { - var calls []struct { - } - mock.lockLogs.RLock() - calls = mock.calls.Logs - mock.lockLogs.RUnlock() - return calls -} - -// Preimages calls PreimagesFunc. -func (mock *PolarStateDBMock) Preimages() map[common.Hash][]byte { - if mock.PreimagesFunc == nil { - panic("PolarStateDBMock.PreimagesFunc: method is nil but PolarStateDB.Preimages was just called") - } - callInfo := struct { - }{} - mock.lockPreimages.Lock() - mock.calls.Preimages = append(mock.calls.Preimages, callInfo) - mock.lockPreimages.Unlock() - return mock.PreimagesFunc() -} - -// PreimagesCalls gets all the calls that were made to Preimages. -// Check the length with: -// -// len(mockedPolarStateDB.PreimagesCalls()) -func (mock *PolarStateDBMock) PreimagesCalls() []struct { -} { - var calls []struct { - } - mock.lockPreimages.RLock() - calls = mock.calls.Preimages - mock.lockPreimages.RUnlock() - return calls -} - // Prepare calls PrepareFunc. func (mock *PolarStateDBMock) Prepare(rules params.Rules, sender common.Address, coinbase common.Address, dest *common.Address, precompiles []common.Address, txAccesses types.AccessList) { if mock.PrepareFunc == nil { @@ -1930,38 +1238,6 @@ func (mock *PolarStateDBMock) PrepareCalls() []struct { return calls } -// RawDump calls RawDumpFunc. -func (mock *PolarStateDBMock) RawDump(opts *state.DumpConfig) state.Dump { - if mock.RawDumpFunc == nil { - panic("PolarStateDBMock.RawDumpFunc: method is nil but PolarStateDB.RawDump was just called") - } - callInfo := struct { - Opts *state.DumpConfig - }{ - Opts: opts, - } - mock.lockRawDump.Lock() - mock.calls.RawDump = append(mock.calls.RawDump, callInfo) - mock.lockRawDump.Unlock() - return mock.RawDumpFunc(opts) -} - -// RawDumpCalls gets all the calls that were made to RawDump. -// Check the length with: -// -// len(mockedPolarStateDB.RawDumpCalls()) -func (mock *PolarStateDBMock) RawDumpCalls() []struct { - Opts *state.DumpConfig -} { - var calls []struct { - Opts *state.DumpConfig - } - mock.lockRawDump.RLock() - calls = mock.calls.RawDump - mock.lockRawDump.RUnlock() - return calls -} - // RevertToSnapshot calls RevertToSnapshotFunc. func (mock *PolarStateDBMock) RevertToSnapshot(n int) { if mock.RevertToSnapshotFunc == nil { @@ -2058,42 +1334,6 @@ func (mock *PolarStateDBMock) Selfdestruct6780Calls() []struct { return calls } -// SetBalance calls SetBalanceFunc. -func (mock *PolarStateDBMock) SetBalance(addr common.Address, amount *big.Int) { - if mock.SetBalanceFunc == nil { - panic("PolarStateDBMock.SetBalanceFunc: method is nil but PolarStateDB.SetBalance was just called") - } - callInfo := struct { - Addr common.Address - Amount *big.Int - }{ - Addr: addr, - Amount: amount, - } - mock.lockSetBalance.Lock() - mock.calls.SetBalance = append(mock.calls.SetBalance, callInfo) - mock.lockSetBalance.Unlock() - mock.SetBalanceFunc(addr, amount) -} - -// SetBalanceCalls gets all the calls that were made to SetBalance. -// Check the length with: -// -// len(mockedPolarStateDB.SetBalanceCalls()) -func (mock *PolarStateDBMock) SetBalanceCalls() []struct { - Addr common.Address - Amount *big.Int -} { - var calls []struct { - Addr common.Address - Amount *big.Int - } - mock.lockSetBalance.RLock() - calls = mock.calls.SetBalance - mock.lockSetBalance.RUnlock() - return calls -} - // SetCode calls SetCodeFunc. func (mock *PolarStateDBMock) SetCode(address common.Address, bytes []byte) { if mock.SetCodeFunc == nil { @@ -2206,42 +1446,6 @@ func (mock *PolarStateDBMock) SetStateCalls() []struct { return calls } -// SetStorage calls SetStorageFunc. -func (mock *PolarStateDBMock) SetStorage(addr common.Address, storage map[common.Hash]common.Hash) { - if mock.SetStorageFunc == nil { - panic("PolarStateDBMock.SetStorageFunc: method is nil but PolarStateDB.SetStorage was just called") - } - callInfo := struct { - Addr common.Address - Storage map[common.Hash]common.Hash - }{ - Addr: addr, - Storage: storage, - } - mock.lockSetStorage.Lock() - mock.calls.SetStorage = append(mock.calls.SetStorage, callInfo) - mock.lockSetStorage.Unlock() - mock.SetStorageFunc(addr, storage) -} - -// SetStorageCalls gets all the calls that were made to SetStorage. -// Check the length with: -// -// len(mockedPolarStateDB.SetStorageCalls()) -func (mock *PolarStateDBMock) SetStorageCalls() []struct { - Addr common.Address - Storage map[common.Hash]common.Hash -} { - var calls []struct { - Addr common.Address - Storage map[common.Hash]common.Hash - } - mock.lockSetStorage.RLock() - calls = mock.calls.SetStorage - mock.lockSetStorage.RUnlock() - return calls -} - // SetTransientState calls SetTransientStateFunc. func (mock *PolarStateDBMock) SetTransientState(addr common.Address, key common.Hash, value common.Hash) { if mock.SetTransientStateFunc == nil { @@ -2282,42 +1486,6 @@ func (mock *PolarStateDBMock) SetTransientStateCalls() []struct { return calls } -// SetTxContext calls SetTxContextFunc. -func (mock *PolarStateDBMock) SetTxContext(thash common.Hash, ti int) { - if mock.SetTxContextFunc == nil { - panic("PolarStateDBMock.SetTxContextFunc: method is nil but PolarStateDB.SetTxContext was just called") - } - callInfo := struct { - Thash common.Hash - Ti int - }{ - Thash: thash, - Ti: ti, - } - mock.lockSetTxContext.Lock() - mock.calls.SetTxContext = append(mock.calls.SetTxContext, callInfo) - mock.lockSetTxContext.Unlock() - mock.SetTxContextFunc(thash, ti) -} - -// SetTxContextCalls gets all the calls that were made to SetTxContext. -// Check the length with: -// -// len(mockedPolarStateDB.SetTxContextCalls()) -func (mock *PolarStateDBMock) SetTxContextCalls() []struct { - Thash common.Hash - Ti int -} { - var calls []struct { - Thash common.Hash - Ti int - } - mock.lockSetTxContext.RLock() - calls = mock.calls.SetTxContext - mock.lockSetTxContext.RUnlock() - return calls -} - // SlotInAccessList calls SlotInAccessListFunc. func (mock *PolarStateDBMock) SlotInAccessList(addr common.Address, slot common.Hash) (bool, bool) { if mock.SlotInAccessListFunc == nil { @@ -2381,65 +1549,6 @@ func (mock *PolarStateDBMock) SnapshotCalls() []struct { return calls } -// StartPrefetcher calls StartPrefetcherFunc. -func (mock *PolarStateDBMock) StartPrefetcher(namespace string) { - if mock.StartPrefetcherFunc == nil { - panic("PolarStateDBMock.StartPrefetcherFunc: method is nil but PolarStateDB.StartPrefetcher was just called") - } - callInfo := struct { - Namespace string - }{ - Namespace: namespace, - } - mock.lockStartPrefetcher.Lock() - mock.calls.StartPrefetcher = append(mock.calls.StartPrefetcher, callInfo) - mock.lockStartPrefetcher.Unlock() - mock.StartPrefetcherFunc(namespace) -} - -// StartPrefetcherCalls gets all the calls that were made to StartPrefetcher. -// Check the length with: -// -// len(mockedPolarStateDB.StartPrefetcherCalls()) -func (mock *PolarStateDBMock) StartPrefetcherCalls() []struct { - Namespace string -} { - var calls []struct { - Namespace string - } - mock.lockStartPrefetcher.RLock() - calls = mock.calls.StartPrefetcher - mock.lockStartPrefetcher.RUnlock() - return calls -} - -// StopPrefetcher calls StopPrefetcherFunc. -func (mock *PolarStateDBMock) StopPrefetcher() { - if mock.StopPrefetcherFunc == nil { - panic("PolarStateDBMock.StopPrefetcherFunc: method is nil but PolarStateDB.StopPrefetcher was just called") - } - callInfo := struct { - }{} - mock.lockStopPrefetcher.Lock() - mock.calls.StopPrefetcher = append(mock.calls.StopPrefetcher, callInfo) - mock.lockStopPrefetcher.Unlock() - mock.StopPrefetcherFunc() -} - -// StopPrefetcherCalls gets all the calls that were made to StopPrefetcher. -// Check the length with: -// -// len(mockedPolarStateDB.StopPrefetcherCalls()) -func (mock *PolarStateDBMock) StopPrefetcherCalls() []struct { -} { - var calls []struct { - } - mock.lockStopPrefetcher.RLock() - calls = mock.calls.StopPrefetcher - mock.lockStopPrefetcher.RUnlock() - return calls -} - // SubBalance calls SubBalanceFunc. func (mock *PolarStateDBMock) SubBalance(address common.Address, intMoqParam *big.Int) { if mock.SubBalanceFunc == nil { @@ -2507,30 +1616,3 @@ func (mock *PolarStateDBMock) SubRefundCalls() []struct { mock.lockSubRefund.RUnlock() return calls } - -// TxIndex calls TxIndexFunc. -func (mock *PolarStateDBMock) TxIndex() int { - if mock.TxIndexFunc == nil { - panic("PolarStateDBMock.TxIndexFunc: method is nil but PolarStateDB.TxIndex was just called") - } - callInfo := struct { - }{} - mock.lockTxIndex.Lock() - mock.calls.TxIndex = append(mock.calls.TxIndex, callInfo) - mock.lockTxIndex.Unlock() - return mock.TxIndexFunc() -} - -// TxIndexCalls gets all the calls that were made to TxIndex. -// Check the length with: -// -// len(mockedPolarStateDB.TxIndexCalls()) -func (mock *PolarStateDBMock) TxIndexCalls() []struct { -} { - var calls []struct { - } - mock.lockTxIndex.RLock() - calls = mock.calls.TxIndex - mock.lockTxIndex.RUnlock() - return calls -} diff --git a/eth/go.mod b/eth/go.mod index fc89a05ce0..ece59b39bc 100644 --- a/eth/go.mod +++ b/eth/go.mod @@ -3,7 +3,7 @@ module pkg.berachain.dev/polaris/eth go 1.21 // We replace `go-ethereum` with `polaris-geth` in order include our required changes. -replace github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 +replace github.com/ethereum/go-ethereum => github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 require ( github.com/ethereum/go-ethereum v1.13.1 diff --git a/eth/go.sum b/eth/go.sum index 0355afeced..13a55540e9 100644 --- a/eth/go.sum +++ b/eth/go.sum @@ -12,8 +12,8 @@ github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7D github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4 h1:t8fKaxVPovG95BUX62QX1DaJld0Uk5Hi9DtDQphIWR0= -github.com/berachain/polaris-geth v0.0.0-20231005195105-e21d980905b4/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 h1:LY4GputrzZf7U2yoDLgt7oQdJc5URRTzQooDnb6igjM= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= diff --git a/go.work.sum b/go.work.sum index cf17c48c90..f381a18609 100644 --- a/go.work.sum +++ b/go.work.sum @@ -436,7 +436,8 @@ github.com/aws/smithy-go v1.8.0 h1:AEwwwXQZtUwP5Mz506FeXXrKBe0jA8gVM+1gEcSRooc= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10 h1:LY4GputrzZf7U2yoDLgt7oQdJc5URRTzQooDnb6igjM= +github.com/berachain/polaris-geth v0.0.0-20231008031417-f6e231f3bf10/go.mod h1:gkQ5Ygi64ZBh9M/4iXY1R8WqoNCx1Ey0CkYn2BD4/fw= github.com/bmatcuk/doublestar v1.1.1 h1:YroD6BJCZBYx06yYFEWvUuKVWQn3vLLQAVmDmvTSaiQ= github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= @@ -452,7 +453,6 @@ github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMr github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/checkpoint-restore/go-criu/v5 v5.3.0 h1:wpFFOoomK3389ue2lAb0Boag6XPht5QYpipxmSNL4d8= github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= -github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89 h1:aPflPkRFkVwbW6dmcVqfgwp1i+UWGFH6VgR1Jim5Ygc= github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= github.com/chromedp/chromedp v0.9.2 h1:dKtNz4kApb06KuSXoTQIyUC2TrA0fhGDwNZf3bcgfKw= @@ -472,7 +472,6 @@ github.com/cloudflare/cloudflare-go v0.14.0 h1:gFqGlGl/5f9UGXAaKapCGUfaTCgRKKnzu github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe h1:QQ3GSy+MqSHxm/d8nCtnAiZdYFd45cYZPs8vOOIYKfk= github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 h1:IKgmqgMQlVJIZj19CdocBeSfSaiCbEBZGKODaixqtHM= @@ -492,10 +491,8 @@ github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8 github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf h1:CAKfRE2YtTUIjjh1bkBtyYFaUT/WmOqsJjgtihT0vMI= github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80 h1:DuBDHVjgGMPki7bAyh91+3cF1Vh34sAEdH8JQgbc2R0= github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI= -github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= github.com/creachadair/command v0.0.0-20220916173946-56a74cdd66b6 h1:uKuolOJonQOb/2+z/wFSJeVREP6fSoigr/X4Wlfhwwg= github.com/creachadair/command v0.0.0-20220916173946-56a74cdd66b6/go.mod h1:jN7ZJM5YSVtD3SHmkAdN/cOC1dXiqg2Y9K5Sr5a8Nxw= -github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= github.com/cristalhq/acmd v0.11.1 h1:DJ4fh2Pv0nPKmqT646IU/0Vh5FNdGblxvF+3/W3NAUI= github.com/cristalhq/acmd v0.11.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= @@ -513,8 +510,6 @@ github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaI github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.11.1 h1:wSUXTlLfiAQRWs2F+p+EKOY9rUyis1MyGqJ2DIk5HpM= github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= @@ -571,36 +566,11 @@ github.com/gogo/status v1.1.0 h1:+eIkrewn5q6b30y+g/BJINVVdi2xH7je5MPJ3ZPK3JA= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-pkcs11 v0.2.0 h1:5meDPB26aJ98f+K9G21f0AqZwo/S5BJMJh8nuhMbdsI= github.com/google/go-pkcs11 v0.2.0/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 h1:tlyzajkF3030q6M8SvmJSemC9DTHL/xaMa18b65+JM4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= @@ -612,13 +582,10 @@ github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtX github.com/hashicorp/consul/api v1.20.0 h1:9IHTjNVSZ7MIwjlW3N3a7iGiykCMDpxZu8jsxFJh0yc= github.com/hashicorp/consul/api v1.20.0/go.mod h1:nR64eD44KQ59Of/ECwt2vUmIK2DKsDzAwTmwmLl8Wpo= github.com/hashicorp/consul/sdk v0.3.0 h1:UOxjlb4xVNF93jak1mzzoBatyFju9nrkxpVwIp/QqxQ= -github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.2/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-retryablehttp v0.5.3 h1:QlWt0KvWT0lq8MFppF9tsJGF+ynG7ztc2KIPhzRGk7s= github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= github.com/hashicorp/go.net v0.0.1 h1:sNCoNyDEvN1xa+X0baata4RdcpKwcMS6DH+xwfqPgjw= @@ -651,8 +618,6 @@ github.com/jhump/gopoet v0.1.0 h1:gYjOPnzHd2nzB37xYQZxj4EIQNpBrBskRqQQ3q4ZgSg= github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI= github.com/jhump/goprotoc v0.5.0 h1:Y1UgUX+txUznfqcGdDef8ZOVlyQvnV0pKWZH08RmZuo= github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= @@ -665,6 +630,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7 github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d h1:c93kUJDtVAXFEhsCh5jSxyOJmFHuzcihnslQiX8Urwo= github.com/junk1tm/musttag v0.5.0 h1:bV1DTdi38Hi4pG4OVWa7Kap0hi0o7EczuK6wQt9zPOM= github.com/junk1tm/musttag v0.5.0/go.mod h1:PcR7BA+oREQYvHwgjIDmw3exJeds5JzRcvEJTfjrA0M= +github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= +github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c h1:AqsttAyEyIEsNz5WLRwuRwjiT5CMDUfLk6cFJDVPebs= github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kataras/blocks v0.0.7 h1:cF3RDY/vxnSRezc7vLFlQFTYXG/yAr1o7WImJuZbzC4= @@ -684,7 +651,6 @@ github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23 h1:FOOIBWrEkLgmlgGfMuZT83xIwfPDxEI2OHu6xUmJMFE= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/knz/go-libedit v1.10.1 h1:0pHpWtx9vcvC0xGZqEQlQdfSQs7WRlAjuPvk3fOZDCo= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= @@ -713,7 +679,6 @@ github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqA github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8ceC6BxnoG8TBrhgAvRg8obzup0= github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= github.com/microcosm-cc/bluemonday v1.0.23 h1:SMZe2IGa0NuHvnVNAZ+6B38gsTbi5e4sViiWJyDDqFY= @@ -841,8 +806,6 @@ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzH github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8 h1:ndzgwNDnKIqyCvHTXaCqh9KlOWKvBry6nuXMJmonVsE= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= -github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8= github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc= github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= @@ -884,197 +847,22 @@ go.etcd.io/etcd/client/v3 v3.5.9 h1:r5xghnU7CwbUxD/fbUtRyJGaYNfDun8sp/gTr1hew6E= go.etcd.io/etcd/client/v3 v3.5.9/go.mod h1:i/Eo5LrZ5IKqpbtpPDuaUnDOUv471oDg8cjQaUr2MbA= go.etcd.io/gofail v0.1.0 h1:XItAMIhOojXFQMgrxjnd2EIIHun/d5qL0Pf7FzVTkFg= go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0 h1:rwOQPCuKAKmwGKq2aVNnYIibI6wnV7EvzgfTCzcdGg8= go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME= go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5 h1:ObuXPmIgI4ZMyQLIz48cJYgSyWdjUXc2SZAdyJMwEAU= golang.org/x/perf v0.0.0-20230113213139-801c7ef9e5c5/go.mod h1:UBKtEnL8aqnd+0JHqZ+2qoMDwtuy6cYhhKNoHLBiTQc= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o= gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= -google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.134.0/go.mod h1:sjRL3UnjTx5UqNQS9EWr9N8p7xbHpy1k0XGRLCf3Spk= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= -google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= -google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= -google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= -google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230720185612-659f7aaaa771 h1:gm8vsVR64Jx1GxHY8M+p8YA2bxU/H/lymcutB2l7l9s= google.golang.org/genproto/googleapis/bytestream v0.0.0-20230720185612-659f7aaaa771/go.mod h1:3QoBVwTHkXbY1oRGzlhwhOykfcATQN43LJ6iT8Wy8kE= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0 h1:M1YKkFIboKNieVO5DLUEVzQfGwJD30Nv2jfUgzb5UcE= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= -gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/gcfg.v1 v1.2.3 h1:m8OOJ4ccYHnx2f4gQwpno8nAX5OGOh7RLaaz0pj3Ogs= From 348b172df078d25701c7f4ab64740932abba3ff0 Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Sun, 8 Oct 2023 11:00:27 -0400 Subject: [PATCH 2/3] chore(testing): remove unused code --- .../types/mock/interfaces/mock/sdk.mock.go | 353 ---------- cosmos/testing/types/mock/interfaces/types.go | 36 -- cosmos/testing/types/mock/types.go | 54 -- cosmos/testing/utils/bank.go | 19 - cosmos/x/evm/genesis_test.go | 2 - x/evm/types/tx.pb.go | 608 ------------------ 6 files changed, 1072 deletions(-) delete mode 100644 cosmos/testing/types/mock/interfaces/mock/sdk.mock.go delete mode 100644 cosmos/testing/types/mock/interfaces/types.go delete mode 100644 cosmos/testing/types/mock/types.go delete mode 100644 x/evm/types/tx.pb.go diff --git a/cosmos/testing/types/mock/interfaces/mock/sdk.mock.go b/cosmos/testing/types/mock/interfaces/mock/sdk.mock.go deleted file mode 100644 index cb7047630d..0000000000 --- a/cosmos/testing/types/mock/interfaces/mock/sdk.mock.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package mock - -import ( - "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/types/tx/signing" - "github.com/cosmos/gogoproto/proto" - "google.golang.org/protobuf/reflect/protoreflect" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock/interfaces" - "sync" -) - -// Ensure, that MsgMock does implement interfaces.Msg. -// If this is not the case, regenerate this file with moq. -var _ interfaces.Msg = &MsgMock{} - -// MsgMock is a mock implementation of interfaces.Msg. -// -// func TestSomethingThatUsesMsg(t *testing.T) { -// -// // make and configure a mocked interfaces.Msg -// mockedMsg := &MsgMock{ -// ProtoMessageFunc: func() { -// panic("mock out the ProtoMessage method") -// }, -// ResetFunc: func() { -// panic("mock out the Reset method") -// }, -// StringFunc: func() string { -// panic("mock out the String method") -// }, -// } -// -// // use mockedMsg in code that requires interfaces.Msg -// // and then make assertions. -// -// } -type MsgMock struct { - // ProtoMessageFunc mocks the ProtoMessage method. - ProtoMessageFunc func() - - // ResetFunc mocks the Reset method. - ResetFunc func() - - // StringFunc mocks the String method. - StringFunc func() string - - // calls tracks calls to the methods. - calls struct { - // ProtoMessage holds details about calls to the ProtoMessage method. - ProtoMessage []struct { - } - // Reset holds details about calls to the Reset method. - Reset []struct { - } - // String holds details about calls to the String method. - String []struct { - } - } - lockProtoMessage sync.RWMutex - lockReset sync.RWMutex - lockString sync.RWMutex -} - -// ProtoMessage calls ProtoMessageFunc. -func (mock *MsgMock) ProtoMessage() { - if mock.ProtoMessageFunc == nil { - panic("MsgMock.ProtoMessageFunc: method is nil but Msg.ProtoMessage was just called") - } - callInfo := struct { - }{} - mock.lockProtoMessage.Lock() - mock.calls.ProtoMessage = append(mock.calls.ProtoMessage, callInfo) - mock.lockProtoMessage.Unlock() - mock.ProtoMessageFunc() -} - -// ProtoMessageCalls gets all the calls that were made to ProtoMessage. -// Check the length with: -// -// len(mockedMsg.ProtoMessageCalls()) -func (mock *MsgMock) ProtoMessageCalls() []struct { -} { - var calls []struct { - } - mock.lockProtoMessage.RLock() - calls = mock.calls.ProtoMessage - mock.lockProtoMessage.RUnlock() - return calls -} - -// Reset calls ResetFunc. -func (mock *MsgMock) Reset() { - if mock.ResetFunc == nil { - panic("MsgMock.ResetFunc: method is nil but Msg.Reset was just called") - } - callInfo := struct { - }{} - mock.lockReset.Lock() - mock.calls.Reset = append(mock.calls.Reset, callInfo) - mock.lockReset.Unlock() - mock.ResetFunc() -} - -// ResetCalls gets all the calls that were made to Reset. -// Check the length with: -// -// len(mockedMsg.ResetCalls()) -func (mock *MsgMock) ResetCalls() []struct { -} { - var calls []struct { - } - mock.lockReset.RLock() - calls = mock.calls.Reset - mock.lockReset.RUnlock() - return calls -} - -// String calls StringFunc. -func (mock *MsgMock) String() string { - if mock.StringFunc == nil { - panic("MsgMock.StringFunc: method is nil but Msg.String was just called") - } - callInfo := struct { - }{} - mock.lockString.Lock() - mock.calls.String = append(mock.calls.String, callInfo) - mock.lockString.Unlock() - return mock.StringFunc() -} - -// StringCalls gets all the calls that were made to String. -// Check the length with: -// -// len(mockedMsg.StringCalls()) -func (mock *MsgMock) StringCalls() []struct { -} { - var calls []struct { - } - mock.lockString.RLock() - calls = mock.calls.String - mock.lockString.RUnlock() - return calls -} - -// Ensure, that TxMock does implement interfaces.Tx. -// If this is not the case, regenerate this file with moq. -var _ interfaces.Tx = &TxMock{} - -// TxMock is a mock implementation of interfaces.Tx. -// -// func TestSomethingThatUsesTx(t *testing.T) { -// -// // make and configure a mocked interfaces.Tx -// mockedTx := &TxMock{ -// GetMsgsFunc: func() []proto.Message { -// panic("mock out the GetMsgs method") -// }, -// GetMsgsV2Func: func() ([]protoreflect.ProtoMessage, error) { -// panic("mock out the GetMsgsV2 method") -// }, -// GetPubKeysFunc: func() ([]types.PubKey, error) { -// panic("mock out the GetPubKeys method") -// }, -// GetSignaturesV2Func: func() ([]signing.SignatureV2, error) { -// panic("mock out the GetSignaturesV2 method") -// }, -// GetSignersFunc: func() ([][]byte, error) { -// panic("mock out the GetSigners method") -// }, -// } -// -// // use mockedTx in code that requires interfaces.Tx -// // and then make assertions. -// -// } -type TxMock struct { - // GetMsgsFunc mocks the GetMsgs method. - GetMsgsFunc func() []proto.Message - - // GetMsgsV2Func mocks the GetMsgsV2 method. - GetMsgsV2Func func() ([]protoreflect.ProtoMessage, error) - - // GetPubKeysFunc mocks the GetPubKeys method. - GetPubKeysFunc func() ([]types.PubKey, error) - - // GetSignaturesV2Func mocks the GetSignaturesV2 method. - GetSignaturesV2Func func() ([]signing.SignatureV2, error) - - // GetSignersFunc mocks the GetSigners method. - GetSignersFunc func() ([][]byte, error) - - // calls tracks calls to the methods. - calls struct { - // GetMsgs holds details about calls to the GetMsgs method. - GetMsgs []struct { - } - // GetMsgsV2 holds details about calls to the GetMsgsV2 method. - GetMsgsV2 []struct { - } - // GetPubKeys holds details about calls to the GetPubKeys method. - GetPubKeys []struct { - } - // GetSignaturesV2 holds details about calls to the GetSignaturesV2 method. - GetSignaturesV2 []struct { - } - // GetSigners holds details about calls to the GetSigners method. - GetSigners []struct { - } - } - lockGetMsgs sync.RWMutex - lockGetMsgsV2 sync.RWMutex - lockGetPubKeys sync.RWMutex - lockGetSignaturesV2 sync.RWMutex - lockGetSigners sync.RWMutex -} - -// GetMsgs calls GetMsgsFunc. -func (mock *TxMock) GetMsgs() []proto.Message { - if mock.GetMsgsFunc == nil { - panic("TxMock.GetMsgsFunc: method is nil but Tx.GetMsgs was just called") - } - callInfo := struct { - }{} - mock.lockGetMsgs.Lock() - mock.calls.GetMsgs = append(mock.calls.GetMsgs, callInfo) - mock.lockGetMsgs.Unlock() - return mock.GetMsgsFunc() -} - -// GetMsgsCalls gets all the calls that were made to GetMsgs. -// Check the length with: -// -// len(mockedTx.GetMsgsCalls()) -func (mock *TxMock) GetMsgsCalls() []struct { -} { - var calls []struct { - } - mock.lockGetMsgs.RLock() - calls = mock.calls.GetMsgs - mock.lockGetMsgs.RUnlock() - return calls -} - -// GetMsgsV2 calls GetMsgsV2Func. -func (mock *TxMock) GetMsgsV2() ([]protoreflect.ProtoMessage, error) { - if mock.GetMsgsV2Func == nil { - panic("TxMock.GetMsgsV2Func: method is nil but Tx.GetMsgsV2 was just called") - } - callInfo := struct { - }{} - mock.lockGetMsgsV2.Lock() - mock.calls.GetMsgsV2 = append(mock.calls.GetMsgsV2, callInfo) - mock.lockGetMsgsV2.Unlock() - return mock.GetMsgsV2Func() -} - -// GetMsgsV2Calls gets all the calls that were made to GetMsgsV2. -// Check the length with: -// -// len(mockedTx.GetMsgsV2Calls()) -func (mock *TxMock) GetMsgsV2Calls() []struct { -} { - var calls []struct { - } - mock.lockGetMsgsV2.RLock() - calls = mock.calls.GetMsgsV2 - mock.lockGetMsgsV2.RUnlock() - return calls -} - -// GetPubKeys calls GetPubKeysFunc. -func (mock *TxMock) GetPubKeys() ([]types.PubKey, error) { - if mock.GetPubKeysFunc == nil { - panic("TxMock.GetPubKeysFunc: method is nil but Tx.GetPubKeys was just called") - } - callInfo := struct { - }{} - mock.lockGetPubKeys.Lock() - mock.calls.GetPubKeys = append(mock.calls.GetPubKeys, callInfo) - mock.lockGetPubKeys.Unlock() - return mock.GetPubKeysFunc() -} - -// GetPubKeysCalls gets all the calls that were made to GetPubKeys. -// Check the length with: -// -// len(mockedTx.GetPubKeysCalls()) -func (mock *TxMock) GetPubKeysCalls() []struct { -} { - var calls []struct { - } - mock.lockGetPubKeys.RLock() - calls = mock.calls.GetPubKeys - mock.lockGetPubKeys.RUnlock() - return calls -} - -// GetSignaturesV2 calls GetSignaturesV2Func. -func (mock *TxMock) GetSignaturesV2() ([]signing.SignatureV2, error) { - if mock.GetSignaturesV2Func == nil { - panic("TxMock.GetSignaturesV2Func: method is nil but Tx.GetSignaturesV2 was just called") - } - callInfo := struct { - }{} - mock.lockGetSignaturesV2.Lock() - mock.calls.GetSignaturesV2 = append(mock.calls.GetSignaturesV2, callInfo) - mock.lockGetSignaturesV2.Unlock() - return mock.GetSignaturesV2Func() -} - -// GetSignaturesV2Calls gets all the calls that were made to GetSignaturesV2. -// Check the length with: -// -// len(mockedTx.GetSignaturesV2Calls()) -func (mock *TxMock) GetSignaturesV2Calls() []struct { -} { - var calls []struct { - } - mock.lockGetSignaturesV2.RLock() - calls = mock.calls.GetSignaturesV2 - mock.lockGetSignaturesV2.RUnlock() - return calls -} - -// GetSigners calls GetSignersFunc. -func (mock *TxMock) GetSigners() ([][]byte, error) { - if mock.GetSignersFunc == nil { - panic("TxMock.GetSignersFunc: method is nil but Tx.GetSigners was just called") - } - callInfo := struct { - }{} - mock.lockGetSigners.Lock() - mock.calls.GetSigners = append(mock.calls.GetSigners, callInfo) - mock.lockGetSigners.Unlock() - return mock.GetSignersFunc() -} - -// GetSignersCalls gets all the calls that were made to GetSigners. -// Check the length with: -// -// len(mockedTx.GetSignersCalls()) -func (mock *TxMock) GetSignersCalls() []struct { -} { - var calls []struct { - } - mock.lockGetSigners.RLock() - calls = mock.calls.GetSigners - mock.lockGetSigners.RUnlock() - return calls -} diff --git a/cosmos/testing/types/mock/interfaces/types.go b/cosmos/testing/types/mock/interfaces/types.go deleted file mode 100644 index e23ad1d87d..0000000000 --- a/cosmos/testing/types/mock/interfaces/types.go +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package interfaces - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/signing" -) - -// Interface wrappers for mocking -// -//go:generate moq -out ./mock/sdk.mock.go -pkg mock . Msg Tx -type ( - // TxMsg wrapper for github.com/cosmos/cosmos-sdk/types.TxMsg. - Msg sdk.Msg - // Tx wrapper for github.com/cosmos/cosmos-sdk/x/auth/signing.Tx. - Tx signing.SigVerifiableTx -) diff --git a/cosmos/testing/types/mock/types.go b/cosmos/testing/types/mock/types.go deleted file mode 100644 index 58c4dac14f..0000000000 --- a/cosmos/testing/types/mock/types.go +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package mock - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "pkg.berachain.dev/polaris/cosmos/testing/types/mock/interfaces/mock" -) - -// FakeMsg is a mock implementation of sdk.Msg for testing purposes. -func NewMsg() *mock.MsgMock { - mockedMsg := &mock.MsgMock{ - ProtoMessageFunc: func() { - panic("mock out the ProtoMessage method") - }, - ResetFunc: func() { - panic("mock out the Reset method") - }, - StringFunc: func() string { - panic("mock out the String method") - }, - } - return mockedMsg -} - -// FakeMsg is a mock implementation of sdk.Msg for testing purposes. -func NewTx() *mock.TxMock { - // make and configure a mocked interfaces.Tx - mockedTx := &mock.TxMock{ - GetMsgsFunc: func() []sdk.Msg { - panic("mock out the GetMsgs method") - }, - } - return mockedTx -} diff --git a/cosmos/testing/utils/bank.go b/cosmos/testing/utils/bank.go index 775b416709..07509382f8 100644 --- a/cosmos/testing/utils/bank.go +++ b/cosmos/testing/utils/bank.go @@ -49,22 +49,3 @@ func MintCoinsToAddress( // Send the bank denomination to the receipient. return bk.SendCoinsFromModuleToAccount(ctx, moduleAcc, recipient.Bytes(), coins) } - -// BurnCoinsFromAddress burns coins from a given address. -func BurnCoinsFromAddress( - ctx context.Context, - bk BankKeeper, - moduleAcc string, - sender common.Address, - denom string, - amount *big.Int, -) error { - // Burn the corresponding bank denom. - coins := sdk.Coins{{Denom: denom, Amount: sdkmath.NewIntFromBigInt(amount)}} - if err := bk.SendCoinsFromAccountToModule(ctx, sender.Bytes(), moduleAcc, coins); err != nil { - return err - } - - // Burn the bank denomination. - return bk.BurnCoins(ctx, moduleAcc, coins) -} diff --git a/cosmos/x/evm/genesis_test.go b/cosmos/x/evm/genesis_test.go index 1c3a3ea4d9..644e4d6cb2 100644 --- a/cosmos/x/evm/genesis_test.go +++ b/cosmos/x/evm/genesis_test.go @@ -35,7 +35,6 @@ import ( "pkg.berachain.dev/polaris/cosmos/config" "pkg.berachain.dev/polaris/cosmos/precompile/staking" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock" testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" "pkg.berachain.dev/polaris/cosmos/x/evm" "pkg.berachain.dev/polaris/cosmos/x/evm/keeper" @@ -66,7 +65,6 @@ var _ = Describe("", func() { BeforeEach(func() { ctx, ak, _, sk = testutil.SetupMinimalKeepers() - ctx = ctx.WithMultiStore(mock.NewMultiStore()) ctx = ctx.WithBlockHeight(0) sc = staking.NewPrecompileContract(ak, &sk) cfg := config.DefaultConfig() diff --git a/x/evm/types/tx.pb.go b/x/evm/types/tx.pb.go deleted file mode 100644 index 008ad571aa..0000000000 --- a/x/evm/types/tx.pb.go +++ /dev/null @@ -1,608 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: polaris/evm/v1alpha1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Status represents the status of a transaction. -type Status int32 - -const ( - // STATUS_REVERT_UNSPECIFIED indicates that the transaction reverted. - Status_STATUS_REVERT_UNSPECIFIED Status = 0 - // STATUS_SUCCESS indicates that the transaction completed successfully. - Status_STATUS_SUCCESS Status = 1 - // STATUS_NOT_INCLUDED indicates that the transaction was not included in the - // `evm` block, due to an critical error. - Status_STATUS_NOT_INCLUDED Status = 2 -) - -var Status_name = map[int32]string{ - 0: "STATUS_REVERT_UNSPECIFIED", - 1: "STATUS_SUCCESS", - 2: "STATUS_NOT_INCLUDED", -} - -var Status_value = map[string]int32{ - "STATUS_REVERT_UNSPECIFIED": 0, - "STATUS_SUCCESS": 1, - "STATUS_NOT_INCLUDED": 2, -} - -func (x Status) String() string { - return proto.EnumName(Status_name, int32(x)) -} - -func (Status) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d8b33d2a2c64400f, []int{0} -} - -// WrappedEthereumTransaction encapsulates an Ethereum transaction as an SDK message. -type WrappedEthereumTransaction struct { - // data is inner transaction data of the Ethereum transaction. - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` -} - -func (m *WrappedEthereumTransaction) Reset() { *m = WrappedEthereumTransaction{} } -func (m *WrappedEthereumTransaction) String() string { return proto.CompactTextString(m) } -func (*WrappedEthereumTransaction) ProtoMessage() {} -func (*WrappedEthereumTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_d8b33d2a2c64400f, []int{0} -} -func (m *WrappedEthereumTransaction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WrappedEthereumTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WrappedEthereumTransaction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WrappedEthereumTransaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_WrappedEthereumTransaction.Merge(m, src) -} -func (m *WrappedEthereumTransaction) XXX_Size() int { - return m.Size() -} -func (m *WrappedEthereumTransaction) XXX_DiscardUnknown() { - xxx_messageInfo_WrappedEthereumTransaction.DiscardUnknown(m) -} - -var xxx_messageInfo_WrappedEthereumTransaction proto.InternalMessageInfo - -func (m *WrappedEthereumTransaction) GetData() []byte { - if m != nil { - return m.Data - } - return nil -} - -// WrappedEthereumTransactionResult defines the Msg/EthereumTx response type. -type WrappedEthereumTransactionResult struct { - // `status` represents a transaction's status - Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=polaris.evm.v1alpha1.Status" json:"status,omitempty"` -} - -func (m *WrappedEthereumTransactionResult) Reset() { *m = WrappedEthereumTransactionResult{} } -func (m *WrappedEthereumTransactionResult) String() string { return proto.CompactTextString(m) } -func (*WrappedEthereumTransactionResult) ProtoMessage() {} -func (*WrappedEthereumTransactionResult) Descriptor() ([]byte, []int) { - return fileDescriptor_d8b33d2a2c64400f, []int{1} -} -func (m *WrappedEthereumTransactionResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WrappedEthereumTransactionResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WrappedEthereumTransactionResult.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WrappedEthereumTransactionResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_WrappedEthereumTransactionResult.Merge(m, src) -} -func (m *WrappedEthereumTransactionResult) XXX_Size() int { - return m.Size() -} -func (m *WrappedEthereumTransactionResult) XXX_DiscardUnknown() { - xxx_messageInfo_WrappedEthereumTransactionResult.DiscardUnknown(m) -} - -var xxx_messageInfo_WrappedEthereumTransactionResult proto.InternalMessageInfo - -func (m *WrappedEthereumTransactionResult) GetStatus() Status { - if m != nil { - return m.Status - } - return Status_STATUS_REVERT_UNSPECIFIED -} - -func init() { - proto.RegisterEnum("polaris.evm.v1alpha1.Status", Status_name, Status_value) - proto.RegisterType((*WrappedEthereumTransaction)(nil), "polaris.evm.v1alpha1.WrappedEthereumTransaction") - proto.RegisterType((*WrappedEthereumTransactionResult)(nil), "polaris.evm.v1alpha1.WrappedEthereumTransactionResult") -} - -func init() { proto.RegisterFile("polaris/evm/v1alpha1/tx.proto", fileDescriptor_d8b33d2a2c64400f) } - -var fileDescriptor_d8b33d2a2c64400f = []byte{ - // 351 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2d, 0xc8, 0xcf, 0x49, - 0x2c, 0xca, 0x2c, 0xd6, 0x4f, 0x2d, 0xcb, 0xd5, 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, - 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0x4a, 0xeb, 0xa5, 0x96, - 0xe5, 0xea, 0xc1, 0xa4, 0xa5, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, - 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xb9, 0x92, 0x01, 0x97, 0x54, 0x78, 0x51, 0x62, 0x41, 0x41, - 0x6a, 0x8a, 0x6b, 0x49, 0x46, 0x6a, 0x51, 0x6a, 0x69, 0x6e, 0x48, 0x51, 0x62, 0x5e, 0x71, 0x62, - 0x72, 0x49, 0x66, 0x7e, 0x9e, 0x90, 0x10, 0x17, 0x4b, 0x4a, 0x62, 0x49, 0xa2, 0x04, 0xa3, 0x02, - 0xa3, 0x06, 0x4f, 0x10, 0x98, 0xad, 0x14, 0xc1, 0xa5, 0x80, 0x5b, 0x47, 0x50, 0x6a, 0x71, 0x69, - 0x4e, 0x89, 0x90, 0x09, 0x17, 0x5b, 0x71, 0x49, 0x62, 0x49, 0x69, 0x31, 0x58, 0x27, 0x9f, 0x91, - 0x8c, 0x1e, 0x36, 0x57, 0xe9, 0x05, 0x83, 0xd5, 0x04, 0x41, 0xd5, 0x6a, 0x85, 0x70, 0xb1, 0x41, - 0x44, 0x84, 0x64, 0xb9, 0x24, 0x83, 0x43, 0x1c, 0x43, 0x42, 0x83, 0xe3, 0x83, 0x5c, 0xc3, 0x5c, - 0x83, 0x42, 0xe2, 0x43, 0xfd, 0x82, 0x03, 0x5c, 0x9d, 0x3d, 0xdd, 0x3c, 0x5d, 0x5d, 0x04, 0x18, - 0x84, 0x84, 0xb8, 0xf8, 0xa0, 0xd2, 0xc1, 0xa1, 0xce, 0xce, 0xae, 0xc1, 0xc1, 0x02, 0x8c, 0x42, - 0xe2, 0x5c, 0xc2, 0x50, 0x31, 0x3f, 0xff, 0x90, 0x78, 0x4f, 0x3f, 0x67, 0x9f, 0x50, 0x17, 0x57, - 0x17, 0x01, 0x26, 0xa3, 0x7e, 0x46, 0x2e, 0x2e, 0xdf, 0xe2, 0xf4, 0xe0, 0xd4, 0xa2, 0xb2, 0xcc, - 0xe4, 0x54, 0xa1, 0x2a, 0x2e, 0x3e, 0xd7, 0x92, 0x0c, 0x64, 0x4f, 0x1a, 0x60, 0x77, 0x1c, 0x6e, - 0x4f, 0x4a, 0x99, 0x91, 0xaa, 0x03, 0x12, 0x2c, 0x52, 0xac, 0x0d, 0xcf, 0x37, 0x68, 0x31, 0x3a, - 0xb9, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, - 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x4e, 0x41, 0x76, 0xba, - 0x5e, 0x52, 0x6a, 0x51, 0x62, 0x72, 0x46, 0x62, 0x66, 0x9e, 0x5e, 0x4a, 0x6a, 0x99, 0x3e, 0x2c, - 0xb6, 0xa1, 0x11, 0x58, 0x01, 0x8e, 0xf6, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x14, - 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x62, 0x15, 0x3f, 0x12, 0x12, 0x02, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgServiceClient is the client API for MsgService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgServiceClient interface { - // EthTransaction defines a method submitting Ethereum transactions. - EthTransaction(ctx context.Context, in *WrappedEthereumTransaction, opts ...grpc.CallOption) (*WrappedEthereumTransactionResult, error) -} - -type msgServiceClient struct { - cc grpc1.ClientConn -} - -func NewMsgServiceClient(cc grpc1.ClientConn) MsgServiceClient { - return &msgServiceClient{cc} -} - -func (c *msgServiceClient) EthTransaction(ctx context.Context, in *WrappedEthereumTransaction, opts ...grpc.CallOption) (*WrappedEthereumTransactionResult, error) { - out := new(WrappedEthereumTransactionResult) - err := c.cc.Invoke(ctx, "/polaris.evm.v1alpha1.MsgService/EthTransaction", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServiceServer is the server API for MsgService service. -type MsgServiceServer interface { - // EthTransaction defines a method submitting Ethereum transactions. - EthTransaction(context.Context, *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) -} - -// UnimplementedMsgServiceServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServiceServer struct { -} - -func (*UnimplementedMsgServiceServer) EthTransaction(ctx context.Context, req *WrappedEthereumTransaction) (*WrappedEthereumTransactionResult, error) { - return nil, status.Errorf(codes.Unimplemented, "method EthTransaction not implemented") -} - -func RegisterMsgServiceServer(s grpc1.Server, srv MsgServiceServer) { - s.RegisterService(&_MsgService_serviceDesc, srv) -} - -func _MsgService_EthTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WrappedEthereumTransaction) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServiceServer).EthTransaction(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/polaris.evm.v1alpha1.MsgService/EthTransaction", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServiceServer).EthTransaction(ctx, req.(*WrappedEthereumTransaction)) - } - return interceptor(ctx, in, info, handler) -} - -var _MsgService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "polaris.evm.v1alpha1.MsgService", - HandlerType: (*MsgServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "EthTransaction", - Handler: _MsgService_EthTransaction_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "polaris/evm/v1alpha1/tx.proto", -} - -func (m *WrappedEthereumTransaction) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WrappedEthereumTransaction) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WrappedEthereumTransaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WrappedEthereumTransactionResult) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WrappedEthereumTransactionResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WrappedEthereumTransactionResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Status != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *WrappedEthereumTransaction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *WrappedEthereumTransactionResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Status != 0 { - n += 1 + sovTx(uint64(m.Status)) - } - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *WrappedEthereumTransaction) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WrappedEthereumTransaction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WrappedEthereumTransaction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WrappedEthereumTransactionResult) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WrappedEthereumTransactionResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WrappedEthereumTransactionResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= Status(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) From cc9e8f7fea9db97873d8d555bc6d0a48b51d4bcc Mon Sep 17 00:00:00 2001 From: Devon Bear Date: Sun, 8 Oct 2023 19:35:36 -0400 Subject: [PATCH 3/3] refactor(testing): Multi and KVStore testing improvements (#1194) ### Summary by CodeRabbit **Refactor:** - Updated the package import paths and refactored the code to use a new logging system across multiple modules. - Modified the `ReadOnlyStore` to use a different underlying data store. - Refactored the `testutil` package for better organization and usage across tests. **Test:** - Enhanced test setup functions to include a logger for better test logging. - Updated test cases to use the new logger and the refactored `testutil` package. **Chore:** - Renamed the package from "utils" to "testutil" for better clarity and consistency. --- cosmos/precompile/bank/bank_test.go | 11 +- .../distribution/distribution_test.go | 15 +- .../precompile/governance/governance_test.go | 2 +- cosmos/precompile/governance/testutil.go | 10 +- cosmos/precompile/staking/staking_test.go | 5 +- cosmos/store/cachekv/readonly_store.go | 6 +- cosmos/store/cachekv/readonly_store_test.go | 13 +- .../types/mock/interfaces/mock/store.mock.go | 1431 ----------------- cosmos/testing/types/mock/interfaces/store.go | 35 - cosmos/testing/types/mock/store.go | 326 ---- cosmos/{testing/utils => testutil}/bank.go | 2 +- .../{testing/utils => testutil}/interfaces.go | 2 +- cosmos/{testing/utils => testutil}/setup.go | 35 +- cosmos/x/evm/genesis_test.go | 7 +- cosmos/x/evm/keeper/processor_test.go | 6 +- cosmos/x/evm/plugins/block/header_test.go | 11 +- cosmos/x/evm/plugins/gas/plugin_test.go | 15 +- .../x/evm/plugins/historical/plugin_test.go | 6 +- .../plugins/precompile/log/factory_test.go | 5 +- .../x/evm/plugins/precompile/plugin_test.go | 10 +- .../evm/plugins/state/events/manager_test.go | 6 +- cosmos/x/evm/plugins/state/genesis_test.go | 6 +- .../plugins/state/plugin_benchmark_test.go | 6 +- cosmos/x/evm/plugins/state/plugin_test.go | 8 +- 24 files changed, 113 insertions(+), 1866 deletions(-) delete mode 100644 cosmos/testing/types/mock/interfaces/mock/store.mock.go delete mode 100644 cosmos/testing/types/mock/interfaces/store.go delete mode 100644 cosmos/testing/types/mock/store.go rename cosmos/{testing/utils => testutil}/bank.go (98%) rename cosmos/{testing/utils => testutil}/interfaces.go (98%) rename cosmos/{testing/utils => testutil}/setup.go (84%) diff --git a/cosmos/precompile/bank/bank_test.go b/cosmos/precompile/bank/bank_test.go index afd570d95b..08bbf414d1 100644 --- a/cosmos/precompile/bank/bank_test.go +++ b/cosmos/precompile/bank/bank_test.go @@ -26,6 +26,7 @@ import ( "math/big" "testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -36,8 +37,8 @@ import ( "pkg.berachain.dev/polaris/cosmos/precompile" "pkg.berachain.dev/polaris/cosmos/precompile/bank" - testutils "pkg.berachain.dev/polaris/cosmos/testing/utils" - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/precompile/log" + testutils "pkg.berachain.dev/polaris/cosmos/testutil" + pclog "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/precompile/log" evmtypes "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/common" ethprecompile "pkg.berachain.dev/polaris/eth/core/precompile" @@ -57,14 +58,14 @@ var _ = Describe("Bank Precompile Test", func() { var ( contract *bank.Contract addr sdk.AccAddress - factory *log.Factory + factory *pclog.Factory ak authkeeper.AccountKeeperI bk bankkeeper.BaseKeeper ctx context.Context ) BeforeEach(func() { - ctx, ak, bk, _ = testutils.SetupMinimalKeepers() + ctx, ak, bk, _ = testutils.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) contract = utils.MustGetAs[*bank.Contract](bank.NewPrecompileContract( ak, bankkeeper.NewMsgServerImpl(bk), bk), @@ -72,7 +73,7 @@ var _ = Describe("Bank Precompile Test", func() { addr = sdk.AccAddress([]byte("bank")) // Register the events. - factory = log.NewFactory([]ethprecompile.Registrable{contract}) + factory = pclog.NewFactory([]ethprecompile.Registrable{contract}) }) It("should register the send event", func() { diff --git a/cosmos/precompile/distribution/distribution_test.go b/cosmos/precompile/distribution/distribution_test.go index 558a2c0421..b7c542c447 100644 --- a/cosmos/precompile/distribution/distribution_test.go +++ b/cosmos/precompile/distribution/distribution_test.go @@ -25,6 +25,7 @@ import ( "math/big" "testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" storetypes "cosmossdk.io/store/types" @@ -44,8 +45,8 @@ import ( "github.com/ethereum/go-ethereum/common" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" - "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/precompile/log" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" + pclog "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/precompile/log" ethprecompile "pkg.berachain.dev/polaris/eth/core/precompile" "pkg.berachain.dev/polaris/eth/core/vm" "pkg.berachain.dev/polaris/lib/utils" @@ -77,7 +78,9 @@ func setup() ( *stakingkeeper.Keeper, *bankkeeper.BaseKeeper, ) { - ctx, ak, bk, sk := testutil.SetupMinimalKeepers() + distrKey := storetypes.NewKVStoreKey(distributiontypes.StoreKey) + ctx, ak, bk, sk := testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT()), + []storetypes.StoreKey{distrKey}...) encCfg := cosmostestutil.MakeTestEncodingConfig( distribution.AppModuleBasic{}, @@ -85,7 +88,7 @@ func setup() ( dk := distrkeeper.NewKeeper( encCfg.Codec, - runtime.NewKVStoreService(storetypes.NewKVStoreKey(distributiontypes.StoreKey)), + runtime.NewKVStoreService(distrKey), ak, bk, sk, @@ -107,7 +110,7 @@ var _ = Describe("Distribution Precompile Test", func() { var ( contract *Contract valAddr sdk.ValAddress - f *log.Factory + f *pclog.Factory amt sdk.Coin ctx sdk.Context @@ -131,7 +134,7 @@ var _ = Describe("Distribution Precompile Test", func() { )) // Register the events. - f = log.NewFactory([]ethprecompile.Registrable{contract}) + f = pclog.NewFactory([]ethprecompile.Registrable{contract}) // Set up the stateful factory. sf = ethprecompile.NewStatefulFactory() diff --git a/cosmos/precompile/governance/governance_test.go b/cosmos/precompile/governance/governance_test.go index 614cf7f8bc..9aa4ea2833 100644 --- a/cosmos/precompile/governance/governance_test.go +++ b/cosmos/precompile/governance/governance_test.go @@ -43,7 +43,7 @@ import ( cbindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/lib" generated "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/governance" - testutils "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutils "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/types" "pkg.berachain.dev/polaris/eth/common" ethprecompile "pkg.berachain.dev/polaris/eth/core/precompile" diff --git a/cosmos/precompile/governance/testutil.go b/cosmos/precompile/governance/testutil.go index d0b8dca0b3..d4dfa36d2a 100644 --- a/cosmos/precompile/governance/testutil.go +++ b/cosmos/precompile/governance/testutil.go @@ -26,6 +26,7 @@ import ( "github.com/golang/mock/gomock" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -43,7 +44,7 @@ import ( v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - testutils "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutils "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/eth/common" //nolint:stylecheck,revive // Ginkgo is the testing framework. @@ -67,7 +68,10 @@ func setupGovTest(ctrl *gomock.Controller, caller sdk.AccAddress) ( sdk.Context, authkeeper.AccountKeeperI, bankkeeper.Keeper, *governancekeeper.Keeper, ) { // Setup the keepers and context. - ctx, ak, bk, sk := testutils.SetupMinimalKeepers() + govKey := storetypes.NewKVStoreKey(governancetypes.StoreKey) + ctx, ak, bk, sk := testutils.SetupMinimalKeepers( + log.NewTestLogger(GinkgoT()), []storetypes.StoreKey{govKey}..., + ) dk := govtestutil.NewMockDistributionKeeper(ctrl) // Create the codec. @@ -94,7 +98,7 @@ func setupGovTest(ctrl *gomock.Controller, caller sdk.AccAddress) ( } gk := governancekeeper.NewKeeper( encCfg.Codec, - runtime.NewKVStoreService(storetypes.NewKVStoreKey(governancetypes.StoreKey)), + runtime.NewKVStoreService(govKey), ak, bk, sk, diff --git a/cosmos/precompile/staking/staking_test.go b/cosmos/precompile/staking/staking_test.go index bb548c9432..b0b345c909 100644 --- a/cosmos/precompile/staking/staking_test.go +++ b/cosmos/precompile/staking/staking_test.go @@ -25,6 +25,7 @@ import ( "math/big" "testing" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" @@ -38,7 +39,7 @@ import ( cbindings "pkg.berachain.dev/polaris/contracts/bindings/cosmos/lib" generated "pkg.berachain.dev/polaris/contracts/bindings/cosmos/precompile/staking" cosmlib "pkg.berachain.dev/polaris/cosmos/lib" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/eth/accounts/abi" "pkg.berachain.dev/polaris/eth/common" ethprecompile "pkg.berachain.dev/polaris/eth/core/precompile" @@ -88,7 +89,7 @@ var _ = Describe("Staking", func() { ) BeforeEach(func() { - sdkCtx, ak, bk, sk = testutil.SetupMinimalKeepers() + sdkCtx, ak, bk, sk = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) contract = libutils.MustGetAs[*Contract](NewPrecompileContract(ak, &sk)) sf = ethprecompile.NewStatefulFactory() }) diff --git a/cosmos/store/cachekv/readonly_store.go b/cosmos/store/cachekv/readonly_store.go index c709167feb..1100b65726 100644 --- a/cosmos/store/cachekv/readonly_store.go +++ b/cosmos/store/cachekv/readonly_store.go @@ -26,14 +26,14 @@ import ( "pkg.berachain.dev/polaris/eth/core/vm" ) -var _ storetypes.CacheKVStore = (*ReadOnlyStore)(nil) +var _ storetypes.KVStore = (*ReadOnlyStore)(nil) // ReadOnlyStore is a wrapper around cachekv.Store that panics on any write operation. type ReadOnlyStore struct { - storetypes.CacheKVStore + storetypes.KVStore } -func NewReadOnlyStoreFor(cacheKVStore storetypes.CacheKVStore) *ReadOnlyStore { +func NewReadOnlyStoreFor(cacheKVStore storetypes.KVStore) *ReadOnlyStore { return &ReadOnlyStore{cacheKVStore} } diff --git a/cosmos/store/cachekv/readonly_store_test.go b/cosmos/store/cachekv/readonly_store_test.go index 427a70f5cd..0b26cfb510 100644 --- a/cosmos/store/cachekv/readonly_store_test.go +++ b/cosmos/store/cachekv/readonly_store_test.go @@ -23,11 +23,11 @@ package cachekv_test import ( "testing" - sdkcachekv "cosmossdk.io/store/cachekv" - storetypes "cosmossdk.io/store/types" + cdb "github.com/cosmos/cosmos-db" + + "cosmossdk.io/store/dbadapter" "pkg.berachain.dev/polaris/cosmos/store/cachekv" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -42,10 +42,9 @@ var _ = Describe("ReadOnly Store", func() { var readOnlyStore *cachekv.ReadOnlyStore BeforeEach(func() { - ms := mock.NewMultiStore() - kv := ms.GetKVStore(storetypes.NewKVStoreKey("test")) - kv.Set([]byte("key"), []byte("value")) - readOnlyStore = cachekv.NewReadOnlyStoreFor(sdkcachekv.NewStore(kv)) + kvStore := dbadapter.Store{DB: cdb.NewMemDB()} + kvStore.Set([]byte("key"), []byte("value")) + readOnlyStore = cachekv.NewReadOnlyStoreFor(kvStore) }) It("should panic only on writes", func() { diff --git a/cosmos/testing/types/mock/interfaces/mock/store.mock.go b/cosmos/testing/types/mock/interfaces/mock/store.mock.go deleted file mode 100644 index ac42b15169..0000000000 --- a/cosmos/testing/types/mock/interfaces/mock/store.mock.go +++ /dev/null @@ -1,1431 +0,0 @@ -// Code generated by moq; DO NOT EDIT. -// github.com/matryer/moq - -package mock - -import ( - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-db" - "io" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock/interfaces" - "sync" -) - -// Ensure, that MultiStoreMock does implement interfaces.MultiStore. -// If this is not the case, regenerate this file with moq. -var _ interfaces.MultiStore = &MultiStoreMock{} - -// MultiStoreMock is a mock implementation of interfaces.MultiStore. -// -// func TestSomethingThatUsesMultiStore(t *testing.T) { -// -// // make and configure a mocked interfaces.MultiStore -// mockedMultiStore := &MultiStoreMock{ -// CacheMultiStoreFunc: func() storetypes.CacheMultiStore { -// panic("mock out the CacheMultiStore method") -// }, -// CacheMultiStoreWithVersionFunc: func(version int64) (storetypes.CacheMultiStore, error) { -// panic("mock out the CacheMultiStoreWithVersion method") -// }, -// CacheWrapFunc: func() storetypes.CacheWrap { -// panic("mock out the CacheWrap method") -// }, -// CacheWrapWithTraceFunc: func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { -// panic("mock out the CacheWrapWithTrace method") -// }, -// GetKVStoreFunc: func(storeKey storetypes.StoreKey) storetypes.KVStore { -// panic("mock out the GetKVStore method") -// }, -// GetStoreFunc: func(storeKey storetypes.StoreKey) storetypes.Store { -// panic("mock out the GetStore method") -// }, -// GetStoreTypeFunc: func() storetypes.StoreType { -// panic("mock out the GetStoreType method") -// }, -// LatestVersionFunc: func() int64 { -// panic("mock out the LatestVersion method") -// }, -// SetTracerFunc: func(w io.Writer) storetypes.MultiStore { -// panic("mock out the SetTracer method") -// }, -// SetTracingContextFunc: func(traceContext storetypes.TraceContext) storetypes.MultiStore { -// panic("mock out the SetTracingContext method") -// }, -// TracingEnabledFunc: func() bool { -// panic("mock out the TracingEnabled method") -// }, -// } -// -// // use mockedMultiStore in code that requires interfaces.MultiStore -// // and then make assertions. -// -// } -type MultiStoreMock struct { - // CacheMultiStoreFunc mocks the CacheMultiStore method. - CacheMultiStoreFunc func() storetypes.CacheMultiStore - - // CacheMultiStoreWithVersionFunc mocks the CacheMultiStoreWithVersion method. - CacheMultiStoreWithVersionFunc func(version int64) (storetypes.CacheMultiStore, error) - - // CacheWrapFunc mocks the CacheWrap method. - CacheWrapFunc func() storetypes.CacheWrap - - // CacheWrapWithTraceFunc mocks the CacheWrapWithTrace method. - CacheWrapWithTraceFunc func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap - - // GetKVStoreFunc mocks the GetKVStore method. - GetKVStoreFunc func(storeKey storetypes.StoreKey) storetypes.KVStore - - // GetStoreFunc mocks the GetStore method. - GetStoreFunc func(storeKey storetypes.StoreKey) storetypes.Store - - // GetStoreTypeFunc mocks the GetStoreType method. - GetStoreTypeFunc func() storetypes.StoreType - - // LatestVersionFunc mocks the LatestVersion method. - LatestVersionFunc func() int64 - - // SetTracerFunc mocks the SetTracer method. - SetTracerFunc func(w io.Writer) storetypes.MultiStore - - // SetTracingContextFunc mocks the SetTracingContext method. - SetTracingContextFunc func(traceContext storetypes.TraceContext) storetypes.MultiStore - - // TracingEnabledFunc mocks the TracingEnabled method. - TracingEnabledFunc func() bool - - // calls tracks calls to the methods. - calls struct { - // CacheMultiStore holds details about calls to the CacheMultiStore method. - CacheMultiStore []struct { - } - // CacheMultiStoreWithVersion holds details about calls to the CacheMultiStoreWithVersion method. - CacheMultiStoreWithVersion []struct { - // Version is the version argument value. - Version int64 - } - // CacheWrap holds details about calls to the CacheWrap method. - CacheWrap []struct { - } - // CacheWrapWithTrace holds details about calls to the CacheWrapWithTrace method. - CacheWrapWithTrace []struct { - // W is the w argument value. - W io.Writer - // Tc is the tc argument value. - Tc storetypes.TraceContext - } - // GetKVStore holds details about calls to the GetKVStore method. - GetKVStore []struct { - // StoreKey is the storeKey argument value. - StoreKey storetypes.StoreKey - } - // GetStore holds details about calls to the GetStore method. - GetStore []struct { - // StoreKey is the storeKey argument value. - StoreKey storetypes.StoreKey - } - // GetStoreType holds details about calls to the GetStoreType method. - GetStoreType []struct { - } - // LatestVersion holds details about calls to the LatestVersion method. - LatestVersion []struct { - } - // SetTracer holds details about calls to the SetTracer method. - SetTracer []struct { - // W is the w argument value. - W io.Writer - } - // SetTracingContext holds details about calls to the SetTracingContext method. - SetTracingContext []struct { - // TraceContext is the traceContext argument value. - TraceContext storetypes.TraceContext - } - // TracingEnabled holds details about calls to the TracingEnabled method. - TracingEnabled []struct { - } - } - lockCacheMultiStore sync.RWMutex - lockCacheMultiStoreWithVersion sync.RWMutex - lockCacheWrap sync.RWMutex - lockCacheWrapWithTrace sync.RWMutex - lockGetKVStore sync.RWMutex - lockGetStore sync.RWMutex - lockGetStoreType sync.RWMutex - lockLatestVersion sync.RWMutex - lockSetTracer sync.RWMutex - lockSetTracingContext sync.RWMutex - lockTracingEnabled sync.RWMutex -} - -// CacheMultiStore calls CacheMultiStoreFunc. -func (mock *MultiStoreMock) CacheMultiStore() storetypes.CacheMultiStore { - if mock.CacheMultiStoreFunc == nil { - panic("MultiStoreMock.CacheMultiStoreFunc: method is nil but MultiStore.CacheMultiStore was just called") - } - callInfo := struct { - }{} - mock.lockCacheMultiStore.Lock() - mock.calls.CacheMultiStore = append(mock.calls.CacheMultiStore, callInfo) - mock.lockCacheMultiStore.Unlock() - return mock.CacheMultiStoreFunc() -} - -// CacheMultiStoreCalls gets all the calls that were made to CacheMultiStore. -// Check the length with: -// -// len(mockedMultiStore.CacheMultiStoreCalls()) -func (mock *MultiStoreMock) CacheMultiStoreCalls() []struct { -} { - var calls []struct { - } - mock.lockCacheMultiStore.RLock() - calls = mock.calls.CacheMultiStore - mock.lockCacheMultiStore.RUnlock() - return calls -} - -// CacheMultiStoreWithVersion calls CacheMultiStoreWithVersionFunc. -func (mock *MultiStoreMock) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { - if mock.CacheMultiStoreWithVersionFunc == nil { - panic("MultiStoreMock.CacheMultiStoreWithVersionFunc: method is nil but MultiStore.CacheMultiStoreWithVersion was just called") - } - callInfo := struct { - Version int64 - }{ - Version: version, - } - mock.lockCacheMultiStoreWithVersion.Lock() - mock.calls.CacheMultiStoreWithVersion = append(mock.calls.CacheMultiStoreWithVersion, callInfo) - mock.lockCacheMultiStoreWithVersion.Unlock() - return mock.CacheMultiStoreWithVersionFunc(version) -} - -// CacheMultiStoreWithVersionCalls gets all the calls that were made to CacheMultiStoreWithVersion. -// Check the length with: -// -// len(mockedMultiStore.CacheMultiStoreWithVersionCalls()) -func (mock *MultiStoreMock) CacheMultiStoreWithVersionCalls() []struct { - Version int64 -} { - var calls []struct { - Version int64 - } - mock.lockCacheMultiStoreWithVersion.RLock() - calls = mock.calls.CacheMultiStoreWithVersion - mock.lockCacheMultiStoreWithVersion.RUnlock() - return calls -} - -// CacheWrap calls CacheWrapFunc. -func (mock *MultiStoreMock) CacheWrap() storetypes.CacheWrap { - if mock.CacheWrapFunc == nil { - panic("MultiStoreMock.CacheWrapFunc: method is nil but MultiStore.CacheWrap was just called") - } - callInfo := struct { - }{} - mock.lockCacheWrap.Lock() - mock.calls.CacheWrap = append(mock.calls.CacheWrap, callInfo) - mock.lockCacheWrap.Unlock() - return mock.CacheWrapFunc() -} - -// CacheWrapCalls gets all the calls that were made to CacheWrap. -// Check the length with: -// -// len(mockedMultiStore.CacheWrapCalls()) -func (mock *MultiStoreMock) CacheWrapCalls() []struct { -} { - var calls []struct { - } - mock.lockCacheWrap.RLock() - calls = mock.calls.CacheWrap - mock.lockCacheWrap.RUnlock() - return calls -} - -// CacheWrapWithTrace calls CacheWrapWithTraceFunc. -func (mock *MultiStoreMock) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { - if mock.CacheWrapWithTraceFunc == nil { - panic("MultiStoreMock.CacheWrapWithTraceFunc: method is nil but MultiStore.CacheWrapWithTrace was just called") - } - callInfo := struct { - W io.Writer - Tc storetypes.TraceContext - }{ - W: w, - Tc: tc, - } - mock.lockCacheWrapWithTrace.Lock() - mock.calls.CacheWrapWithTrace = append(mock.calls.CacheWrapWithTrace, callInfo) - mock.lockCacheWrapWithTrace.Unlock() - return mock.CacheWrapWithTraceFunc(w, tc) -} - -// CacheWrapWithTraceCalls gets all the calls that were made to CacheWrapWithTrace. -// Check the length with: -// -// len(mockedMultiStore.CacheWrapWithTraceCalls()) -func (mock *MultiStoreMock) CacheWrapWithTraceCalls() []struct { - W io.Writer - Tc storetypes.TraceContext -} { - var calls []struct { - W io.Writer - Tc storetypes.TraceContext - } - mock.lockCacheWrapWithTrace.RLock() - calls = mock.calls.CacheWrapWithTrace - mock.lockCacheWrapWithTrace.RUnlock() - return calls -} - -// GetKVStore calls GetKVStoreFunc. -func (mock *MultiStoreMock) GetKVStore(storeKey storetypes.StoreKey) storetypes.KVStore { - if mock.GetKVStoreFunc == nil { - panic("MultiStoreMock.GetKVStoreFunc: method is nil but MultiStore.GetKVStore was just called") - } - callInfo := struct { - StoreKey storetypes.StoreKey - }{ - StoreKey: storeKey, - } - mock.lockGetKVStore.Lock() - mock.calls.GetKVStore = append(mock.calls.GetKVStore, callInfo) - mock.lockGetKVStore.Unlock() - return mock.GetKVStoreFunc(storeKey) -} - -// GetKVStoreCalls gets all the calls that were made to GetKVStore. -// Check the length with: -// -// len(mockedMultiStore.GetKVStoreCalls()) -func (mock *MultiStoreMock) GetKVStoreCalls() []struct { - StoreKey storetypes.StoreKey -} { - var calls []struct { - StoreKey storetypes.StoreKey - } - mock.lockGetKVStore.RLock() - calls = mock.calls.GetKVStore - mock.lockGetKVStore.RUnlock() - return calls -} - -// GetStore calls GetStoreFunc. -func (mock *MultiStoreMock) GetStore(storeKey storetypes.StoreKey) storetypes.Store { - if mock.GetStoreFunc == nil { - panic("MultiStoreMock.GetStoreFunc: method is nil but MultiStore.GetStore was just called") - } - callInfo := struct { - StoreKey storetypes.StoreKey - }{ - StoreKey: storeKey, - } - mock.lockGetStore.Lock() - mock.calls.GetStore = append(mock.calls.GetStore, callInfo) - mock.lockGetStore.Unlock() - return mock.GetStoreFunc(storeKey) -} - -// GetStoreCalls gets all the calls that were made to GetStore. -// Check the length with: -// -// len(mockedMultiStore.GetStoreCalls()) -func (mock *MultiStoreMock) GetStoreCalls() []struct { - StoreKey storetypes.StoreKey -} { - var calls []struct { - StoreKey storetypes.StoreKey - } - mock.lockGetStore.RLock() - calls = mock.calls.GetStore - mock.lockGetStore.RUnlock() - return calls -} - -// GetStoreType calls GetStoreTypeFunc. -func (mock *MultiStoreMock) GetStoreType() storetypes.StoreType { - if mock.GetStoreTypeFunc == nil { - panic("MultiStoreMock.GetStoreTypeFunc: method is nil but MultiStore.GetStoreType was just called") - } - callInfo := struct { - }{} - mock.lockGetStoreType.Lock() - mock.calls.GetStoreType = append(mock.calls.GetStoreType, callInfo) - mock.lockGetStoreType.Unlock() - return mock.GetStoreTypeFunc() -} - -// GetStoreTypeCalls gets all the calls that were made to GetStoreType. -// Check the length with: -// -// len(mockedMultiStore.GetStoreTypeCalls()) -func (mock *MultiStoreMock) GetStoreTypeCalls() []struct { -} { - var calls []struct { - } - mock.lockGetStoreType.RLock() - calls = mock.calls.GetStoreType - mock.lockGetStoreType.RUnlock() - return calls -} - -// LatestVersion calls LatestVersionFunc. -func (mock *MultiStoreMock) LatestVersion() int64 { - if mock.LatestVersionFunc == nil { - panic("MultiStoreMock.LatestVersionFunc: method is nil but MultiStore.LatestVersion was just called") - } - callInfo := struct { - }{} - mock.lockLatestVersion.Lock() - mock.calls.LatestVersion = append(mock.calls.LatestVersion, callInfo) - mock.lockLatestVersion.Unlock() - return mock.LatestVersionFunc() -} - -// LatestVersionCalls gets all the calls that were made to LatestVersion. -// Check the length with: -// -// len(mockedMultiStore.LatestVersionCalls()) -func (mock *MultiStoreMock) LatestVersionCalls() []struct { -} { - var calls []struct { - } - mock.lockLatestVersion.RLock() - calls = mock.calls.LatestVersion - mock.lockLatestVersion.RUnlock() - return calls -} - -// SetTracer calls SetTracerFunc. -func (mock *MultiStoreMock) SetTracer(w io.Writer) storetypes.MultiStore { - if mock.SetTracerFunc == nil { - panic("MultiStoreMock.SetTracerFunc: method is nil but MultiStore.SetTracer was just called") - } - callInfo := struct { - W io.Writer - }{ - W: w, - } - mock.lockSetTracer.Lock() - mock.calls.SetTracer = append(mock.calls.SetTracer, callInfo) - mock.lockSetTracer.Unlock() - return mock.SetTracerFunc(w) -} - -// SetTracerCalls gets all the calls that were made to SetTracer. -// Check the length with: -// -// len(mockedMultiStore.SetTracerCalls()) -func (mock *MultiStoreMock) SetTracerCalls() []struct { - W io.Writer -} { - var calls []struct { - W io.Writer - } - mock.lockSetTracer.RLock() - calls = mock.calls.SetTracer - mock.lockSetTracer.RUnlock() - return calls -} - -// SetTracingContext calls SetTracingContextFunc. -func (mock *MultiStoreMock) SetTracingContext(traceContext storetypes.TraceContext) storetypes.MultiStore { - if mock.SetTracingContextFunc == nil { - panic("MultiStoreMock.SetTracingContextFunc: method is nil but MultiStore.SetTracingContext was just called") - } - callInfo := struct { - TraceContext storetypes.TraceContext - }{ - TraceContext: traceContext, - } - mock.lockSetTracingContext.Lock() - mock.calls.SetTracingContext = append(mock.calls.SetTracingContext, callInfo) - mock.lockSetTracingContext.Unlock() - return mock.SetTracingContextFunc(traceContext) -} - -// SetTracingContextCalls gets all the calls that were made to SetTracingContext. -// Check the length with: -// -// len(mockedMultiStore.SetTracingContextCalls()) -func (mock *MultiStoreMock) SetTracingContextCalls() []struct { - TraceContext storetypes.TraceContext -} { - var calls []struct { - TraceContext storetypes.TraceContext - } - mock.lockSetTracingContext.RLock() - calls = mock.calls.SetTracingContext - mock.lockSetTracingContext.RUnlock() - return calls -} - -// TracingEnabled calls TracingEnabledFunc. -func (mock *MultiStoreMock) TracingEnabled() bool { - if mock.TracingEnabledFunc == nil { - panic("MultiStoreMock.TracingEnabledFunc: method is nil but MultiStore.TracingEnabled was just called") - } - callInfo := struct { - }{} - mock.lockTracingEnabled.Lock() - mock.calls.TracingEnabled = append(mock.calls.TracingEnabled, callInfo) - mock.lockTracingEnabled.Unlock() - return mock.TracingEnabledFunc() -} - -// TracingEnabledCalls gets all the calls that were made to TracingEnabled. -// Check the length with: -// -// len(mockedMultiStore.TracingEnabledCalls()) -func (mock *MultiStoreMock) TracingEnabledCalls() []struct { -} { - var calls []struct { - } - mock.lockTracingEnabled.RLock() - calls = mock.calls.TracingEnabled - mock.lockTracingEnabled.RUnlock() - return calls -} - -// Ensure, that CacheMultiStoreMock does implement interfaces.CacheMultiStore. -// If this is not the case, regenerate this file with moq. -var _ interfaces.CacheMultiStore = &CacheMultiStoreMock{} - -// CacheMultiStoreMock is a mock implementation of interfaces.CacheMultiStore. -// -// func TestSomethingThatUsesCacheMultiStore(t *testing.T) { -// -// // make and configure a mocked interfaces.CacheMultiStore -// mockedCacheMultiStore := &CacheMultiStoreMock{ -// CacheMultiStoreFunc: func() storetypes.CacheMultiStore { -// panic("mock out the CacheMultiStore method") -// }, -// CacheMultiStoreWithVersionFunc: func(version int64) (storetypes.CacheMultiStore, error) { -// panic("mock out the CacheMultiStoreWithVersion method") -// }, -// CacheWrapFunc: func() storetypes.CacheWrap { -// panic("mock out the CacheWrap method") -// }, -// CacheWrapWithTraceFunc: func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { -// panic("mock out the CacheWrapWithTrace method") -// }, -// GetKVStoreFunc: func(storeKey storetypes.StoreKey) storetypes.KVStore { -// panic("mock out the GetKVStore method") -// }, -// GetStoreFunc: func(storeKey storetypes.StoreKey) storetypes.Store { -// panic("mock out the GetStore method") -// }, -// GetStoreTypeFunc: func() storetypes.StoreType { -// panic("mock out the GetStoreType method") -// }, -// LatestVersionFunc: func() int64 { -// panic("mock out the LatestVersion method") -// }, -// SetTracerFunc: func(w io.Writer) storetypes.MultiStore { -// panic("mock out the SetTracer method") -// }, -// SetTracingContextFunc: func(traceContext storetypes.TraceContext) storetypes.MultiStore { -// panic("mock out the SetTracingContext method") -// }, -// TracingEnabledFunc: func() bool { -// panic("mock out the TracingEnabled method") -// }, -// WriteFunc: func() { -// panic("mock out the Write method") -// }, -// } -// -// // use mockedCacheMultiStore in code that requires interfaces.CacheMultiStore -// // and then make assertions. -// -// } -type CacheMultiStoreMock struct { - // CacheMultiStoreFunc mocks the CacheMultiStore method. - CacheMultiStoreFunc func() storetypes.CacheMultiStore - - // CacheMultiStoreWithVersionFunc mocks the CacheMultiStoreWithVersion method. - CacheMultiStoreWithVersionFunc func(version int64) (storetypes.CacheMultiStore, error) - - // CacheWrapFunc mocks the CacheWrap method. - CacheWrapFunc func() storetypes.CacheWrap - - // CacheWrapWithTraceFunc mocks the CacheWrapWithTrace method. - CacheWrapWithTraceFunc func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap - - // GetKVStoreFunc mocks the GetKVStore method. - GetKVStoreFunc func(storeKey storetypes.StoreKey) storetypes.KVStore - - // GetStoreFunc mocks the GetStore method. - GetStoreFunc func(storeKey storetypes.StoreKey) storetypes.Store - - // GetStoreTypeFunc mocks the GetStoreType method. - GetStoreTypeFunc func() storetypes.StoreType - - // LatestVersionFunc mocks the LatestVersion method. - LatestVersionFunc func() int64 - - // SetTracerFunc mocks the SetTracer method. - SetTracerFunc func(w io.Writer) storetypes.MultiStore - - // SetTracingContextFunc mocks the SetTracingContext method. - SetTracingContextFunc func(traceContext storetypes.TraceContext) storetypes.MultiStore - - // TracingEnabledFunc mocks the TracingEnabled method. - TracingEnabledFunc func() bool - - // WriteFunc mocks the Write method. - WriteFunc func() - - // calls tracks calls to the methods. - calls struct { - // CacheMultiStore holds details about calls to the CacheMultiStore method. - CacheMultiStore []struct { - } - // CacheMultiStoreWithVersion holds details about calls to the CacheMultiStoreWithVersion method. - CacheMultiStoreWithVersion []struct { - // Version is the version argument value. - Version int64 - } - // CacheWrap holds details about calls to the CacheWrap method. - CacheWrap []struct { - } - // CacheWrapWithTrace holds details about calls to the CacheWrapWithTrace method. - CacheWrapWithTrace []struct { - // W is the w argument value. - W io.Writer - // Tc is the tc argument value. - Tc storetypes.TraceContext - } - // GetKVStore holds details about calls to the GetKVStore method. - GetKVStore []struct { - // StoreKey is the storeKey argument value. - StoreKey storetypes.StoreKey - } - // GetStore holds details about calls to the GetStore method. - GetStore []struct { - // StoreKey is the storeKey argument value. - StoreKey storetypes.StoreKey - } - // GetStoreType holds details about calls to the GetStoreType method. - GetStoreType []struct { - } - // LatestVersion holds details about calls to the LatestVersion method. - LatestVersion []struct { - } - // SetTracer holds details about calls to the SetTracer method. - SetTracer []struct { - // W is the w argument value. - W io.Writer - } - // SetTracingContext holds details about calls to the SetTracingContext method. - SetTracingContext []struct { - // TraceContext is the traceContext argument value. - TraceContext storetypes.TraceContext - } - // TracingEnabled holds details about calls to the TracingEnabled method. - TracingEnabled []struct { - } - // Write holds details about calls to the Write method. - Write []struct { - } - } - lockCacheMultiStore sync.RWMutex - lockCacheMultiStoreWithVersion sync.RWMutex - lockCacheWrap sync.RWMutex - lockCacheWrapWithTrace sync.RWMutex - lockGetKVStore sync.RWMutex - lockGetStore sync.RWMutex - lockGetStoreType sync.RWMutex - lockLatestVersion sync.RWMutex - lockSetTracer sync.RWMutex - lockSetTracingContext sync.RWMutex - lockTracingEnabled sync.RWMutex - lockWrite sync.RWMutex -} - -// CacheMultiStore calls CacheMultiStoreFunc. -func (mock *CacheMultiStoreMock) CacheMultiStore() storetypes.CacheMultiStore { - if mock.CacheMultiStoreFunc == nil { - panic("CacheMultiStoreMock.CacheMultiStoreFunc: method is nil but CacheMultiStore.CacheMultiStore was just called") - } - callInfo := struct { - }{} - mock.lockCacheMultiStore.Lock() - mock.calls.CacheMultiStore = append(mock.calls.CacheMultiStore, callInfo) - mock.lockCacheMultiStore.Unlock() - return mock.CacheMultiStoreFunc() -} - -// CacheMultiStoreCalls gets all the calls that were made to CacheMultiStore. -// Check the length with: -// -// len(mockedCacheMultiStore.CacheMultiStoreCalls()) -func (mock *CacheMultiStoreMock) CacheMultiStoreCalls() []struct { -} { - var calls []struct { - } - mock.lockCacheMultiStore.RLock() - calls = mock.calls.CacheMultiStore - mock.lockCacheMultiStore.RUnlock() - return calls -} - -// CacheMultiStoreWithVersion calls CacheMultiStoreWithVersionFunc. -func (mock *CacheMultiStoreMock) CacheMultiStoreWithVersion(version int64) (storetypes.CacheMultiStore, error) { - if mock.CacheMultiStoreWithVersionFunc == nil { - panic("CacheMultiStoreMock.CacheMultiStoreWithVersionFunc: method is nil but CacheMultiStore.CacheMultiStoreWithVersion was just called") - } - callInfo := struct { - Version int64 - }{ - Version: version, - } - mock.lockCacheMultiStoreWithVersion.Lock() - mock.calls.CacheMultiStoreWithVersion = append(mock.calls.CacheMultiStoreWithVersion, callInfo) - mock.lockCacheMultiStoreWithVersion.Unlock() - return mock.CacheMultiStoreWithVersionFunc(version) -} - -// CacheMultiStoreWithVersionCalls gets all the calls that were made to CacheMultiStoreWithVersion. -// Check the length with: -// -// len(mockedCacheMultiStore.CacheMultiStoreWithVersionCalls()) -func (mock *CacheMultiStoreMock) CacheMultiStoreWithVersionCalls() []struct { - Version int64 -} { - var calls []struct { - Version int64 - } - mock.lockCacheMultiStoreWithVersion.RLock() - calls = mock.calls.CacheMultiStoreWithVersion - mock.lockCacheMultiStoreWithVersion.RUnlock() - return calls -} - -// CacheWrap calls CacheWrapFunc. -func (mock *CacheMultiStoreMock) CacheWrap() storetypes.CacheWrap { - if mock.CacheWrapFunc == nil { - panic("CacheMultiStoreMock.CacheWrapFunc: method is nil but CacheMultiStore.CacheWrap was just called") - } - callInfo := struct { - }{} - mock.lockCacheWrap.Lock() - mock.calls.CacheWrap = append(mock.calls.CacheWrap, callInfo) - mock.lockCacheWrap.Unlock() - return mock.CacheWrapFunc() -} - -// CacheWrapCalls gets all the calls that were made to CacheWrap. -// Check the length with: -// -// len(mockedCacheMultiStore.CacheWrapCalls()) -func (mock *CacheMultiStoreMock) CacheWrapCalls() []struct { -} { - var calls []struct { - } - mock.lockCacheWrap.RLock() - calls = mock.calls.CacheWrap - mock.lockCacheWrap.RUnlock() - return calls -} - -// CacheWrapWithTrace calls CacheWrapWithTraceFunc. -func (mock *CacheMultiStoreMock) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { - if mock.CacheWrapWithTraceFunc == nil { - panic("CacheMultiStoreMock.CacheWrapWithTraceFunc: method is nil but CacheMultiStore.CacheWrapWithTrace was just called") - } - callInfo := struct { - W io.Writer - Tc storetypes.TraceContext - }{ - W: w, - Tc: tc, - } - mock.lockCacheWrapWithTrace.Lock() - mock.calls.CacheWrapWithTrace = append(mock.calls.CacheWrapWithTrace, callInfo) - mock.lockCacheWrapWithTrace.Unlock() - return mock.CacheWrapWithTraceFunc(w, tc) -} - -// CacheWrapWithTraceCalls gets all the calls that were made to CacheWrapWithTrace. -// Check the length with: -// -// len(mockedCacheMultiStore.CacheWrapWithTraceCalls()) -func (mock *CacheMultiStoreMock) CacheWrapWithTraceCalls() []struct { - W io.Writer - Tc storetypes.TraceContext -} { - var calls []struct { - W io.Writer - Tc storetypes.TraceContext - } - mock.lockCacheWrapWithTrace.RLock() - calls = mock.calls.CacheWrapWithTrace - mock.lockCacheWrapWithTrace.RUnlock() - return calls -} - -// GetKVStore calls GetKVStoreFunc. -func (mock *CacheMultiStoreMock) GetKVStore(storeKey storetypes.StoreKey) storetypes.KVStore { - if mock.GetKVStoreFunc == nil { - panic("CacheMultiStoreMock.GetKVStoreFunc: method is nil but CacheMultiStore.GetKVStore was just called") - } - callInfo := struct { - StoreKey storetypes.StoreKey - }{ - StoreKey: storeKey, - } - mock.lockGetKVStore.Lock() - mock.calls.GetKVStore = append(mock.calls.GetKVStore, callInfo) - mock.lockGetKVStore.Unlock() - return mock.GetKVStoreFunc(storeKey) -} - -// GetKVStoreCalls gets all the calls that were made to GetKVStore. -// Check the length with: -// -// len(mockedCacheMultiStore.GetKVStoreCalls()) -func (mock *CacheMultiStoreMock) GetKVStoreCalls() []struct { - StoreKey storetypes.StoreKey -} { - var calls []struct { - StoreKey storetypes.StoreKey - } - mock.lockGetKVStore.RLock() - calls = mock.calls.GetKVStore - mock.lockGetKVStore.RUnlock() - return calls -} - -// GetStore calls GetStoreFunc. -func (mock *CacheMultiStoreMock) GetStore(storeKey storetypes.StoreKey) storetypes.Store { - if mock.GetStoreFunc == nil { - panic("CacheMultiStoreMock.GetStoreFunc: method is nil but CacheMultiStore.GetStore was just called") - } - callInfo := struct { - StoreKey storetypes.StoreKey - }{ - StoreKey: storeKey, - } - mock.lockGetStore.Lock() - mock.calls.GetStore = append(mock.calls.GetStore, callInfo) - mock.lockGetStore.Unlock() - return mock.GetStoreFunc(storeKey) -} - -// GetStoreCalls gets all the calls that were made to GetStore. -// Check the length with: -// -// len(mockedCacheMultiStore.GetStoreCalls()) -func (mock *CacheMultiStoreMock) GetStoreCalls() []struct { - StoreKey storetypes.StoreKey -} { - var calls []struct { - StoreKey storetypes.StoreKey - } - mock.lockGetStore.RLock() - calls = mock.calls.GetStore - mock.lockGetStore.RUnlock() - return calls -} - -// GetStoreType calls GetStoreTypeFunc. -func (mock *CacheMultiStoreMock) GetStoreType() storetypes.StoreType { - if mock.GetStoreTypeFunc == nil { - panic("CacheMultiStoreMock.GetStoreTypeFunc: method is nil but CacheMultiStore.GetStoreType was just called") - } - callInfo := struct { - }{} - mock.lockGetStoreType.Lock() - mock.calls.GetStoreType = append(mock.calls.GetStoreType, callInfo) - mock.lockGetStoreType.Unlock() - return mock.GetStoreTypeFunc() -} - -// GetStoreTypeCalls gets all the calls that were made to GetStoreType. -// Check the length with: -// -// len(mockedCacheMultiStore.GetStoreTypeCalls()) -func (mock *CacheMultiStoreMock) GetStoreTypeCalls() []struct { -} { - var calls []struct { - } - mock.lockGetStoreType.RLock() - calls = mock.calls.GetStoreType - mock.lockGetStoreType.RUnlock() - return calls -} - -// LatestVersion calls LatestVersionFunc. -func (mock *CacheMultiStoreMock) LatestVersion() int64 { - if mock.LatestVersionFunc == nil { - panic("CacheMultiStoreMock.LatestVersionFunc: method is nil but CacheMultiStore.LatestVersion was just called") - } - callInfo := struct { - }{} - mock.lockLatestVersion.Lock() - mock.calls.LatestVersion = append(mock.calls.LatestVersion, callInfo) - mock.lockLatestVersion.Unlock() - return mock.LatestVersionFunc() -} - -// LatestVersionCalls gets all the calls that were made to LatestVersion. -// Check the length with: -// -// len(mockedCacheMultiStore.LatestVersionCalls()) -func (mock *CacheMultiStoreMock) LatestVersionCalls() []struct { -} { - var calls []struct { - } - mock.lockLatestVersion.RLock() - calls = mock.calls.LatestVersion - mock.lockLatestVersion.RUnlock() - return calls -} - -// SetTracer calls SetTracerFunc. -func (mock *CacheMultiStoreMock) SetTracer(w io.Writer) storetypes.MultiStore { - if mock.SetTracerFunc == nil { - panic("CacheMultiStoreMock.SetTracerFunc: method is nil but CacheMultiStore.SetTracer was just called") - } - callInfo := struct { - W io.Writer - }{ - W: w, - } - mock.lockSetTracer.Lock() - mock.calls.SetTracer = append(mock.calls.SetTracer, callInfo) - mock.lockSetTracer.Unlock() - return mock.SetTracerFunc(w) -} - -// SetTracerCalls gets all the calls that were made to SetTracer. -// Check the length with: -// -// len(mockedCacheMultiStore.SetTracerCalls()) -func (mock *CacheMultiStoreMock) SetTracerCalls() []struct { - W io.Writer -} { - var calls []struct { - W io.Writer - } - mock.lockSetTracer.RLock() - calls = mock.calls.SetTracer - mock.lockSetTracer.RUnlock() - return calls -} - -// SetTracingContext calls SetTracingContextFunc. -func (mock *CacheMultiStoreMock) SetTracingContext(traceContext storetypes.TraceContext) storetypes.MultiStore { - if mock.SetTracingContextFunc == nil { - panic("CacheMultiStoreMock.SetTracingContextFunc: method is nil but CacheMultiStore.SetTracingContext was just called") - } - callInfo := struct { - TraceContext storetypes.TraceContext - }{ - TraceContext: traceContext, - } - mock.lockSetTracingContext.Lock() - mock.calls.SetTracingContext = append(mock.calls.SetTracingContext, callInfo) - mock.lockSetTracingContext.Unlock() - return mock.SetTracingContextFunc(traceContext) -} - -// SetTracingContextCalls gets all the calls that were made to SetTracingContext. -// Check the length with: -// -// len(mockedCacheMultiStore.SetTracingContextCalls()) -func (mock *CacheMultiStoreMock) SetTracingContextCalls() []struct { - TraceContext storetypes.TraceContext -} { - var calls []struct { - TraceContext storetypes.TraceContext - } - mock.lockSetTracingContext.RLock() - calls = mock.calls.SetTracingContext - mock.lockSetTracingContext.RUnlock() - return calls -} - -// TracingEnabled calls TracingEnabledFunc. -func (mock *CacheMultiStoreMock) TracingEnabled() bool { - if mock.TracingEnabledFunc == nil { - panic("CacheMultiStoreMock.TracingEnabledFunc: method is nil but CacheMultiStore.TracingEnabled was just called") - } - callInfo := struct { - }{} - mock.lockTracingEnabled.Lock() - mock.calls.TracingEnabled = append(mock.calls.TracingEnabled, callInfo) - mock.lockTracingEnabled.Unlock() - return mock.TracingEnabledFunc() -} - -// TracingEnabledCalls gets all the calls that were made to TracingEnabled. -// Check the length with: -// -// len(mockedCacheMultiStore.TracingEnabledCalls()) -func (mock *CacheMultiStoreMock) TracingEnabledCalls() []struct { -} { - var calls []struct { - } - mock.lockTracingEnabled.RLock() - calls = mock.calls.TracingEnabled - mock.lockTracingEnabled.RUnlock() - return calls -} - -// Write calls WriteFunc. -func (mock *CacheMultiStoreMock) Write() { - if mock.WriteFunc == nil { - panic("CacheMultiStoreMock.WriteFunc: method is nil but CacheMultiStore.Write was just called") - } - callInfo := struct { - }{} - mock.lockWrite.Lock() - mock.calls.Write = append(mock.calls.Write, callInfo) - mock.lockWrite.Unlock() - mock.WriteFunc() -} - -// WriteCalls gets all the calls that were made to Write. -// Check the length with: -// -// len(mockedCacheMultiStore.WriteCalls()) -func (mock *CacheMultiStoreMock) WriteCalls() []struct { -} { - var calls []struct { - } - mock.lockWrite.RLock() - calls = mock.calls.Write - mock.lockWrite.RUnlock() - return calls -} - -// Ensure, that KVStoreMock does implement interfaces.KVStore. -// If this is not the case, regenerate this file with moq. -var _ interfaces.KVStore = &KVStoreMock{} - -// KVStoreMock is a mock implementation of interfaces.KVStore. -// -// func TestSomethingThatUsesKVStore(t *testing.T) { -// -// // make and configure a mocked interfaces.KVStore -// mockedKVStore := &KVStoreMock{ -// CacheWrapFunc: func() storetypes.CacheWrap { -// panic("mock out the CacheWrap method") -// }, -// CacheWrapWithTraceFunc: func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { -// panic("mock out the CacheWrapWithTrace method") -// }, -// DeleteFunc: func(key []byte) { -// panic("mock out the Delete method") -// }, -// GetFunc: func(key []byte) []byte { -// panic("mock out the Get method") -// }, -// GetStoreTypeFunc: func() storetypes.StoreType { -// panic("mock out the GetStoreType method") -// }, -// HasFunc: func(key []byte) bool { -// panic("mock out the Has method") -// }, -// IteratorFunc: func(start []byte, end []byte) db.Iterator { -// panic("mock out the Iterator method") -// }, -// ReverseIteratorFunc: func(start []byte, end []byte) db.Iterator { -// panic("mock out the ReverseIterator method") -// }, -// SetFunc: func(key []byte, value []byte) { -// panic("mock out the Set method") -// }, -// } -// -// // use mockedKVStore in code that requires interfaces.KVStore -// // and then make assertions. -// -// } -type KVStoreMock struct { - // CacheWrapFunc mocks the CacheWrap method. - CacheWrapFunc func() storetypes.CacheWrap - - // CacheWrapWithTraceFunc mocks the CacheWrapWithTrace method. - CacheWrapWithTraceFunc func(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap - - // DeleteFunc mocks the Delete method. - DeleteFunc func(key []byte) - - // GetFunc mocks the Get method. - GetFunc func(key []byte) []byte - - // GetStoreTypeFunc mocks the GetStoreType method. - GetStoreTypeFunc func() storetypes.StoreType - - // HasFunc mocks the Has method. - HasFunc func(key []byte) bool - - // IteratorFunc mocks the Iterator method. - IteratorFunc func(start []byte, end []byte) db.Iterator - - // ReverseIteratorFunc mocks the ReverseIterator method. - ReverseIteratorFunc func(start []byte, end []byte) db.Iterator - - // SetFunc mocks the Set method. - SetFunc func(key []byte, value []byte) - - // calls tracks calls to the methods. - calls struct { - // CacheWrap holds details about calls to the CacheWrap method. - CacheWrap []struct { - } - // CacheWrapWithTrace holds details about calls to the CacheWrapWithTrace method. - CacheWrapWithTrace []struct { - // W is the w argument value. - W io.Writer - // Tc is the tc argument value. - Tc storetypes.TraceContext - } - // Delete holds details about calls to the Delete method. - Delete []struct { - // Key is the key argument value. - Key []byte - } - // Get holds details about calls to the Get method. - Get []struct { - // Key is the key argument value. - Key []byte - } - // GetStoreType holds details about calls to the GetStoreType method. - GetStoreType []struct { - } - // Has holds details about calls to the Has method. - Has []struct { - // Key is the key argument value. - Key []byte - } - // Iterator holds details about calls to the Iterator method. - Iterator []struct { - // Start is the start argument value. - Start []byte - // End is the end argument value. - End []byte - } - // ReverseIterator holds details about calls to the ReverseIterator method. - ReverseIterator []struct { - // Start is the start argument value. - Start []byte - // End is the end argument value. - End []byte - } - // Set holds details about calls to the Set method. - Set []struct { - // Key is the key argument value. - Key []byte - // Value is the value argument value. - Value []byte - } - } - lockCacheWrap sync.RWMutex - lockCacheWrapWithTrace sync.RWMutex - lockDelete sync.RWMutex - lockGet sync.RWMutex - lockGetStoreType sync.RWMutex - lockHas sync.RWMutex - lockIterator sync.RWMutex - lockReverseIterator sync.RWMutex - lockSet sync.RWMutex -} - -// CacheWrap calls CacheWrapFunc. -func (mock *KVStoreMock) CacheWrap() storetypes.CacheWrap { - if mock.CacheWrapFunc == nil { - panic("KVStoreMock.CacheWrapFunc: method is nil but KVStore.CacheWrap was just called") - } - callInfo := struct { - }{} - mock.lockCacheWrap.Lock() - mock.calls.CacheWrap = append(mock.calls.CacheWrap, callInfo) - mock.lockCacheWrap.Unlock() - return mock.CacheWrapFunc() -} - -// CacheWrapCalls gets all the calls that were made to CacheWrap. -// Check the length with: -// -// len(mockedKVStore.CacheWrapCalls()) -func (mock *KVStoreMock) CacheWrapCalls() []struct { -} { - var calls []struct { - } - mock.lockCacheWrap.RLock() - calls = mock.calls.CacheWrap - mock.lockCacheWrap.RUnlock() - return calls -} - -// CacheWrapWithTrace calls CacheWrapWithTraceFunc. -func (mock *KVStoreMock) CacheWrapWithTrace(w io.Writer, tc storetypes.TraceContext) storetypes.CacheWrap { - if mock.CacheWrapWithTraceFunc == nil { - panic("KVStoreMock.CacheWrapWithTraceFunc: method is nil but KVStore.CacheWrapWithTrace was just called") - } - callInfo := struct { - W io.Writer - Tc storetypes.TraceContext - }{ - W: w, - Tc: tc, - } - mock.lockCacheWrapWithTrace.Lock() - mock.calls.CacheWrapWithTrace = append(mock.calls.CacheWrapWithTrace, callInfo) - mock.lockCacheWrapWithTrace.Unlock() - return mock.CacheWrapWithTraceFunc(w, tc) -} - -// CacheWrapWithTraceCalls gets all the calls that were made to CacheWrapWithTrace. -// Check the length with: -// -// len(mockedKVStore.CacheWrapWithTraceCalls()) -func (mock *KVStoreMock) CacheWrapWithTraceCalls() []struct { - W io.Writer - Tc storetypes.TraceContext -} { - var calls []struct { - W io.Writer - Tc storetypes.TraceContext - } - mock.lockCacheWrapWithTrace.RLock() - calls = mock.calls.CacheWrapWithTrace - mock.lockCacheWrapWithTrace.RUnlock() - return calls -} - -// Delete calls DeleteFunc. -func (mock *KVStoreMock) Delete(key []byte) { - if mock.DeleteFunc == nil { - panic("KVStoreMock.DeleteFunc: method is nil but KVStore.Delete was just called") - } - callInfo := struct { - Key []byte - }{ - Key: key, - } - mock.lockDelete.Lock() - mock.calls.Delete = append(mock.calls.Delete, callInfo) - mock.lockDelete.Unlock() - mock.DeleteFunc(key) -} - -// DeleteCalls gets all the calls that were made to Delete. -// Check the length with: -// -// len(mockedKVStore.DeleteCalls()) -func (mock *KVStoreMock) DeleteCalls() []struct { - Key []byte -} { - var calls []struct { - Key []byte - } - mock.lockDelete.RLock() - calls = mock.calls.Delete - mock.lockDelete.RUnlock() - return calls -} - -// Get calls GetFunc. -func (mock *KVStoreMock) Get(key []byte) []byte { - if mock.GetFunc == nil { - panic("KVStoreMock.GetFunc: method is nil but KVStore.Get was just called") - } - callInfo := struct { - Key []byte - }{ - Key: key, - } - mock.lockGet.Lock() - mock.calls.Get = append(mock.calls.Get, callInfo) - mock.lockGet.Unlock() - return mock.GetFunc(key) -} - -// GetCalls gets all the calls that were made to Get. -// Check the length with: -// -// len(mockedKVStore.GetCalls()) -func (mock *KVStoreMock) GetCalls() []struct { - Key []byte -} { - var calls []struct { - Key []byte - } - mock.lockGet.RLock() - calls = mock.calls.Get - mock.lockGet.RUnlock() - return calls -} - -// GetStoreType calls GetStoreTypeFunc. -func (mock *KVStoreMock) GetStoreType() storetypes.StoreType { - if mock.GetStoreTypeFunc == nil { - panic("KVStoreMock.GetStoreTypeFunc: method is nil but KVStore.GetStoreType was just called") - } - callInfo := struct { - }{} - mock.lockGetStoreType.Lock() - mock.calls.GetStoreType = append(mock.calls.GetStoreType, callInfo) - mock.lockGetStoreType.Unlock() - return mock.GetStoreTypeFunc() -} - -// GetStoreTypeCalls gets all the calls that were made to GetStoreType. -// Check the length with: -// -// len(mockedKVStore.GetStoreTypeCalls()) -func (mock *KVStoreMock) GetStoreTypeCalls() []struct { -} { - var calls []struct { - } - mock.lockGetStoreType.RLock() - calls = mock.calls.GetStoreType - mock.lockGetStoreType.RUnlock() - return calls -} - -// Has calls HasFunc. -func (mock *KVStoreMock) Has(key []byte) bool { - if mock.HasFunc == nil { - panic("KVStoreMock.HasFunc: method is nil but KVStore.Has was just called") - } - callInfo := struct { - Key []byte - }{ - Key: key, - } - mock.lockHas.Lock() - mock.calls.Has = append(mock.calls.Has, callInfo) - mock.lockHas.Unlock() - return mock.HasFunc(key) -} - -// HasCalls gets all the calls that were made to Has. -// Check the length with: -// -// len(mockedKVStore.HasCalls()) -func (mock *KVStoreMock) HasCalls() []struct { - Key []byte -} { - var calls []struct { - Key []byte - } - mock.lockHas.RLock() - calls = mock.calls.Has - mock.lockHas.RUnlock() - return calls -} - -// Iterator calls IteratorFunc. -func (mock *KVStoreMock) Iterator(start []byte, end []byte) db.Iterator { - if mock.IteratorFunc == nil { - panic("KVStoreMock.IteratorFunc: method is nil but KVStore.Iterator was just called") - } - callInfo := struct { - Start []byte - End []byte - }{ - Start: start, - End: end, - } - mock.lockIterator.Lock() - mock.calls.Iterator = append(mock.calls.Iterator, callInfo) - mock.lockIterator.Unlock() - return mock.IteratorFunc(start, end) -} - -// IteratorCalls gets all the calls that were made to Iterator. -// Check the length with: -// -// len(mockedKVStore.IteratorCalls()) -func (mock *KVStoreMock) IteratorCalls() []struct { - Start []byte - End []byte -} { - var calls []struct { - Start []byte - End []byte - } - mock.lockIterator.RLock() - calls = mock.calls.Iterator - mock.lockIterator.RUnlock() - return calls -} - -// ReverseIterator calls ReverseIteratorFunc. -func (mock *KVStoreMock) ReverseIterator(start []byte, end []byte) db.Iterator { - if mock.ReverseIteratorFunc == nil { - panic("KVStoreMock.ReverseIteratorFunc: method is nil but KVStore.ReverseIterator was just called") - } - callInfo := struct { - Start []byte - End []byte - }{ - Start: start, - End: end, - } - mock.lockReverseIterator.Lock() - mock.calls.ReverseIterator = append(mock.calls.ReverseIterator, callInfo) - mock.lockReverseIterator.Unlock() - return mock.ReverseIteratorFunc(start, end) -} - -// ReverseIteratorCalls gets all the calls that were made to ReverseIterator. -// Check the length with: -// -// len(mockedKVStore.ReverseIteratorCalls()) -func (mock *KVStoreMock) ReverseIteratorCalls() []struct { - Start []byte - End []byte -} { - var calls []struct { - Start []byte - End []byte - } - mock.lockReverseIterator.RLock() - calls = mock.calls.ReverseIterator - mock.lockReverseIterator.RUnlock() - return calls -} - -// Set calls SetFunc. -func (mock *KVStoreMock) Set(key []byte, value []byte) { - if mock.SetFunc == nil { - panic("KVStoreMock.SetFunc: method is nil but KVStore.Set was just called") - } - callInfo := struct { - Key []byte - Value []byte - }{ - Key: key, - Value: value, - } - mock.lockSet.Lock() - mock.calls.Set = append(mock.calls.Set, callInfo) - mock.lockSet.Unlock() - mock.SetFunc(key, value) -} - -// SetCalls gets all the calls that were made to Set. -// Check the length with: -// -// len(mockedKVStore.SetCalls()) -func (mock *KVStoreMock) SetCalls() []struct { - Key []byte - Value []byte -} { - var calls []struct { - Key []byte - Value []byte - } - mock.lockSet.RLock() - calls = mock.calls.Set - mock.lockSet.RUnlock() - return calls -} diff --git a/cosmos/testing/types/mock/interfaces/store.go b/cosmos/testing/types/mock/interfaces/store.go deleted file mode 100644 index 3e74a9f59a..0000000000 --- a/cosmos/testing/types/mock/interfaces/store.go +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package interfaces - -import storetypes "cosmossdk.io/store/types" - -// Interface wrappers for mocking -// -//go:generate moq -out ./mock/store.mock.go -pkg mock . MultiStore CacheMultiStore KVStore -type ( - // MultiStore wrapper for github.com/cosmos/cosmos-sdk/types.MultiStore. - MultiStore storetypes.MultiStore - // CacheMultiStore wrapper for github.com/cosmos/cosmos-sdk/types.CacheMultiStore. - CacheMultiStore storetypes.CacheMultiStore - // KVStore wrapper for github.com/cosmos/cosmos-sdk/types.KVStore. - KVStore storetypes.KVStore -) diff --git a/cosmos/testing/types/mock/store.go b/cosmos/testing/types/mock/store.go deleted file mode 100644 index 62b6f87d32..0000000000 --- a/cosmos/testing/types/mock/store.go +++ /dev/null @@ -1,326 +0,0 @@ -// SPDX-License-Identifier: BUSL-1.1 -// -// Copyright (C) 2023, Berachain Foundation. All rights reserved. -// Use of this software is govered by the Business Source License included -// in the LICENSE file of this repository and at www.mariadb.com/bsl11. -// -// ANY USE OF THE LICENSED WORK IN VIOLATION OF THIS LICENSE WILL AUTOMATICALLY -// TERMINATE YOUR RIGHTS UNDER THIS LICENSE FOR THE CURRENT AND ALL OTHER -// VERSIONS OF THE LICENSED WORK. -// -// THIS LICENSE DOES NOT GRANT YOU ANY RIGHT IN ANY TRADEMARK OR LOGO OF -// LICENSOR OR ITS AFFILIATES (PROVIDED THAT YOU MAY USE A TRADEMARK OR LOGO OF -// LICENSOR AS EXPRESSLY REQUIRED BY THIS LICENSE). -// -// TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON -// AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, -// EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND -// TITLE. - -package mock - -import ( - "bytes" - "io" - "sort" - "sync" - - "cosmossdk.io/store/types" - - "pkg.berachain.dev/polaris/cosmos/testing/types/mock/interfaces" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock/interfaces/mock" - "pkg.berachain.dev/polaris/lib/utils" -) - -// MultiStore is a simple multistore used for testing. -type MultiStore struct { - kvstore map[string]interfaces.KVStore - *mock.MultiStoreMock -} - -// MultiStore implements precompile.MultiStore. -func (m MultiStore) SetReadOnly(bool) {} - -// MultiStore implements precompile.MultiStore. -func (m MultiStore) IsReadOnly() bool { return false } - -// CachedMultiStore is a simple chached multistore for testing. -type CachedMultiStore struct { - kvstore map[string]interfaces.KVStore - *mock.CacheMultiStoreMock -} - -// NewMultiStore returns a new Multistore instance used for testing. -func NewMultiStore() types.MultiStore { - ms := MultiStore{ - kvstore: map[string]interfaces.KVStore{}, - MultiStoreMock: &mock.MultiStoreMock{}, - } - ms.GetKVStoreFunc = func(storeKey types.StoreKey) types.KVStore { - if store, ok := ms.kvstore[storeKey.String()]; ok { - return store - } - store := newTestKVStore() - ms.kvstore[storeKey.String()] = store - return store - } - - ms.CacheMultiStoreFunc = func() types.CacheMultiStore { - return NewCachedMultiStore(ms) - } - - return ms -} - -// NewCachedMultiStore returns a new CacheMultiStore instance for testing. -func NewCachedMultiStore(ms MultiStore) types.CacheMultiStore { - kvstore := map[string]interfaces.KVStore{} - - for key, store := range ms.kvstore { - kvstore[key] = utils.MustGetAs[interfaces.KVStore](store.CacheWrap()) - } - - cached := CachedMultiStore{ - kvstore: kvstore, - CacheMultiStoreMock: &mock.CacheMultiStoreMock{}, - } - cached.GetKVStoreFunc = func(storeKey types.StoreKey) types.KVStore { - if store, ok := cached.kvstore[storeKey.String()]; ok { - return store - } - store := newTestKVStore() - store.write = func() { - ms.kvstore[storeKey.String()] = store - } - cached.kvstore[storeKey.String()] = store - return store - } - - cached.WriteFunc = func() { - for _, store := range cached.kvstore { - utils.MustGetAs[*TestKVStore](store).Write() - } - } - return cached -} - -// TestKVStore is a kv store for testing. -type TestKVStore struct { - mutex *sync.RWMutex - store map[string][]byte - write func() -} - -func (t TestKVStore) Write() { - t.write() -} - -// newTestKVStore returns a new kv store instance for testing. -func newTestKVStore() *TestKVStore { - return &TestKVStore{ - mutex: &sync.RWMutex{}, - store: map[string][]byte{}, - write: func() {}, - } -} - -// GetStoreType is not implemented. -func (t TestKVStore) GetStoreType() types.StoreType { - panic("implement me") -} - -// CacheWrap is not implemented. -func (t *TestKVStore) CacheWrap() types.CacheWrap { - t.mutex.RLock() - defer t.mutex.RUnlock() - - cache := &TestKVStore{ - mutex: &sync.RWMutex{}, - store: map[string][]byte{}, - } - cache.write = func() { t.store = cache.store } - - for key, val := range t.store { - cache.store[key] = val - } - - return cache -} - -// CacheWrapWithTrace is not implemented. -func (t TestKVStore) CacheWrapWithTrace(_ io.Writer, _ types.TraceContext) types.CacheWrap { - panic("implement me") -} - -// Get returns the value of the given key, nil if it does not exist. -func (t TestKVStore) Get(key []byte) []byte { - t.mutex.RLock() - defer t.mutex.RUnlock() - val, ok := t.store[string(key)] - - if !ok { - return nil - } - return val -} - -// Has checks if an entry for the given key exists. -func (t TestKVStore) Has(key []byte) bool { - t.mutex.RLock() - defer t.mutex.RUnlock() - _, ok := t.store[string(key)] - return ok -} - -// Set stores the given key value pair. -func (t TestKVStore) Set(key, value []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - t.store[string(key)] = value -} - -// Delete deletes a key if it exists. -func (t TestKVStore) Delete(key []byte) { - t.mutex.Lock() - defer t.mutex.Unlock() - - delete(t.store, string(key)) -} - -// Iterator returns an interator over the given key domain. -func (t TestKVStore) Iterator(start, end []byte) types.Iterator { - t.mutex.Lock() - defer t.mutex.Unlock() - - return newMockIterator(start, end, t.store) -} - -// ReverseIterator returns an iterator -// that iterates over all keys in the given domain in reverse order. -func (t TestKVStore) ReverseIterator(start, end []byte) types.Iterator { - t.mutex.Lock() - defer t.mutex.Unlock() - - iter := newMockIterator(start, end, t.store) - - // reverse the order of the iterator, which is returned already - // sorted in ascending order - for i, j := 0, len(iter.keys)-1; i < j; i, j = i+1, j-1 { - iter.keys[i], iter.keys[j] = iter.keys[j], iter.keys[i] - iter.values[i], iter.values[j] = iter.values[j], iter.values[i] - } - - iter.start = end - iter.end = start - - return iter -} - -// fake iterator. -type mockIterator struct { - keys [][]byte - values [][]byte - index int - start, end []byte -} - -func newMockIterator(start, end []byte, content map[string][]byte) *mockIterator { - keys := make([][]byte, 0) - - // select the keys according to the specified domain - for k := range content { - b := []byte(k) - - if (start == nil && end == nil) || - (bytes.Compare(b, start) >= 0 && bytes.Compare(b, end) < 0) { - // make sure data is a copy so that there is no concurrent writing - temp := make([]byte, len(k)) - copy(temp, k) - keys = append(keys, temp) - } - } - - // Sort the keys in ascending order - sort.Slice(keys, func(i, j int) bool { - return bytes.Compare(keys[i], keys[j]) < 0 - }) - - // With the keys chosen and sorted, we can now populate the slice of values - values := make([][]byte, len(keys)) - - for i := 0; i < len(keys); i++ { - // make sure data is a copy so that there is no concurrent writing - value := content[string(keys[i])] - temp := make([]byte, len(value)) - copy(temp, value) - - values[i] = temp - } - - return &mockIterator{ - keys: keys, - values: values, - index: 0, - start: start, - end: end, - } -} - -// Domain returns the key domain of the iterator. -// The start & end (exclusive) limits to iterate over. -// If end < start, then the Iterator goes in reverse order. -// -// A domain of ([]byte{12, 13}, []byte{12, 14}) will iterate -// over anything with the prefix []byte{12, 13}. -// -// The smallest key is the empty byte array []byte{} - see BeginningKey(). -// The largest key is the nil byte array []byte(nil) - see EndingKey(). -// CONTRACT: start, end readonly []byte. -func (mi mockIterator) Domain() ([]byte, []byte) { - return mi.start, mi.end -} - -// Valid returns whether the current position is valid. -// Once invalid, an Iterator is forever invalid. -func (mi mockIterator) Valid() bool { - return mi.index < len(mi.keys) -} - -// Next moves the iterator to the next sequential key in the database, as -// defined by order of iteration. -// If Valid returns false, this method will panic. -func (mi *mockIterator) Next() { - mi.index++ -} - -// Key returns the key of the cursor. -// If Valid returns false, this method will panic. -// CONTRACT: key readonly []byte. -func (mi mockIterator) Key() []byte { - if !mi.Valid() { - panic("Iterator position out of bounds") - } - - return mi.keys[mi.index] -} - -// Value returns the value of the cursor. -// If Valid returns false, this method will panic. -// CONTRACT: value readonly []byte. -func (mi mockIterator) Value() []byte { - if !mi.Valid() { - panic("Iterator position out of bounds") - } - - return mi.values[mi.index] -} - -func (mi mockIterator) Error() error { - return nil -} - -// Close releases the Iterator. -func (mi mockIterator) Close() error { - return nil -} diff --git a/cosmos/testing/utils/bank.go b/cosmos/testutil/bank.go similarity index 98% rename from cosmos/testing/utils/bank.go rename to cosmos/testutil/bank.go index 07509382f8..2bcf453318 100644 --- a/cosmos/testing/utils/bank.go +++ b/cosmos/testutil/bank.go @@ -18,7 +18,7 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package utils +package testutil import ( "context" diff --git a/cosmos/testing/utils/interfaces.go b/cosmos/testutil/interfaces.go similarity index 98% rename from cosmos/testing/utils/interfaces.go rename to cosmos/testutil/interfaces.go index 56502eb9bd..b1b944e56e 100644 --- a/cosmos/testing/utils/interfaces.go +++ b/cosmos/testutil/interfaces.go @@ -18,7 +18,7 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package utils +package testutil import ( "context" diff --git a/cosmos/testing/utils/setup.go b/cosmos/testutil/setup.go similarity index 84% rename from cosmos/testing/utils/setup.go rename to cosmos/testutil/setup.go index 8c84ee9552..32a6a70006 100644 --- a/cosmos/testing/utils/setup.go +++ b/cosmos/testutil/setup.go @@ -18,12 +18,16 @@ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND // TITLE. -package utils +package testutil import ( "testing" + cdb "github.com/cosmos/cosmos-db" + "cosmossdk.io/log" + "cosmossdk.io/store/metrics" + "cosmossdk.io/store/rootmulti" storetypes "cosmossdk.io/store/types" cometproto "github.com/cometbft/cometbft/proto/tendermint/types" @@ -50,7 +54,6 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "pkg.berachain.dev/polaris/cosmos/testing/types/mock" "pkg.berachain.dev/polaris/cosmos/types" evmtypes "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/common" @@ -66,13 +69,26 @@ var ( ) // NewContext creates a SDK context and mounts a mock multistore. -func NewContext() sdk.Context { - return sdk.NewContext( - mock.NewMultiStore(), cometproto.Header{}, false, log.NewTestLogger(&testing.T{})) +func NewContext(logger log.Logger, storekeys ...storetypes.StoreKey) sdk.Context { + cdb := cdb.NewMemDB() + rms := rootmulti.NewStore(cdb, logger, metrics.NewNoOpMetrics()) + + // Register defaults + rms.MountStoreWithDB(AccKey, storetypes.StoreTypeIAVL, cdb) + rms.MountStoreWithDB(BankKey, storetypes.StoreTypeIAVL, cdb) + rms.MountStoreWithDB(EvmKey, storetypes.StoreTypeIAVL, cdb) + rms.MountStoreWithDB(StakingKey, storetypes.StoreTypeIAVL, cdb) + + // Allow extending the + for _, storeKey := range storekeys { + rms.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, cdb) + } + _ = rms.LoadLatestVersion() + return NewContextWithMultiStore(rms, logger) } -func NewContextWithMultiStore(ms storetypes.MultiStore) sdk.Context { - return sdk.NewContext(ms, cometproto.Header{}, false, log.NewTestLogger(&testing.T{})) +func NewContextWithMultiStore(ms storetypes.MultiStore, logger log.Logger) sdk.Context { + return sdk.NewContext(ms, cometproto.Header{}, false, logger) } // TestEncodingConfig defines an encoding configuration that is used for testing @@ -112,14 +128,14 @@ func MakeTestEncodingConfig(modules ...module.AppModuleBasic) TestEncodingConfig } // SetupMinimalKeepers creates and returns keepers for the base SDK modules. -func SetupMinimalKeepers() ( +func SetupMinimalKeepers(logger log.Logger, keys ...storetypes.StoreKey) ( sdk.Context, authkeeper.AccountKeeper, bankkeeper.BaseKeeper, stakingkeeper.Keeper, ) { types.SetupCosmosConfig() - ctx := NewContext().WithBlockHeight(1) + ctx := NewContext(logger, keys...).WithBlockHeight(1) encodingConfig := testutil.MakeTestEncodingConfig( auth.AppModuleBasic{}, @@ -144,7 +160,6 @@ func SetupMinimalKeepers() ( govtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, distrtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, }, - // TODO: switch to eip-55 fuck bech32. addrCodec, "cosmos", authority, diff --git a/cosmos/x/evm/genesis_test.go b/cosmos/x/evm/genesis_test.go index 644e4d6cb2..003b1cdd7c 100644 --- a/cosmos/x/evm/genesis_test.go +++ b/cosmos/x/evm/genesis_test.go @@ -27,7 +27,6 @@ import ( "math/big" "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -35,7 +34,7 @@ import ( "pkg.berachain.dev/polaris/cosmos/config" "pkg.berachain.dev/polaris/cosmos/precompile/staking" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm" "pkg.berachain.dev/polaris/cosmos/x/evm/keeper" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" @@ -64,7 +63,7 @@ var _ = Describe("", func() { ) BeforeEach(func() { - ctx, ak, _, sk = testutil.SetupMinimalKeepers() + ctx, ak, _, sk = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) ctx = ctx.WithBlockHeight(0) sc = staking.NewPrecompileContract(ak, &sk) cfg := config.DefaultConfig() @@ -73,7 +72,7 @@ var _ = Describe("", func() { cfg.Node.KeyStoreDir = GinkgoT().TempDir() k = keeper.NewKeeper( ak, sk, - storetypes.NewKVStoreKey("evm"), + testutil.EvmKey, func() *ethprecompile.Injector { return ethprecompile.NewPrecompiles([]ethprecompile.Registrable{sc}...) }, diff --git a/cosmos/x/evm/keeper/processor_test.go b/cosmos/x/evm/keeper/processor_test.go index d5d1691394..b882cc3c0b 100644 --- a/cosmos/x/evm/keeper/processor_test.go +++ b/cosmos/x/evm/keeper/processor_test.go @@ -36,7 +36,7 @@ import ( bindings "pkg.berachain.dev/polaris/contracts/bindings/testing" "pkg.berachain.dev/polaris/cosmos/config" "pkg.berachain.dev/polaris/cosmos/precompile/staking" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/keeper" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/eth/accounts/abi" @@ -88,14 +88,14 @@ var _ = Describe("Processor", func() { } // before chain, init genesis state - ctx, ak, _, sk = testutil.SetupMinimalKeepers() + ctx, ak, _, sk = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) cfg := config.DefaultConfig() cfg.Node.DataDir = GinkgoT().TempDir() cfg.Node.KeyStoreDir = GinkgoT().TempDir() sc = staking.NewPrecompileContract(ak, &sk) k = keeper.NewKeeper( ak, sk, - storetypes.NewKVStoreKey("evm"), + testutil.EvmKey, func() *ethprecompile.Injector { return ethprecompile.NewPrecompiles([]ethprecompile.Registrable{sc}...) }, diff --git a/cosmos/x/evm/plugins/block/header_test.go b/cosmos/x/evm/plugins/block/header_test.go index 07a6abe291..87212a5fd7 100644 --- a/cosmos/x/evm/plugins/block/header_test.go +++ b/cosmos/x/evm/plugins/block/header_test.go @@ -24,11 +24,12 @@ import ( "errors" "math/big" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" evmtypes "pkg.berachain.dev/polaris/cosmos/x/evm/types" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" @@ -44,8 +45,10 @@ var _ = Describe("Header", func() { var p *plugin BeforeEach(func() { - _, _, _, sk := testutil.SetupMinimalKeepers() - ctx = testutil.NewContext().WithBlockGasMeter(storetypes.NewGasMeter(uint64(10000))) + _, _, _, sk := testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) + ctx = testutil.NewContext( + log.NewTestLogger(GinkgoT())). + WithBlockGasMeter(storetypes.NewGasMeter(uint64(10000))) p = utils.MustGetAs[*plugin](NewPlugin(testutil.EvmKey, sk)) p.SetQueryContextFn( func() func(height int64, prove bool) (sdk.Context, error) { return mockQueryContext }) @@ -134,7 +137,7 @@ func mockQueryContext(height int64, _ bool) (sdk.Context, error) { if height <= 0 { return sdk.Context{}, errors.New("cannot query context at this height") } - ctx := testutil.NewContext().WithBlockHeight(height) + ctx := testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockHeight(height) header := generateHeaderAtHeight(height) headerBz, err := types.MarshalHeader(header) if err != nil { diff --git a/cosmos/x/evm/plugins/gas/plugin_test.go b/cosmos/x/evm/plugins/gas/plugin_test.go index 4ac1564860..d45b267a8a 100644 --- a/cosmos/x/evm/plugins/gas/plugin_test.go +++ b/cosmos/x/evm/plugins/gas/plugin_test.go @@ -23,11 +23,12 @@ package gas import ( "math" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/lib/utils" . "github.com/onsi/ginkgo/v2" @@ -43,14 +44,14 @@ var _ = Describe("plugin", func() { BeforeEach(func() { // new block blockGasMeter = storetypes.NewGasMeter(blockGasLimit) - ctx = testutil.NewContext().WithBlockGasMeter(blockGasMeter) + ctx = testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter) p = utils.MustGetAs[*plugin](NewPlugin()) p.Reset(ctx) p.Prepare(ctx) }) It("correctly consume, refund, and report cumulative in the same block", func() { - p.Reset(testutil.NewContext().WithBlockGasMeter(blockGasMeter)) + p.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter)) // tx 1 p.gasMeter = storetypes.NewGasMeter(1000) @@ -65,7 +66,7 @@ var _ = Describe("plugin", func() { // as block gas is handled by the baseapp. blockGasMeter.ConsumeGas(250, "") // finalize tx 1 - p.Reset(testutil.NewContext().WithBlockGasMeter(blockGasMeter)) + p.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter)) // tx 2 p.gasMeter = storetypes.NewGasMeter(1000) @@ -77,7 +78,7 @@ var _ = Describe("plugin", func() { Expect(p.BlockGasConsumed()).To(Equal(uint64(250))) // shouldn't use any xtra gas yet. blockGasMeter.ConsumeGas(1000, "") // finalize tx 2 Expect(p.BlockGasConsumed()).To(Equal(uint64(1250))) - p.Reset(testutil.NewContext().WithBlockGasMeter(blockGasMeter)) + p.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter)) // tx 3 p.gasMeter = storetypes.NewGasMeter(1000) @@ -110,14 +111,14 @@ var _ = Describe("plugin", func() { It("should error on block gas overconsumption", func() { Expect(p.BlockGasLimit()).To(Equal(blockGasLimit)) - p.Reset(testutil.NewContext().WithBlockGasMeter(blockGasMeter)) + p.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter)) // tx 1 err := p.ConsumeTxGas(1000) Expect(err).ToNot(HaveOccurred()) blockGasMeter.ConsumeGas(1000, "") // finalize tx 1 - p.Reset(testutil.NewContext().WithBlockGasMeter(blockGasMeter)) + p.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockGasMeter(blockGasMeter)) // tx 2 err = p.ConsumeTxGas(1000) diff --git a/cosmos/x/evm/plugins/historical/plugin_test.go b/cosmos/x/evm/plugins/historical/plugin_test.go index 7815df67f2..e6f52e89fa 100644 --- a/cosmos/x/evm/plugins/historical/plugin_test.go +++ b/cosmos/x/evm/plugins/historical/plugin_test.go @@ -23,11 +23,13 @@ package historical import ( "math/big" + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/trie" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" "pkg.berachain.dev/polaris/eth/core/mock" @@ -45,7 +47,7 @@ var _ = Describe("Historical Data", func() { ) BeforeEach(func() { - ctx = testutil.NewContext().WithBlockHeight(0) + ctx = testutil.NewContext(log.NewTestLogger(GinkgoT())).WithBlockHeight(0) cp := mock.NewConfigurationPluginMock() bp := mock.NewBlockPluginMock() diff --git a/cosmos/x/evm/plugins/precompile/log/factory_test.go b/cosmos/x/evm/plugins/precompile/log/factory_test.go index d5e7ffd8c8..7b74eb6d14 100644 --- a/cosmos/x/evm/plugins/precompile/log/factory_test.go +++ b/cosmos/x/evm/plugins/precompile/log/factory_test.go @@ -24,13 +24,14 @@ import ( "errors" "strconv" + "cosmossdk.io/log" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" cosmlib "pkg.berachain.dev/polaris/cosmos/lib" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/eth/accounts/abi" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core/precompile" @@ -54,7 +55,7 @@ var _ = Describe("Factory", func() { ) BeforeEach(func() { - _, _, _, sk = testutil.SetupMinimalKeepers() + _, _, _, sk = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) valAddr = sdk.ValAddress([]byte("alice")) delAddr = sdk.AccAddress([]byte("bob")) creationHeight = int64(10) diff --git a/cosmos/x/evm/plugins/precompile/plugin_test.go b/cosmos/x/evm/plugins/precompile/plugin_test.go index 4ed23ffd42..135be6f22e 100644 --- a/cosmos/x/evm/plugins/precompile/plugin_test.go +++ b/cosmos/x/evm/plugins/precompile/plugin_test.go @@ -25,12 +25,13 @@ import ( "errors" "math/big" + "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - tmock "pkg.berachain.dev/polaris/cosmos/testing/types/mock" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + "pkg.berachain.dev/polaris/cosmos/store/snapmulti" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/events" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/events/mock" @@ -50,10 +51,11 @@ var _ = Describe("plugin", func() { var ctx sdk.Context BeforeEach(func() { - ctx = testutil.NewContext() + ctx = testutil.NewContext(log.NewTestLogger(GinkgoT())) ctx = ctx.WithEventManager( events.NewManagerFrom(ctx.EventManager(), mock.NewPrecompileLogFactory()), ) + ctx = ctx.WithMultiStore(snapmulti.NewStoreFrom(ctx.MultiStore())) p = utils.MustGetAs[*plugin](NewPlugin()) e = &mockEVM{nil, ctx, &mockSDB{nil, ctx, 0}} }) @@ -70,7 +72,7 @@ var _ = Describe("plugin", func() { }) It("should handle read-only static calls", func() { - ms := utils.MustGetAs[tmock.MultiStore](ctx.MultiStore()) + ms := utils.MustGetAs[MultiStore](ctx.MultiStore()) cem := utils.MustGetAs[state.ControllableEventManager](ctx.EventManager()) // verify its not read-only right now Expect(ms.IsReadOnly()).To(BeFalse()) diff --git a/cosmos/x/evm/plugins/state/events/manager_test.go b/cosmos/x/evm/plugins/state/events/manager_test.go index 9b454393aa..f6f1e19212 100644 --- a/cosmos/x/evm/plugins/state/events/manager_test.go +++ b/cosmos/x/evm/plugins/state/events/manager_test.go @@ -18,9 +18,11 @@ package events_test import ( + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/events" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state/events/mock" @@ -37,7 +39,7 @@ var _ = Describe("Manager", func() { BeforeEach(func() { ldb = mock.NewEmptyLogsDB() - ctx = testutil.NewContext() + ctx = testutil.NewContext(log.NewTestLogger(GinkgoT())) ctx.EventManager().EmitEvent(sdk.NewEvent("1")) cem = events.NewManagerFrom(ctx.EventManager(), mock.NewPrecompileLogFactory()) diff --git a/cosmos/x/evm/plugins/state/genesis_test.go b/cosmos/x/evm/plugins/state/genesis_test.go index fe7228fb6e..81818fbebe 100644 --- a/cosmos/x/evm/plugins/state/genesis_test.go +++ b/cosmos/x/evm/plugins/state/genesis_test.go @@ -23,9 +23,11 @@ package state_test import ( "math/big" + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" @@ -44,7 +46,7 @@ var _ = Describe("Genesis", func() { BeforeEach(func() { var ak state.AccountKeeper - ctx, ak, _, _ = testutil.SetupMinimalKeepers() + ctx, ak, _, _ = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) sp = state.NewPlugin(ak, testutil.EvmKey, &mockPLF{}) // Create account for alice, bob diff --git a/cosmos/x/evm/plugins/state/plugin_benchmark_test.go b/cosmos/x/evm/plugins/state/plugin_benchmark_test.go index 7004c07209..1be40c1c27 100644 --- a/cosmos/x/evm/plugins/state/plugin_benchmark_test.go +++ b/cosmos/x/evm/plugins/state/plugin_benchmark_test.go @@ -24,7 +24,9 @@ import ( "math/big" "testing" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + "cosmossdk.io/log" + + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/eth/common" "pkg.berachain.dev/polaris/eth/core" @@ -37,7 +39,7 @@ var ( ) func GetNewStatePlugin() core.StatePlugin { - ctx, ak, _, _ := testutil.SetupMinimalKeepers() + ctx, ak, _, _ := testutil.SetupMinimalKeepers(log.NewTestLogger(&testing.B{})) sp := state.NewPlugin(ak, testutil.EvmKey, nil) sp.Reset(ctx) return sp diff --git a/cosmos/x/evm/plugins/state/plugin_test.go b/cosmos/x/evm/plugins/state/plugin_test.go index 9796970650..a506dcd658 100644 --- a/cosmos/x/evm/plugins/state/plugin_test.go +++ b/cosmos/x/evm/plugins/state/plugin_test.go @@ -23,9 +23,11 @@ package state_test import ( "math/big" + "cosmossdk.io/log" + sdk "github.com/cosmos/cosmos-sdk/types" - testutil "pkg.berachain.dev/polaris/cosmos/testing/utils" + testutil "pkg.berachain.dev/polaris/cosmos/testutil" "pkg.berachain.dev/polaris/cosmos/x/evm/plugins/state" "pkg.berachain.dev/polaris/eth/common" coretypes "pkg.berachain.dev/polaris/eth/core/types" @@ -47,7 +49,7 @@ var _ = Describe("State Plugin", func() { var sp state.Plugin BeforeEach(func() { - ctx, ak, _, _ = testutil.SetupMinimalKeepers() + ctx, ak, _, _ = testutil.SetupMinimalKeepers(log.NewTestLogger(GinkgoT())) sp = state.NewPlugin(ak, testutil.EvmKey, &mockPLF{}) sp.Reset(ctx) }) @@ -63,7 +65,7 @@ var _ = Describe("State Plugin", func() { sp.SetCode(alice, []byte{1, 2, 3}) sp.SetState(alice, common.BytesToHash([]byte{1}), common.BytesToHash([]byte{2})) - sp.Reset(testutil.NewContext()) + sp.Reset(testutil.NewContext(log.NewTestLogger(GinkgoT()))) Expect(sp.Exist(alice)).To(BeFalse()) Expect(sp.GetBalance(alice)).To(Equal(new(big.Int)))