From 98001e374a530b5b5cc36eb66ca7a7490881a591 Mon Sep 17 00:00:00 2001 From: itsdevbear Date: Mon, 20 Nov 2023 16:44:38 -0500 Subject: [PATCH] bing bong --- build/scripts/main.mk | 6 +- .../bindings/testing/load_test_ops.abigen.go | 224 ++++++++++++++++++ contracts/gen.go | 1 + contracts/src/testing/LoadTestOps.sol | 23 ++ cosmos/config/mocks/app_options.go | 2 +- cosmos/runtime/txpool/mocks/geth_tx_pool.go | 2 +- cosmos/runtime/txpool/mocks/lifecycle.go | 2 +- cosmos/runtime/txpool/mocks/sdk_tx.go | 2 +- cosmos/runtime/txpool/mocks/subscription.go | 2 +- cosmos/runtime/txpool/mocks/tx_broadcaster.go | 2 +- cosmos/runtime/txpool/mocks/tx_serializer.go | 2 +- .../runtime/txpool/mocks/tx_sub_provider.go | 2 +- e2e/localnet/container/container.go | 30 +++ e2e/localnet/network/fixture.go | 19 ++ e2e/localnet/network/load_test.go | 93 ++++++++ e2e/localnet/network/node.go | 40 ++++ eth/core/state/journal/mocks/accesslist.go | 2 +- eth/core/state/journal/mocks/log.go | 2 +- eth/core/state/journal/mocks/refund.go | 2 +- .../mocks/self_destruct_state_plugin.go | 2 +- .../state/journal/mocks/self_destructs.go | 2 +- .../state/journal/mocks/transient_storage.go | 2 +- eth/core/state/mocks/plugin.go | 2 +- eth/core/state/mocks/polar_state_db.go | 2 +- eth/core/state/mocks/precompile_plugin.go | 2 +- 25 files changed, 452 insertions(+), 18 deletions(-) create mode 100644 contracts/bindings/testing/load_test_ops.abigen.go create mode 100644 contracts/src/testing/LoadTestOps.sol create mode 100644 e2e/localnet/network/load_test.go diff --git a/build/scripts/main.mk b/build/scripts/main.mk index 3e531d455..9c1d07028 100644 --- a/build/scripts/main.mk +++ b/build/scripts/main.mk @@ -122,7 +122,7 @@ endef ############################################################################### generate: - @$(MAKE) abigen-install moq-install mockery + @$(MAKE) rlpgen-install abigen-install moq-install mockery @for module in $(MODULES); do \ echo "Running go generate in $$module"; \ (cd $$module && go generate ./...) || exit 1; \ @@ -132,6 +132,10 @@ abigen-install: @echo "--> Installing abigen" @go install github.com/ethereum/go-ethereum/cmd/abigen@latest +rlpgen-install: + @echo "--> Installing rlpgen" + @go install github.com/ethereum/go-ethereum/rlp/rlpgen@latest + moq-install: @echo "--> Installing moq" @go install github.com/matryer/moq@latest diff --git a/contracts/bindings/testing/load_test_ops.abigen.go b/contracts/bindings/testing/load_test_ops.abigen.go new file mode 100644 index 000000000..6d1839058 --- /dev/null +++ b/contracts/bindings/testing/load_test_ops.abigen.go @@ -0,0 +1,224 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package testing + +import ( + "errors" + "math/big" + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// Reference imports to suppress errors if they are not otherwise used. +var ( + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = ethereum.NotFound + _ = bind.Bind + _ = common.Big1 + _ = types.BloomLookup + _ = event.NewSubscription + _ = abi.ConvertType +) + +// LoadTestOpsMetaData contains all meta data concerning the LoadTestOps contract. +var LoadTestOpsMetaData = &bind.MetaData{ + ABI: "[{\"inputs\":[],\"name\":\"loadData\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x608060405260015f553480156012575f80fd5b5060788061001f5f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c8063100b815d14602a575b5f80fd5b60306032565b005b60405160608152602081205f555056fea2646970667358221220d97583e2ab82a155b3ab643b1f9c4de9c067816ecf83449a8504450a69a6bd9964736f6c63430008160033", +} + +// LoadTestOpsABI is the input ABI used to generate the binding from. +// Deprecated: Use LoadTestOpsMetaData.ABI instead. +var LoadTestOpsABI = LoadTestOpsMetaData.ABI + +// LoadTestOpsBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use LoadTestOpsMetaData.Bin instead. +var LoadTestOpsBin = LoadTestOpsMetaData.Bin + +// DeployLoadTestOps deploys a new Ethereum contract, binding an instance of LoadTestOps to it. +func DeployLoadTestOps(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *LoadTestOps, error) { + parsed, err := LoadTestOpsMetaData.GetAbi() + if err != nil { + return common.Address{}, nil, nil, err + } + if parsed == nil { + return common.Address{}, nil, nil, errors.New("GetABI returned nil") + } + + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(LoadTestOpsBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &LoadTestOps{LoadTestOpsCaller: LoadTestOpsCaller{contract: contract}, LoadTestOpsTransactor: LoadTestOpsTransactor{contract: contract}, LoadTestOpsFilterer: LoadTestOpsFilterer{contract: contract}}, nil +} + +// LoadTestOps is an auto generated Go binding around an Ethereum contract. +type LoadTestOps struct { + LoadTestOpsCaller // Read-only binding to the contract + LoadTestOpsTransactor // Write-only binding to the contract + LoadTestOpsFilterer // Log filterer for contract events +} + +// LoadTestOpsCaller is an auto generated read-only Go binding around an Ethereum contract. +type LoadTestOpsCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// LoadTestOpsTransactor is an auto generated write-only Go binding around an Ethereum contract. +type LoadTestOpsTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// LoadTestOpsFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type LoadTestOpsFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// LoadTestOpsSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type LoadTestOpsSession struct { + Contract *LoadTestOps // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// LoadTestOpsCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type LoadTestOpsCallerSession struct { + Contract *LoadTestOpsCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// LoadTestOpsTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type LoadTestOpsTransactorSession struct { + Contract *LoadTestOpsTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// LoadTestOpsRaw is an auto generated low-level Go binding around an Ethereum contract. +type LoadTestOpsRaw struct { + Contract *LoadTestOps // Generic contract binding to access the raw methods on +} + +// LoadTestOpsCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type LoadTestOpsCallerRaw struct { + Contract *LoadTestOpsCaller // Generic read-only contract binding to access the raw methods on +} + +// LoadTestOpsTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type LoadTestOpsTransactorRaw struct { + Contract *LoadTestOpsTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewLoadTestOps creates a new instance of LoadTestOps, bound to a specific deployed contract. +func NewLoadTestOps(address common.Address, backend bind.ContractBackend) (*LoadTestOps, error) { + contract, err := bindLoadTestOps(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &LoadTestOps{LoadTestOpsCaller: LoadTestOpsCaller{contract: contract}, LoadTestOpsTransactor: LoadTestOpsTransactor{contract: contract}, LoadTestOpsFilterer: LoadTestOpsFilterer{contract: contract}}, nil +} + +// NewLoadTestOpsCaller creates a new read-only instance of LoadTestOps, bound to a specific deployed contract. +func NewLoadTestOpsCaller(address common.Address, caller bind.ContractCaller) (*LoadTestOpsCaller, error) { + contract, err := bindLoadTestOps(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &LoadTestOpsCaller{contract: contract}, nil +} + +// NewLoadTestOpsTransactor creates a new write-only instance of LoadTestOps, bound to a specific deployed contract. +func NewLoadTestOpsTransactor(address common.Address, transactor bind.ContractTransactor) (*LoadTestOpsTransactor, error) { + contract, err := bindLoadTestOps(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &LoadTestOpsTransactor{contract: contract}, nil +} + +// NewLoadTestOpsFilterer creates a new log filterer instance of LoadTestOps, bound to a specific deployed contract. +func NewLoadTestOpsFilterer(address common.Address, filterer bind.ContractFilterer) (*LoadTestOpsFilterer, error) { + contract, err := bindLoadTestOps(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &LoadTestOpsFilterer{contract: contract}, nil +} + +// bindLoadTestOps binds a generic wrapper to an already deployed contract. +func bindLoadTestOps(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := LoadTestOpsMetaData.GetAbi() + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_LoadTestOps *LoadTestOpsRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _LoadTestOps.Contract.LoadTestOpsCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_LoadTestOps *LoadTestOpsRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _LoadTestOps.Contract.LoadTestOpsTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_LoadTestOps *LoadTestOpsRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _LoadTestOps.Contract.LoadTestOpsTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_LoadTestOps *LoadTestOpsCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _LoadTestOps.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_LoadTestOps *LoadTestOpsTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _LoadTestOps.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_LoadTestOps *LoadTestOpsTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _LoadTestOps.Contract.contract.Transact(opts, method, params...) +} + +// LoadData is a paid mutator transaction binding the contract method 0x100b815d. +// +// Solidity: function loadData() returns() +func (_LoadTestOps *LoadTestOpsTransactor) LoadData(opts *bind.TransactOpts) (*types.Transaction, error) { + return _LoadTestOps.contract.Transact(opts, "loadData") +} + +// LoadData is a paid mutator transaction binding the contract method 0x100b815d. +// +// Solidity: function loadData() returns() +func (_LoadTestOps *LoadTestOpsSession) LoadData() (*types.Transaction, error) { + return _LoadTestOps.Contract.LoadData(&_LoadTestOps.TransactOpts) +} + +// LoadData is a paid mutator transaction binding the contract method 0x100b815d. +// +// Solidity: function loadData() returns() +func (_LoadTestOps *LoadTestOpsTransactorSession) LoadData() (*types.Transaction, error) { + return _LoadTestOps.Contract.LoadData(&_LoadTestOps.TransactOpts) +} diff --git a/contracts/gen.go b/contracts/gen.go index 7dd68bc5f..e601b061d 100644 --- a/contracts/gen.go +++ b/contracts/gen.go @@ -38,3 +38,4 @@ package contracts //go:generate abigen --pkg testing_governance --abi ./out/GovernanceWrapper.sol/GovernanceWrapper.abi.json --bin ./out/GovernanceWrapper.sol/GovernanceWrapper.bin --out ./bindings/testing/governance/governance_wrapper.abigen.go --type GovernanceWrapper //go:generate abigen --pkg testing --abi ./out/DistributionWrapper.sol/DistributionWrapper.abi.json --bin ./out/DistributionWrapper.sol/DistributionWrapper.bin --out ./bindings/testing/distribution_testing_helper.abigen.go --type DistributionWrapper //go:generate abigen --pkg testing --abi ./out/MockMethods.sol/MockMethods.abi.json --out ./bindings/testing/mock_methods.abigen.go --type MockMethods +//go:generate abigen --pkg testing --abi ./out/LoadTestOps.sol/LoadTestOps.abi.json --bin ./out/LoadTestOps.sol/LoadTestOps.bin --out ./bindings/testing/load_test_ops.abigen.go --type LoadTestOps diff --git a/contracts/src/testing/LoadTestOps.sol b/contracts/src/testing/LoadTestOps.sol new file mode 100644 index 000000000..fe4cc3ac8 --- /dev/null +++ b/contracts/src/testing/LoadTestOps.sol @@ -0,0 +1,23 @@ +pragma solidity 0.8.22; + +/** + * @title LoadTestOps + * @dev This contract is used to benchmark I/O and computation complex operations + */ +contract LoadTestOps { + uint256 private data = 1; + + /** + * @dev Loads data into memory and performs various operations + */ + function loadData() public { + assembly { + // mload + let m := mload(0x40) + // mstore + mstore(m, 0x60) + // sstore and keccak256 + sstore(data.slot, keccak256(m, 0x20)) + } + } +} diff --git a/cosmos/config/mocks/app_options.go b/cosmos/config/mocks/app_options.go index b86f949fd..e51fb5130 100644 --- a/cosmos/config/mocks/app_options.go +++ b/cosmos/config/mocks/app_options.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/geth_tx_pool.go b/cosmos/runtime/txpool/mocks/geth_tx_pool.go index 5112b1cc4..5f76fa8d0 100644 --- a/cosmos/runtime/txpool/mocks/geth_tx_pool.go +++ b/cosmos/runtime/txpool/mocks/geth_tx_pool.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/lifecycle.go b/cosmos/runtime/txpool/mocks/lifecycle.go index 2934c5ae0..3d96f731d 100644 --- a/cosmos/runtime/txpool/mocks/lifecycle.go +++ b/cosmos/runtime/txpool/mocks/lifecycle.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/sdk_tx.go b/cosmos/runtime/txpool/mocks/sdk_tx.go index 08c7226f4..6108c05c5 100644 --- a/cosmos/runtime/txpool/mocks/sdk_tx.go +++ b/cosmos/runtime/txpool/mocks/sdk_tx.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/subscription.go b/cosmos/runtime/txpool/mocks/subscription.go index 71c12a473..5642cd408 100644 --- a/cosmos/runtime/txpool/mocks/subscription.go +++ b/cosmos/runtime/txpool/mocks/subscription.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/tx_broadcaster.go b/cosmos/runtime/txpool/mocks/tx_broadcaster.go index 02e339974..30c06ef94 100644 --- a/cosmos/runtime/txpool/mocks/tx_broadcaster.go +++ b/cosmos/runtime/txpool/mocks/tx_broadcaster.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/tx_serializer.go b/cosmos/runtime/txpool/mocks/tx_serializer.go index 5da69d3fa..c6a9bffd1 100644 --- a/cosmos/runtime/txpool/mocks/tx_serializer.go +++ b/cosmos/runtime/txpool/mocks/tx_serializer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/cosmos/runtime/txpool/mocks/tx_sub_provider.go b/cosmos/runtime/txpool/mocks/tx_sub_provider.go index 995cd5a40..c427975bf 100644 --- a/cosmos/runtime/txpool/mocks/tx_sub_provider.go +++ b/cosmos/runtime/txpool/mocks/tx_sub_provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/e2e/localnet/container/container.go b/e2e/localnet/container/container.go index 26bae39e4..d3d3ddac9 100644 --- a/e2e/localnet/container/container.go +++ b/e2e/localnet/container/container.go @@ -52,6 +52,36 @@ type Client interface { GetContainerLogs() ([]byte, error) } +func NewNoopClient(endpoint string) Client { + return &noopClient{ + endpoint: endpoint, + } +} + +type noopClient struct { + endpoint string +} + +func (c *noopClient) Start() error { + return nil +} + +func (c *noopClient) Stop() error { + return nil +} + +func (c *noopClient) Remove() error { + return nil +} + +func (c *noopClient) GetEndpoint(string) string { + return c.endpoint +} + +func (c *noopClient) GetContainerLogs() ([]byte, error) { + return nil, nil +} + // client implements the Client interface using the dockertest library. type client struct { pool *dt.Pool // pool is a docker resource pool diff --git a/e2e/localnet/network/fixture.go b/e2e/localnet/network/fixture.go index 22d0b413f..7f5e077f7 100644 --- a/e2e/localnet/network/fixture.go +++ b/e2e/localnet/network/fixture.go @@ -127,6 +127,25 @@ func NewTestFixture(t ginkgo.FullGinkgoTInterface, config *FixtureConfig) *TestF return tf } +func NewRemoteTestFixture(t ginkgo.FullGinkgoTInterface, ethHTTPURL string) *TestFixture { + tf := &TestFixture{ + t: t, + keysMap: make(map[string]*ecdsa.PrivateKey), + } + + err := tf.setupTestAccounts(&FixtureConfig{}) + if err != nil { + t.Fatal(err) + } + + tf.ContainerizedNode, err = NewRemoteNode(ethHTTPURL, "") + if err != nil { + t.Fatal(err) + } + + return tf +} + func (tf *TestFixture) Teardown() error { if err := tf.Stop(); err != nil { return err diff --git a/e2e/localnet/network/load_test.go b/e2e/localnet/network/load_test.go new file mode 100644 index 000000000..654168aa9 --- /dev/null +++ b/e2e/localnet/network/load_test.go @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: MIT +// +// Copyright (c) 2023 Berachain Foundation +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + +package localnet_test + +import ( + "context" + "os" + + "github.com/berachain/polaris/contracts/bindings/testing" + localnet "github.com/berachain/polaris/e2e/localnet/network" + coretypes "github.com/berachain/polaris/eth/core/types" + + . "github.com/berachain/polaris/e2e/localnet/utils" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +var _ = Describe("evm load testing", func() { + var ( + tf *localnet.TestFixture + contract *testing.LoadTestOps + ) + + BeforeEach(func() { + if os.Getenv("REMOTE_NODE_URL") != "" { + tf = localnet.NewRemoteTestFixture(GinkgoT(), os.Getenv("REMOTE_NODE_URL")) + } else { + tf = localnet.NewTestFixture(GinkgoT(), localnet.NewFixtureConfig( + "../../../e2e/precompile/polard/config/", + "polard/base:v0.0.0", + "polard/localnet:v0.0.0", + "goodcontainer", + "8545/tcp", + "8546/tcp", + "1.21.3", + )) + Expect(tf).ToNot(BeNil()) + } + + // Check to make sure "alice" has balance to complete the test. + balance, err := tf.EthClient().BalanceAt(context.Background(), tf.Address("alice"), nil) + Expect(err).ToNot(HaveOccurred()) + Expect(*balance).To(BeNumerically(">", 0)) + + var tx *coretypes.Transaction + _, tx, contract, err = testing.DeployLoadTestOps( + tf.GenerateTransactOpts("alice"), tf.EthClient(), + ) + Expect(err).ToNot(HaveOccurred()) + ExpectSuccessReceipt(tf.EthClient(), tx) + }) + + AfterEach(func() { + // Dump logs and stop the containter here. + if !CurrentSpecReport().Failure.IsZero() { + logs, err := tf.DumpLogs() + Expect(err).ToNot(HaveOccurred()) + GinkgoWriter.Println(logs) + } + Expect(tf.Teardown()).To(Succeed()) + }) + + Context("evm load testing", func() { + It("should run a load test", func() { + tx, err := contract.LoadData(tf.GenerateTransactOpts("alice")) + Expect(err).ToNot(HaveOccurred()) + ExpectSuccessReceipt(tf.EthClient(), tx) + }) + }) +}) diff --git a/e2e/localnet/network/node.go b/e2e/localnet/network/node.go index 9633e9e51..952dde6b0 100644 --- a/e2e/localnet/network/node.go +++ b/e2e/localnet/network/node.go @@ -66,6 +66,46 @@ type containerizedNode struct { ethWsClient *ethclient.Client } +// NewRemoteNode creates an implementation of Localnet using a remote node. +// This node is not managed by the test fixture and thus will not be stopped +// started etc. +// +//nolint:nonamedreturns // deferred error handling. +func NewRemoteNode( + ethHTTPURL string, + ethWSURL string, +) (c ContainerizedNode, err error) { + // Create the containerized node object. + node := &containerizedNode{ + httpEndpoint: ethHTTPURL, + wsEndpoint: ethWSURL, + containerClient: container.NewNoopClient(ethHTTPURL), + } + + // Set up the http eth client. + node.ethClient, err = ethclient.Dial(node.httpEndpoint) + if err != nil { + return nil, err + } + + // Wait for the chain to start. + time.Sleep(nodeStartTime) + if err = node.WaitForNextBlock(); err != nil { + return nil, err + } + + // Set up the websocket eth client. + ws, err := gethrpc.DialWebsocket( + context.Background(), node.wsEndpoint, "*", + ) + if err != nil { + return nil, err + } + node.ethWsClient = ethclient.NewClient(ws) + + return node, nil +} + // NewContainerizedNode creates an implementation of Localnet using Docker. // //nolint:nonamedreturns // deferred error handling. diff --git a/eth/core/state/journal/mocks/accesslist.go b/eth/core/state/journal/mocks/accesslist.go index 60a998237..4afdfa097 100644 --- a/eth/core/state/journal/mocks/accesslist.go +++ b/eth/core/state/journal/mocks/accesslist.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/journal/mocks/log.go b/eth/core/state/journal/mocks/log.go index 8b9b082ec..971dfde64 100644 --- a/eth/core/state/journal/mocks/log.go +++ b/eth/core/state/journal/mocks/log.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/journal/mocks/refund.go b/eth/core/state/journal/mocks/refund.go index 48c543310..4bb93b5bb 100644 --- a/eth/core/state/journal/mocks/refund.go +++ b/eth/core/state/journal/mocks/refund.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/journal/mocks/self_destruct_state_plugin.go b/eth/core/state/journal/mocks/self_destruct_state_plugin.go index 9a52bdbbc..3979e9362 100644 --- a/eth/core/state/journal/mocks/self_destruct_state_plugin.go +++ b/eth/core/state/journal/mocks/self_destruct_state_plugin.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/journal/mocks/self_destructs.go b/eth/core/state/journal/mocks/self_destructs.go index bb60199a0..586085311 100644 --- a/eth/core/state/journal/mocks/self_destructs.go +++ b/eth/core/state/journal/mocks/self_destructs.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/journal/mocks/transient_storage.go b/eth/core/state/journal/mocks/transient_storage.go index c2c61edce..f7fe865ef 100644 --- a/eth/core/state/journal/mocks/transient_storage.go +++ b/eth/core/state/journal/mocks/transient_storage.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/mocks/plugin.go b/eth/core/state/mocks/plugin.go index f2b183535..95723bc66 100644 --- a/eth/core/state/mocks/plugin.go +++ b/eth/core/state/mocks/plugin.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/mocks/polar_state_db.go b/eth/core/state/mocks/polar_state_db.go index fe130a3d8..b85ed57e2 100644 --- a/eth/core/state/mocks/polar_state_db.go +++ b/eth/core/state/mocks/polar_state_db.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks diff --git a/eth/core/state/mocks/precompile_plugin.go b/eth/core/state/mocks/precompile_plugin.go index 79db521ac..2bd572d16 100644 --- a/eth/core/state/mocks/precompile_plugin.go +++ b/eth/core/state/mocks/precompile_plugin.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.36.1. DO NOT EDIT. +// Code generated by mockery v2.37.1. DO NOT EDIT. package mocks