diff --git a/Dockerfile b/Dockerfile index dc68ba89c1..b43c2ca501 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ WORKDIR /go/delivery/zeta-node # Copy module files and download dependencies COPY go.mod . COPY go.sum . + RUN go mod download # Copy the rest of the source code and build the application @@ -24,15 +25,23 @@ RUN make install # Run Stage FROM alpine:3.18 +ENV COSMOVISOR_CHECKSUM="626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc" +ENV COSMOVISOR_VERSION="v1.5.0" # Copy Start Script Helpers COPY contrib/docker-scripts/* /scripts/ # Install runtime dependencies -RUN apk --no-cache add git jq bash curl python3 libusb-dev linux-headers make build-base wget py3-pip qemu-img qemu-system-x86_64 && \ +RUN apk --no-cache add git jq bash curl nano vim tmux python3 libusb-dev linux-headers make build-base bind-tools psmisc coreutils wget py3-pip qemu-img qemu-system-x86_64 && \ pip install requests && \ chmod a+x -R /scripts && \ wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.31-r0/glibc-2.31-r0.apk && \ - apk add --force-overwrite --allow-untrusted glibc-2.31-r0.apk + apk add --force-overwrite --allow-untrusted glibc-2.31-r0.apk && \ + curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz && \ + mkdir -p /usr/local/gcloud && \ + tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz && \ + /usr/local/gcloud/google-cloud-sdk/install.sh --quiet && \ + ln -s /usr/local/gcloud/google-cloud-sdk/bin/gcloud /usr/bin/gcloud && \ + python /scripts/install_cosmovisor.py # Copy the binaries from the build stage COPY --from=builder /go/bin/zetaclientd /usr/local/bin/zetaclientd @@ -50,4 +59,4 @@ EXPOSE 8545 EXPOSE 8546 EXPOSE 9090 EXPOSE 26657 -EXPOSE 9091 +EXPOSE 9091 \ No newline at end of file diff --git a/Dockerfile-upgrade b/Dockerfile-upgrade index 065f8622f0..e53b766256 100644 --- a/Dockerfile-upgrade +++ b/Dockerfile-upgrade @@ -20,8 +20,8 @@ WORKDIR /go/delivery/zeta-node RUN mkdir -p $GOPATH/bin/old RUN mkdir -p $GOPATH/bin/new -ARG OLD_VERSION=v13.0.0 -ENV NEW_VERSION=v14 +ARG OLD_VERSION=v14.0.0 +ENV NEW_VERSION=v15 # Build new release from the current source COPY go.mod /go/delivery/zeta-node/ diff --git a/LOCAL_TESTING.md b/LOCAL_TESTING.md index 84087eaef2..e70e560b78 100644 --- a/LOCAL_TESTING.md +++ b/LOCAL_TESTING.md @@ -17,7 +17,6 @@ $ make zetanode This Makefile rule builds the zetanode image. **Rebuild if zetacored/zetaclientd code is updated**. ```bash -# in zeta-node/ $ docker build -t zetanode . ``` @@ -25,10 +24,19 @@ $ docker build -t zetanode . Now we have built all the docker images, we can run the e2e test with make command: ```bash -# in zeta-node/ make start-e2e-test ``` +#### Run admin functions e2e tests + +We define e2e tests allowing to test admin functionalities (emergency network pause for example). +Since these tests interact with the network functionalities, these can't be run concurrently with the regular e2e tests. +Moreover, these tests test scoped functionalities of the protocol, and won't be tested in the same pipeline as the regular e2e tests. +Therefore, we provide a separate command to run e2e admin functions tests: +```bash +make start-e2e-admin-test +``` + ### Run upgrade tests Upgrade tests run the E2E tests with an older version, upgrade the nodes to the new version, and run the E2E tests again. @@ -46,10 +54,15 @@ NOTE: We only specify the major version for `NEW_VERSION` since we use major ver The upgrade tests can be run with the following command: ```bash -# in zeta-node/ make start-upgrade-test ``` +The test the upgrade script faster a light version of the upgrade test can be run with the following command: +```bash +make start-upgrade-test-light +``` +This command will run the upgrade test with a lower height and will not populate the state. + ### Run stress tests Stress tests run the E2E tests with a larger number of nodes and clients to test the performance of the network. @@ -57,7 +70,6 @@ It also stresses the network by sending a large number of cross-chain transactio The stress tests can be run with the following command: ```bash -# in zeta-node/ make start-stress-test ``` @@ -68,7 +80,7 @@ If everything works fine, it should finish without panic. The logs can be observed with the following command: ```bash -# in zeta-node/contrib/localnet/orchestrator +# in node/contrib/localnet/orchestrator $ docker logs -f orchestrator ``` @@ -76,7 +88,6 @@ $ docker logs -f orchestrator To stop the tests, ```bash -# in zeta-node/ make stop-test ``` @@ -86,7 +97,6 @@ Before starting the monitoring setup, make sure the Zetacore API is up at http:/ You can also add any additional ETH addresses to monitor in `zeta-node/contrib/localnet/grafana/addresses.txt` file ```bash -# in zeta-node/ make start-monitoring ``` @@ -97,7 +107,6 @@ The Grafana default credentials are admin:admin. The dashboards are located at h ### Stop monitoring setup ```bash -# in zeta-node/ make stop-monitoring ``` @@ -108,7 +117,6 @@ In addition to running automated tests, you can also interact with the localnet The localnet can be started without running tests with the following command: ```bash -# in zeta-node/ make start-localnet ``` @@ -193,8 +201,8 @@ type E2ETestFunc func(*E2ERunner) The test can interact with the different networks using the runned object: ```go type E2ERunner struct { - ZevmClient *ethclient.Client - GoerliClient *ethclient.Client + ZEVMClient *ethclient.Client + EVMClient *ethclient.Client BtcRPCClient *rpcclient.Client CctxClient crosschaintypes.QueryClient @@ -204,8 +212,8 @@ type E2ERunner struct { ObserverClient observertypes.QueryClient ZetaTxServer txserver.ZetaTxServer - GoerliAuth *bind.TransactOpts - ZevmAuth *bind.TransactOpts + EVMAuth *bind.TransactOpts + ZEVMAuth *bind.TransactOpts // ... } diff --git a/Makefile b/Makefile index b888d22629..b5cf22b39f 100644 --- a/Makefile +++ b/Makefile @@ -192,20 +192,35 @@ install-zetae2e: go.sum @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetae2e .PHONY: install-zetae2e -start-e2e-test: +start-e2e-test: zetanode @echo "--> Starting e2e test" cd contrib/localnet/ && $(DOCKER) compose up -d +start-e2e-admin-test: zetanode + @echo "--> Starting e2e admin test" + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-admin.yml up -d + +start-e2e-performance-test: zetanode + @echo "--> Starting e2e performance test" + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-performance.yml up -d + start-stress-test: zetanode + @echo "--> Starting stress test" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stresstest.yml up -d start-upgrade-test: @echo "--> Starting upgrade test" - $(DOCKER) build --build-arg -t zetanode -f ./Dockerfile-upgrade . + $(DOCKER) build -t zetanode -f ./Dockerfile-upgrade . $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild . cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d -start-localnet: +start-upgrade-test-light: + @echo "--> Starting light upgrade test (no ZetaChain state populating before upgrade)" + $(DOCKER) build -t zetanode -f ./Dockerfile-upgrade . + $(DOCKER) build -t orchestrator -f contrib/localnet/orchestrator/Dockerfile.fastbuild . + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade-light.yml up -d + +start-localnet: zetanode @echo "--> Starting localnet" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-setup-only.yml up -d diff --git a/app/setup_handlers.go b/app/setup_handlers.go index b773745398..d9119ee8f6 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -5,10 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/types" - crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -const releaseVersion = "v14" +const releaseVersion = "v15" func SetupHandlers(app *App) { app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) { @@ -17,7 +18,7 @@ func SetupHandlers(app *App) { for m, mb := range app.mm.Modules { vm[m] = mb.ConsensusVersion() } - VersionMigrator{v: vm}.TriggerMigration(crosschaintypes.ModuleName) + VersionMigrator{v: vm}.TriggerMigration(observertypes.ModuleName) return app.mm.RunMigrations(ctx, app.configurator, vm) }) @@ -28,7 +29,7 @@ func SetupHandlers(app *App) { } if upgradeInfo.Name == releaseVersion && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ - // Added: []string{}, + Added: []string{authoritytypes.ModuleName}, } // Use upgrade store loader for the initial loading of all stores when app starts, // it checks if version == upgradeHeight and applies store upgrades before loading the stores, diff --git a/changelog.md b/changelog.md index 693b1fcd04..5d80c30e6c 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,10 @@ * [1783](https://github.com/zeta-chain/node/pull/1783) - refactor zetaclient metrics naming and structure * [1774](https://github.com/zeta-chain/node/pull/1774) - split params and config in zetaclient * [1831](https://github.com/zeta-chain/node/pull/1831) - removing unnecessary pointers in context structure +* [1864](https://github.com/zeta-chain/node/pull/1864) - prevent panic in param management +* [1848](https://github.com/zeta-chain/node/issues/1848) - create a method to observe deposits to tss address in one evm block +* [1885](https://github.com/zeta-chain/node/pull/1885) - change important metrics on port 8123 to be prometheus compatible +* [1863](https://github.com/zeta-chain/node/pull/1863) - remove duplicate ValidateChainParams function ### Features @@ -30,6 +34,11 @@ * [1787](https://github.com/zeta-chain/node/pull/1787) - add unit tests for cross-chain evm hooks and e2e test failed withdraw to BTC legacy address * [1840](https://github.com/zeta-chain/node/pull/1840) - fix code coverage test failures ignored in CI * [1870](https://github.com/zeta-chain/node/pull/1870) - enable emissions pool in local e2e testing +* [1868](https://github.com/zeta-chain/node/pull/1868) - run e2e btc tests locally +* [1851](https://github.com/zeta-chain/node/pull/1851) - rename usdt to erc20 in e2e tests +* [1872](https://github.com/zeta-chain/node/pull/1872) - remove usage of RPC in unit test +* [1805](https://github.com/zeta-chain/node/pull/1805) - add admin and performance test and fix upgrade test +* [1879](https://github.com/zeta-chain/node/pull/1879) - full coverage for messages in types packages ### Fixes @@ -39,6 +48,12 @@ * [1814](https://github.com/zeta-chain/node/pull/1814) - fix code coverage ignore for protobuf generated files +### CI + +* [1867](https://github.com/zeta-chain/node/pull/1867) - default restore_type for full node docker-compose to snapshot instead of statesync for reliability. +* [1891](https://github.com/zeta-chain/node/pull/1891) - fix typo that was introduced to docker-compose and a typo in start.sh for the docker start script for full nodes. +* [1894](https://github.com/zeta-chain/node/pull/1894) - added download binaries and configs to the start sequence so it will download binaries that don't exist + ## Version: v14 - [1817](https://github.com/zeta-chain/node/pull/1817) - Add migration script to fix pending and chain nonces on testnet @@ -88,7 +103,6 @@ * [1584](https://github.com/zeta-chain/node/pull/1584) - allow to run E2E tests on any networks * [1746](https://github.com/zeta-chain/node/pull/1746) - rename smoke tests to e2e tests * [1753](https://github.com/zeta-chain/node/pull/1753) - fix gosec errors on usage of rand package - * [1762](https://github.com/zeta-chain/node/pull/1762) - improve coverage for fungibile module * [1782](https://github.com/zeta-chain/node/pull/1782) - improve coverage for fungibile module system contract diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index 3816699c78..f402b26b4d 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -162,12 +162,15 @@ func start(_ *cobra.Command, _ []string) error { } } - metrics, err := metrics.NewMetrics() + m, err := metrics.NewMetrics() if err != nil { log.Error().Err(err).Msg("NewMetrics") return err } - metrics.Start() + m.Start() + + metrics.Info.WithLabelValues(common.Version).Set(1) + metrics.LastStartTime.SetToCurrentTime() var tssHistoricalList []observerTypes.TSS tssHistoricalList, err = zetaBridge.GetTssHistory() diff --git a/cmd/zetae2e/README.md b/cmd/zetae2e/README.md index c296d44057..c57863e7cf 100644 --- a/cmd/zetae2e/README.md +++ b/cmd/zetae2e/README.md @@ -43,7 +43,7 @@ contracts: zevm: system_contract: "0xEdf1c3275d13489aCdC6cD6eD246E72458B8795B" eth_zrc20: "0x13A0c5930C028511Dc02665E7285134B6d11A5f4" - usdt_zrc20: "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a" + erc20_zrc20: "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a" btc_zrc20: "0x65a45c57636f9BcCeD4fe193A602008578BcA90b" uniswap_factory: "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c" uniswap_router: "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" @@ -51,22 +51,20 @@ contracts: zeta_eth: "0x0000c304d2934c00db1d51995b9f6996affd17c0" connector_eth: "0x00005e3125aba53c5652f9f0ce1a4cf91d8b15ea" custody: "0x000047f11c6e42293f433c82473532e869ce4ec5" - usdt: "0x07865c6e87b9f70255377e024ace6630c1eaa37f" + erc20: "0x07865c6e87b9f70255377e024ace6630c1eaa37f" ``` ### Bitcoin setup Interaction with the Bitcoin node will require setting up a specific node tracking the address. It can be set locally following the guide [Using Bitcoin Docker Image for Local Development](https://www.notion.so/Using-Bitcoin-Docker-Image-for-Local-Development-bf7e84c58f22431fb52f17a471997e1f?pvs=21) -If an error occurs mention that wallets are not loaded. The following commands might need to be run in the Docker container: +If an error occurs mention that wallets are not loaded, this command can be run to set it up: ```go -docker exec -it bash - -bitcoin-cli -testnet -rpcuser=${bitcoin_username} -rpcpassword=${bitcoin_password} -named createwallet wallet_name=${WALLET_NAME} disable_private_keys=false load_on_startup=true -bitcoin-cli -testnet -rpcuser=${bitcoin_username} -rpcpassword=${bitcoin_password} importaddress "${WALLET_ADDRESS}" "${WALLET_NAME}" true -bitcoin-cli -testnet -rpcuser=${bitcoin_username} -rpcpassword=${bitcoin_password} importprivkey "your_private_key" "${WALLET_NAME}" false +zetae2e setup-bitcoin [config] ``` +Note: This command is intended for local testing only and won't work on live networks, where a node with an enabled wallet should already be set up. + ### Commands Show the balances of the accounts used on the different networks: @@ -126,9 +124,7 @@ contracts: One of the tests can be commented out in case only a deposit or a withdrawal is to be tested. Testing an ERC20 ZRC20 from an EVM chain -Testing ZRC20 requires the same config as for the gas tokens, but must include the `usdt` field that contains the address of the ERC20 on the evm chain and `usdt_zrc20` on ZetaChain. - -It is currently named USDT because it was the defacto ERC20 tested in local tests, this field will be renamed into a more generic name in the future +Testing ZRC20 requires the same config as for the gas tokens, but must include the `erc20` field that contains the address of the ERC20 on the evm chain and `erc20_zrc20` on ZetaChain. ```go zeta_chain_id @@ -142,9 +138,9 @@ rpcs: zetacore_rpc contracts: zevm: - usdt_zrc20 + erc20_zrc20 evm: - usdt + erc20 ``` ### Testing a ZRC20 from a Bitcoin chain diff --git a/cmd/zetae2e/config/clients.go b/cmd/zetae2e/config/clients.go index e85acd2dc3..e5d69ba4fe 100644 --- a/cmd/zetae2e/config/clients.go +++ b/cmd/zetae2e/config/clients.go @@ -35,7 +35,7 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get btc client: %w", err) } - goerliClient, goerliAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey) + evmClient, evmAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey) if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get evm client: %w", err) } @@ -48,8 +48,8 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get zevm client: %w", err) } return btcRPCClient, - goerliClient, - goerliAuth, + evmClient, + evmAuth, cctxClient, fungibleClient, authClient, @@ -80,12 +80,11 @@ func getBtcClient(rpcConf config.BitcoinRPC) (*rpcclient.Client, error) { HTTPPostMode: rpcConf.HTTPPostMode, DisableTLS: rpcConf.DisableTLS, Params: param, - //Endpoint: "/wallet/user", } return rpcclient.New(connCfg, nil) } -// getEVMClient get goerli client +// getEVMClient get evm client func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, *bind.TransactOpts, error) { evmClient, err := ethclient.Dial(rpc) if err != nil { diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index 2d0cd3fed0..2b2bdecc38 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -24,8 +24,8 @@ func RunnerFromConfig( ) (*runner.E2ERunner, error) { // initialize clients btcRPCClient, - goerliClient, - goerliAuth, + evmClient, + evmAuth, cctxClient, fungibleClient, authClient, @@ -56,7 +56,7 @@ func RunnerFromConfig( evmUserAddr, evmUserPrivKey, zetaUserMnemonic, - goerliClient, + evmClient, zevmClient, cctxClient, zetaTxServer, @@ -64,7 +64,7 @@ func RunnerFromConfig( authClient, bankClient, observerClient, - goerliAuth, + evmAuth, zevmAuth, btcRPCClient, logger, @@ -92,14 +92,16 @@ func ExportContractsFromRunner(r *runner.E2ERunner, conf config.Config) config.C conf.Contracts.EVM.ZetaEthAddress = r.ZetaEthAddr.Hex() conf.Contracts.EVM.ConnectorEthAddr = r.ConnectorEthAddr.Hex() conf.Contracts.EVM.CustodyAddr = r.ERC20CustodyAddr.Hex() - conf.Contracts.EVM.USDT = r.USDTERC20Addr.Hex() + conf.Contracts.EVM.ERC20 = r.ERC20Addr.Hex() conf.Contracts.ZEVM.SystemContractAddr = r.SystemContractAddr.Hex() conf.Contracts.ZEVM.ETHZRC20Addr = r.ETHZRC20Addr.Hex() - conf.Contracts.ZEVM.USDTZRC20Addr = r.USDTZRC20Addr.Hex() + conf.Contracts.ZEVM.ERC20ZRC20Addr = r.ERC20ZRC20Addr.Hex() conf.Contracts.ZEVM.BTCZRC20Addr = r.BTCZRC20Addr.Hex() conf.Contracts.ZEVM.UniswapFactoryAddr = r.UniswapV2FactoryAddr.Hex() conf.Contracts.ZEVM.UniswapRouterAddr = r.UniswapV2RouterAddr.Hex() + conf.Contracts.ZEVM.ConnectorZEVMAddr = r.ConnectorZEVMAddr.Hex() + conf.Contracts.ZEVM.WZetaAddr = r.WZetaAddr.Hex() conf.Contracts.ZEVM.ZEVMSwapAppAddr = r.ZEVMSwapAppAddr.Hex() conf.Contracts.ZEVM.ContextAppAddr = r.ContextAppAddr.Hex() conf.Contracts.ZEVM.TestDappAddr = r.TestDAppAddr.Hex() diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index 04cd24f9d2..2d456a8989 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -30,7 +30,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ZetaEthAddress: %s", c) } r.ZetaEthAddr = ethcommon.HexToAddress(c) - r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.GoerliClient) + r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.EVMClient) if err != nil { return err } @@ -40,7 +40,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ConnectorEthAddr: %s", c) } r.ConnectorEthAddr = ethcommon.HexToAddress(c) - r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.GoerliClient) + r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.EVMClient) if err != nil { return err } @@ -50,17 +50,17 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid CustodyAddr: %s", c) } r.ERC20CustodyAddr = ethcommon.HexToAddress(c) - r.ERC20Custody, err = erc20custody.NewERC20Custody(r.ERC20CustodyAddr, r.GoerliClient) + r.ERC20Custody, err = erc20custody.NewERC20Custody(r.ERC20CustodyAddr, r.EVMClient) if err != nil { return err } } - if c := conf.Contracts.EVM.USDT; c != "" { + if c := conf.Contracts.EVM.ERC20; c != "" { if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid USDT: %s", c) + return fmt.Errorf("invalid ERC20: %s", c) } - r.USDTERC20Addr = ethcommon.HexToAddress(c) - r.USDTERC20, err = erc20.NewUSDT(r.USDTERC20Addr, r.GoerliClient) + r.ERC20Addr = ethcommon.HexToAddress(c) + r.ERC20, err = erc20.NewERC20(r.ERC20Addr, r.EVMClient) if err != nil { return err } @@ -72,7 +72,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid SystemContractAddr: %s", c) } r.SystemContractAddr = ethcommon.HexToAddress(c) - r.SystemContract, err = systemcontract.NewSystemContract(r.SystemContractAddr, r.ZevmClient) + r.SystemContract, err = systemcontract.NewSystemContract(r.SystemContractAddr, r.ZEVMClient) if err != nil { return err } @@ -82,17 +82,17 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ETHZRC20Addr: %s", c) } r.ETHZRC20Addr = ethcommon.HexToAddress(c) - r.ETHZRC20, err = zrc20.NewZRC20(r.ETHZRC20Addr, r.ZevmClient) + r.ETHZRC20, err = zrc20.NewZRC20(r.ETHZRC20Addr, r.ZEVMClient) if err != nil { return err } } - if c := conf.Contracts.ZEVM.USDTZRC20Addr; c != "" { + if c := conf.Contracts.ZEVM.ERC20ZRC20Addr; c != "" { if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid USDTZRC20Addr: %s", c) + return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) } - r.USDTZRC20Addr = ethcommon.HexToAddress(c) - r.USDTZRC20, err = zrc20.NewZRC20(r.USDTZRC20Addr, r.ZevmClient) + r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) + r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -102,17 +102,17 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid BTCZRC20Addr: %s", c) } r.BTCZRC20Addr = ethcommon.HexToAddress(c) - r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZevmClient) + r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZEVMClient) if err != nil { return err } } - if c := conf.Contracts.ZEVM.USDTZRC20Addr; c != "" { + if c := conf.Contracts.ZEVM.ERC20ZRC20Addr; c != "" { if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid USDTZRC20Addr: %s", c) + return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) } - r.USDTZRC20Addr = ethcommon.HexToAddress(c) - r.USDTZRC20, err = zrc20.NewZRC20(r.USDTZRC20Addr, r.ZevmClient) + r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) + r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) if err != nil { return err } @@ -122,7 +122,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid UniswapFactoryAddr: %s", c) } r.UniswapV2FactoryAddr = ethcommon.HexToAddress(c) - r.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(r.UniswapV2FactoryAddr, r.ZevmClient) + r.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(r.UniswapV2FactoryAddr, r.ZEVMClient) if err != nil { return err } @@ -132,7 +132,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid UniswapRouterAddr: %s", c) } r.UniswapV2RouterAddr = ethcommon.HexToAddress(c) - r.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(r.UniswapV2RouterAddr, r.ZevmClient) + r.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(r.UniswapV2RouterAddr, r.ZEVMClient) if err != nil { return err } @@ -142,7 +142,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ConnectorZEVMAddr: %s", c) } r.ConnectorZEVMAddr = ethcommon.HexToAddress(c) - r.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(r.ConnectorZEVMAddr, r.ZevmClient) + r.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(r.ConnectorZEVMAddr, r.ZEVMClient) if err != nil { return err } @@ -152,7 +152,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid WZetaAddr: %s", c) } r.WZetaAddr = ethcommon.HexToAddress(c) - r.WZeta, err = wzeta.NewWETH9(r.WZetaAddr, r.ZevmClient) + r.WZeta, err = wzeta.NewWETH9(r.WZetaAddr, r.ZEVMClient) if err != nil { return err } @@ -162,7 +162,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ZEVMSwapAppAddr: %s", c) } r.ZEVMSwapAppAddr = ethcommon.HexToAddress(c) - r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZevmClient) + r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZEVMClient) if err != nil { return err } @@ -172,7 +172,7 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { return fmt.Errorf("invalid ContextAppAddr: %s", c) } r.ContextAppAddr = ethcommon.HexToAddress(c) - r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZevmClient) + r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZEVMClient) if err != nil { return err } diff --git a/cmd/zetae2e/config/example.yml b/cmd/zetae2e/config/example.yml index 4381834a7f..be692b9d4c 100644 --- a/cmd/zetae2e/config/example.yml +++ b/cmd/zetae2e/config/example.yml @@ -18,7 +18,7 @@ contracts: zevm: system_contract: "0xEdf1c3275d13489aCdC6cD6eD246E72458B8795B" eth_zrc20: "0x13A0c5930C028511Dc02665E7285134B6d11A5f4" - usdt_zrc20: "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a" + erc20_zrc20: "0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a" btc_zrc20: "0x65a45c57636f9BcCeD4fe193A602008578BcA90b" uniswap_factory: "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c" uniswap_router: "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" @@ -26,5 +26,5 @@ contracts: zeta_eth: "0x0000c304d2934c00db1d51995b9f6996affd17c0" connector_eth: "0x00005e3125aba53c5652f9f0ce1a4cf91d8b15ea" custody: "0x000047f11c6e42293f433c82473532e869ce4ec5" - usdt: "0x07865c6e87b9f70255377e024ace6630c1eaa37f" + erc20: "0x07865c6e87b9f70255377e024ace6630c1eaa37f" diff --git a/cmd/zetae2e/config/local.yml b/cmd/zetae2e/config/local.yml index 5c02747766..ae2638ace7 100644 --- a/cmd/zetae2e/config/local.yml +++ b/cmd/zetae2e/config/local.yml @@ -7,7 +7,7 @@ rpcs: evm: "http://0.0.0.0:8545" bitcoin: host: "0.0.0.0:18443" - user: "e2e" + user: "smoketest" pass: "123" http_post_mode: true disable_tls: true @@ -18,7 +18,7 @@ contracts: zevm: system_contract: "0x91d18e54DAf4F677cB28167158d6dd21F6aB3921" eth_zrc20: "0x13A0c5930C028511Dc02665E7285134B6d11A5f4" - usdt_zrc20: "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb" + erc20_zrc20: "0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb" btc_zrc20: "0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891" uniswap_factory: "0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c" uniswap_router: "0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe" @@ -28,4 +28,4 @@ contracts: zeta_eth: "0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9" connector_eth: "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca" custody: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a" - usdt: "0xbD1e64A22B9F92D9Ce81aA9B4b0fFacd80215564" \ No newline at end of file + erc20: "0xbD1e64A22B9F92D9Ce81aA9B4b0fFacd80215564" \ No newline at end of file diff --git a/cmd/zetae2e/local/admin.go b/cmd/zetae2e/local/admin.go index 7db44c4453..50c8b2b8f7 100644 --- a/cmd/zetae2e/local/admin.go +++ b/cmd/zetae2e/local/admin.go @@ -17,6 +17,7 @@ func adminTestRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -48,9 +49,9 @@ func adminTestRoutine( // funding the account txZetaSend := deployerRunner.SendZetaOnEvm(UserAdminAddress, 1000) - txUSDTSend := deployerRunner.SendUSDTOnEvm(UserAdminAddress, 1000) + txERC20Send := deployerRunner.SendERC20OnEvm(UserAdminAddress, 1000) adminRunner.WaitForTxReceiptOnEvm(txZetaSend) - adminRunner.WaitForTxReceiptOnEvm(txUSDTSend) + adminRunner.WaitForTxReceiptOnEvm(txERC20Send) // depositing the necessary tokens on ZetaChain txZetaDeposit := adminRunner.DepositZeta() @@ -63,9 +64,7 @@ func adminTestRoutine( // run erc20 advanced test testsToRun, err := adminRunner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - e2etests.TestPauseZRC20Name, - e2etests.TestUpdateBytecodeName, - e2etests.TestDepositEtherLiquidityCapName, + testNames..., ) if err != nil { return fmt.Errorf("admin tests failed: %v", err) diff --git a/cmd/zetae2e/local/bitcoin.go b/cmd/zetae2e/local/bitcoin.go index 6da863d26a..e7470518a9 100644 --- a/cmd/zetae2e/local/bitcoin.go +++ b/cmd/zetae2e/local/bitcoin.go @@ -17,6 +17,8 @@ func bitcoinTestRoutine( deployerRunner *runner.E2ERunner, verbose bool, initBitcoinNetwork bool, + testHeader bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -48,8 +50,8 @@ func bitcoinTestRoutine( startTime := time.Now() // funding the account - txUSDTSend := deployerRunner.SendUSDTOnEvm(UserBitcoinAddress, 1000) - bitcoinRunner.WaitForTxReceiptOnEvm(txUSDTSend) + txERC20Send := deployerRunner.SendERC20OnEvm(UserBitcoinAddress, 1000) + bitcoinRunner.WaitForTxReceiptOnEvm(txERC20Send) // depositing the necessary tokens on ZetaChain txEtherDeposit := bitcoinRunner.DepositEther(false) @@ -59,18 +61,14 @@ func bitcoinTestRoutine( bitcoinRunner.WaitForMinedCCTX(txERC20Deposit) bitcoinRunner.SetupBitcoinAccount(initBitcoinNetwork) - bitcoinRunner.DepositBTC(true) + bitcoinRunner.DepositBTC(testHeader) // run bitcoin test // Note: due to the extensive block generation in Bitcoin localnet, block header test is run first // to make it faster to catch up with the latest block header testsToRun, err := bitcoinRunner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - e2etests.TestBitcoinWithdrawInvalidAddressName, - e2etests.TestBitcoinWithdrawName, - e2etests.TestZetaWithdrawBTCRevertName, - e2etests.TestCrosschainSwapName, - e2etests.TestBitcoinWithdrawRestrictedName, + testNames..., ) if err != nil { return fmt.Errorf("bitcoin tests failed: %v", err) diff --git a/cmd/zetae2e/local/erc20.go b/cmd/zetae2e/local/erc20.go index c8eb63163f..a453770842 100644 --- a/cmd/zetae2e/local/erc20.go +++ b/cmd/zetae2e/local/erc20.go @@ -16,6 +16,7 @@ func erc20TestRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -47,8 +48,8 @@ func erc20TestRoutine( startTime := time.Now() // funding the account - txUSDTSend := deployerRunner.SendUSDTOnEvm(UserERC20Address, 10) - erc20Runner.WaitForTxReceiptOnEvm(txUSDTSend) + txERC20Send := deployerRunner.SendERC20OnEvm(UserERC20Address, 10) + erc20Runner.WaitForTxReceiptOnEvm(txERC20Send) // depositing the necessary tokens on ZetaChain txEtherDeposit := erc20Runner.DepositEther(false) @@ -56,17 +57,10 @@ func erc20TestRoutine( erc20Runner.WaitForMinedCCTX(txEtherDeposit) erc20Runner.WaitForMinedCCTX(txERC20Deposit) - //erc20Runner.SetupBitcoinAccount() - //erc20Runner.DepositBTC() - // run erc20 test testsToRun, err := erc20Runner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - e2etests.TestERC20WithdrawName, - e2etests.TestMultipleWithdrawsName, - e2etests.TestERC20DepositAndCallRefundName, - e2etests.TestZRC20SwapName, - e2etests.TestERC20DepositRestrictedName, + testNames..., ) if err != nil { return fmt.Errorf("erc20 tests failed: %v", err) diff --git a/cmd/zetae2e/local/ethereum.go b/cmd/zetae2e/local/ethereum.go index 72fe03fe2c..d5745472bd 100644 --- a/cmd/zetae2e/local/ethereum.go +++ b/cmd/zetae2e/local/ethereum.go @@ -16,6 +16,8 @@ func ethereumTestRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, + testHeader bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -47,7 +49,7 @@ func ethereumTestRoutine( startTime := time.Now() // depositing the necessary tokens on ZetaChain - txEtherDeposit := ethereumRunner.DepositEther(true) + txEtherDeposit := ethereumRunner.DepositEther(testHeader) ethereumRunner.WaitForMinedCCTX(txEtherDeposit) // run ethereum test @@ -55,11 +57,7 @@ func ethereumTestRoutine( // to make it faster to catch up with the latest block header testsToRun, err := ethereumRunner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - e2etests.TestEtherWithdrawName, - e2etests.TestContextUpgradeName, - e2etests.TestEtherDepositAndCallName, - e2etests.TestDepositAndCallRefundName, - e2etests.TestEtherWithdrawRestrictedName, + testNames..., ) if err != nil { return fmt.Errorf("ethereum tests failed: %v", err) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index a1382b716e..3d1addee1e 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -10,6 +10,7 @@ import ( "github.com/spf13/cobra" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" "github.com/zeta-chain/zetacore/e2e/config" + "github.com/zeta-chain/zetacore/e2e/e2etests" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" "golang.org/x/sync/errgroup" @@ -19,13 +20,16 @@ const ( flagContractsDeployed = "deployed" flagWaitForHeight = "wait-for" FlagConfigFile = "config" + flagConfigOut = "config-out" flagVerbose = "verbose" flagTestAdmin = "test-admin" + flagTestPerformance = "test-performance" flagTestCustom = "test-custom" flagSkipRegular = "skip-regular" + flagLight = "light" flagSetupOnly = "setup-only" - flagConfigOut = "config-out" flagSkipSetup = "skip-setup" + flagSkipBitcoinSetup = "skip-bitcoin-setup" ) var ( @@ -50,6 +54,7 @@ func NewLocalCmd() *cobra.Command { cmd.Flags().Bool(flagSetupOnly, false, "set to true to only setup the networks") cmd.Flags().String(flagConfigOut, "", "config file to write the deployed contracts from the setup") cmd.Flags().Bool(flagSkipSetup, false, "set to true to skip setup") + cmd.Flags().Bool(flagSkipBitcoinSetup, false, "set to true to skip bitcoin wallet setup") return cmd } @@ -68,11 +73,18 @@ func localE2ETest(cmd *cobra.Command, _ []string) { if err != nil { panic(err) } - logger := runner.NewLogger(verbose, color.FgWhite, "setup") + configOut, err := cmd.Flags().GetString(flagConfigOut) + if err != nil { + panic(err) + } testAdmin, err := cmd.Flags().GetBool(flagTestAdmin) if err != nil { panic(err) } + testPerformance, err := cmd.Flags().GetBool(flagTestPerformance) + if err != nil { + panic(err) + } testCustom, err := cmd.Flags().GetBool(flagTestCustom) if err != nil { panic(err) @@ -81,11 +93,11 @@ func localE2ETest(cmd *cobra.Command, _ []string) { if err != nil { panic(err) } - setupOnly, err := cmd.Flags().GetBool(flagSetupOnly) + light, err := cmd.Flags().GetBool(flagLight) if err != nil { panic(err) } - configOut, err := cmd.Flags().GetString(flagConfigOut) + setupOnly, err := cmd.Flags().GetBool(flagSetupOnly) if err != nil { panic(err) } @@ -93,6 +105,12 @@ func localE2ETest(cmd *cobra.Command, _ []string) { if err != nil { panic(err) } + skipBitcoinSetup, err := cmd.Flags().GetBool(flagSkipBitcoinSetup) + if err != nil { + panic(err) + } + + logger := runner.NewLogger(verbose, color.FgWhite, "setup") testStartTime := time.Now() logger.Print("starting E2E tests") @@ -101,6 +119,11 @@ func localE2ETest(cmd *cobra.Command, _ []string) { logger.Print("⚠️ admin tests enabled") } + if testPerformance { + logger.Print("⚠️ performance tests enabled, regular tests will be skipped") + skipRegular = true + } + // start timer go func() { time.Sleep(TestTimeout) @@ -126,7 +149,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { setCosmosConfig() // wait for Genesis - // if setup is skipp, we assume that the genesis is already created + // if setup is skip, we assume that the genesis is already created if !skipSetup { logger.Print("⏳ wait 70s for genesis") time.Sleep(70 * time.Second) @@ -173,7 +196,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) { panic(err) } - deployerRunner.MintUSDTOnEvm(10000) + deployerRunner.MintERC20OnEvm(10000) + logger.Print("✅ setup completed in %s", time.Since(startTime)) } @@ -204,16 +228,69 @@ func localE2ETest(cmd *cobra.Command, _ []string) { // run tests var eg errgroup.Group if !skipRegular { - eg.Go(erc20TestRoutine(conf, deployerRunner, verbose)) - eg.Go(zetaTestRoutine(conf, deployerRunner, verbose)) - eg.Go(bitcoinTestRoutine(conf, deployerRunner, verbose, !skipSetup)) - eg.Go(ethereumTestRoutine(conf, deployerRunner, verbose)) + // defines all tests, if light is enabled, only the most basic tests are run + erc20Tests := []string{ + e2etests.TestERC20WithdrawName, + e2etests.TestMultipleWithdrawsName, + e2etests.TestERC20DepositAndCallRefundName, + e2etests.TestZRC20SwapName, + } + erc20AdvancedTests := []string{ + e2etests.TestERC20DepositRestrictedName, + } + zetaTests := []string{ + e2etests.TestZetaWithdrawName, + e2etests.TestMessagePassingName, + e2etests.TestMessagePassingRevertFailName, + e2etests.TestMessagePassingRevertSuccessName, + } + zetaAdvancedTests := []string{ + e2etests.TestZetaDepositRestrictedName, + } + bitcoinTests := []string{ + e2etests.TestBitcoinWithdrawName, + e2etests.TestBitcoinWithdrawInvalidAddressName, + e2etests.TestZetaWithdrawBTCRevertName, + e2etests.TestCrosschainSwapName, + } + bitcoinAdvancedTests := []string{ + e2etests.TestBitcoinWithdrawRestrictedName, + } + ethereumTests := []string{ + e2etests.TestEtherWithdrawName, + e2etests.TestContextUpgradeName, + e2etests.TestEtherDepositAndCallName, + e2etests.TestDepositAndCallRefundName, + } + ethereumAdvancedTests := []string{ + e2etests.TestEtherWithdrawRestrictedName, + } + + if !light { + erc20Tests = append(erc20Tests, erc20AdvancedTests...) + zetaTests = append(zetaTests, zetaAdvancedTests...) + bitcoinTests = append(bitcoinTests, bitcoinAdvancedTests...) + ethereumTests = append(ethereumTests, ethereumAdvancedTests...) + } + + eg.Go(erc20TestRoutine(conf, deployerRunner, verbose, erc20Tests...)) + eg.Go(zetaTestRoutine(conf, deployerRunner, verbose, zetaTests...)) + eg.Go(bitcoinTestRoutine(conf, deployerRunner, verbose, !skipBitcoinSetup, !light, bitcoinTests...)) + eg.Go(ethereumTestRoutine(conf, deployerRunner, verbose, !light, ethereumTests...)) } if testAdmin { - eg.Go(adminTestRoutine(conf, deployerRunner, verbose)) + eg.Go(adminTestRoutine(conf, deployerRunner, verbose, + e2etests.TestPauseZRC20Name, + e2etests.TestUpdateBytecodeName, + e2etests.TestDepositEtherLiquidityCapName, + )) + } + if testPerformance { + eg.Go(ethereumDepositPerformanceRoutine(conf, deployerRunner, verbose, e2etests.TestStressEtherDepositName)) + eg.Go(ethereumWithdrawPerformanceRoutine(conf, deployerRunner, verbose, e2etests.TestStressEtherWithdrawName)) } if testCustom { - eg.Go(miscTestRoutine(conf, deployerRunner, verbose)) + eg.Go(miscTestRoutine(conf, deployerRunner, verbose, e2etests.TestMyTestName)) } if err := eg.Wait(); err != nil { diff --git a/cmd/zetae2e/local/misc.go b/cmd/zetae2e/local/misc.go index b3f2b90e4b..bc5240e571 100644 --- a/cmd/zetae2e/local/misc.go +++ b/cmd/zetae2e/local/misc.go @@ -17,6 +17,7 @@ func miscTestRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -58,8 +59,7 @@ func miscTestRoutine( // run misc test testsToRun, err := miscRunner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - //e2etests.TestBlockHeadersName, - e2etests.TestMyTestName, + testNames..., ) if err != nil { return fmt.Errorf("misc tests failed: %v", err) diff --git a/cmd/zetae2e/local/performance.go b/cmd/zetae2e/local/performance.go new file mode 100644 index 0000000000..0c15e799db --- /dev/null +++ b/cmd/zetae2e/local/performance.go @@ -0,0 +1,127 @@ +package local + +// performance.go provides routines that run the stress tests for different actions (deposit, withdraw) to measure network performance +// Note: the routine provided here should not be used concurrently with other routines as these reuse the accounts of other routines + +import ( + "fmt" + "runtime" + "time" + + "github.com/fatih/color" + "github.com/zeta-chain/zetacore/e2e/config" + "github.com/zeta-chain/zetacore/e2e/e2etests" + "github.com/zeta-chain/zetacore/e2e/runner" +) + +// ethereumDepositPerformanceRoutine runs performance tests for Ether deposit +func ethereumDepositPerformanceRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + // return an error on panic + // TODO: remove and instead return errors in the tests + // https://github.com/zeta-chain/node/issues/1500 + defer func() { + if r := recover(); r != nil { + // print stack trace + stack := make([]byte, 4096) + n := runtime.Stack(stack, false) + err = fmt.Errorf("ethereum deposit perf panic: %v, stack trace %s", r, stack[:n]) + } + }() + + // initialize runner for ether test + r, err := initTestRunner( + "ether", + conf, + deployerRunner, + UserERC20Address, + UserERC20PrivateKey, + runner.NewLogger(verbose, color.FgHiMagenta, "perf_eth_deposit"), + ) + if err != nil { + return err + } + + r.Logger.Print("🏃 starting Ethereum deposit performance tests") + startTime := time.Now() + + tests, err := r.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("ethereum deposit performance test failed: %v", err) + } + + if err := r.RunE2ETests(tests); err != nil { + return fmt.Errorf("misc tests failed: %v", err) + } + + r.Logger.Print("🍾 Ethereum deposit performance test completed in %s", time.Since(startTime).String()) + + return err + } +} + +// ethereumWithdrawPerformanceRoutine runs performance tests for Ether withdraw +func ethereumWithdrawPerformanceRoutine( + conf config.Config, + deployerRunner *runner.E2ERunner, + verbose bool, + testNames ...string, +) func() error { + return func() (err error) { + // return an error on panic + // TODO: remove and instead return errors in the tests + // https://github.com/zeta-chain/node/issues/1500 + defer func() { + if r := recover(); r != nil { + // print stack trace + stack := make([]byte, 4096) + n := runtime.Stack(stack, false) + err = fmt.Errorf("ethereum withdraw perf panic: %v, stack trace %s", r, stack[:n]) + } + }() + + // initialize runner for ether test + r, err := initTestRunner( + "ether", + conf, + deployerRunner, + UserEtherAddress, + UserEtherPrivateKey, + runner.NewLogger(verbose, color.FgHiBlue, "perf_eth_withdraw"), + ) + if err != nil { + return err + } + + r.Logger.Print("🏃 starting Ethereum withdraw performance tests") + startTime := time.Now() + + // depositing the necessary tokens on ZetaChain + txEtherDeposit := r.DepositEther(false) + r.WaitForMinedCCTX(txEtherDeposit) + + tests, err := r.GetE2ETestsToRunByName( + e2etests.AllE2ETests, + testNames..., + ) + if err != nil { + return fmt.Errorf("ethereum withdraw performance test failed: %v", err) + } + + if err := r.RunE2ETests(tests); err != nil { + return fmt.Errorf("misc tests failed: %v", err) + } + + r.Logger.Print("🍾 Ethereum withdraw performance test completed in %s", time.Since(startTime).String()) + + return err + } +} diff --git a/cmd/zetae2e/local/zeta.go b/cmd/zetae2e/local/zeta.go index 13ff2bfbab..a24ee3872e 100644 --- a/cmd/zetae2e/local/zeta.go +++ b/cmd/zetae2e/local/zeta.go @@ -16,6 +16,7 @@ func zetaTestRoutine( conf config.Config, deployerRunner *runner.E2ERunner, verbose bool, + testNames ...string, ) func() error { return func() (err error) { // return an error on panic @@ -59,11 +60,7 @@ func zetaTestRoutine( // run zeta test testsToRun, err := zetaRunner.GetE2ETestsToRunByName( e2etests.AllE2ETests, - e2etests.TestZetaWithdrawName, - e2etests.TestMessagePassingName, - e2etests.TestMessagePassingRevertFailName, - e2etests.TestMessagePassingRevertSuccessName, - e2etests.TestZetaDepositRestrictedName, + testNames..., ) if err != nil { return fmt.Errorf("zeta tests failed: %v", err) diff --git a/cmd/zetae2e/root.go b/cmd/zetae2e/root.go index ba82430a45..4568358512 100644 --- a/cmd/zetae2e/root.go +++ b/cmd/zetae2e/root.go @@ -27,6 +27,7 @@ func NewRootCmd() *cobra.Command { local.NewLocalCmd(), NewStressTestCmd(), NewInitCmd(), + NewSetupBitcoinCmd(), ) return cmd diff --git a/cmd/zetae2e/setup_bitcoin.go b/cmd/zetae2e/setup_bitcoin.go new file mode 100644 index 0000000000..4de6b0685d --- /dev/null +++ b/cmd/zetae2e/setup_bitcoin.go @@ -0,0 +1,77 @@ +package main + +import ( + "context" + "errors" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/fatih/color" + "github.com/spf13/cobra" + "github.com/zeta-chain/zetacore/app" + zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/e2e/config" + "github.com/zeta-chain/zetacore/e2e/runner" + "github.com/zeta-chain/zetacore/e2e/utils" +) + +// NewSetupBitcoinCmd sets up bitcoin wallet for e2e tests +// should be run in case bitcoin e2e tests return load wallet errors +func NewSetupBitcoinCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "setup-bitcoin [config-file] ", + Short: "Setup Bitcoin wallet for e2e tests", + RunE: runSetupBitcoin, + Args: cobra.ExactArgs(1), + } + return cmd +} + +func runSetupBitcoin(_ *cobra.Command, args []string) error { + // read the config file + conf, err := config.ReadConfig(args[0]) + if err != nil { + return err + } + + // initialize logger + logger := runner.NewLogger(false, color.FgHiYellow, "") + + // set config + app.SetConfig() + + // initialize context + ctx, cancel := context.WithCancel(context.Background()) + + // get EVM address from config + evmAddr := conf.Accounts.EVMAddress + if !ethcommon.IsHexAddress(evmAddr) { + cancel() + return errors.New("invalid EVM address") + } + // initialize deployer runner with config + r, err := zetae2econfig.RunnerFromConfig( + ctx, + "e2e", + cancel, + conf, + ethcommon.HexToAddress(evmAddr), + conf.Accounts.EVMPrivKey, + utils.FungibleAdminName, // placeholder value, not used + FungibleAdminMnemonic, // placeholder value, not used + logger, + ) + if err != nil { + cancel() + return err + } + + if err := r.SetTSSAddresses(); err != nil { + return err + } + + r.SetupBitcoinAccount(true) + + logger.Print("* BTC setup done") + + return nil +} diff --git a/cmd/zetae2e/stress.go b/cmd/zetae2e/stress.go index 86703ef94b..b85d0e78d7 100644 --- a/cmd/zetae2e/stress.go +++ b/cmd/zetae2e/stress.go @@ -89,12 +89,12 @@ func StressTest(cmd *cobra.Command, _ []string) { } // Initialize clients ---------------------------------------------------------------- - goerliClient, err := ethclient.Dial(conf.RPCs.EVM) + evmClient, err := ethclient.Dial(conf.RPCs.EVM) if err != nil { panic(err) } - bal, err := goerliClient.BalanceAt(context.TODO(), local.DeployerAddress, nil) + bal, err := evmClient.BalanceAt(context.TODO(), local.DeployerAddress, nil) if err != nil { panic(err) } @@ -171,7 +171,7 @@ func StressTest(cmd *cobra.Command, _ []string) { panic(err) } e2eTest.ETHZRC20Addr = ethZRC20Addr - e2eTest.ETHZRC20, err = zrc20.NewZRC20(e2eTest.ETHZRC20Addr, e2eTest.ZevmClient) + e2eTest.ETHZRC20, err = zrc20.NewZRC20(e2eTest.ETHZRC20Addr, e2eTest.ZEVMClient) if err != nil { panic(err) } @@ -190,21 +190,21 @@ func StressTest(cmd *cobra.Command, _ []string) { //Pre-approve ETH withdraw on ZEVM fmt.Printf("approving ETH ZRC20...\n") ethZRC20 := e2eTest.ETHZRC20 - tx, err := ethZRC20.Approve(e2eTest.ZevmAuth, e2eTest.ETHZRC20Addr, big.NewInt(1e18)) + tx, err := ethZRC20.Approve(e2eTest.ZEVMAuth, e2eTest.ETHZRC20Addr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(ctx, e2eTest.ZevmClient, tx, logger, e2eTest.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(ctx, e2eTest.ZEVMClient, tx, logger, e2eTest.ReceiptTimeout) fmt.Printf("eth zrc20 approve receipt: status %d\n", receipt.Status) // Get current nonce on zevm for DeployerAddress - Need to keep track of nonce at client level - blockNum, err := e2eTest.ZevmClient.BlockNumber(context.Background()) + blockNum, err := e2eTest.ZEVMClient.BlockNumber(context.Background()) if err != nil { panic(err) } // #nosec G701 e2eTest - always in range - nonce, err := e2eTest.ZevmClient.NonceAt(context.Background(), local.DeployerAddress, big.NewInt(int64(blockNum))) + nonce, err := e2eTest.ZEVMClient.NonceAt(context.Background(), local.DeployerAddress, big.NewInt(int64(blockNum))) if err != nil { panic(err) } @@ -215,17 +215,17 @@ func StressTest(cmd *cobra.Command, _ []string) { // -------------- TEST BEGINS ------------------ fmt.Println("**** STRESS TEST BEGINS ****") - fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM - goerli") + fmt.Println(" 1. Periodically Withdraw ETH from ZEVM to EVM") fmt.Println(" 2. Display Network metrics to monitor performance [Num Pending outbound tx], [Num Trackers]") e2eTest.WG.Add(2) - go WithdrawCCtx(e2eTest) // Withdraw USDT from ZEVM to EVM - goerli + go WithdrawCCtx(e2eTest) // Withdraw from ZEVM to EVM go EchoNetworkMetrics(e2eTest) // Display Network metrics periodically to monitor performance e2eTest.WG.Wait() } -// WithdrawCCtx withdraw USDT from ZEVM to EVM +// WithdrawCCtx withdraw ETHZRC20 from ZEVM to EVM func WithdrawCCtx(runner *runner.E2ERunner) { ticker := time.NewTicker(time.Millisecond * time.Duration(stressTestArgs.txnInterval)) for { @@ -242,7 +242,7 @@ func EchoNetworkMetrics(runner *runner.E2ERunner) { var numTicks = 0 var totalMinedTxns = uint64(0) var previousMinedTxns = uint64(0) - chainID, err := getChainID(runner.GoerliClient) + chainID, err := getChainID(runner.EVMClient) if err != nil { panic(err) @@ -306,8 +306,8 @@ func WithdrawETHZRC20(runner *runner.E2ERunner) { ethZRC20 := runner.ETHZRC20 - runner.ZevmAuth.Nonce = zevmNonce - _, err := ethZRC20.Withdraw(runner.ZevmAuth, local.DeployerAddress.Bytes(), big.NewInt(100)) + runner.ZEVMAuth.Nonce = zevmNonce + _, err := ethZRC20.Withdraw(runner.ZEVMAuth, local.DeployerAddress.Bytes(), big.NewInt(100)) if err != nil { panic(err) } diff --git a/common/ethereum/proof_test.go b/common/ethereum/proof_test.go index 14a153ffc7..257a9ab26e 100644 --- a/common/ethereum/proof_test.go +++ b/common/ethereum/proof_test.go @@ -1,125 +1,91 @@ package ethereum import ( - "context" - "math/big" + "encoding/json" + "fmt" + "os" "testing" - "time" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/stretchr/testify/require" ) -func TestProofGeneration(t *testing.T) { - RPC_URL := "https://rpc.ankr.com/eth_goerli" - client, err := ethclient.Dial(RPC_URL) - if err != nil { - t.Fatal(err) - } - bn := int64(9509129) - block, err := client.BlockByNumber(context.Background(), big.NewInt(bn)) - if err != nil { - t.Fatal(err) - } - - headerRLP, _ := rlp.EncodeToBytes(block.Header()) - t.Logf("block header size %d\n", len(headerRLP)) - - var header types.Header - rlp.DecodeBytes(headerRLP, &header) - - t.Logf("block %d\n", block.Number()) - t.Logf(" tx root %x\n", header.TxHash) +const ( + headerPath = "./testdata/header.json" + receiptPrefixPath = "./testdata/receipt_" + receiptCount = 81 +) - //ttt := new(trie.Trie) - tr := NewTrie(block.Transactions()) - t.Logf(" sha2 %x\n", tr.Hash()) - if tr.Hash() != header.TxHash { - t.Fatal("tx root mismatch") - } else { - t.Logf(" tx root hash & block tx root match\n") +func TestProofGeneration(t *testing.T) { + header, err := readHeader() + require.NoError(t, err) + + var receipts types.Receipts + for i := 0; i < receiptCount; i++ { + receipt, err := readReceipt(i) + require.NoError(t, err) + receipts = append(receipts, &receipt) } - var indexBuf []byte - for i := 0; i < len(block.Transactions()); i++ { + // generate a trie from the receipts and compare the root hash with the one in the header + receiptTree := NewTrie(receipts) + require.EqualValues(t, header.ReceiptHash.Hex(), header.ReceiptHash.Hex()) - indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) + for i, receipt := range receipts { + // generate a proof for each receipt and verify it + proof, err := receiptTree.GenerateProof(i) + require.NoError(t, err) - proof := NewProof() - tr.Prove(indexBuf, 0, proof) - t.Logf("proof len %d\n", len(proof.Keys)) - value, err := proof.Verify(block.Header().TxHash, i) - //value, err := trie.VerifyProof(tr.trie.Hash(), indexBuf, proof) - t.Logf("pass? %v\n", err == nil) - //t.Logf("value %x\n", value) + verified, err := proof.Verify(header.ReceiptHash, i) + require.NoError(t, err) - var txx types.Transaction - txx.UnmarshalBinary(value) - t.Logf(" tx %+v\n", txx.To().Hex()) - t.Logf(" tx hash %+v\n", txx.Hash().Hex()) - if txx.Hash() != block.Transactions()[i].Hash() { - t.Fatal("tx hash mismatch") - } else { - t.Logf(" tx hash & block tx hash match\n") + // recover the receipt from the proof and compare it with the original receipt + // NOTE: eth receipts only hashes the following fields + // data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs} + var verifiedReceipt types.Receipt + err = verifiedReceipt.UnmarshalBinary(verified) + require.NoError(t, err) + require.EqualValues(t, receipt.Status, verifiedReceipt.Status) + require.EqualValues(t, receipt.CumulativeGasUsed, verifiedReceipt.CumulativeGasUsed) + require.EqualValues(t, receipt.Bloom.Bytes(), verifiedReceipt.Bloom.Bytes()) + require.EqualValues(t, len(receipt.Logs), len(verifiedReceipt.Logs)) + for i, log := range receipt.Logs { + require.EqualValues(t, log.Address, verifiedReceipt.Logs[i].Address) + require.EqualValues(t, log.Topics, verifiedReceipt.Logs[i].Topics) + require.EqualValues(t, log.Data, verifiedReceipt.Logs[i].Data) } - signer := types.NewLondonSigner(txx.ChainId()) - sender, err := types.Sender(signer, &txx) - t.Logf(" tx from %s\n", sender.Hex()) } - //for k, v := range proof.Proof { - // key, _ := base64.StdEncoding.DecodeString(k) - // t.Logf("k: %x, v: %x\n", key, v) - //} - - { - var receipts types.Receipts - for _, tx := range block.Transactions() { - receipt, err := client.TransactionReceipt(context.Background(), tx.Hash()) - if err != nil { - t.Fatal(err) - } - receipts = append(receipts, receipt) - time.Sleep(200 * time.Millisecond) - } - - receiptTree := NewTrie(receipts) - t.Logf(" block receipt root %x\n", block.Header().ReceiptHash) - t.Logf(" receipt tree root %x\n", receiptTree.Hash()) - if receiptTree.Hash() != block.Header().ReceiptHash { - t.Fatal("receipt root mismatch") - } else { - t.Logf(" receipt root hash & block receipt root match\n") - } - - i := 1 - proof := NewProof() - indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) - err = receiptTree.Prove(indexBuf, 0, proof) - if err != nil { - t.Fatal(err) - } +} - // NOTE: eth receipts only hashes the following fields - // data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs} - value, err := trie.VerifyProof(block.Header().ReceiptHash, indexBuf, proof) - t.Logf("pass? %v\n", err == nil) - t.Logf("value %x\n", value) - value, err = proof.Verify(block.Header().ReceiptHash, i) - if err != nil { - t.Fatal(err) - } +// readHeader reads a header from a file. +// TODO: centralize test data +// https://github.com/zeta-chain/node/issues/1874 +func readHeader() (header types.Header, err error) { + file, err := os.Open(headerPath) + if err != nil { + return header, err + } + defer file.Close() - var receipt types.Receipt - receipt.UnmarshalBinary(value) + decoder := json.NewDecoder(file) + err = decoder.Decode(&header) + return header, err +} - t.Logf(" receipt %+v\n", receipt) - t.Logf(" receipt tx hash %+v\n", receipt.TxHash.Hex()) +// readReceipt reads a receipt from a file. +// TODO: centralize test data +// https://github.com/zeta-chain/node/issues/1874 +func readReceipt(index int) (receipt types.Receipt, err error) { + filePath := fmt.Sprintf("%s%d.json", receiptPrefixPath, index) - for _, log := range receipt.Logs { - t.Logf(" log %+v\n", log) - } + file, err := os.Open(filePath) + if err != nil { + return receipt, err } + defer file.Close() + + decoder := json.NewDecoder(file) + err = decoder.Decode(&receipt) + return receipt, err } diff --git a/common/ethereum/testdata/header.json b/common/ethereum/testdata/header.json new file mode 100644 index 0000000000..f3e212ff06 --- /dev/null +++ b/common/ethereum/testdata/header.json @@ -0,0 +1 @@ +{"parentHash":"0x69c3f269c0e96530feb9c3ec01ab8c87c77a8c489148d34bdd3ce00d78f00b3c","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0xd9a5179f091d85051d3c982785efd1455cec8699","stateRoot":"0xfbc81b7cf76ec579a74fea7d01c93f89e2c5bc3689732697682144c045756594","transactionsRoot":"0xe98dcafb82038e90d0403f9717a45eafda1c3d33a9ec898394016e2d3c310310","receiptsRoot":"0xb55bea9aa993839f093399911d1cf806cb1ec2be0cbd71a3bb8528aa9ef2fc53","logsBloom":"0x106010c449c041421308460893b00352001100308434001001d41128601245a04194424000c10f094a2088b1000400000000008530060ea102a00018002c020214518016002320528254601c08c801960c81c00440c400083c62442c4014c244b0c822088200241080a65025a0022f48a422044300500040608100d15c0003042c48210880e4884034232904881042000239c0084100884009147000455c00251e88442402a0294a40220070000908c0100124c43108801269203162c6020500800bc12b900250a13d0404211657001005003119008800046044a4002841654902fc20000004200200d13b02a00460ad84402400122e8008c214420404d05110","difficulty":"0x0","number":"0x4c4b40","gasLimit":"0x1c9c380","gasUsed":"0xea329c","timestamp":"0x6592aed4","extraData":"0xd883010d05846765746888676f312e32312e34856c696e7578","mixHash":"0xfce8b8cf88b975164b8911c51d144db1a5093d60779cb6f64493f30f9062e19b","nonce":"0x0000000000000000","baseFeePerGas":"0xc11611","hash":"0xb4272db0d4b614f464dc067dcf3ca01bd2087070dcf6edbe240571642b2c1825"} diff --git a/common/ethereum/testdata/receipt_0.json b/common/ethereum/testdata/receipt_0.json new file mode 100644 index 0000000000..bfdd9a9f82 --- /dev/null +++ b/common/ethereum/testdata/receipt_0.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0x5208","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xe5a58e3d4460acf272945bc15bd91bad5b626b3f8ef33a36630cbce97d86b172","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x0"} diff --git a/common/ethereum/testdata/receipt_1.json b/common/ethereum/testdata/receipt_1.json new file mode 100644 index 0000000000..8cd8571725 --- /dev/null +++ b/common/ethereum/testdata/receipt_1.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0xa410","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x2fd214d899e3b8e3ac957ab69927461f0c0a3afe9fc3b79a73a71a3f18c97e35","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1"} diff --git a/common/ethereum/testdata/receipt_10.json b/common/ethereum/testdata/receipt_10.json new file mode 100644 index 0000000000..5133536e94 --- /dev/null +++ b/common/ethereum/testdata/receipt_10.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x35da2a","logsBloom":"0x000010040000000000000000000000100000000000100000008000080000000000000000000000000000080000000000000000000002000000000000000000001000000200000000000000080000018000000000008000000000000040004000004000000200001080804001000028000000004000000000000000100000000000080000000000000001000008000000000000000000000000000000000000000c00000000a0000000000000000000000000000000008000000000200000000000000003000000000000000000000000000010000000000400000000000020010040000000000000000000000000000000000000000400000000000400000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1e","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1f","removed":false},{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x20","removed":false},{"address":"0x5b41a5c0df16551f5edeaa2b2ede2135f1a824df","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x21","removed":false},{"address":"0xd7b45cbc28ba9ba8653665d5fb37167a2afe35d9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x22","removed":false},{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x23","removed":false},{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x24","removed":false},{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x25","removed":false},{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x26","removed":false},{"address":"0xc870a3dc444bf970da13979e9cfac1a01c198eac","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x27","removed":false},{"address":"0x837ad475f0177bcb6cf426a725d5d52dfb577ee7","topics":["0x624601b6b2c889f8d24f3b93ec6db534d4c0f2cb51c0087f2d5739679393fa51","0x0000000000000000000000003a549672d9a4de8a096dcf75d947a4fd0c607cc0"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","transactionIndex":"0xa","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x28","removed":false}],"transactionHash":"0xb24efa8d61c60ec11386273038d5db7ac691c650507ec4521c5e8cb24d5bc183","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x680ac","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xa"} diff --git a/common/ethereum/testdata/receipt_11.json b/common/ethereum/testdata/receipt_11.json new file mode 100644 index 0000000000..41a0c3ec96 --- /dev/null +++ b/common/ethereum/testdata/receipt_11.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x37c6b7","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000100000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000cba6c4ce8380a5cdb49424a56b7dc897c213576a","0x0000000000000000000000000000000000000000000000000000000000000000"],"data":"0x000000000000000000000000000000000000000000000000297efd4145427aa3","blockNumber":"0x4c4b40","transactionHash":"0x42fcbccabd349cecdbf0beeebc9933764d07050c9bd9215f653530c269f6f7e8","transactionIndex":"0xb","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x29","removed":false}],"transactionHash":"0x42fcbccabd349cecdbf0beeebc9933764d07050c9bd9215f653530c269f6f7e8","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1ec8d","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xb"} diff --git a/common/ethereum/testdata/receipt_12.json b/common/ethereum/testdata/receipt_12.json new file mode 100644 index 0000000000..456d5fec54 --- /dev/null +++ b/common/ethereum/testdata/receipt_12.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x3e4763","logsBloom":"0x000010040000000000000000000000100000000000100000008000080000000000000000000000000000080000000000000000000002000000000000000000001000000200000000000000080000008000000000008000000000000040004000004000000200001080804001000028000000004000000000000000100000000000000000000000000001000008000000000000000000000000000000400000000c00000000a0000000000000000000000000000000008000000000200000000000000003000000000000000000000000000010000000000400000000000020010040000000000002000000000000000000000000020000000000000400000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2a","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2b","removed":false},{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2c","removed":false},{"address":"0x5b41a5c0df16551f5edeaa2b2ede2135f1a824df","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2d","removed":false},{"address":"0xd7b45cbc28ba9ba8653665d5fb37167a2afe35d9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2e","removed":false},{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2f","removed":false},{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x30","removed":false},{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x31","removed":false},{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x32","removed":false},{"address":"0xc870a3dc444bf970da13979e9cfac1a01c198eac","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x33","removed":false},{"address":"0x837ad475f0177bcb6cf426a725d5d52dfb577ee7","topics":["0x624601b6b2c889f8d24f3b93ec6db534d4c0f2cb51c0087f2d5739679393fa51","0x0000000000000000000000008e864788917344c996a959b165389172c0d11323"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","transactionIndex":"0xc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x34","removed":false}],"transactionHash":"0x2b858ea5056974cd589179f22861f44f85ee57035e7aad2da161f56f089c2573","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x680ac","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xc"} diff --git a/common/ethereum/testdata/receipt_13.json b/common/ethereum/testdata/receipt_13.json new file mode 100644 index 0000000000..390dcbc4c3 --- /dev/null +++ b/common/ethereum/testdata/receipt_13.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x44c80f","logsBloom":"0x000010040000000000000000001000100000000000100000008000080000000000000000000000000000080000000000000000000002000000000000000000001000000200000000000000080000008000000000008000000000000040004000004000000200001080804001000028000000004000000000000000100000020000000000000000000001000008000000000000000000000000000000000000000c00000000a0000000000000000000000000000000008000000000200000000000000003000000000000000000000000000010000000000400000000000020010040000000000000000008000000000000000000000000000000000400000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x35","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x36","removed":false},{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x37","removed":false},{"address":"0x5b41a5c0df16551f5edeaa2b2ede2135f1a824df","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x38","removed":false},{"address":"0xd7b45cbc28ba9ba8653665d5fb37167a2afe35d9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x39","removed":false},{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3a","removed":false},{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3b","removed":false},{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3c","removed":false},{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3d","removed":false},{"address":"0xc870a3dc444bf970da13979e9cfac1a01c198eac","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3e","removed":false},{"address":"0x837ad475f0177bcb6cf426a725d5d52dfb577ee7","topics":["0x624601b6b2c889f8d24f3b93ec6db534d4c0f2cb51c0087f2d5739679393fa51","0x000000000000000000000000b44f4fac885b2c8926333f7b275271e07049a76b"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","transactionIndex":"0xd","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3f","removed":false}],"transactionHash":"0x99bc1fb41e6620f1c4d60880bc813222d9012849b5e5c7a74b6da5c77784c43d","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x680ac","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xd"} diff --git a/common/ethereum/testdata/receipt_14.json b/common/ethereum/testdata/receipt_14.json new file mode 100644 index 0000000000..bed4fa8ecf --- /dev/null +++ b/common/ethereum/testdata/receipt_14.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x459380","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000200000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000008000000000001000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000009f16053750cf145d1788c0d5c0577bb8b6f9d5c0"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0x39ac5411adf30f48274ed9e83d1a5e345572f4858191870f49304ac25c172841","transactionIndex":"0xe","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x40","removed":false}],"transactionHash":"0x39ac5411adf30f48274ed9e83d1a5e345572f4858191870f49304ac25c172841","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xe"} diff --git a/common/ethereum/testdata/receipt_15.json b/common/ethereum/testdata/receipt_15.json new file mode 100644 index 0000000000..233d904c18 --- /dev/null +++ b/common/ethereum/testdata/receipt_15.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4622dc","logsBloom":"0x00200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000400000000000000010000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020010000000000000000000000000000000000002000000000000000000000000000","logs":[{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bbb1d19f0d7bfaff24ebe03f5be95162111e8acc"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x39f0b135ba1fe235a61a06d1c68d8d91c02d504a3f3974a022a5adfc49c338b4","transactionIndex":"0xf","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x41","removed":false}],"transactionHash":"0x39f0b135ba1fe235a61a06d1c68d8d91c02d504a3f3974a022a5adfc49c338b4","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8f5c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0xf"} diff --git a/common/ethereum/testdata/receipt_16.json b/common/ethereum/testdata/receipt_16.json new file mode 100644 index 0000000000..2cf7ee1b77 --- /dev/null +++ b/common/ethereum/testdata/receipt_16.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x46b22c","logsBloom":"0x00000000000000000000000000000002000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000400000000000000010000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000002000000000000000000000000000000000000000000000000000020010000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000016d1008ea65d4754651b30308ba8d3c2b404e7e6"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x75c215eefb48ea43521ea96206e919f50533eeb7a78792043e98bd32a2ad3a6d","transactionIndex":"0x10","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x42","removed":false}],"transactionHash":"0x75c215eefb48ea43521ea96206e919f50533eeb7a78792043e98bd32a2ad3a6d","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8f50","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x10"} diff --git a/common/ethereum/testdata/receipt_17.json b/common/ethereum/testdata/receipt_17.json new file mode 100644 index 0000000000..d293fb3b5a --- /dev/null +++ b/common/ethereum/testdata/receipt_17.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x477d9d","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000001000000000000000000000000000000040000000000020000000000000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000c3bc2cf7a56ef2708cabd49b306c30f71d0adb3f"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0xc3b3d23a26280cb8997823b23b0610c39e2019a7e3f39959734b056d3f95420b","transactionIndex":"0x11","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x43","removed":false}],"transactionHash":"0xc3b3d23a26280cb8997823b23b0610c39e2019a7e3f39959734b056d3f95420b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x11"} diff --git a/common/ethereum/testdata/receipt_18.json b/common/ethereum/testdata/receipt_18.json new file mode 100644 index 0000000000..5f9d1d7ab3 --- /dev/null +++ b/common/ethereum/testdata/receipt_18.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x483512","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000001000200000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000004000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000080010000000000000000000000000000000000000000000008000020000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000c1439c6f7b80e9ba3b20a21ea4b181b8432a53d2","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x000000000000000000000000000000000000000000084595161401484a000000","blockNumber":"0x4c4b40","transactionHash":"0x3f321a12e595e4e3f31655a3a589b2e022d5b1f166488271f6d169a913eee26b","transactionIndex":"0x12","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x44","removed":false}],"transactionHash":"0x3f321a12e595e4e3f31655a3a589b2e022d5b1f166488271f6d169a913eee26b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb775","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x12"} diff --git a/common/ethereum/testdata/receipt_19.json b/common/ethereum/testdata/receipt_19.json new file mode 100644 index 0000000000..32d13d3a47 --- /dev/null +++ b/common/ethereum/testdata/receipt_19.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x48bdc3","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000800000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000200000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000f8ef5ebba408769cb6c7fca121bcd039e81589dd"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x8ef26786006171ab31b65aaeb0f059cc81d240dc6f58176416dedf3ba30fb0fb","transactionIndex":"0x13","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x45","removed":false}],"transactionHash":"0x8ef26786006171ab31b65aaeb0f059cc81d240dc6f58176416dedf3ba30fb0fb","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x88b1","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x13"} diff --git a/common/ethereum/testdata/receipt_2.json b/common/ethereum/testdata/receipt_2.json new file mode 100644 index 0000000000..c434f2ba65 --- /dev/null +++ b/common/ethereum/testdata/receipt_2.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xf618","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xab13feef2d739e8276da60663b9a58f3886eca8f7873093f9f31015b6c7a404f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2"} diff --git a/common/ethereum/testdata/receipt_20.json b/common/ethereum/testdata/receipt_20.json new file mode 100644 index 0000000000..c984834837 --- /dev/null +++ b/common/ethereum/testdata/receipt_20.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4a6784","logsBloom":"0x00000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000100000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000bac1752f90a431d314bc7f8f03b02580059c799e","0x0000000000000000000000000000000000000000000000000000000000000000"],"data":"0x000000000000000000000000000000000000000000000000297efd4145427aa3","blockNumber":"0x4c4b40","transactionHash":"0xeb7337b7307584a78ae5d2b2fdd0872554f68468bbeed30791f6e4e01718d9f0","transactionIndex":"0x14","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x46","removed":false}],"transactionHash":"0xeb7337b7307584a78ae5d2b2fdd0872554f68468bbeed30791f6e4e01718d9f0","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1a9c1","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x14"} diff --git a/common/ethereum/testdata/receipt_21.json b/common/ethereum/testdata/receipt_21.json new file mode 100644 index 0000000000..b382caf469 --- /dev/null +++ b/common/ethereum/testdata/receipt_21.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4b32f5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000002000000001000000000000000000000000000000000000000000020000020000000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000006ccc84c3f28d22a6409494ef6b736a8ad0320c58"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0x6371e54c8ea54159a7d310dc29c725f593274be169823a175debe06330be67f5","transactionIndex":"0x15","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x47","removed":false}],"transactionHash":"0x6371e54c8ea54159a7d310dc29c725f593274be169823a175debe06330be67f5","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x15"} diff --git a/common/ethereum/testdata/receipt_22.json b/common/ethereum/testdata/receipt_22.json new file mode 100644 index 0000000000..392f674b8b --- /dev/null +++ b/common/ethereum/testdata/receipt_22.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4bfe66","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000002000000000000000002000000000000000000000000000000000020000000000000000000000000002000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000094f3681b674cc07607ba2bbc2289687a9591ff9f"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0x05c85848bce75d102a110a0d379c01413de3a50a5f189258dd47c4fc3cb3c45a","transactionIndex":"0x16","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x48","removed":false}],"transactionHash":"0x05c85848bce75d102a110a0d379c01413de3a50a5f189258dd47c4fc3cb3c45a","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x16"} diff --git a/common/ethereum/testdata/receipt_23.json b/common/ethereum/testdata/receipt_23.json new file mode 100644 index 0000000000..5320e1762b --- /dev/null +++ b/common/ethereum/testdata/receipt_23.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4c8dc2","logsBloom":"0x00000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000020000000000000008000000000000000000000000000000000000400000000000020000000000000000000800000000000000000000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000002000000000000000000000000000000000000000000000000000","logs":[{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000160c9f73c956177c473987cde20c654519a435a0"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xb2f460aa0450f7b2d621d5761e5a33a3d21e13b380bf439cbf85017dd0a06118","transactionIndex":"0x17","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x49","removed":false}],"transactionHash":"0xb2f460aa0450f7b2d621d5761e5a33a3d21e13b380bf439cbf85017dd0a06118","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8f5c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x17"} diff --git a/common/ethereum/testdata/receipt_24.json b/common/ethereum/testdata/receipt_24.json new file mode 100644 index 0000000000..020058e598 --- /dev/null +++ b/common/ethereum/testdata/receipt_24.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4ecb1d","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200002000000000800000000000000000000000000000008000000000000000000000000000000000000000000000008020000108000400000000800000004000000000000000010000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000400008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000076dd2d7311ad402325b4a0cd92512f17719393b7","0x0000000000000000000000000000000000000000000000000000000000000000"],"data":"0x00000000000000000000000000000000000000000000000166cf562a0051604c","blockNumber":"0x4c4b40","transactionHash":"0x064e6910450c8878f51a7d594bfc26eca5d972ed805087e19e1853049208b0d6","transactionIndex":"0x18","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4a","removed":false},{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000fc3a42641cfbd700c6adacc14419418d4d2bbd02","0x00000000000000000000000076dd2d7311ad402325b4a0cd92512f17719393b7"],"data":"0x0000000000000000000000000000000000000000000000000000000017d78400","blockNumber":"0x4c4b40","transactionHash":"0x064e6910450c8878f51a7d594bfc26eca5d972ed805087e19e1853049208b0d6","transactionIndex":"0x18","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4b","removed":false}],"transactionHash":"0x064e6910450c8878f51a7d594bfc26eca5d972ed805087e19e1853049208b0d6","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x23d5b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x18"} diff --git a/common/ethereum/testdata/receipt_25.json b/common/ethereum/testdata/receipt_25.json new file mode 100644 index 0000000000..d546392671 --- /dev/null +++ b/common/ethereum/testdata/receipt_25.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x4f968e","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000040000000002000000000000000000000000000000000000000000000000000020000000000000000000008000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000d155daa1aa68264b8657da68711d285703f13b55"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0xc0816ffefb3f8605c006df368eb07d0704062e935700f88edf74afc962c6eb3c","transactionIndex":"0x19","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4c","removed":false}],"transactionHash":"0xc0816ffefb3f8605c006df368eb07d0704062e935700f88edf74afc962c6eb3c","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x19"} diff --git a/common/ethereum/testdata/receipt_26.json b/common/ethereum/testdata/receipt_26.json new file mode 100644 index 0000000000..9af287fe9d --- /dev/null +++ b/common/ethereum/testdata/receipt_26.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5025ea","logsBloom":"0x00000000000000000000000000000110000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000002000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000400000000","logs":[{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000c1393cc33b8574e18b0408f276e6e067f9317b39"],"data":"0x00000000000000000000000000000000000000000000010f0cf064dd59200000","blockNumber":"0x4c4b40","transactionHash":"0x59dd57653e2fffbbc21d67bc20bd426261ba972179579d92990acb0ed44604c8","transactionIndex":"0x1a","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4d","removed":false}],"transactionHash":"0x59dd57653e2fffbbc21d67bc20bd426261ba972179579d92990acb0ed44604c8","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8f5c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1a"} diff --git a/common/ethereum/testdata/receipt_27.json b/common/ethereum/testdata/receipt_27.json new file mode 100644 index 0000000000..383a45fed7 --- /dev/null +++ b/common/ethereum/testdata/receipt_27.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x50b546","logsBloom":"0x00000000000000000000000000000000000000000000000000000008000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000020000000000000100000800000000000000000000000010400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000004002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000072d98af9ff745277bcda4da0d76d603c4a8cc44f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0x43dfd90c01da2c3843b28102040a427acc8aa5545e7898d5ec28eadb11a8eaee","transactionIndex":"0x1b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4e","removed":false}],"transactionHash":"0x43dfd90c01da2c3843b28102040a427acc8aa5545e7898d5ec28eadb11a8eaee","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8f5c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1b"} diff --git a/common/ethereum/testdata/receipt_28.json b/common/ethereum/testdata/receipt_28.json new file mode 100644 index 0000000000..00c02b50c5 --- /dev/null +++ b/common/ethereum/testdata/receipt_28.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5180b7","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000008020000000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000002000000800000000000020000000000000000000000000000000020000000000000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000d800f334aa2733a3c49a307fc4147717e086bf6"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0x6e7ae03ba63ee6f0cfb3203eff114513aaba07a57cc041543352f04509a181f6","transactionIndex":"0x1c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4f","removed":false}],"transactionHash":"0x6e7ae03ba63ee6f0cfb3203eff114513aaba07a57cc041543352f04509a181f6","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1c"} diff --git a/common/ethereum/testdata/receipt_29.json b/common/ethereum/testdata/receipt_29.json new file mode 100644 index 0000000000..7de969a98f --- /dev/null +++ b/common/ethereum/testdata/receipt_29.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5398b2","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000002000000000000200000000000000000000000000008000000000000000000000000000000000000000000000000000000108000400000000000000000000000000000000010000000000000000000000000000000000800000000000000000000000000000000000000020000000200000000200000000000000000000000000000200001000000000000000002000000000000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000020000000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000ec42e8d4e10760f66a9ab28b134a28f9e49ce37d","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x000000000000000000000000000000000000000000000000000000001dcd6500","blockNumber":"0x4c4b40","transactionHash":"0x772246c4c281b2ed30092e387c6b9cf49e0dbe7abcd9bb68805bce6a47c2fd30","transactionIndex":"0x1d","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x50","removed":false},{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000ec42e8d4e10760f66a9ab28b134a28f9e49ce37d","0x000000000000000000000000fc3a42641cfbd700c6adacc14419418d4d2bbd02"],"data":"0x00000000000000000000000000000000000000000000000000000002363e7f00","blockNumber":"0x4c4b40","transactionHash":"0x772246c4c281b2ed30092e387c6b9cf49e0dbe7abcd9bb68805bce6a47c2fd30","transactionIndex":"0x1d","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x51","removed":false}],"transactionHash":"0x772246c4c281b2ed30092e387c6b9cf49e0dbe7abcd9bb68805bce6a47c2fd30","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x217fb","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1d"} diff --git a/common/ethereum/testdata/receipt_3.json b/common/ethereum/testdata/receipt_3.json new file mode 100644 index 0000000000..a051afd878 --- /dev/null +++ b/common/ethereum/testdata/receipt_3.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x14820","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x7f92fc9ccdc51b58557e1de4bd3f2548cf1cbb9e89cfce0ebf74ecf161870d6d","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3"} diff --git a/common/ethereum/testdata/receipt_30.json b/common/ethereum/testdata/receipt_30.json new file mode 100644 index 0000000000..0abdf69200 --- /dev/null +++ b/common/ethereum/testdata/receipt_30.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x57aaa5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000040000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000002000000000000000000000000000000000000000000","logs":[{"address":"0xd4d3d0db6e0de6697346140e889522f01e18dc36","topics":["0x8203a21e4f95f72e5081d5e0929b1a8c52141e123f9a14e1e74b0260fa5f52f1"],"data":"0x000000000000000000000000000000000000000000000000000000000003b6a6000000000000000000000000000000000000000000000000000000000000000a","blockNumber":"0x4c4b40","transactionHash":"0x39d18b3ade0f992a3db856c25c8e3b3d188234388646972d311d7c504ae1295b","transactionIndex":"0x1e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x52","removed":false}],"transactionHash":"0x39d18b3ade0f992a3db856c25c8e3b3d188234388646972d311d7c504ae1295b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x411f3","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1e"} diff --git a/common/ethereum/testdata/receipt_31.json b/common/ethereum/testdata/receipt_31.json new file mode 100644 index 0000000000..ae73301c6a --- /dev/null +++ b/common/ethereum/testdata/receipt_31.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x585f59","logsBloom":"0x00000004000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000020000000200000000000000000000000000000000000000000000000000000000000010000000000000000000020000000000000000000000000080010000000000000000000000000000000000000000000000000020000000000","logs":[{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000de656275e2c20d1550c8bf42cd6f6d559e61da15","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x000000000000000000000000000000000000000000000878678326eac9000000","blockNumber":"0x4c4b40","transactionHash":"0x9c05318df1bdb300aae680b2cbacabc8d562550ba1a97ab0e569bb7db686fa01","transactionIndex":"0x1f","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x53","removed":false}],"transactionHash":"0x9c05318df1bdb300aae680b2cbacabc8d562550ba1a97ab0e569bb7db686fa01","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb4b4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x1f"} diff --git a/common/ethereum/testdata/receipt_32.json b/common/ethereum/testdata/receipt_32.json new file mode 100644 index 0000000000..1a73badac3 --- /dev/null +++ b/common/ethereum/testdata/receipt_32.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5913f5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000004108000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000080010000000000000000000000000008000000000000000000000020000000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x00000000000000000000000034a88c98a4d080d527c4e18f4aa120203d26d4c8","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x000000000000000000000000000000000000000000000000000009184e72a000","blockNumber":"0x4c4b40","transactionHash":"0x2a1fc8b3a85b88dc2b1f95477fcb3876503f64c1a2f7d4bfa0e487db4813953e","transactionIndex":"0x20","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x54","removed":false}],"transactionHash":"0x2a1fc8b3a85b88dc2b1f95477fcb3876503f64c1a2f7d4bfa0e487db4813953e","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb49c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x20"} diff --git a/common/ethereum/testdata/receipt_33.json b/common/ethereum/testdata/receipt_33.json new file mode 100644 index 0000000000..0cf2dadfe3 --- /dev/null +++ b/common/ethereum/testdata/receipt_33.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x59c885","logsBloom":"0x00000000000000000000000000100000000000000000000000000000400000000000000000000001000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000108000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080010000000000000000000000000002000000000000000000000020000000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x00000000000000000000000021f00faba2f0e634f16c08f83db79331a46f5cd0","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xdbeb6aa535fcc95d5b499b650dfd5361daf49e14bc0723f4a8d87d1fa3022905","transactionIndex":"0x21","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x55","removed":false}],"transactionHash":"0xdbeb6aa535fcc95d5b499b650dfd5361daf49e14bc0723f4a8d87d1fa3022905","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb490","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x21"} diff --git a/common/ethereum/testdata/receipt_34.json b/common/ethereum/testdata/receipt_34.json new file mode 100644 index 0000000000..518dc428b2 --- /dev/null +++ b/common/ethereum/testdata/receipt_34.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5a4db6","logsBloom":"0x00000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000008000000000000000000000008000000000000000000000000020000000004000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000004000000000000000","logs":[{"address":"0x53844f9577c2334e541aec7df7174ece5df1fcf0","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000b4d68d677a5f765117d374569d5ecd5739ad5df6"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xc7b374861bc29413cc71c89ad81d285270c84fdaaa465b452e90f33228aee34b","transactionIndex":"0x22","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x56","removed":false}],"transactionHash":"0xc7b374861bc29413cc71c89ad81d285270c84fdaaa465b452e90f33228aee34b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8531","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x22"} diff --git a/common/ethereum/testdata/receipt_35.json b/common/ethereum/testdata/receipt_35.json new file mode 100644 index 0000000000..fb6b178335 --- /dev/null +++ b/common/ethereum/testdata/receipt_35.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0x5b9539","logsBloom":"0x00000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000001000000000008000000000000000000000000000000000000000000000000020000000000000400000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000008000000000000000020000000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x3f4b6664338f23d2397c953f2ab4ce8031663f80","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000005896ad5a983573ea435d809183fed11c6a505f77"],"data":"0x0000000000000000000000000000000000000000000000008ac7230489e80000","blockNumber":"0x4c4b40","transactionHash":"0xa2fc58ad754b05bf941eb415df526cfd5c750cde573498c1727d421327457179","transactionIndex":"0x23","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x57","removed":false}],"transactionHash":"0xa2fc58ad754b05bf941eb415df526cfd5c750cde573498c1727d421327457179","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x14783","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x23"} diff --git a/common/ethereum/testdata/receipt_36.json b/common/ethereum/testdata/receipt_36.json new file mode 100644 index 0000000000..1c63fea869 --- /dev/null +++ b/common/ethereum/testdata/receipt_36.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0x5be741","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x63afbe677969883b9d78c8fbe62cf0fe72ef31220744770837320d4a27d2b4f1","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x24"} diff --git a/common/ethereum/testdata/receipt_37.json b/common/ethereum/testdata/receipt_37.json new file mode 100644 index 0000000000..c35dedb574 --- /dev/null +++ b/common/ethereum/testdata/receipt_37.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0x5c63e6","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xcd719f107c1867eca2e7a8a1c84f3bb9f3da121ea5a6023fe07c96352f06e383","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x7ca5","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x25"} diff --git a/common/ethereum/testdata/receipt_38.json b/common/ethereum/testdata/receipt_38.json new file mode 100644 index 0000000000..feb10aceb7 --- /dev/null +++ b/common/ethereum/testdata/receipt_38.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5cb5ee","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x392fbb6f4bec78563030c40437d27bb9b6295654692f3b08187d67199219d47b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x26"} diff --git a/common/ethereum/testdata/receipt_39.json b/common/ethereum/testdata/receipt_39.json new file mode 100644 index 0000000000..7c61ea8327 --- /dev/null +++ b/common/ethereum/testdata/receipt_39.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5d6d63","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000400000000000200000000000000008000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000008000020000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000f0f113adcd49207a1458ad1481f3e4a7cc98b7ed","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x00000000000000000000000000000000000000000000010f0cf064dd59200000","blockNumber":"0x4c4b40","transactionHash":"0x157ed28cd282a00683ddc2b3b83063548c2f858b09ac673c53bd5ff988daab2f","transactionIndex":"0x27","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x58","removed":false}],"transactionHash":"0x157ed28cd282a00683ddc2b3b83063548c2f858b09ac673c53bd5ff988daab2f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb775","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x27"} diff --git a/common/ethereum/testdata/receipt_4.json b/common/ethereum/testdata/receipt_4.json new file mode 100644 index 0000000000..39f424d534 --- /dev/null +++ b/common/ethereum/testdata/receipt_4.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x1d6f97","logsBloom":"0x00000000080000000008000000800000000000100000000000000000000000000080000000000800000000000000000000000000000000000000000000000000000000000000004080400000000800000000000000000000004000000010000000000008000000000020000000000000000000000000000000000040080000000000000800240800000000000000000000208000000000000004000000000020000000000000000000000000000100000001000000000000000000000000000000000000000000010000000000040000000000000000000000000000000000000000000000000000000000008000000080000400000000000000000000004000","logs":[{"address":"0x6d6e010a2680e2e5a3b097ce411528b36d880ef6","topics":["0x8f2916b2f2d78cc5890ead36c06c0f6d5d112c7e103589947e8e2f0d6eddb763","0x000000000000000000000000000000000000000000000000000000000006da3c","0xe10bf8327d32a8b36507fe247cde91bf7fc9f7dc9fff4756afc71d83302700ae","0xa70282e19681d283bf0e911eca67420c5378feffa51f84e127aaab460bbebfb6"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x556e73d7a40c0a55dd675d4e0803033454c27e6c17158ea55e59546eb79b6e65","transactionIndex":"0x4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x0","removed":false},{"address":"0x6d6e010a2680e2e5a3b097ce411528b36d880ef6","topics":["0x8f2916b2f2d78cc5890ead36c06c0f6d5d112c7e103589947e8e2f0d6eddb763","0x000000000000000000000000000000000000000000000000000000000006da3d","0x2cda7e6af18763e5637dbe6110bb1ca020a87813da610f530fda6573f89e733d","0x63bb34a7b617f70a58d960fff4375f68d5abd459c4f3a7bc5932d87ad126e74e"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x556e73d7a40c0a55dd675d4e0803033454c27e6c17158ea55e59546eb79b6e65","transactionIndex":"0x4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1","removed":false},{"address":"0x6d6e010a2680e2e5a3b097ce411528b36d880ef6","topics":["0x8f2916b2f2d78cc5890ead36c06c0f6d5d112c7e103589947e8e2f0d6eddb763","0x000000000000000000000000000000000000000000000000000000000006da3e","0x5f33e65eb95f977dd0e956f2bf2bc2c2c3ae20fea461833b96c17f47f8b493b6","0x9b13dbdaa2f61ee191b8bf742c8c80559671c999a780cbcdd9984d27e5200af3"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x556e73d7a40c0a55dd675d4e0803033454c27e6c17158ea55e59546eb79b6e65","transactionIndex":"0x4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x2","removed":false}],"transactionHash":"0x556e73d7a40c0a55dd675d4e0803033454c27e6c17158ea55e59546eb79b6e65","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1c2777","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4"} diff --git a/common/ethereum/testdata/receipt_40.json b/common/ethereum/testdata/receipt_40.json new file mode 100644 index 0000000000..e275c1d3c1 --- /dev/null +++ b/common/ethereum/testdata/receipt_40.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5f3fb3","logsBloom":"0x00000000000000000000000000100000000100000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000200200000000000000000000000000000000000080000140000000000000000000000000000000000000000000000000040000000000000000080008000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000020000000000000000040000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x9ef7d57a4ea30b9e37794e55b0c75f2a70275dcc","topics":["0xdd84a3fa9ef9409f550d54d6affec7e9c480c878c6ab27b78912a03e1b371c6e","0x000000000000000000000000000000000000000000000000505d17e36030dae9"],"data":"0x000000000000000000000000000000003138000000000000000000006b515188000000000000000000000000000000000000000000000000000000006592aed4","blockNumber":"0x4c4b40","transactionHash":"0xd76a70456ad688bf4eb61ee093911c2c73135995734d6e6090e66285cd995b8f","transactionIndex":"0x28","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x59","removed":false},{"address":"0x92dc24ba33a2ac8a5af8d0aaad1bc97f69c416dc","topics":["0xb04e63db38c49950639fa09d29872f21f5d49d614f3a969d8adf3d4b52e41a62"],"data":"0x000193348fa898feb0d0b83d38465aaa3500d9f975dbe503e55300ccafca6bc600000000000000000000000000000000000000000000000000000000000044a5","blockNumber":"0x4c4b40","transactionHash":"0xd76a70456ad688bf4eb61ee093911c2c73135995734d6e6090e66285cd995b8f","transactionIndex":"0x28","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5a","removed":false}],"transactionHash":"0xd76a70456ad688bf4eb61ee093911c2c73135995734d6e6090e66285cd995b8f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1d250","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x28"} diff --git a/common/ethereum/testdata/receipt_41.json b/common/ethereum/testdata/receipt_41.json new file mode 100644 index 0000000000..57da6df2ee --- /dev/null +++ b/common/ethereum/testdata/receipt_41.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x5fb1d3","logsBloom":"0x00000000000000000000040000000000000000000004000000040000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000020000000000080000000000000000000000000000000000000000004000000000000000000010000100000000000000000000000000000000000000000000000010000000000000000000000000000400000000000000000000000000000000","logs":[{"address":"0xcd85b9a767ef2277e264a4b9a14a2deacab82ffb","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x00000000000000000000000020eb57ae3c4d359a6ca06cfaa9a441feab34654f","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79"],"data":"0x00000000000000000000000000000000000000000000003feb244e2d02130205","blockNumber":"0x4c4b40","transactionHash":"0xf2a70eaa241b3b2466478fe0131d02eaa4d8c117fa5b5b71e3928fd6c70ff9cb","transactionIndex":"0x29","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5b","removed":false}],"transactionHash":"0xf2a70eaa241b3b2466478fe0131d02eaa4d8c117fa5b5b71e3928fd6c70ff9cb","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x7220","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x29"} diff --git a/common/ethereum/testdata/receipt_42.json b/common/ethereum/testdata/receipt_42.json new file mode 100644 index 0000000000..4739b64c7d --- /dev/null +++ b/common/ethereum/testdata/receipt_42.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x607097","logsBloom":"0x00000000000000000000040000000000001000000000000000000000000000000000000000000000000000000000000000000004000000000000000000200000000080000020000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000010000100000000000000000000080000000000000000000000000010000000000000000000008000000000000000000000000000000000000000","logs":[{"address":"0x4820416cf02094ac6b9c253f64777516713330f4","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000e98f1d9496cba49d3ff21ffe2bab88273d6e1776","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79","0x000000000000000000000000000000000000000000000000000000000002dfcc"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x5b11ce6f33b4a94c9cd438033bd1d6bec5676801c64c3b153884b467a49ea325","transactionIndex":"0x2a","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5c","removed":false}],"transactionHash":"0x5b11ce6f33b4a94c9cd438033bd1d6bec5676801c64c3b153884b467a49ea325","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xbec4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2a"} diff --git a/common/ethereum/testdata/receipt_43.json b/common/ethereum/testdata/receipt_43.json new file mode 100644 index 0000000000..a330513a4a --- /dev/null +++ b/common/ethereum/testdata/receipt_43.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x62c7e9","logsBloom":"0x00000000000000000000000000000000000000000000000000400000000000000000004000000000000000000000000000000000000000000000000000000000001000000002000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000020000010000000008000110000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000","logs":[{"address":"0x03f2901db5723639978debed3aba66d4ea03af73","topics":["0xd9e6225aff5cf09ee2f0b39b98941e3c2beca6957b16b9e02b674a69e0e83ee7","0x6e9f5475a4674485d22963942fe5fea4f865f521b79e83b6f290b5a4593aa5a3","0xd9c034f0f1d6b680daad72b0e9fc25441f74c1d530d2ac46ebbd87794515c949","0x000000000000000000000000d20bdecf96871ad354a6cc7741c3ad65ead738cb"],"data":"0x000000000000000000000000000000000000000000000000000000001443fd00","blockNumber":"0x4c4b40","transactionHash":"0x9178fcb460b7000d9dbc9e1c32d97cbc620a8a5ce60051fdfe137854119d1cf2","transactionIndex":"0x2b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5d","removed":false}],"transactionHash":"0x9178fcb460b7000d9dbc9e1c32d97cbc620a8a5ce60051fdfe137854119d1cf2","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x25752","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2b"} diff --git a/common/ethereum/testdata/receipt_44.json b/common/ethereum/testdata/receipt_44.json new file mode 100644 index 0000000000..30cd2c74fa --- /dev/null +++ b/common/ethereum/testdata/receipt_44.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6abfb0","logsBloom":"0x00000000000000000200040000000040001000200004000000140000000000004010000000010000000000000000000000000000000008010000000000200000000000000020000000000008000000000000000000000000100000000000000000000000020000000000000000000800000000000000000000000010000000000000000000800000002000000000000000000000000080400000000000000000020004000000000000000000000000000000004000080000000000000002000000000102000010000500000000000000000000000000000040000000000020000010000000000000000020008004200500000000000000000200000000000010","logs":[{"address":"0xcd85b9a767ef2277e264a4b9a14a2deacab82ffb","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000ce04bb28f3df67c933c88f284cc6eff616265edf","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79"],"data":"0x00000000000000000000000000000000000000000000000004dcc97735ac90d3","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5e","removed":false},{"address":"0xcd85b9a767ef2277e264a4b9a14a2deacab82ffb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000ce04bb28f3df67c933c88f284cc6eff616265edf","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79"],"data":"0x000000000000000000000000000000000000000000000040216c4832871c0000","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5f","removed":false},{"address":"0x0bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79","topics":["0x879b0d7fc5ab2044f5760066c1bded84507ae1ffc3f3224017c512e378f7f63d","0x0000000000000000000000000000000000000000000000000000000000002f8b"],"data":"0x000000000000000000000000000000000000000000012c32a2d744b59d70f00000000000000000000000000000000000000000000000139847378ddb2c1800000000000000000000000000000000000000000000000000000000000000016976000000000000000000000000000000000000000000000000d49c763ab27542ef000000000000000000000000000000000000000000000000d6bcbf1771aec10a","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x60","removed":false},{"address":"0x4820416cf02094ac6b9c253f64777516713330f4","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000ce04bb28f3df67c933c88f284cc6eff616265edf","0x0000000000000000000000000000000000000000000000000000000000073d68"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x61","removed":false},{"address":"0x4820416cf02094ac6b9c253f64777516713330f4","topics":["0x83997618ca0dd0ece94d357019b8f062e52d8e67f8c8e7cbdfeadd462a49d371","0x0000000000000000000000000000000000000000000000000000000000073d68","0x000000000000000000000000ce04bb28f3df67c933c88f284cc6eff616265edf"],"data":"0x0000000000000000000000000000000000000000000000000000000000002f8b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000040216c4832871c0000000000000000000000000000000000000000000000000040216c4832871c0000000000000000000000000000000000000000000000000000d3cfab621935c8000000000000000000000000000000000000000000000000000000000000014be9","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x62","removed":false},{"address":"0xd968776ce286a963079331669f86c13873d73602","topics":["0xa2ba758028b7d21eee988892461f8630fe375441d69998d867174616c5eef8fb"],"data":"0x000000000000000000000000cd85b9a767ef2277e264a4b9a14a2deacab82ffb0000000000000000000000000000000000000000000000000000000000002f8b0000000000000000000000000000000000000000000003d2cca8fa527f8738000000000000000000000000000000000000000000000003d2cca8fa527f873800","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x63","removed":false},{"address":"0x0bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79","topics":["0xb9fa1caa1e1541788a4b5cd68270e6d375e3a28f4f94017af9351c5955d58fa7","0x0000000000000000000000000000000000000000000000000000000000073d68","0x0000000000000000000000000000000000000000000000000000000000002f8b","0x000000000000000000000000ce04bb28f3df67c933c88f284cc6eff616265edf"],"data":"0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000040216c4832871c0000000000000000000000000000000000000000000000000040216c4832871c0000000000000000000000000000000000000000000000000000d3cfab621935c800","blockNumber":"0x4c4b40","transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","transactionIndex":"0x2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x64","removed":false}],"transactionHash":"0xf8f49de77caf2e10ad76114b28db5878f0f043204d2bff014d0cc9aceef1a18e","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x7f7c7","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2c"} diff --git a/common/ethereum/testdata/receipt_45.json b/common/ethereum/testdata/receipt_45.json new file mode 100644 index 0000000000..bce90d55cf --- /dev/null +++ b/common/ethereum/testdata/receipt_45.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6b749c","logsBloom":"0x00000000004000000000040000000000000000000004000000040000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000020000000000000000000000000000000000000000000000000000010000100000000000000000000000000000000000000000000000010000000000000000000000000000400000000000000000000000000000000","logs":[{"address":"0xcd85b9a767ef2277e264a4b9a14a2deacab82ffb","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000d9d9a0b2df3c8151f9e8277bb91d2c58f36a17dc","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79"],"data":"0x00000000000000000000000000000000000000000000003b4f064fa01ee3e1c2","blockNumber":"0x4c4b40","transactionHash":"0x0d7bc25069a4694ba7707cb9b82b594ff0baf87d08caab72a5ca0da0c7d5404e","transactionIndex":"0x2d","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x65","removed":false}],"transactionHash":"0x0d7bc25069a4694ba7707cb9b82b594ff0baf87d08caab72a5ca0da0c7d5404e","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xb4ec","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2d"} diff --git a/common/ethereum/testdata/receipt_46.json b/common/ethereum/testdata/receipt_46.json new file mode 100644 index 0000000000..eaffb8dd1a --- /dev/null +++ b/common/ethereum/testdata/receipt_46.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6c3360","logsBloom":"0x00000000000000000000040000000000001000000000000000000000000200000000000000000000000000000000000000000000000000000000000000200000000000000020000080000000000000000001000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000040000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000010000100000000000000000000000000000000000000000000000010000000000000000000008000000000000000000000000000000000000000","logs":[{"address":"0x4820416cf02094ac6b9c253f64777516713330f4","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x0000000000000000000000008692d7158013a91c883744dd3a8bd2b1778a9c3a","0x0000000000000000000000000bcb9ea12d0b02d846fb8bbb8763ec8efecb4c79","0x000000000000000000000000000000000000000000000000000000000002dfce"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0x73c15d796d3cd5568aefe7390896510d06b22580ede6435ec59a8592ef17777f","transactionIndex":"0x2e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x66","removed":false}],"transactionHash":"0x73c15d796d3cd5568aefe7390896510d06b22580ede6435ec59a8592ef17777f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xbec4","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2e"} diff --git a/common/ethereum/testdata/receipt_47.json b/common/ethereum/testdata/receipt_47.json new file mode 100644 index 0000000000..1e45ffeff7 --- /dev/null +++ b/common/ethereum/testdata/receipt_47.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6c8568","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x147e38e7596c9d06167094115f25ce0b42d6ad8aa4056578c8801cf185eca05a","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x2f"} diff --git a/common/ethereum/testdata/receipt_48.json b/common/ethereum/testdata/receipt_48.json new file mode 100644 index 0000000000..b6f2a9c17a --- /dev/null +++ b/common/ethereum/testdata/receipt_48.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6cd770","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x24cddb57bd27af388b7a066cb6d6501781e1a1172c02604de1b18da9a0299c8a","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x30"} diff --git a/common/ethereum/testdata/receipt_49.json b/common/ethereum/testdata/receipt_49.json new file mode 100644 index 0000000000..cb541648d4 --- /dev/null +++ b/common/ethereum/testdata/receipt_49.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6d2978","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x41f577d5d7af7fe8ab2ffbddc55d1a215a6bfc8f8a17b2411a6420f7e5974b5e","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x31"} diff --git a/common/ethereum/testdata/receipt_5.json b/common/ethereum/testdata/receipt_5.json new file mode 100644 index 0000000000..b31ecbb1d2 --- /dev/null +++ b/common/ethereum/testdata/receipt_5.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x1f74d2","logsBloom":"0x00000000000000000000000000000000000000000010000000000000200000000000000000000001000000000000000000000000000002000000000000200000000000000000000000000008000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000010000000000000000000000000000000000800000000004000000000000000000000000000020000200000000000000000000000000000000000000000200000000000000000000002000000000000000000000000000000000000000000000000000000080050000000000000000000000000000000000000000000000000020000000000","logs":[{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x0000000000000000000000003b54910405994ca0959fc0630df297ffda1b8814","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x0000000000000000000000000000000000000000000000000000000000000000","blockNumber":"0x4c4b40","transactionHash":"0xc3e30fc09f87349b9f053aed25a3d436ee781d20a8b6af749e8f17453d09cef0","transactionIndex":"0x5","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x3","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000003b54910405994ca0959fc0630df297ffda1b8814","0x000000000000000000000000fc3a42641cfbd700c6adacc14419418d4d2bbd02"],"data":"0x000000000000000000000000000000000000000000000000000000012a05f200","blockNumber":"0x4c4b40","transactionHash":"0xc3e30fc09f87349b9f053aed25a3d436ee781d20a8b6af749e8f17453d09cef0","transactionIndex":"0x5","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x4","removed":false}],"transactionHash":"0xc3e30fc09f87349b9f053aed25a3d436ee781d20a8b6af749e8f17453d09cef0","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x2053b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x5"} diff --git a/common/ethereum/testdata/receipt_50.json b/common/ethereum/testdata/receipt_50.json new file mode 100644 index 0000000000..fe5108d772 --- /dev/null +++ b/common/ethereum/testdata/receipt_50.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x6d7b80","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x2f45384a6bc3d99b5679dd9384a5e74003832a1995ce8a3cf16468ed71620ff9","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x32"} diff --git a/common/ethereum/testdata/receipt_51.json b/common/ethereum/testdata/receipt_51.json new file mode 100644 index 0000000000..1f3c381843 --- /dev/null +++ b/common/ethereum/testdata/receipt_51.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x7ce781","logsBloom":"0x00000080008001020000000002200000000000000020001000000000000001800000000000000000400080100000000000000080100000a000000000000c02000041000000000010000040000000000000000004000400081400000000000040100822000000000000800000200002000002000000000000000100000400000000000000004000400000290000104000000000000000000008000000000c0005100040000000010000020000000000800000200010000000010000000400000080008000000000000000000000010000010000000000000020000000000044000080000000000000001000000000000000000000002280000000000000000100","logs":[{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xd93fde3ea1bb11dcd7a4e66320a05fc5aa63983b6447eff660084c4b1b1b499b","0x00000000000000000000000000000000000000000000000000000000001f18f2"],"data":"0x312460061832396926f53581881aaeadba99b2a079de87e04d81c8cb644e2939476b1be33efa95336fd1e0de90002ef92d584e3b17ccfd64f15b2fd25c7c282f14a81e098c4e273814155a503afceaef0f183979b84596c406d38bf9b5fbe6a40000000000000000000000002909db987aa74120a15f743197c58be1b8d5e83b","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x67","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000004ff7646c6a4ae1066293e89d0a131f1e9bd79a5c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119100000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x68","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1191","0x0000000000000000000000004ff7646c6a4ae1066293e89d0a131f1e9bd79a5c"],"data":"0x93be6efc35fd0c9ac63e24637dfd103b7a9246d2433fccf6e9b38557d79b6830","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x69","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000d82d06140448e2c9b3cb155565de540d23fd2314"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119200000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6a","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1192","0x000000000000000000000000d82d06140448e2c9b3cb155565de540d23fd2314"],"data":"0xa0416bd3ed64a95a1b83d7e7c57bc88a479b229ca2e4220e2f2327e103036ad6","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6b","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000007687911165c543a3739f2d61e66dcb26780052c3"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119300000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6c","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1193","0x0000000000000000000000007687911165c543a3739f2d61e66dcb26780052c3"],"data":"0x7cacd5f7b4953a0a444a98ea44c026c28faf55893c81f6d5260051bf3cf6ce63","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6d","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1194","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x2f8dd96616e66fe32ea0b282de94cde58d06b8989bd0442a11f8e8000cb1364c","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6e","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b728c9c584cd54576c5cfe0bd7d8ee3daa4388f1"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119500000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6f","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1195","0x000000000000000000000000b728c9c584cd54576c5cfe0bd7d8ee3daa4388f1"],"data":"0x1727bd4e5d76f9cc06cf2622ee9e533d9d774bc03169987e2aadce4648604039","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x70","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000719111e1f2bb1b51d77a88b791fdf3d4d3ed8f89"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119600000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x71","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1196","0x000000000000000000000000719111e1f2bb1b51d77a88b791fdf3d4d3ed8f89"],"data":"0x4e336c6da1ddf75f85ca84815c9e7f955a98d335ac6831132adef6d8b2c356dc","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x72","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119700000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x73","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1197","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0xae2596ab35c02f99e3c14a37c15d39216e6fc760a20dea7bb309a235022e0873","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x74","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000ebba619b42f68feb007957f42915b8d012b1ad0a"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119800000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x75","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1198","0x000000000000000000000000ebba619b42f68feb007957f42915b8d012b1ad0a"],"data":"0x54e809d87c33f78758adde12e23451b1d220b16b33fead47f8f6111a73701dbe","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x76","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119900000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x77","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f1199","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0xd22f24112fb5d82d390e471e71227c3d97b363bf57f6f23bc6d1229c3784a904","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x78","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000009dff7476d17c43fc7b33d4ff7637a9b63dc228cb"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119a00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x79","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119a","0x0000000000000000000000009dff7476d17c43fc7b33d4ff7637a9b63dc228cb"],"data":"0x959e281de73b8814208b8bedc56f11f70c11295c09d729c5a95debd5b91c666a","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7a","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0x004ce985b8852a486571d0545799251fd671adcf33b7854a5f0f6a6a2431a555","0x00000000000000000000000000000000000000000000000000000000001f119a"],"data":"0x959e281de73b8814208b8bedc56f11f70c11295c09d729c5a95debd5b91c666a94cc38d7aefa979d76980c5ecb60d01dc69c354f32600d81aa14dd00b7012fee","blockNumber":"0x4c4b40","transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","transactionIndex":"0x33","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7b","removed":false}],"transactionHash":"0x4d1e80658624d26d22e923739e300f77612a5052172a6ea48cb79376689bafb1","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf6c01","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x33"} diff --git a/common/ethereum/testdata/receipt_52.json b/common/ethereum/testdata/receipt_52.json new file mode 100644 index 0000000000..bed02a3e3d --- /dev/null +++ b/common/ethereum/testdata/receipt_52.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0x7d3989","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xd4f86b1f1bd8ac8070340e1636c33503a0b210c42a16e57d1184e33182387804","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x34"} diff --git a/common/ethereum/testdata/receipt_53.json b/common/ethereum/testdata/receipt_53.json new file mode 100644 index 0000000000..136062e4fa --- /dev/null +++ b/common/ethereum/testdata/receipt_53.json @@ -0,0 +1 @@ +{"root":"0x","status":"0x1","cumulativeGasUsed":"0x7d8b91","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x74030b16aaa16512564f4f07d9d12ce173acc22724975fdb88ebf4d12f9ef5aa","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5208","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x35"} diff --git a/common/ethereum/testdata/receipt_54.json b/common/ethereum/testdata/receipt_54.json new file mode 100644 index 0000000000..85b4a28b50 --- /dev/null +++ b/common/ethereum/testdata/receipt_54.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x7e8551","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x62d5949da691f0bbfbf7ac4401f2485c8bfe6eb3f2d80433be7f4d2408bfb5f7","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf9c0","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x36"} diff --git a/common/ethereum/testdata/receipt_55.json b/common/ethereum/testdata/receipt_55.json new file mode 100644 index 0000000000..dd29770b97 --- /dev/null +++ b/common/ethereum/testdata/receipt_55.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x7fd887","logsBloom":"0x00000000000040000000000801000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000002000000000000000010000000000000000000000000000000000000000200000000000000000000000000000000000000004000000000800000000000000000010000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000400000000000000000000000100","logs":[{"address":"0x438dd5572b7d075e6c019c01068866f785c28066","topics":["0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2","0xe06151218f6fb7d5220bbe278ccac2470a21094b6697aaeb33a6fc5211624f87","0x000000000000000000000000000000000000000000000000000000000000037b","0x0000000000000000000000000000000000000000000000000000000000027330"],"data":"0x000000000000000000000000000000000000000000000000000000006592aed4","blockNumber":"0x4c4b40","transactionHash":"0x92218e35f6b90b6de65099e553106bc39d84f35bae615bf6f3b75f12e8ce6e40","transactionIndex":"0x37","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7c","removed":false}],"transactionHash":"0x92218e35f6b90b6de65099e553106bc39d84f35bae615bf6f3b75f12e8ce6e40","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x15336","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x37"} diff --git a/common/ethereum/testdata/receipt_56.json b/common/ethereum/testdata/receipt_56.json new file mode 100644 index 0000000000..3fba0eaacd --- /dev/null +++ b/common/ethereum/testdata/receipt_56.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x816426","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000040000000000000400008000000000000000000000000000000000000000000000000000000040000000000000000004000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000200000000000000000000000000000000000000004040000000800000000000000000000000000000000000000000000000000000000000000000000000000000400000000040000000000000000000000000400000000000008000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x3883d42e90b204f5a5e2f072f414e68c2c944698","topics":["0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2","0x48e301fda2ab52899cb8ae5e81c92b0e2ddb0bba87a05da35db483f1e0f9de93","0x0000000000000000000000000000000000000000000000000000000000001384","0x000000000000000000000000000000000000000000000000000000000007b5f8"],"data":"0x000000000000000000000000000000000000000000000000000000006592aed4","blockNumber":"0x4c4b40","transactionHash":"0x6b4046b9e8b1089ecaed3c8e64a49e43b2aa24ae5565d0c6a8cfbd43915883ac","transactionIndex":"0x38","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7d","removed":false}],"transactionHash":"0x6b4046b9e8b1089ecaed3c8e64a49e43b2aa24ae5565d0c6a8cfbd43915883ac","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x18b9f","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x38"} diff --git a/common/ethereum/testdata/receipt_57.json b/common/ethereum/testdata/receipt_57.json new file mode 100644 index 0000000000..8af50720dc --- /dev/null +++ b/common/ethereum/testdata/receipt_57.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x81cc4e","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x4e805d0fa8f16e4eefe503535cb4b8749cc1c909f3ba20a58730b530a80360c7","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x6828","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x39"} diff --git a/common/ethereum/testdata/receipt_58.json b/common/ethereum/testdata/receipt_58.json new file mode 100644 index 0000000000..9f20778ae0 --- /dev/null +++ b/common/ethereum/testdata/receipt_58.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x831f84","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000002000000000140000000000000000002000000000000000000000000000000000000000000008200000000000000000000080000000000000000000000000200200000000000000000000400000000000000004000000000800000000000000000000000000000000000000000000000000000000000000000000000000200004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0x5f4a0588d91de64a046de7f6892739d5d98258c2","topics":["0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2","0x9683c4f5af49b5eddec3e3338f99ade22f3d2f9fd71ce0fc0f4ff73a7e142938","0x0000000000000000000000000000000000000000000000000000000000000653","0x0000000000000000000000000000000000000000000000000000000000047310"],"data":"0x000000000000000000000000000000000000000000000000000000006592aed4","blockNumber":"0x4c4b40","transactionHash":"0xd520fd686c093833422c83fe7ebacd52aee33cdb32a18fe783e12bd50e4ee58f","transactionIndex":"0x3a","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7e","removed":false}],"transactionHash":"0xd520fd686c093833422c83fe7ebacd52aee33cdb32a18fe783e12bd50e4ee58f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x15336","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3a"} diff --git a/common/ethereum/testdata/receipt_59.json b/common/ethereum/testdata/receipt_59.json new file mode 100644 index 0000000000..915a1945b4 --- /dev/null +++ b/common/ethereum/testdata/receipt_59.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x8490ce","logsBloom":"0x00000000000000000000000010000200000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000100000000000040000000000000000000000000000000000000000000000000000800000000002000000000000000000000040000000000001000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000020000000000000000000000000000100000010000000000000000000000000000000000000000004000000000000004000020000000000000000000800000000000000000000","logs":[{"address":"0x1f72ebfc1763ca349346dc39de591d822b0ce931","topics":["0x33e849cb0fec1c09717acb97b31d5c785c809f0b281858ddae6dcbc17ded5b9d"],"data":"0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000b457468657242726964676500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000aa36a70000000000000000000000000000000000000000000000000000000000000080000000000000000000000000b048bf4f0ebc0fb3408477f7fe37ccd90ad1abf6d568e6ad9e6eeb17631b191db123d54e073c38fe890fc81372e16f203ecc94ea0000000000000000000000000000000000000000000000000000000000e4e1c0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000e00","blockNumber":"0x4c4b40","transactionHash":"0x43bb11273961d2da6862da5b4010edfc17697c300a2d362d80b3eb9acf089509","transactionIndex":"0x3b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7f","removed":false},{"address":"0x7c9e161ebe55000a3220f972058fb83273653a6e","topics":["0xcc9c1a7566adfa8bdc9f7a63a106576fec355c6b4f61ce07baad45eaa30560c3","0x000000000000000000000000b048bf4f0ebc0fb3408477f7fe37ccd90ad1abf6","0xd568e6ad9e6eeb17631b191db123d54e073c38fe890fc81372e16f203ecc94ea"],"data":"0x00000000000000000000000000000000000000000000000000354a6ba7a18000000000000000000000000000000000000000000000000000000000174876e800","blockNumber":"0x4c4b40","transactionHash":"0x43bb11273961d2da6862da5b4010edfc17697c300a2d362d80b3eb9acf089509","transactionIndex":"0x3b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x80","removed":false}],"transactionHash":"0x43bb11273961d2da6862da5b4010edfc17697c300a2d362d80b3eb9acf089509","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1714a","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3b"} diff --git a/common/ethereum/testdata/receipt_6.json b/common/ethereum/testdata/receipt_6.json new file mode 100644 index 0000000000..33ae9811e0 --- /dev/null +++ b/common/ethereum/testdata/receipt_6.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x218cb5","logsBloom":"0x00000000000000000000000000000000000000000000000000000000001000000000000000000001000000000000000000000000000002000000000000200000000000000000000000000008000000000000000000000000000000000000000000000000000000108000400000000000000000000000000000000010000000000000000080000000000000000800000000000000000000000000000000000000020000000000000000000000000000000000000000000000202000000000000000000002000000000000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000020000000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x0000000000000000000000008d98c42071882edeb8b9031b62d629ddce69afa4","0x000000000000000000000000321ce961084fcf3a56de4be2f2006707a0421aa4"],"data":"0x0000000000000000000000000000000000000000000000000000000230489e00","blockNumber":"0x4c4b40","transactionHash":"0x12268df277776abf849ed79df114ff4f72a705b491fa518f7e97f82f404aee19","transactionIndex":"0x6","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x5","removed":false},{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000008d98c42071882edeb8b9031b62d629ddce69afa4","0x000000000000000000000000fc3a42641cfbd700c6adacc14419418d4d2bbd02"],"data":"0x0000000000000000000000000000000000000000000000000000000023c34600","blockNumber":"0x4c4b40","transactionHash":"0x12268df277776abf849ed79df114ff4f72a705b491fa518f7e97f82f404aee19","transactionIndex":"0x6","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x6","removed":false}],"transactionHash":"0x12268df277776abf849ed79df114ff4f72a705b491fa518f7e97f82f404aee19","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x217e3","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x6"} diff --git a/common/ethereum/testdata/receipt_60.json b/common/ethereum/testdata/receipt_60.json new file mode 100644 index 0000000000..7e8b58b5f6 --- /dev/null +++ b/common/ethereum/testdata/receipt_60.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x850d0a","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x795226463e22b90a6938e7329cc5cd4009e4d68d6b141ca0a29094bd92e8b715","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x7c3c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3c"} diff --git a/common/ethereum/testdata/receipt_61.json b/common/ethereum/testdata/receipt_61.json new file mode 100644 index 0000000000..27a701104b --- /dev/null +++ b/common/ethereum/testdata/receipt_61.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0x8c4601","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x1bf6486a048a2a2ba8fba9be33cbd4ad5bd1e14af4fd69607b9e7fe77755ed3e","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x738f7","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3d"} diff --git a/common/ethereum/testdata/receipt_62.json b/common/ethereum/testdata/receipt_62.json new file mode 100644 index 0000000000..0a7e00ce74 --- /dev/null +++ b/common/ethereum/testdata/receipt_62.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x9bc42c","logsBloom":"0x0000004041000000010000000000000000000000002000100000000000000000000400000000000008200000000000000000000100000400000000000024000000000000000000000000400c0080000204000000400400000c0200080000024080000000000000000000000000020500040004020000000040000000000000000000010000000000000009048010400000000000000000000800000000000005100000200000010800000000000000000000200030000002000000024400000000000000800000002800002100400010040000010000000000002000000040000084000000040000000001000000000000400000000000080014400000100000","logs":[{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xd93fde3ea1bb11dcd7a4e66320a05fc5aa63983b6447eff660084c4b1b1b499b","0x00000000000000000000000000000000000000000000000000000000001f1b0c"],"data":"0xf499cfd8b9ed8d9e36c14009e13711edd65fa9137775f1f9d6174a5e57d7ed491612d5f030fbe2c4466e35c2adc08845f627f7397c40d6de1c08368f956305e9abcaf7214d0c360f43f882ab6146c37b2a806ea7224b5f19f467d7b0aa834dff00000000000000000000000083efd3ee9278cc7800e93e7f9a14607f5c331b3e","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x81","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x00000000000000000000000076ed71a8192a7a750935bb853e45e84cf11d86e6"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119b00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x82","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119b","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0xb62cf13805fbb04b4d2b410fc9e7c060d6a6a8b424c9a87e776d4e9c5e64b7c6","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x83","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119c","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0xc666c2c001db40d531a00ee427680af0894088dfaf82f3a8fca9f46aa81c626e","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x84","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000c0e85a8358151c61afd821138d20999871a21710"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119d00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x85","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119d","0x000000000000000000000000c0e85a8358151c61afd821138d20999871a21710"],"data":"0x1500b4f03b2678b296d96cd65d4603b075482979ae70ccac6e994fb30d6d70c1","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x86","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000000fb12735757d2bc87964c32f261f018e2ee17d83"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119e00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x87","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119e","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0xa6fe70c62b44e2f6725fc9fa25753534a326bf4260ac2b6f9d70e1f7a53cbe0a","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x88","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000567fc66442440bc502fc8d00bd79d64c846bf2fa"],"data":"0x00000000000000000000000000000000000000000000000000000000001f119f00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x89","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f119f","0x000000000000000000000000567fc66442440bc502fc8d00bd79d64c846bf2fa"],"data":"0x84e0378c6846c3089c6d6381f902a06bf07922df53bee7b6cf296c103961c741","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8a","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000ee3348f93f9994a0c6c9fc222edf2818ef782af9"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a000000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8b","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a0","0x000000000000000000000000ee3348f93f9994a0c6c9fc222edf2818ef782af9"],"data":"0x84fb5a4e026ec8d55e27f84e451a83fac8fe9c55814fe8a6d76deda387d89042","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8c","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000007a5af7609effff6692d44185198289b70cebbb9a"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a100000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8d","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a1","0x0000000000000000000000007a5af7609effff6692d44185198289b70cebbb9a"],"data":"0xa9c551a1fc81e12c5f864258e44094595aee3dc6ed57719ed01673ba4ccf6f08","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8e","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x00000000000000000000000025973b0141569fe24e32daecb93e0edd14643e64"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a200000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8f","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a2","0x00000000000000000000000025973b0141569fe24e32daecb93e0edd14643e64"],"data":"0x819fed5127441feed0e4f984dd81fea3dda87edfd9388bc7a537223a85925098","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x90","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a300000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x91","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a3","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x50d304216d5b38e96b24fc9429253ba45e9a23c5734bbc83f1b5e06066a080c9","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x92","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000004525d7f7903dec45e4aca90add32cea143448c74"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a400000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x93","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a4","0x0000000000000000000000004525d7f7903dec45e4aca90add32cea143448c74"],"data":"0xcfd655a851f59bbcdf984962eceb73b39df3260351ae715f7a78eab0d4783c84","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x94","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0x004ce985b8852a486571d0545799251fd671adcf33b7854a5f0f6a6a2431a555","0x00000000000000000000000000000000000000000000000000000000001f11a4"],"data":"0xcfd655a851f59bbcdf984962eceb73b39df3260351ae715f7a78eab0d4783c8494cc38d7aefa979d76980c5ecb60d01dc69c354f32600d81aa14dd00b7012fee","blockNumber":"0x4c4b40","transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","transactionIndex":"0x3e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x95","removed":false}],"transactionHash":"0x6c525448f5d4bd2483992b845f0b76e617edea62b7e56703d4a4beadb77f65ac","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf7e2b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3e"} diff --git a/common/ethereum/testdata/receipt_63.json b/common/ethereum/testdata/receipt_63.json new file mode 100644 index 0000000000..958ca14cce --- /dev/null +++ b/common/ethereum/testdata/receipt_63.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x9cbd30","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xe8846e616cba0be9290b702bac7d8a97541391020dea68bcfb360c4f1567ccb1","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf904","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x3f"} diff --git a/common/ethereum/testdata/receipt_64.json b/common/ethereum/testdata/receipt_64.json new file mode 100644 index 0000000000..ed1626202a --- /dev/null +++ b/common/ethereum/testdata/receipt_64.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x9db464","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xaac7a255947ca82219c97fbf516e98361397343879e13a2d8fe10589bfeebb81","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf734","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x40"} diff --git a/common/ethereum/testdata/receipt_65.json b/common/ethereum/testdata/receipt_65.json new file mode 100644 index 0000000000..3e9b9ff5d1 --- /dev/null +++ b/common/ethereum/testdata/receipt_65.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0xa48f1e","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x044bed07204631cbc0e04f5c50ce76b1fb4d7bf6c6a181b40692429aa0b7828d","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x6daba","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x41"} diff --git a/common/ethereum/testdata/receipt_66.json b/common/ethereum/testdata/receipt_66.json new file mode 100644 index 0000000000..4a3d72a48e --- /dev/null +++ b/common/ethereum/testdata/receipt_66.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0xabbd94","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x02d8f98382fd5fd460c1f8f67056ff8d73bea1dadc26864bd8e29753d4792d40","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x72e76","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x42"} diff --git a/common/ethereum/testdata/receipt_67.json b/common/ethereum/testdata/receipt_67.json new file mode 100644 index 0000000000..f8bfecf307 --- /dev/null +++ b/common/ethereum/testdata/receipt_67.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0xb342df","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xc7ee1b7c8184e52c4f3be8c8d6208be5a5b176144fd613a519d21debd19c9e82","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x7854b","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x43"} diff --git a/common/ethereum/testdata/receipt_68.json b/common/ethereum/testdata/receipt_68.json new file mode 100644 index 0000000000..ba0bda1bea --- /dev/null +++ b/common/ethereum/testdata/receipt_68.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xb49609","logsBloom":"0x00000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000400000000000000000000000000020000000000000000000000000000000200000000000000002000000000000000000300004000000000804000000200000000000000800000000000000000000000000000000000000010000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000","logs":[{"address":"0xd1275ff1bc4c97637d2171ae48d1875ce6b5cfb6","topics":["0xa7aaf2512769da4e444e3de247be2564225c2e7a8f74cfe528e46e17d24868e2","0x5b9c162bd059f9c5b1f7503315dfac3402fca5d71e567db11c28d60da8a4c11a","0x000000000000000000000000000000000000000000000000000000000000019b","0x000000000000000000000000000000000000000000000000000000000000c120"],"data":"0x000000000000000000000000000000000000000000000000000000006592aed4","blockNumber":"0x4c4b40","transactionHash":"0x676d0be9c2b9dab79699499af03b5391d9bde2d152291c0df873cd48f86b7f4f","transactionIndex":"0x44","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x96","removed":false}],"transactionHash":"0x676d0be9c2b9dab79699499af03b5391d9bde2d152291c0df873cd48f86b7f4f","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x1532a","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x44"} diff --git a/common/ethereum/testdata/receipt_69.json b/common/ethereum/testdata/receipt_69.json new file mode 100644 index 0000000000..61d77beff0 --- /dev/null +++ b/common/ethereum/testdata/receipt_69.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xb4fe01","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x9b682546c28a555767ffcea330f96a7f8808af6736e09fdea6bb0d9df62436a2","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x67f8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x45"} diff --git a/common/ethereum/testdata/receipt_7.json b/common/ethereum/testdata/receipt_7.json new file mode 100644 index 0000000000..31930e7ff2 --- /dev/null +++ b/common/ethereum/testdata/receipt_7.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x225826","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000008000000000000000000000000000000000000000000000008020004000000000000000800000004000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000008000000000000000","logs":[{"address":"0x4873528341d33ec918c7465f244491acb75bc95f","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000e731026174a82200e3973d3323854fc8b97e11bc"],"data":"0x00000000000000000000000000000000000000000000003635c9adc5dea00000","blockNumber":"0x4c4b40","transactionHash":"0xb53c33cf5720c48df3aab15aae1c33feb2c6fb9a389586201eff9186c291e983","transactionIndex":"0x7","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x7","removed":false}],"transactionHash":"0xb53c33cf5720c48df3aab15aae1c33feb2c6fb9a389586201eff9186c291e983","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xcb71","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x7"} diff --git a/common/ethereum/testdata/receipt_70.json b/common/ethereum/testdata/receipt_70.json new file mode 100644 index 0000000000..22346aaf2d --- /dev/null +++ b/common/ethereum/testdata/receipt_70.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xbc4dda","logsBloom":"0x00000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000800000000000000000040000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000001000000000000000000000000000000000004000000000000000000000000400000","logs":[{"address":"0x5293bb897db0b64ffd11e0194984e8c5f1f06178","topics":["0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c","0x74f8c21c8faea142881d4bf24d4ea380008a2d40b5f25d33c4d3ba1a0a48487c"],"data":"0x00000000000000000000000000000000000000000000000000000000000000020000000000000000000000003e6f70d19b931503b98b5147da59ecc6dddcfb26","blockNumber":"0x4c4b40","transactionHash":"0x0b4d1a3c9bc5a6c99c810a278609194364dc694e8c05b7de62143fb7f0f45fbc","transactionIndex":"0x46","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x97","removed":false}],"transactionHash":"0x0b4d1a3c9bc5a6c99c810a278609194364dc694e8c05b7de62143fb7f0f45fbc","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x74fd9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x46"} diff --git a/common/ethereum/testdata/receipt_71.json b/common/ethereum/testdata/receipt_71.json new file mode 100644 index 0000000000..cea4deb907 --- /dev/null +++ b/common/ethereum/testdata/receipt_71.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xc32e2d","logsBloom":"0x10000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000004000000000000000000000000400000","logs":[{"address":"0x5293bb897db0b64ffd11e0194984e8c5f1f06178","topics":["0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c","0xdce04c1838a9d1a59fbb06091925ff5007cc5cb4c2bebbd3f04b09f693e8b9f0"],"data":"0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000045f1a95d617b5f90c601e52cb244acbb750ec450","blockNumber":"0x4c4b40","transactionHash":"0x59b7585f9481f9b64a3cb8dd3871b341c238da9091abe6e58a9722f9bf1524b3","transactionIndex":"0x47","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x98","removed":false}],"transactionHash":"0x59b7585f9481f9b64a3cb8dd3871b341c238da9091abe6e58a9722f9bf1524b3","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x6e053","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x47"} diff --git a/common/ethereum/testdata/receipt_72.json b/common/ethereum/testdata/receipt_72.json new file mode 100644 index 0000000000..61ca29f836 --- /dev/null +++ b/common/ethereum/testdata/receipt_72.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xcbe969","logsBloom":"0x00000000080000001000000001000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000008080000000000000000000000000000000000000400000000020000000000000000000800000000000010004000000010000000040000000000000000000000000000000000000000000000000000000000000000008000000000000000000040000000001000000000000000000000008000000000000002000000000000000000000000000000000000000000000000284021000200000000000000000000000000400004000000000000000000000000400000","logs":[{"address":"0x75f94f04d2144cb6056ccd0cff1771573d838974","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000b40347bee82679b88028a9eb9684c2a937c1734"],"data":"0x00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0xe03e4070980c60bffd134939a59342dcb48645811d2cd3b55a1889798d08e7cd","transactionIndex":"0x48","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x99","removed":false},{"address":"0x9f1a34a0e4f6c77c3648c4d9e922da615c64d194","topics":["0x883b72735ca0ee2cdd2a462a393658b1a0b36ebd8756e4c22b7509a92ff86a02","0xf583400d9a33583fb139291c5101987af10a1f42b4649d51980c8e5d6fb983e3","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000b40347bee82679b88028a9eb9684c2a937c1734"],"data":"0x0000000000000000000000000000000000000000000000000000000000028c5f00000000000000000000000075f94f04d2144cb6056ccd0cff1771573d83897400000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0xe03e4070980c60bffd134939a59342dcb48645811d2cd3b55a1889798d08e7cd","transactionIndex":"0x48","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9a","removed":false},{"address":"0x5293bb897db0b64ffd11e0194984e8c5f1f06178","topics":["0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c","0xf583400d9a33583fb139291c5101987af10a1f42b4649d51980c8e5d6fb983e3"],"data":"0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000045f1a95d617b5f90c601e52cb244acbb750ec450","blockNumber":"0x4c4b40","transactionHash":"0xe03e4070980c60bffd134939a59342dcb48645811d2cd3b55a1889798d08e7cd","transactionIndex":"0x48","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9b","removed":false}],"transactionHash":"0xe03e4070980c60bffd134939a59342dcb48645811d2cd3b55a1889798d08e7cd","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x8bb3c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x48"} diff --git a/common/ethereum/testdata/receipt_73.json b/common/ethereum/testdata/receipt_73.json new file mode 100644 index 0000000000..67fa9790e0 --- /dev/null +++ b/common/ethereum/testdata/receipt_73.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0xd1ffeb","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x65dbe42a0b7f404a7f018e83937c3994f1562ba47e51c8ba3d14f0c6c2ae27b6","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x61682","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x49"} diff --git a/common/ethereum/testdata/receipt_74.json b/common/ethereum/testdata/receipt_74.json new file mode 100644 index 0000000000..c06cdd5e87 --- /dev/null +++ b/common/ethereum/testdata/receipt_74.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xd25e17","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x65dfe40af92c848183ec0dbf2aee80081793ed739add50605dddafe2e8b66431","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5e2c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4a"} diff --git a/common/ethereum/testdata/receipt_75.json b/common/ethereum/testdata/receipt_75.json new file mode 100644 index 0000000000..47b02f9a13 --- /dev/null +++ b/common/ethereum/testdata/receipt_75.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xd352df","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x0c5af703290a5be4b4eaef9bbf9078536155af65ccbc75d17511c92b7ad79e3c","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf4c8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4b"} diff --git a/common/ethereum/testdata/receipt_76.json b/common/ethereum/testdata/receipt_76.json new file mode 100644 index 0000000000..4357ba0f65 --- /dev/null +++ b/common/ethereum/testdata/receipt_76.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xd3abf3","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xeea766c55f74bd6d6ac66c3805890cde402fa3d9dda369a096e42d519a950c6d","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x5914","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4c"} diff --git a/common/ethereum/testdata/receipt_77.json b/common/ethereum/testdata/receipt_77.json new file mode 100644 index 0000000000..f49026f237 --- /dev/null +++ b/common/ethereum/testdata/receipt_77.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xd413ef","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0xdd127227ec9beb79d1b2aba445e942d8274a0c58f7b73ee0e76233a632581ef4","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x67fc","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4d"} diff --git a/common/ethereum/testdata/receipt_78.json b/common/ethereum/testdata/receipt_78.json new file mode 100644 index 0000000000..eeb929fb22 --- /dev/null +++ b/common/ethereum/testdata/receipt_78.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xe3adc8","logsBloom":"0x00400000000000000000400000000000000000008020001001000020000004000000400000800408000000000000000000000000000400000000000000040002000000000000200200104010000000000000c00000040000140040040000004020800000000000000000400000000800802000000000000000000000000001002000000000000000300009000810400000008000010000000800000001000005100000000000014000000000000000400000200010000000080000000400010000080008000040000000000002100000000000000080000000000000000040400080000000000000000010000000000800000000100000000000000004800000","logs":[{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xd93fde3ea1bb11dcd7a4e66320a05fc5aa63983b6447eff660084c4b1b1b499b","0x00000000000000000000000000000000000000000000000000000000001f15a7"],"data":"0x3d95d4df946be6afb58557f813d52a3e1bf5b5a1086a4f2e2676827e4f5a8dde15c7565fe9ac1f9a7ebf0e75f335aeaafe0d6889c17a30ca416c1e540b968e2be921fc6a3a30c71fb75e9682ca050339bcf965f1e41b95d22a2552b625632b0e00000000000000000000000055ae9699a3d7b776bde60a58e44e798e2c785663","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9c","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a500000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9d","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a5","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x41736ad68472fd471b6dfa700c171c651848ed3843b467b10578593a3ac71de8","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9e","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000d67284027cf3d51a5c5fb4a32b777531497cea0d"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a600000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9f","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a6","0x000000000000000000000000d67284027cf3d51a5c5fb4a32b777531497cea0d"],"data":"0x7a828794867c335bcc5aa2acd846af037234a250046d7a0df50796c1f3324475","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa0","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000acab7e392b38461521ced3b5bfe5e3163d611ee5"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a700000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa1","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a7","0x000000000000000000000000acab7e392b38461521ced3b5bfe5e3163d611ee5"],"data":"0x49ac64654cd3d173425a0ea7d664fbcd6d9244a8306d14d916d7c1301f438d6a","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa2","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a8","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x9bfc492a8412990d3339a4320824d98a7358584c8c808bf459cac91351a0c1be","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa3","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000ce5ad711f2753346c1f1ebd32e14d0d1291c4259"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11a900000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa4","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11a9","0x000000000000000000000000ce5ad711f2753346c1f1ebd32e14d0d1291c4259"],"data":"0xf4fc0500f6e3db564765ab675cdb3809d37728e271efae2c75a92adcd6756dc1","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa5","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000001f6b52d20c841af1255c886293d10ad0c3281418"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11aa00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa6","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11aa","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x80980d740948a9609dd31547c8c1c2488ae48f4fc5c21e86a9a49420b98d3816","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa7","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000004e48a497541eb7cfc305b01d820d1226c79a15be"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11ab00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa8","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11ab","0x0000000000000000000000004e48a497541eb7cfc305b01d820d1226c79a15be"],"data":"0x58e7cb6d7515c42c501cf29dfa3a42d0763ef3599ff4e6bd93afc755cab0a056","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa9","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11ac00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xaa","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11ac","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x3c57d47a1cdc47fe1087142df4b3db39e7dc8980ac622ad560404ec9cb2748ef","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xab","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x0000000000000000000000002ecf603442da46c412f580a263531376aeb8eec3"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11ad00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xac","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11ad","0x0000000000000000000000002ecf603442da46c412f580a263531376aeb8eec3"],"data":"0xbfbbb619d31906d1e3a63cbf35f2dfb8a4421882c04529130c875fa80a923ad1","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xad","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb14706301de9c688dd040a2ac19fc629179149bb39b0765094ef833e7bd907b2","0x000000000000000000000000b2079986ebeb294b3fa713e9c14b7717ed85873c"],"data":"0x00000000000000000000000000000000000000000000000000000000001f11ae00000000000000000000000000000000000000000000000022b1c8c1227a0000","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xae","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0xb2fa36cea736414fca28c5aca50d94c59d740984c4c878c3dd8ba26791309b1a","0x00000000000000000000000000000000000000000000000000000000001f11ae","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x2391cc9fbe3e96bbd4eccf81f4bfbf32ac622616e71d07274258a5cda9832807","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xaf","removed":false},{"address":"0x95ff8d3ce9dcb7455beb7845143bea84fe5c4f6f","topics":["0x004ce985b8852a486571d0545799251fd671adcf33b7854a5f0f6a6a2431a555","0x00000000000000000000000000000000000000000000000000000000001f11ae"],"data":"0x2391cc9fbe3e96bbd4eccf81f4bfbf32ac622616e71d07274258a5cda983280794cc38d7aefa979d76980c5ecb60d01dc69c354f32600d81aa14dd00b7012fee","blockNumber":"0x4c4b40","transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","transactionIndex":"0x4e","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xb0","removed":false}],"transactionHash":"0x4cf1577b40f7214e6abb765810c14b989a025b89d984516f8de5216a75579786","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0xf99d9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4e"} diff --git a/common/ethereum/testdata/receipt_79.json b/common/ethereum/testdata/receipt_79.json new file mode 100644 index 0000000000..0cc9b3e015 --- /dev/null +++ b/common/ethereum/testdata/receipt_79.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x0","cumulativeGasUsed":"0xe9ca80","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x2814077d8a964ee17856564df2c9902523697f82d1aca79a4ed296186b3c8bc6","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x61cb8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x4f"} diff --git a/common/ethereum/testdata/receipt_8.json b/common/ethereum/testdata/receipt_8.json new file mode 100644 index 0000000000..fc85310025 --- /dev/null +++ b/common/ethereum/testdata/receipt_8.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x28d8d2","logsBloom":"0x000010040000000000000000000000100000000000100000008000080000000000000000000000000000080000000000000000000002000000000000000000001000000200000000000000080000008000000000008000000000000040004000004000000200201080804001000028000000004000000000000000100000000000000000000000000001000008000000000000000000000000000000001000000c00000000a0000040000000000000000000000000008000000000200000000000000003000000000000000000000000000010000000000400000000000020010040000000000000000000000000000000000000000000000000000400000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x8","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x9","removed":false},{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xa","removed":false},{"address":"0x5b41a5c0df16551f5edeaa2b2ede2135f1a824df","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xb","removed":false},{"address":"0xd7b45cbc28ba9ba8653665d5fb37167a2afe35d9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xc","removed":false},{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xd","removed":false},{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xe","removed":false},{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0xf","removed":false},{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x10","removed":false},{"address":"0xc870a3dc444bf970da13979e9cfac1a01c198eac","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x11","removed":false},{"address":"0x837ad475f0177bcb6cf426a725d5d52dfb577ee7","topics":["0x624601b6b2c889f8d24f3b93ec6db534d4c0f2cb51c0087f2d5739679393fa51","0x00000000000000000000000098158dbd4dc0fb8c2d0aa47505e212db016a471f"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","transactionIndex":"0x8","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x12","removed":false}],"transactionHash":"0xe12ca21ecb93c5de1b9223427fc1d1a6673da8f4014fd944df8b311d411b4ad9","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x680ac","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x8"} diff --git a/common/ethereum/testdata/receipt_80.json b/common/ethereum/testdata/receipt_80.json new file mode 100644 index 0000000000..9ac22dc690 --- /dev/null +++ b/common/ethereum/testdata/receipt_80.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0xea329c","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","logs":[],"transactionHash":"0x542fd6cb8f1465444481ae4673add119e7643e58713d3315e2ac12fc5b4bed55","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x681c","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x50"} diff --git a/common/ethereum/testdata/receipt_9.json b/common/ethereum/testdata/receipt_9.json new file mode 100644 index 0000000000..ee0c1e9dbb --- /dev/null +++ b/common/ethereum/testdata/receipt_9.json @@ -0,0 +1 @@ +{"type":"0x2","root":"0x","status":"0x1","cumulativeGasUsed":"0x2f597e","logsBloom":"0x000010040000000000000000000000100000000000140000008000080000000000000200000000000000080000000000000000000002000000000000000000001000000200000000000000080000008000000000008000000000000040004000004000000200001080804001000028000000004000000000000000100000000008000000000000000001000008000000000000000000000000000000000000000c00000000a0000000000000000000000000000000008000000000200000000000000003000000000000000000000000000010000000000400000000000020010040000000000000000000000000000000000000000000000000000400000000","logs":[{"address":"0x08394e7e653472694ecd4527656b2881e5701a14","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x13","removed":false},{"address":"0x63355a2ff725b11b6d82071c9fd710c0dcc71900","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000000000000002540be400","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x14","removed":false},{"address":"0x1cd40deb4196d219097499031922ff690f9ea813","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x15","removed":false},{"address":"0x5b41a5c0df16551f5edeaa2b2ede2135f1a824df","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x16","removed":false},{"address":"0xd7b45cbc28ba9ba8653665d5fb37167a2afe35d9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x17","removed":false},{"address":"0x01fa8deeddea8e4e465f158d93e162438d61c9eb","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x18","removed":false},{"address":"0x11dc5c441971bb3b2e933e0256e8a6bc6c41a91a","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x19","removed":false},{"address":"0xbe1d0db61e7562d88ef1fab7436d02b6d00ce728","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1a","removed":false},{"address":"0xd75edf81cd2109d4264624dbf34bd4dee36f18b9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1b","removed":false},{"address":"0xc870a3dc444bf970da13979e9cfac1a01c198eac","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1c","removed":false},{"address":"0x837ad475f0177bcb6cf426a725d5d52dfb577ee7","topics":["0x624601b6b2c889f8d24f3b93ec6db534d4c0f2cb51c0087f2d5739679393fa51","0x000000000000000000000000bf43c5a5da6c1e6212f4ee2c3176838f1c873e82"],"data":"0x","blockNumber":"0x4c4b40","transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","transactionIndex":"0x9","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","logIndex":"0x1d","removed":false}],"transactionHash":"0xe0715c59ad3003efdf41dba93eb350db4f20a5e6ccbddc311b61f598cdf2d58b","contractAddress":"0x0000000000000000000000000000000000000000","gasUsed":"0x680ac","blockHash":"0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55","blockNumber":"0x4c4b40","transactionIndex":"0x9"} diff --git a/common/headers_test.go b/common/headers_test.go index 2a0ed6bb74..db0bc002d4 100644 --- a/common/headers_test.go +++ b/common/headers_test.go @@ -26,7 +26,7 @@ const numHeadersToTest = 100 func generateHeader() { rpcclient, _ := ethclient.Dial("https://eth.llamarpc.com") header, _ := rpcclient.HeaderByNumber(context.Background(), big.NewInt(18495266)) - file, _ := os.Create("test_data/eth_header_18495266.json") + file, _ := os.Create("testdata/eth_header_18495266.json") b, _ := header.MarshalJSON() file.Write(b) } @@ -35,7 +35,7 @@ func TestTrueEthereumHeader(t *testing.T) { generateHeader() var header ethtypes.Header // read file into a byte slice - file, err := os.Open("./test_data/eth_header_18495266.json") + file, err := os.Open("./testdata/eth_header_18495266.json") require.NoError(t, err) defer file.Close() headerBytes := make([]byte, 4096) @@ -56,7 +56,7 @@ func TestFalseEthereumHeader(t *testing.T) { generateHeader() var header ethtypes.Header // read file into a byte slice - file, err := os.Open("./test_data/eth_header_18495266.json") + file, err := os.Open("./testdata/eth_header_18495266.json") require.NoError(t, err) defer file.Close() headerBytes := make([]byte, 4096) diff --git a/common/proof_test.go b/common/proof_test.go index 0bf1244e80..b6b2173444 100644 --- a/common/proof_test.go +++ b/common/proof_test.go @@ -38,7 +38,7 @@ type Blocks struct { } func LoadTestBlocks(t *testing.T) Blocks { - file, err := os.Open("./test_data/test_blocks.json") + file, err := os.Open("./testdata/test_blocks.json") require.NoError(t, err) defer file.Close() diff --git a/common/test_data/eth_header_18495266.json b/common/testdata/eth_header_18495266.json similarity index 100% rename from common/test_data/eth_header_18495266.json rename to common/testdata/eth_header_18495266.json diff --git a/common/test_data/test_blocks.json b/common/testdata/test_blocks.json similarity index 100% rename from common/test_data/test_blocks.json rename to common/testdata/test_blocks.json diff --git a/contrib/athens3/zetacored/docker-compose.yml b/contrib/athens3/zetacored/docker-compose.yml index 6db48703d2..cee5b695bc 100644 --- a/contrib/athens3/zetacored/docker-compose.yml +++ b/contrib/athens3/zetacored/docker-compose.yml @@ -6,17 +6,15 @@ services: # build: # context: ../../.. # dockerfile: Dockerfile - image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14} + image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1} environment: DAEMON_HOME: "/root/.zetacored" NETWORK: athens3 #RESTORE_TYPE=snapshot/snapshot-archive/statesync - RESTORE_TYPE: "statesync" + RESTORE_TYPE: "snapshot" SNAPSHOT_API: https://snapshots.zetachain.com TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000 - COSMOVISOR_VERSION: "v1.5.0" CHAIN_ID: "athens_7001-1" - COSMOVISOR_CHECKSUM: "626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc" VISOR_NAME: "cosmovisor" DAEMON_NAME: "zetacored" DAEMON_ALLOW_DOWNLOAD_BINARIES: "false" @@ -37,8 +35,8 @@ services: - "9090:9090" - "9091:9091" volumes: - - zetacored_data:/root/.zetacored/ + - zetacored_data_athens3:/root/.zetacored/ entrypoint: bash /scripts/start.sh volumes: - zetacored_data: + zetacored_data_athens3: diff --git a/contrib/docker-scripts/start.sh b/contrib/docker-scripts/start.sh index e235bc30ce..d60f131c2c 100644 --- a/contrib/docker-scripts/start.sh +++ b/contrib/docker-scripts/start.sh @@ -4,6 +4,49 @@ logt() { echo "$(date '+%Y-%m-%d %H:%M:%S') $1" } + +function load_defaults { + #DEFAULT: Mainnet Statesync. + export DAEMON_HOME=${DAEMON_HOME:=/root/.zetacored} + export NETWORK=${NETWORK:=mainnet} + export RESTORE_TYPE=${RESTORE_TYPE:=statesync} + export SNAPSHOT_API=${SNAPSHOT_API:=https://snapshots.zetachain.com} + export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:=40000} + export COSMOVISOR_VERSION=${COSMOVISOR_VERSION:=v1.5.0} + export CHAIN_ID=${CHAIN_ID:=zetachain_7000-1} + export COSMOVISOR_CHECKSUM=${COSMOVISOR_CHECKSUM:=626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc} + export VISOR_NAME=${VISOR_NAME:=cosmovisor} + export DAEMON_NAME=${DAEMON_NAME:=zetacored} + export DAEMON_ALLOW_DOWNLOAD_BINARIES=${DAEMON_ALLOW_DOWNLOAD_BINARIES:=false} + export DAEMON_RESTART_AFTER_UPGRADE=${DAEMON_RESTART_AFTER_UPGRADE:=true} + export UNSAFE_SKIP_BACKUP=${UNSAFE_SKIP_BACKUP:=true} + export CLIENT_DAEMON_NAME=${CLIENT_DAEMON_NAME:=zetaclientd} + export CLIENT_DAEMON_ARGS=${CLIENT_DAEMON_ARGS:""} + export CLIENT_SKIP_UPGRADE=${CLIENT_SKIP_UPGRADE:=true} + export CLIENT_START_PROCESS=${CLIENT_START_PROCESS:=false} + export MONIKER=${MONIKER:=local-test} + export RE_DO_START_SEQUENCE=${RE_DO_START_SEQUENCE:=false} + + #ATHENS3 + export BINARY_LIST_ATHENS3=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/binary_list.json} + export STATE_SYNC_RPC_NODE_FILE_ATHENS3=${STATE_SYNC_RPC_NODE_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/state_sync_node} + export RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3=${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/rpc_state_sync_nodes} + export APP_TOML_FILE_ATHENS3=${APP_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/app.toml} + export CONFIG_TOML_FILE_ATHENS3=${CONFIG_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/config.toml} + export CLIENT_TOML_FILE_ATHENS3=${CLIENT_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/client.toml} + export GENESIS_FILE_ATHENS3=${GENESIS_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/genesis.json} + + #MAINNET + export BINARY_LIST_MAINNET=${BINARY_LIST_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/binary_list.json} + export STATE_SYNC_RPC_NODE_FILE_MAINNET=${STATE_SYNC_RPC_NODE_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/state_sync_node} + export RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET=${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/rpc_state_sync_nodes} + export APP_TOML_FILE_MAINNET=${APP_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml} + export CONFIG_TOML_FILE_MAINNET=${CONFIG_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml} + export CLIENT_TOML_FILE_MAINNET=${CLIENT_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml} + export GENESIS_FILE_MAINNET=${GENESIS_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json} + +} + function init_chain { if [ -d "${DAEMON_HOME}/config" ]; then logt "${DAEMON_NAME} home directory already initialized." @@ -41,7 +84,7 @@ function download_configs { function setup_restore_type { if [ "${RESTORE_TYPE}" == "statesync" ]; then - logt "Statesync restore. Download state sync rpc address from network-config." + logt "Statesync restore. Download state sync rpc address from network-config" if [ "${NETWORK}" == "mainnet" ]; then logt "MAINNET STATE SYNC" logt "STATE_SYNC_RPC_NODE_FILE_MAINNET: ${STATE_SYNC_RPC_NODE_FILE_MAINNET}" @@ -77,7 +120,7 @@ function setup_restore_type { logt " Cleanup Snapshot" rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} elif [ "${NETWORK}" == "athens3" ]; then - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-snapshot?network=athens3 | jq .latest_snapshot) + SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-snapshot?network=athens3 | jq -r .latest_snapshot) SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}") SNAPSHOT_DIR=$(pwd) logt "Download Snapshot from url: ${SNAPSHOT_URL}" @@ -91,7 +134,7 @@ function setup_restore_type { elif [ "${RESTORE_TYPE}" == "snapshot-archive" ]; then if [ "${NETWORK}" == "mainnet" ]; then logt "Get Latest Snapshot URL" - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=mainnet | jq .latest_snapshot) + SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=mainnet | jq -r .latest_snapshot) SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}") SNAPSHOT_DIR=$(pwd) logt "Download Snapshot from url: ${SNAPSHOT_URL}" @@ -102,7 +145,7 @@ function setup_restore_type { logt " Cleanup Snapshot" rm -rf ${SNAPSHOT_DIR}/${SNAPSHOT_FILENAME} elif [ "${NETWORK}" == "athens3" ]; then - SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=athens3 | jq .latest_snapshot) + SNAPSHOT_URL=$(curl -s ${SNAPSHOT_API}/latest-archive-snapshot?network=athens3 | jq -r .latest_snapshot) SNAPSHOT_FILENAME=$(basename "${SNAPSHOT_URL}") SNAPSHOT_DIR=$(pwd) logt "Download Snapshot from url: ${SNAPSHOT_URL}" @@ -148,6 +191,7 @@ function change_config_values { logt "EXTERNAL_IP: ${EXTERNAL_IP}" logt "SED Change Config Files." sed -i -e "s/^enable = .*/enable = \"true\"/" ${DAEMON_HOME}/config/config.toml + sed '/^\[statesync\]/,/^\[/ s/enable = "true"/enable = "false"/' ${DAEMON_HOME}/config/config.toml sed -i -e "s/^moniker = .*/moniker = \"${MONIKER}\"/" ${DAEMON_HOME}/config/config.toml sed -i -e "s/^external_address = .*/external_address = \"${EXTERNAL_IP}:26656\"/" ${DAEMON_HOME}/config/config.toml fi @@ -162,18 +206,6 @@ function setup_basic_keyring { fi } -function install_dependencies { - apt-get update - apt-get install nano jq python3 -y - pip3 install requests -} - -function download_cosmovisor { - mkdir -p ${DAEMON_HOME}/cosmovisor/ - mkdir -p ${DAEMON_HOME}/cosmovisor/upgrades/ - python3 /scripts/install_cosmovisor.py -} - function download_binary_version { if [ "${NETWORK}" == "mainnet" ]; then wget -q ${BINARY_LIST_MAINNET} @@ -204,6 +236,7 @@ function move_zetacored_binaries { } function start_network { + ${VISOR_NAME} version ${VISOR_NAME} run start --home ${DAEMON_HOME} \ --log_level info \ --moniker ${MONIKER} \ @@ -211,54 +244,18 @@ function start_network { --minimum-gas-prices 1.0azeta "--grpc.enable=true" } -function load_defaults { - #DEFAULT: Mainnet Statesync. - export DAEMON_HOME=${DAEMON_HOME:=/root/.zetacored} - export NETWORK=${NETWORK:=mainnet} - export RESTORE_TYPE=${RESTORE_TYPE:=statesync} - export SNAPSHOT_API=${SNAPSHOT_API:=https://snapshots.zetachain.com} - export TRUST_HEIGHT_DIFFERENCE_STATE_SYNC=${TRUST_HEIGHT_DIFFERENCE_STATE_SYNC:=40000} - export COSMOVISOR_VERSION=${COSMOVISOR_VERSION:=v1.5.0} - export CHAIN_ID=${CHAIN_ID:=zetachain_7000-1} - export COSMOVISOR_CHECKSUM=${COSMOVISOR_CHECKSUM:=626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc} - export VISOR_NAME=${VISOR_NAME:=cosmovisor} - export DAEMON_NAME=${DAEMON_NAME:=zetacored} - export DAEMON_ALLOW_DOWNLOAD_BINARIES=${DAEMON_ALLOW_DOWNLOAD_BINARIES:=false} - export DAEMON_RESTART_AFTER_UPGRADE=${DAEMON_RESTART_AFTER_UPGRADE:=true} - export UNSAFE_SKIP_BACKUP=${UNSAFE_SKIP_BACKUP:=true} - export CLIENT_DAEMON_NAME=${CLIENT_DAEMON_NAME:=zetaclientd} - export CLIENT_DAEMON_ARGS=${CLIENT_DAEMON_ARGS:""} - export CLIENT_SKIP_UPGRADE=${CLIENT_SKIP_UPGRADE:=true} - export CLIENT_START_PROCESS=${CLIENT_START_PROCESS:=false} - export MONIKER=${MONIKER:=local-test} - export RE_DO_START_SEQUENCE=${RE_DO_START_SEQUENCE:=false} - - #ATHENS3 - export BINARY_LIST_ATHENS3=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/binary_list.json} - export STATE_SYNC_RPC_NODE_FILE_ATHENS3=${STATE_SYNC_RPC_NODE_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/state_sync_node} - export RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3=${RPC_STATE_SYNC_RPC_LIST_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/rpc_state_sync_nodes} - export APP_TOML_FILE_ATHENS3=${APP_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/app.toml} - export CONFIG_TOML_FILE_ATHENS3=${CONFIG_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/config.toml} - export CLIENT_TOML_FILE_ATHENS3=${CLIENT_TOML_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/client.toml} - export GENESIS_FILE_ATHENS3=${GENESIS_FILE_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/athens3/genesis.json} - - #MAINNET - export BINARY_LIST_MAINNET=${BINARY_LIST_ATHENS3:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/binary_list.json} - export STATE_SYNC_RPC_NODE_FILE_MAINNET=${STATE_SYNC_RPC_NODE_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/state_sync_node} - export RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET=${RPC_STATE_SYNC_RPC_LIST_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/rpc_state_sync_nodes} - export APP_TOML_FILE_MAINNET=${APP_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/app.toml} - export CONFIG_TOML_FILE_MAINNET=${CONFIG_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/config.toml} - export CLIENT_TOML_FILE_MAINNET=${CLIENT_TOML_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/client.toml} - export GENESIS_FILE_MAINNET=${GENESIS_FILE_MAINNET:=https://raw.githubusercontent.com/zeta-chain/network-config/main/mainnet/genesis.json} - -} - logt "Load Default Values for ENV Vars if not set." load_defaults if [[ -f "${DAEMON_HOME}/start_sequence_status" ]] && grep -q "START_SEQUENCE_COMPLETE" "${DAEMON_HOME}/start_sequence_status" && [[ "$RE_DO_START_SEQUENCE" != "true" ]]; then logt "The start sequence is complete and no redo is required." + logt "Download Configs" + download_configs + + logt "Download Historical Binaries" + download_binary_version + if [ "${RESTORE_TYPE}" == "statesync" ]; then logt "Setup Restore Type: ${RESTORE_TYPE}" logt "During restarts, we re-do this to ensure to update the configs with valid values. When you call change config the stuff that gets set in this function for statesync needs to be set. Doesn't effect to re-set this." @@ -268,9 +265,6 @@ if [[ -f "${DAEMON_HOME}/start_sequence_status" ]] && grep -q "START_SEQUENCE_CO logt "Modify Chain Configs" change_config_values - logt "Download Cosmosvisor." - download_cosmovisor - logt "Move Zetacored Binaries." move_zetacored_binaries @@ -293,9 +287,6 @@ else logt "Download Configs" download_configs - logt "Download Cosmovisor" - download_cosmovisor - logt "Download Historical Binaries" download_binary_version @@ -313,5 +304,4 @@ else logt "Start Network" start_network -fi - +fi \ No newline at end of file diff --git a/contrib/localnet/docker-compose-admin.yml b/contrib/localnet/docker-compose-admin.yml new file mode 100644 index 0000000000..46b24bfb24 --- /dev/null +++ b/contrib/localnet/docker-compose-admin.yml @@ -0,0 +1,9 @@ +version: "3" + +# This docker-compose file overrides the orchestrator service to specify the flag to test the admin functions +# and skip the regular tests + +services: + orchestrator: + entrypoint: ["/work/start-zetae2e.sh", "local --skip-regular --test-admin"] + diff --git a/contrib/localnet/docker-compose-performance.yml b/contrib/localnet/docker-compose-performance.yml new file mode 100644 index 0000000000..0374d42030 --- /dev/null +++ b/contrib/localnet/docker-compose-performance.yml @@ -0,0 +1,9 @@ +version: "3" + +# This docker-compose file overrides the orchestrator service to specify the flag to test performance of cctxs +# and skip the regular tests + +services: + orchestrator: + entrypoint: ["/work/start-zetae2e.sh", "local --test-performance"] + diff --git a/contrib/localnet/docker-compose-setup-only.yml b/contrib/localnet/docker-compose-setup-only.yml index ed210c3264..11761ad817 100644 --- a/contrib/localnet/docker-compose-setup-only.yml +++ b/contrib/localnet/docker-compose-setup-only.yml @@ -5,18 +5,5 @@ version: "3" services: orchestrator: - image: orchestrator:latest - tty: true - container_name: orchestrator - build: - context: ../../. - dockerfile: contrib/localnet/orchestrator/Dockerfile - depends_on: - - zetacore0 - - eth - hostname: orchestrator - networks: - mynetwork: - ipv4_address: 172.20.0.2 - entrypoint: ["/work/start.sh", "local", "setup-only"] + entrypoint: ["/work/start-zetae2e.sh", "local --setup-only"] diff --git a/contrib/localnet/docker-compose-stresstest.yml b/contrib/localnet/docker-compose-stresstest.yml index b8d65cdf6c..38df1133f3 100644 --- a/contrib/localnet/docker-compose-stresstest.yml +++ b/contrib/localnet/docker-compose-stresstest.yml @@ -7,36 +7,10 @@ version: "3" services: zetacore0: - image: zetanode:latest - container_name: zetacore0 - build: - context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetacore0 - ports: - - "1317:1317" - - "9545:8545" - - "9546:8546" - networks: - mynetwork: - ipv4_address: 172.20.0.11 entrypoint: ["/root/start-zetacored.sh", "4"] - environment: - - HOTKEY_BACKEND=test zetacore1: - image: zetanode:latest - container_name: zetacore1 - build: - context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetacore1 - networks: - mynetwork: - ipv4_address: 172.20.0.12 entrypoint: ["/root/start-zetacored.sh", "4"] - environment: - - HOTKEY_BACKEND=test zetacore2: image: zetanode:latest @@ -50,7 +24,8 @@ services: ipv4_address: 172.20.0.13 entrypoint: [ "/root/start-zetacored.sh", "4" ] environment: - - HOTKEY_BACKEND=test + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only zetacore3: image: zetanode:latest @@ -64,39 +39,16 @@ services: ipv4_address: 172.20.0.14 entrypoint: [ "/root/start-zetacored.sh", "4" ] environment: - - HOTKEY_BACKEND=test + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only zetaclient0: - image: zetanode:latest - container_name: zetaclient0 - build: - context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetaclient0 - networks: - mynetwork: - ipv4_address: 172.20.0.21 ports: - "8123:8123" entrypoint: /root/start-zetaclientd.sh - environment: - - ETHDEV_ENDPOINT=http://eth:8545 - - HOTKEY_BACKEND=test zetaclient1: - image: zetanode:latest - container_name: zetaclient1 - build: - context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetaclient1 - networks: - mynetwork: - ipv4_address: 172.20.0.22 entrypoint: /root/start-zetaclientd.sh - environment: - - ETHDEV_ENDPOINT=http://eth:8545 - - HOTKEY_BACKEND=test zetaclient2: image: zetanode:latest @@ -111,7 +63,8 @@ services: entrypoint: /root/start-zetaclientd.sh environment: - ETHDEV_ENDPOINT=http://eth:8545 - - HOTKEY_BACKEND=test + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only zetaclient3: image: zetanode:latest @@ -126,19 +79,10 @@ services: entrypoint: /root/start-zetaclientd.sh environment: - ETHDEV_ENDPOINT=http://eth:8545 - - HOTKEY_BACKEND=test + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only orchestrator: - image: orchestrator:latest - container_name: orchestrator build: - context: ../../. dockerfile: contrib/localnet/orchestrator/Dockerfile.fastbuild - depends_on: - - zetacore0 - - eth - hostname: orchestrator - networks: - mynetwork: - ipv4_address: 172.20.0.2 - entrypoint: ["/work/start.sh", "stress"] \ No newline at end of file + entrypoint: ["/work/start-zetae2e.sh", "stress"] \ No newline at end of file diff --git a/contrib/localnet/docker-compose-upgrade-light.yml b/contrib/localnet/docker-compose-upgrade-light.yml new file mode 100644 index 0000000000..0599f1acfc --- /dev/null +++ b/contrib/localnet/docker-compose-upgrade-light.yml @@ -0,0 +1,32 @@ +version: "3" + +# This docker-compose is similar to the docker-compose-upgrade.yml, but it uses a smaller height option for the upgrade (90) +# By using 90, the orchestrator will automatically run setup only for the first e2e test execution. + +services: + zetacore0: + entrypoint: ["/root/start-zetacored.sh", "2", "upgrade", "90"] + build: + context: ../../. + dockerfile: Dockerfile-upgrade + + zetacore1: + entrypoint: ["/root/start-zetacored.sh", "2", "upgrade", "90"] + build: + context: ../../. + dockerfile: Dockerfile-upgrade + + zetaclient0: + entrypoint: ["/root/start-zetaclientd.sh", "background"] + build: + context: ../../. + dockerfile: Dockerfile-upgrade + + zetaclient1: + entrypoint: ["/root/start-zetaclientd.sh", "background"] + build: + context: ../../. + dockerfile: Dockerfile-upgrade + + orchestrator: + entrypoint: ["/work/start-zetae2e.sh", "local", "upgrade", "90"] diff --git a/contrib/localnet/docker-compose-upgrade.yml b/contrib/localnet/docker-compose-upgrade.yml index 6f02feff70..3bf858ec9a 100644 --- a/contrib/localnet/docker-compose-upgrade.yml +++ b/contrib/localnet/docker-compose-upgrade.yml @@ -7,78 +7,28 @@ version: "3" services: zetacore0: - image: zetanode:latest - container_name: zetacore0 + entrypoint: ["/root/start-zetacored.sh", "2", "upgrade"] build: context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetacore0 - ports: - - "1317:1317" - - "9545:8545" - - "9546:8546" - networks: - mynetwork: - ipv4_address: 172.20.0.11 - entrypoint: ["/root/start-zetacored.sh", "2", "upgrade"] - environment: - - HOTKEY_BACKEND=test + dockerfile: Dockerfile-upgrade zetacore1: - image: zetanode:latest - container_name: zetacore1 + entrypoint: ["/root/start-zetacored.sh", "2", "upgrade"] build: context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetacore1 - networks: - mynetwork: - ipv4_address: 172.20.0.12 - entrypoint: ["/root/start-zetacored.sh", "2", "upgrade"] - environment: - - HOTKEY_BACKEND=test + dockerfile: Dockerfile-upgrade zetaclient0: - image: zetanode:latest - container_name: zetaclient0 + entrypoint: ["/root/start-zetaclientd.sh", "background"] build: context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetaclient0 - networks: - mynetwork: - ipv4_address: 172.20.0.21 - entrypoint: ["/root/start-zetaclientd.sh", "background"] - environment: - - HOTKEY_BACKEND=test - - ETHDEV_ENDPOINT=http://eth:8545 + dockerfile: Dockerfile-upgrade zetaclient1: - image: zetanode:latest - container_name: zetaclient1 + entrypoint: ["/root/start-zetaclientd.sh", "background"] build: context: ../../. - dockerfile: Dockerfile-localnet - hostname: zetaclient1 - networks: - mynetwork: - ipv4_address: 172.20.0.22 - entrypoint: ["/root/start-zetaclientd.sh", "background"] - environment: - - HOTKEY_BACKEND=test - - ETHDEV_ENDPOINT=http://eth:8545 + dockerfile: Dockerfile-upgrade orchestrator: - image: orchestrator:latest - container_name: orchestrator - build: - context: ../../. - dockerfile: contrib/localnet/orchestrator/Dockerfile - depends_on: - - zetacore0 - - eth - hostname: orchestrator - networks: - mynetwork: - ipv4_address: 172.20.0.2 - entrypoint: ["/work/start.sh", "local", "upgrade"] + entrypoint: ["/work/start-zetae2e.sh", "local", "upgrade"] diff --git a/contrib/localnet/docker-compose.yml b/contrib/localnet/docker-compose.yml index e1a94442f0..52ce7d2124 100644 --- a/contrib/localnet/docker-compose.yml +++ b/contrib/localnet/docker-compose.yml @@ -39,6 +39,7 @@ services: - "9545:8545" - "9546:8546" - "26657:26657" + - "6060:6060" - "9090:9090" networks: mynetwork: @@ -118,9 +119,9 @@ services: command: -printtoconsole -regtest=1 - -rpcallowip=172.20.0.0/16 + -rpcallowip=0.0.0.0/0 -rpcbind=0.0.0.0 - -rpcauth=e2e:63acf9b8dccecce914d85ff8c044b78b$$5892f9bbc84f4364e79f0970039f88bdd823f168d4acc76099ab97b14a766a99 + -rpcauth=smoketest:63acf9b8dccecce914d85ff8c044b78b$$5892f9bbc84f4364e79f0970039f88bdd823f168d4acc76099ab97b14a766a99 -txindex=1 orchestrator: @@ -137,5 +138,5 @@ services: networks: mynetwork: ipv4_address: 172.20.0.2 - entrypoint: ["/work/start.sh", "local"] + entrypoint: ["/work/start-zetae2e.sh", "local"] diff --git a/contrib/localnet/orchestrator/Dockerfile b/contrib/localnet/orchestrator/Dockerfile index 5e579916cc..e159d8ba84 100644 --- a/contrib/localnet/orchestrator/Dockerfile +++ b/contrib/localnet/orchestrator/Dockerfile @@ -11,7 +11,7 @@ COPY --from=geth /usr/local/bin/geth /usr/local/bin/ COPY --from=zeta /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys COPY --from=zeta /root/.ssh/localtest.pem /root/.ssh/localtest.pem -COPY contrib/localnet/orchestrator/start.sh /work/ +COPY contrib/localnet/orchestrator/start-zetae2e.sh /work/ COPY contrib/localnet/orchestrator/restart-zetaclientd.sh /work/ RUN chmod +x /work/*.sh diff --git a/contrib/localnet/orchestrator/Dockerfile.fastbuild b/contrib/localnet/orchestrator/Dockerfile.fastbuild index 198205c000..64d9e9c87e 100644 --- a/contrib/localnet/orchestrator/Dockerfile.fastbuild +++ b/contrib/localnet/orchestrator/Dockerfile.fastbuild @@ -11,7 +11,7 @@ COPY --from=geth /usr/local/bin/geth /usr/local/bin/ COPY --from=zeta /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys COPY --from=zeta /root/.ssh/localtest.pem /root/.ssh/localtest.pem -COPY contrib/localnet/orchestrator/start.sh /work/ +COPY contrib/localnet/orchestrator/start-zetae2e.sh /work/ COPY contrib/localnet/orchestrator/restart-zetaclientd.sh /work/ RUN chmod +x /work/*.sh diff --git a/contrib/localnet/orchestrator/restart-zetaclientd.sh b/contrib/localnet/orchestrator/restart-zetaclientd.sh index 9b8f24e49f..7911deca01 100644 --- a/contrib/localnet/orchestrator/restart-zetaclientd.sh +++ b/contrib/localnet/orchestrator/restart-zetaclientd.sh @@ -46,5 +46,5 @@ echo upgrade height reached, restarting zetaclients for NODE in "${CLIENT_LIST[@]}"; do ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem killall zetaclientd - ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem "$GOPATH/bin/new/zetaclientd start < /dev/null > $HOME/zetaclient.log 2>&1 &" + ssh -o "StrictHostKeyChecking no" "$NODE" -i ~/.ssh/localtest.pem "$GOPATH/bin/new/zetaclientd start < /root/password.file > $HOME/zetaclient.log 2>&1 &" done diff --git a/contrib/localnet/orchestrator/start.sh b/contrib/localnet/orchestrator/start-zetae2e.sh similarity index 77% rename from contrib/localnet/orchestrator/start.sh rename to contrib/localnet/orchestrator/start-zetae2e.sh index b7e75c0f81..129317932d 100644 --- a/contrib/localnet/orchestrator/start.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -51,8 +51,19 @@ if [ "$OPTION" == "upgrade" ]; then # Run the e2e tests, then restart zetaclientd at upgrade height and run the e2e tests again - echo "running E2E command to setup the networks and populate the state..." - zetae2e "$ZETAE2E_CMD" --config-out deployed.yml + # Fetch the height of the upgrade, default is 200, if arg3 is passed, use that value + UPGRADE_HEIGHT=${3:-200} + + # Run zetae2e, if the upgrade height is lower than 100, we use the setup-only flag + if [ "$UPGRADE_HEIGHT" -lt 100 ]; then + echo "running E2E command to setup the networks..." + zetae2e "$ZETAE2E_CMD" --setup-only --config-out deployed.yml + else + echo "running E2E command to setup the networks and populate the state..." + + # Use light flag to ensure tests can complete before the upgrade height + zetae2e "$ZETAE2E_CMD" --config-out deployed.yml --light + fi ZETAE2E_EXIT_CODE=$? if [ $ZETAE2E_EXIT_CODE -ne 0 ]; then @@ -63,7 +74,7 @@ if [ "$OPTION" == "upgrade" ]; then echo "E2E setup passed, waiting for upgrade height..." # Restart zetaclients at upgrade height - /work/restart-zetaclientd.sh -u 200 -n 2 + /work/restart-zetaclientd.sh -u "$UPGRADE_HEIGHT" -n 2 echo "waiting 10 seconds for node to restart..." @@ -71,29 +82,21 @@ if [ "$OPTION" == "upgrade" ]; then echo "running E2E command to test the network after upgrade..." - zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml - - ZETAE2E_EXIT_CODE=$? - if [ $ZETAE2E_EXIT_CODE -eq 0 ]; then - echo "E2E passed after upgrade" - exit 0 + # Run zetae2e again + # When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up + # Use light flag to skip advanced tests + if [ "$UPGRADE_HEIGHT" -lt 100 ]; then + zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --light else - echo "E2E failed after upgrade" - exit 1 + zetae2e "$ZETAE2E_CMD" --skip-setup --config deployed.yml --skip-bitcoin-setup --light fi -elif [ "$OPTION" == "setup-only" ]; then - - # Setup localnet with the --setup-only flag - - zetae2e "$ZETAE2E_CMD" --setup-only - ZETAE2E_EXIT_CODE=$? if [ $ZETAE2E_EXIT_CODE -eq 0 ]; then - echo "Localnet setup" + echo "E2E passed after upgrade" exit 0 else - echo "Localnet failed to start" + echo "E2E failed after upgrade" exit 1 fi @@ -102,7 +105,8 @@ else # Run the e2e tests normally echo "running e2e tests..." - zetae2e "$ZETAE2E_CMD" + + eval "zetae2e $ZETAE2E_CMD" ZETAE2E_EXIT_CODE=$? # if e2e passed, exit with 0, otherwise exit with 1 diff --git a/contrib/localnet/scripts/start-zetaclientd.sh b/contrib/localnet/scripts/start-zetaclientd.sh index d519a1fbc9..761a58098d 100755 --- a/contrib/localnet/scripts/start-zetaclientd.sh +++ b/contrib/localnet/scripts/start-zetaclientd.sh @@ -2,7 +2,7 @@ # This script is used to start ZetaClient for the localnet # An optional argument can be passed and can have the following value: -# background: start the ZetaClient in the background +# background: start the ZetaClient in the background, this prevent the image from being stopped when ZetaClient must be restarted /usr/sbin/sshd diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index 713627171b..e5fde418d2 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -210,10 +210,13 @@ else sleep 20 echo + # Fetch the height of the upgrade, default is 200, if arg3 is passed, use that value + UPGRADE_HEIGHT=${3:-200} + # If this is the first node, create a governance proposal for upgrade if [ $HOSTNAME = "zetacore0" ] then - /root/.zetacored/cosmovisor/genesis/bin/zetacored tx gov submit-legacy-proposal software-upgrade $UpgradeName --from hotkey --deposit 100000000azeta --upgrade-height 200 --title $UpgradeName --description $UpgradeName --keyring-backend test --chain-id $CHAINID --yes --no-validate --fees=2000000000000000azeta --broadcast-mode block + /root/.zetacored/cosmovisor/genesis/bin/zetacored tx gov submit-legacy-proposal software-upgrade $UpgradeName --from operator --deposit 100000000azeta --upgrade-height "$UPGRADE_HEIGHT" --title $UpgradeName --description $UpgradeName --keyring-backend test --chain-id $CHAINID --yes --no-validate --fees=2000000000000000azeta --broadcast-mode block fi # Wait for the proposal to be voted on diff --git a/contrib/localnet/zetacored/common/config.toml b/contrib/localnet/zetacored/common/config.toml index c0f955ea4b..c357395ce1 100644 --- a/contrib/localnet/zetacored/common/config.toml +++ b/contrib/localnet/zetacored/common/config.toml @@ -191,7 +191,7 @@ tls_cert_file = "" tls_key_file = "" # pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" +pprof_laddr = "0.0.0.0:6060" ####################################################### ### P2P Configuration Options ### diff --git a/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml b/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml index 4178dde511..5f915131fc 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml +++ b/contrib/localnet/zetacored/zetacored_zetacore0/config/config.toml @@ -191,7 +191,7 @@ tls_cert_file = "" tls_key_file = "" # pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" +pprof_laddr = "0.0.0.0:6060" ####################################################### ### P2P Configuration Options ### diff --git a/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml b/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml index 6bbaf13d27..d9f89c1f2e 100644 --- a/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml +++ b/contrib/localnet/zetacored/zetacored_zetacore1/config/config.toml @@ -191,7 +191,7 @@ tls_cert_file = "" tls_key_file = "" # pprof listen address (https://golang.org/pkg/net/http/pprof) -pprof_laddr = "localhost:6060" +pprof_laddr = "0.0.0.0:6060" ####################################################### ### P2P Configuration Options ### diff --git a/contrib/mainnet/zetacored/docker-compose.yml b/contrib/mainnet/zetacored/docker-compose.yml index 6df2a17616..ed75d0254c 100644 --- a/contrib/mainnet/zetacored/docker-compose.yml +++ b/contrib/mainnet/zetacored/docker-compose.yml @@ -6,18 +6,16 @@ services: # build: # context: ../../.. # dockerfile: Dockerfile - image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14} + image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1} container_name: zetachain_mainnet_rpc environment: DAEMON_HOME: "/root/.zetacored" NETWORK: mainnet #RESTORE_TYPE=snapshot/snapshot-archive/statesync - RESTORE_TYPE: "statesync" + RESTORE_TYPE: "snapshot" SNAPSHOT_API: https://snapshots.zetachain.com TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000 - COSMOVISOR_VERSION: "v1.5.0" CHAIN_ID: "zetachain_7000-1" - COSMOVISOR_CHECKSUM: "626dfc58c266b85f84a7ed8e2fe0e2346c15be98cfb9f9b88576ba899ed78cdc" VISOR_NAME: "cosmovisor" DAEMON_NAME: "zetacored" DAEMON_ALLOW_DOWNLOAD_BINARIES: "false" @@ -38,10 +36,10 @@ services: - "9090:9090" - "9091:9091" volumes: - - zetacored_data:/root/.zetacored/ + - zetacored_data_mainnet:/root/.zetacored/ entrypoint: bash /scripts/start.sh #for debugging #entrypoint: ["/bin/sh", "-c"] #command: ["while true; do sleep 86400; done"] volumes: - zetacored_data: + zetacored_data_mainnet: diff --git a/e2e/README.md b/e2e/README.md index 882f73c100..f7d43ddf08 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -36,7 +36,7 @@ A config YAML file can be provided to the E2E test tool via the `--config` flag. **EVM Contracts** - `ZetaEthAddress`: Address of Zeta token contract on EVM chain. - `ConnectorEthAddr`: Address of a connector contract on EVM chain. -- `USDT`: Address of the USDT token contract on EVM chain. +- `ERC20`: Address of the ERC20 token contract on EVM chain. ### Config Example @@ -51,7 +51,7 @@ contracts: evm: zeta_eth: "0x..." connector_eth: "0x..." - usdt: "0x..." + erc20: "0x..." zeta_chain_id: "zetachain-1" ``` diff --git a/e2e/config/config.go b/e2e/config/config.go index 5eebd5fc68..e8f51dbf9a 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -54,14 +54,14 @@ type EVM struct { ZetaEthAddress string `yaml:"zeta_eth"` ConnectorEthAddr string `yaml:"connector_eth"` CustodyAddr string `yaml:"custody"` - USDT string `yaml:"usdt"` + ERC20 string `yaml:"erc20"` } // ZEVM contains the addresses of predeployed contracts on the zEVM chain type ZEVM struct { SystemContractAddr string `yaml:"system_contract"` ETHZRC20Addr string `yaml:"eth_zrc20"` - USDTZRC20Addr string `yaml:"usdt_zrc20"` + ERC20ZRC20Addr string `yaml:"erc20_zrc20"` BTCZRC20Addr string `yaml:"btc_zrc20"` UniswapFactoryAddr string `yaml:"uniswap_factory"` UniswapRouterAddr string `yaml:"uniswap_router"` @@ -80,7 +80,7 @@ func DefaultConfig() Config { EVM: "http://eth:8545", Bitcoin: BitcoinRPC{ Host: "bitcoin:18443", - User: "e2e", + User: "smoketest", Pass: "123", HTTPPostMode: true, DisableTLS: true, @@ -92,7 +92,7 @@ func DefaultConfig() Config { ZetaChainID: "athens_101-1", Contracts: Contracts{ EVM: EVM{ - USDT: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a", + ERC20: "0xff3135df4F2775f4091b81f4c7B6359CfA07862a", }, }, } diff --git a/e2e/contracts/erc20/USDT.abi b/e2e/contracts/erc20/ERC20.abi similarity index 100% rename from e2e/contracts/erc20/USDT.abi rename to e2e/contracts/erc20/ERC20.abi diff --git a/e2e/contracts/erc20/USDT.bin b/e2e/contracts/erc20/ERC20.bin similarity index 100% rename from e2e/contracts/erc20/USDT.bin rename to e2e/contracts/erc20/ERC20.bin diff --git a/e2e/contracts/erc20/USDT.go b/e2e/contracts/erc20/ERC20.go similarity index 65% rename from e2e/contracts/erc20/USDT.go rename to e2e/contracts/erc20/ERC20.go index 186ee6d273..095ffcdec7 100644 --- a/e2e/contracts/erc20/USDT.go +++ b/e2e/contracts/erc20/ERC20.go @@ -26,25 +26,26 @@ var ( _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription + _ = abi.ConvertType ) -// USDTMetaData contains all meta data concerning the USDT contract. -var USDTMetaData = &bind.MetaData{ +// ERC20MetaData contains all meta data concerning the ERC20 contract. +var ERC20MetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name_\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol_\",\"type\":\"string\"},{\"internalType\":\"uint8\",\"name\":\"decimals_\",\"type\":\"uint8\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", Bin: "0x60806040523480156200001157600080fd5b5060405162000bb138038062000bb183398101604081905262000034916200014c565b600362000042848262000260565b50600462000051838262000260565b506005805460ff191660ff92909216919091179055505033600090815260208190526040902066038d7ea4c6800090556200032c565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620000af57600080fd5b81516001600160401b0380821115620000cc57620000cc62000087565b604051601f8301601f19908116603f01168101908282118183101715620000f757620000f762000087565b816040528381526020925086838588010111156200011457600080fd5b600091505b8382101562000138578582018301518183018401529082019062000119565b600093810190920192909252949350505050565b6000806000606084860312156200016257600080fd5b83516001600160401b03808211156200017a57600080fd5b62000188878388016200009d565b945060208601519150808211156200019f57600080fd5b50620001ae868287016200009d565b925050604084015160ff81168114620001c657600080fd5b809150509250925092565b600181811c90821680620001e657607f821691505b6020821081036200020757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200025b57600081815260208120601f850160051c81016020861015620002365750805b601f850160051c820191505b81811015620002575782815560010162000242565b5050505b505050565b81516001600160401b038111156200027c576200027c62000087565b62000294816200028d8454620001d1565b846200020d565b602080601f831160018114620002cc5760008415620002b35750858301515b600019600386901b1c1916600185901b17855562000257565b600085815260208120601f198616915b82811015620002fd57888601518255948401946001909101908401620002dc565b50858210156200031c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610875806200033c6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806342966c681161007157806342966c681461012957806370a082311461013e57806395d89b4114610167578063a0712d681461016f578063a9059cbb14610182578063dd62ed3e1461019557600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101ce565b6040516100c3919061068b565b60405180910390f35b6100df6100da3660046106f5565b610260565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461071f565b610277565b60055460405160ff90911681526020016100c3565b61013c61013736600461075b565b61032d565b005b6100f361014c366004610774565b6001600160a01b031660009081526020819052604090205490565b6100b6610354565b61013c61017d36600461075b565b610363565b6100df6101903660046106f5565b610382565b6100f36101a3366004610796565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101dd906107c9565b80601f0160208091040260200160405190810160405280929190818152602001828054610209906107c9565b80156102565780601f1061022b57610100808354040283529160200191610256565b820191906000526020600020905b81548152906001019060200180831161023957829003601f168201915b5050505050905090565b600061026d33848461038f565b5060015b92915050565b60006102848484846104b3565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561030e5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610322853361031d8685610819565b61038f565b506001949350505050565b336000908152602081905260408120805483929061034c908490610819565b909155505050565b6060600480546101dd906107c9565b336000908152602081905260408120805483929061034c90849061082c565b600061026d3384846104b3565b6001600160a01b0383166103f15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610305565b6001600160a01b0382166104525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610305565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610305565b6001600160a01b0382166105795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610305565b6001600160a01b038316600090815260208190526040902054818110156105f15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610305565b6105fb8282610819565b6001600160a01b03808616600090815260208190526040808220939093559085168152908120805484929061063190849061082c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161067d91815260200190565b60405180910390a350505050565b600060208083528351808285015260005b818110156106b85785810183015185820160400152820161069c565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146106f057600080fd5b919050565b6000806040838503121561070857600080fd5b610711836106d9565b946020939093013593505050565b60008060006060848603121561073457600080fd5b61073d846106d9565b925061074b602085016106d9565b9150604084013590509250925092565b60006020828403121561076d57600080fd5b5035919050565b60006020828403121561078657600080fd5b61078f826106d9565b9392505050565b600080604083850312156107a957600080fd5b6107b2836106d9565b91506107c0602084016106d9565b90509250929050565b600181811c908216806107dd57607f821691505b6020821081036107fd57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561027157610271610803565b808201808211156102715761027161080356fea26469706673582212202be4005b8bbb29132ec10f55a7ffcfb97074f1c7504254b1a3048764592668bb64736f6c63430008110033", } -// USDTABI is the input ABI used to generate the binding from. -// Deprecated: Use USDTMetaData.ABI instead. -var USDTABI = USDTMetaData.ABI +// ERC20ABI is the input ABI used to generate the binding from. +// Deprecated: Use ERC20MetaData.ABI instead. +var ERC20ABI = ERC20MetaData.ABI -// USDTBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use USDTMetaData.Bin instead. -var USDTBin = USDTMetaData.Bin +// ERC20Bin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use ERC20MetaData.Bin instead. +var ERC20Bin = ERC20MetaData.Bin -// DeployUSDT deploys a new Ethereum contract, binding an instance of USDT to it. -func DeployUSDT(auth *bind.TransactOpts, backend bind.ContractBackend, name_ string, symbol_ string, decimals_ uint8) (common.Address, *types.Transaction, *USDT, error) { - parsed, err := USDTMetaData.GetAbi() +// DeployERC20 deploys a new Ethereum contract, binding an instance of ERC20 to it. +func DeployERC20(auth *bind.TransactOpts, backend bind.ContractBackend, name_ string, symbol_ string, decimals_ uint8) (common.Address, *types.Transaction, *ERC20, error) { + parsed, err := ERC20MetaData.GetAbi() if err != nil { return common.Address{}, nil, nil, err } @@ -52,161 +53,161 @@ func DeployUSDT(auth *bind.TransactOpts, backend bind.ContractBackend, name_ str return common.Address{}, nil, nil, errors.New("GetABI returned nil") } - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(USDTBin), backend, name_, symbol_, decimals_) + address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(ERC20Bin), backend, name_, symbol_, decimals_) if err != nil { return common.Address{}, nil, nil, err } - return address, tx, &USDT{USDTCaller: USDTCaller{contract: contract}, USDTTransactor: USDTTransactor{contract: contract}, USDTFilterer: USDTFilterer{contract: contract}}, nil + return address, tx, &ERC20{ERC20Caller: ERC20Caller{contract: contract}, ERC20Transactor: ERC20Transactor{contract: contract}, ERC20Filterer: ERC20Filterer{contract: contract}}, nil } -// USDT is an auto generated Go binding around an Ethereum contract. -type USDT struct { - USDTCaller // Read-only binding to the contract - USDTTransactor // Write-only binding to the contract - USDTFilterer // Log filterer for contract events +// ERC20 is an auto generated Go binding around an Ethereum contract. +type ERC20 struct { + ERC20Caller // Read-only binding to the contract + ERC20Transactor // Write-only binding to the contract + ERC20Filterer // Log filterer for contract events } -// USDTCaller is an auto generated read-only Go binding around an Ethereum contract. -type USDTCaller struct { +// ERC20Caller is an auto generated read-only Go binding around an Ethereum contract. +type ERC20Caller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// USDTTransactor is an auto generated write-only Go binding around an Ethereum contract. -type USDTTransactor struct { +// ERC20Transactor is an auto generated write-only Go binding around an Ethereum contract. +type ERC20Transactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// USDTFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type USDTFilterer struct { +// ERC20Filterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ERC20Filterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// USDTSession is an auto generated Go binding around an Ethereum contract, +// ERC20Session is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type USDTSession struct { - Contract *USDT // Generic contract binding to set the session for +type ERC20Session struct { + Contract *ERC20 // 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 } -// USDTCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// ERC20CallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type USDTCallerSession struct { - Contract *USDTCaller // Generic contract caller binding to set the session for +type ERC20CallerSession struct { + Contract *ERC20Caller // Generic contract caller binding to set the session for CallOpts bind.CallOpts // Call options to use throughout this session } -// USDTTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// ERC20TransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type USDTTransactorSession struct { - Contract *USDTTransactor // Generic contract transactor binding to set the session for +type ERC20TransactorSession struct { + Contract *ERC20Transactor // Generic contract transactor binding to set the session for TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// USDTRaw is an auto generated low-level Go binding around an Ethereum contract. -type USDTRaw struct { - Contract *USDT // Generic contract binding to access the raw methods on +// ERC20Raw is an auto generated low-level Go binding around an Ethereum contract. +type ERC20Raw struct { + Contract *ERC20 // Generic contract binding to access the raw methods on } -// USDTCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type USDTCallerRaw struct { - Contract *USDTCaller // Generic read-only contract binding to access the raw methods on +// ERC20CallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ERC20CallerRaw struct { + Contract *ERC20Caller // Generic read-only contract binding to access the raw methods on } -// USDTTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type USDTTransactorRaw struct { - Contract *USDTTransactor // Generic write-only contract binding to access the raw methods on +// ERC20TransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ERC20TransactorRaw struct { + Contract *ERC20Transactor // Generic write-only contract binding to access the raw methods on } -// NewUSDT creates a new instance of USDT, bound to a specific deployed contract. -func NewUSDT(address common.Address, backend bind.ContractBackend) (*USDT, error) { - contract, err := bindUSDT(address, backend, backend, backend) +// NewERC20 creates a new instance of ERC20, bound to a specific deployed contract. +func NewERC20(address common.Address, backend bind.ContractBackend) (*ERC20, error) { + contract, err := bindERC20(address, backend, backend, backend) if err != nil { return nil, err } - return &USDT{USDTCaller: USDTCaller{contract: contract}, USDTTransactor: USDTTransactor{contract: contract}, USDTFilterer: USDTFilterer{contract: contract}}, nil + return &ERC20{ERC20Caller: ERC20Caller{contract: contract}, ERC20Transactor: ERC20Transactor{contract: contract}, ERC20Filterer: ERC20Filterer{contract: contract}}, nil } -// NewUSDTCaller creates a new read-only instance of USDT, bound to a specific deployed contract. -func NewUSDTCaller(address common.Address, caller bind.ContractCaller) (*USDTCaller, error) { - contract, err := bindUSDT(address, caller, nil, nil) +// NewERC20Caller creates a new read-only instance of ERC20, bound to a specific deployed contract. +func NewERC20Caller(address common.Address, caller bind.ContractCaller) (*ERC20Caller, error) { + contract, err := bindERC20(address, caller, nil, nil) if err != nil { return nil, err } - return &USDTCaller{contract: contract}, nil + return &ERC20Caller{contract: contract}, nil } -// NewUSDTTransactor creates a new write-only instance of USDT, bound to a specific deployed contract. -func NewUSDTTransactor(address common.Address, transactor bind.ContractTransactor) (*USDTTransactor, error) { - contract, err := bindUSDT(address, nil, transactor, nil) +// NewERC20Transactor creates a new write-only instance of ERC20, bound to a specific deployed contract. +func NewERC20Transactor(address common.Address, transactor bind.ContractTransactor) (*ERC20Transactor, error) { + contract, err := bindERC20(address, nil, transactor, nil) if err != nil { return nil, err } - return &USDTTransactor{contract: contract}, nil + return &ERC20Transactor{contract: contract}, nil } -// NewUSDTFilterer creates a new log filterer instance of USDT, bound to a specific deployed contract. -func NewUSDTFilterer(address common.Address, filterer bind.ContractFilterer) (*USDTFilterer, error) { - contract, err := bindUSDT(address, nil, nil, filterer) +// NewERC20Filterer creates a new log filterer instance of ERC20, bound to a specific deployed contract. +func NewERC20Filterer(address common.Address, filterer bind.ContractFilterer) (*ERC20Filterer, error) { + contract, err := bindERC20(address, nil, nil, filterer) if err != nil { return nil, err } - return &USDTFilterer{contract: contract}, nil + return &ERC20Filterer{contract: contract}, nil } -// bindUSDT binds a generic wrapper to an already deployed contract. -func bindUSDT(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(USDTABI)) +// bindERC20 binds a generic wrapper to an already deployed contract. +func bindERC20(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := ERC20MetaData.GetAbi() if err != nil { return nil, err } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil + 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 (_USDT *USDTRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _USDT.Contract.USDTCaller.contract.Call(opts, result, method, params...) +func (_ERC20 *ERC20Raw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20.Contract.ERC20Caller.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 (_USDT *USDTRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _USDT.Contract.USDTTransactor.contract.Transfer(opts) +func (_ERC20 *ERC20Raw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20.Contract.ERC20Transactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_USDT *USDTRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _USDT.Contract.USDTTransactor.contract.Transact(opts, method, params...) +func (_ERC20 *ERC20Raw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20.Contract.ERC20Transactor.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 (_USDT *USDTCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _USDT.Contract.contract.Call(opts, result, method, params...) +func (_ERC20 *ERC20CallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _ERC20.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 (_USDT *USDTTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _USDT.Contract.contract.Transfer(opts) +func (_ERC20 *ERC20TransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _ERC20.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_USDT *USDTTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _USDT.Contract.contract.Transact(opts, method, params...) +func (_ERC20 *ERC20TransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _ERC20.Contract.contract.Transact(opts, method, params...) } // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_USDT *USDTCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { +func (_ERC20 *ERC20Caller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "allowance", owner, spender) + err := _ERC20.contract.Call(opts, &out, "allowance", owner, spender) if err != nil { return *new(*big.Int), err @@ -221,23 +222,23 @@ func (_USDT *USDTCaller) Allowance(opts *bind.CallOpts, owner common.Address, sp // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_USDT *USDTSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { - return _USDT.Contract.Allowance(&_USDT.CallOpts, owner, spender) +func (_ERC20 *ERC20Session) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ERC20.Contract.Allowance(&_ERC20.CallOpts, owner, spender) } // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_USDT *USDTCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { - return _USDT.Contract.Allowance(&_USDT.CallOpts, owner, spender) +func (_ERC20 *ERC20CallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { + return _ERC20.Contract.Allowance(&_ERC20.CallOpts, owner, spender) } // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address account) view returns(uint256) -func (_USDT *USDTCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { +func (_ERC20 *ERC20Caller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "balanceOf", account) + err := _ERC20.contract.Call(opts, &out, "balanceOf", account) if err != nil { return *new(*big.Int), err @@ -252,23 +253,23 @@ func (_USDT *USDTCaller) BalanceOf(opts *bind.CallOpts, account common.Address) // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address account) view returns(uint256) -func (_USDT *USDTSession) BalanceOf(account common.Address) (*big.Int, error) { - return _USDT.Contract.BalanceOf(&_USDT.CallOpts, account) +func (_ERC20 *ERC20Session) BalanceOf(account common.Address) (*big.Int, error) { + return _ERC20.Contract.BalanceOf(&_ERC20.CallOpts, account) } // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address account) view returns(uint256) -func (_USDT *USDTCallerSession) BalanceOf(account common.Address) (*big.Int, error) { - return _USDT.Contract.BalanceOf(&_USDT.CallOpts, account) +func (_ERC20 *ERC20CallerSession) BalanceOf(account common.Address) (*big.Int, error) { + return _ERC20.Contract.BalanceOf(&_ERC20.CallOpts, account) } // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_USDT *USDTCaller) Decimals(opts *bind.CallOpts) (uint8, error) { +func (_ERC20 *ERC20Caller) Decimals(opts *bind.CallOpts) (uint8, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "decimals") + err := _ERC20.contract.Call(opts, &out, "decimals") if err != nil { return *new(uint8), err @@ -283,23 +284,23 @@ func (_USDT *USDTCaller) Decimals(opts *bind.CallOpts) (uint8, error) { // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_USDT *USDTSession) Decimals() (uint8, error) { - return _USDT.Contract.Decimals(&_USDT.CallOpts) +func (_ERC20 *ERC20Session) Decimals() (uint8, error) { + return _ERC20.Contract.Decimals(&_ERC20.CallOpts) } // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_USDT *USDTCallerSession) Decimals() (uint8, error) { - return _USDT.Contract.Decimals(&_USDT.CallOpts) +func (_ERC20 *ERC20CallerSession) Decimals() (uint8, error) { + return _ERC20.Contract.Decimals(&_ERC20.CallOpts) } // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_USDT *USDTCaller) Name(opts *bind.CallOpts) (string, error) { +func (_ERC20 *ERC20Caller) Name(opts *bind.CallOpts) (string, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "name") + err := _ERC20.contract.Call(opts, &out, "name") if err != nil { return *new(string), err @@ -314,23 +315,23 @@ func (_USDT *USDTCaller) Name(opts *bind.CallOpts) (string, error) { // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_USDT *USDTSession) Name() (string, error) { - return _USDT.Contract.Name(&_USDT.CallOpts) +func (_ERC20 *ERC20Session) Name() (string, error) { + return _ERC20.Contract.Name(&_ERC20.CallOpts) } // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_USDT *USDTCallerSession) Name() (string, error) { - return _USDT.Contract.Name(&_USDT.CallOpts) +func (_ERC20 *ERC20CallerSession) Name() (string, error) { + return _ERC20.Contract.Name(&_ERC20.CallOpts) } // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_USDT *USDTCaller) Symbol(opts *bind.CallOpts) (string, error) { +func (_ERC20 *ERC20Caller) Symbol(opts *bind.CallOpts) (string, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "symbol") + err := _ERC20.contract.Call(opts, &out, "symbol") if err != nil { return *new(string), err @@ -345,23 +346,23 @@ func (_USDT *USDTCaller) Symbol(opts *bind.CallOpts) (string, error) { // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_USDT *USDTSession) Symbol() (string, error) { - return _USDT.Contract.Symbol(&_USDT.CallOpts) +func (_ERC20 *ERC20Session) Symbol() (string, error) { + return _ERC20.Contract.Symbol(&_ERC20.CallOpts) } // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_USDT *USDTCallerSession) Symbol() (string, error) { - return _USDT.Contract.Symbol(&_USDT.CallOpts) +func (_ERC20 *ERC20CallerSession) Symbol() (string, error) { + return _ERC20.Contract.Symbol(&_ERC20.CallOpts) } // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_USDT *USDTCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { +func (_ERC20 *ERC20Caller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _USDT.contract.Call(opts, &out, "totalSupply") + err := _ERC20.contract.Call(opts, &out, "totalSupply") if err != nil { return *new(*big.Int), err @@ -376,125 +377,125 @@ func (_USDT *USDTCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_USDT *USDTSession) TotalSupply() (*big.Int, error) { - return _USDT.Contract.TotalSupply(&_USDT.CallOpts) +func (_ERC20 *ERC20Session) TotalSupply() (*big.Int, error) { + return _ERC20.Contract.TotalSupply(&_ERC20.CallOpts) } // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_USDT *USDTCallerSession) TotalSupply() (*big.Int, error) { - return _USDT.Contract.TotalSupply(&_USDT.CallOpts) +func (_ERC20 *ERC20CallerSession) TotalSupply() (*big.Int, error) { + return _ERC20.Contract.TotalSupply(&_ERC20.CallOpts) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // // Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_USDT *USDTTransactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.contract.Transact(opts, "approve", spender, amount) +func (_ERC20 *ERC20Transactor) Approve(opts *bind.TransactOpts, spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.contract.Transact(opts, "approve", spender, amount) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // // Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_USDT *USDTSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Approve(&_USDT.TransactOpts, spender, amount) +func (_ERC20 *ERC20Session) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Approve(&_ERC20.TransactOpts, spender, amount) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // // Solidity: function approve(address spender, uint256 amount) returns(bool) -func (_USDT *USDTTransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Approve(&_USDT.TransactOpts, spender, amount) +func (_ERC20 *ERC20TransactorSession) Approve(spender common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Approve(&_ERC20.TransactOpts, spender, amount) } // Burn is a paid mutator transaction binding the contract method 0x42966c68. // // Solidity: function burn(uint256 amount) returns() -func (_USDT *USDTTransactor) Burn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { - return _USDT.contract.Transact(opts, "burn", amount) +func (_ERC20 *ERC20Transactor) Burn(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _ERC20.contract.Transact(opts, "burn", amount) } // Burn is a paid mutator transaction binding the contract method 0x42966c68. // // Solidity: function burn(uint256 amount) returns() -func (_USDT *USDTSession) Burn(amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Burn(&_USDT.TransactOpts, amount) +func (_ERC20 *ERC20Session) Burn(amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Burn(&_ERC20.TransactOpts, amount) } // Burn is a paid mutator transaction binding the contract method 0x42966c68. // // Solidity: function burn(uint256 amount) returns() -func (_USDT *USDTTransactorSession) Burn(amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Burn(&_USDT.TransactOpts, amount) +func (_ERC20 *ERC20TransactorSession) Burn(amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Burn(&_ERC20.TransactOpts, amount) } // Mint is a paid mutator transaction binding the contract method 0xa0712d68. // // Solidity: function mint(uint256 amount) returns() -func (_USDT *USDTTransactor) Mint(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { - return _USDT.contract.Transact(opts, "mint", amount) +func (_ERC20 *ERC20Transactor) Mint(opts *bind.TransactOpts, amount *big.Int) (*types.Transaction, error) { + return _ERC20.contract.Transact(opts, "mint", amount) } // Mint is a paid mutator transaction binding the contract method 0xa0712d68. // // Solidity: function mint(uint256 amount) returns() -func (_USDT *USDTSession) Mint(amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Mint(&_USDT.TransactOpts, amount) +func (_ERC20 *ERC20Session) Mint(amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Mint(&_ERC20.TransactOpts, amount) } // Mint is a paid mutator transaction binding the contract method 0xa0712d68. // // Solidity: function mint(uint256 amount) returns() -func (_USDT *USDTTransactorSession) Mint(amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Mint(&_USDT.TransactOpts, amount) +func (_ERC20 *ERC20TransactorSession) Mint(amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Mint(&_ERC20.TransactOpts, amount) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) -func (_USDT *USDTTransactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.contract.Transact(opts, "transfer", recipient, amount) +func (_ERC20 *ERC20Transactor) Transfer(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.contract.Transact(opts, "transfer", recipient, amount) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) -func (_USDT *USDTSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Transfer(&_USDT.TransactOpts, recipient, amount) +func (_ERC20 *ERC20Session) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Transfer(&_ERC20.TransactOpts, recipient, amount) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address recipient, uint256 amount) returns(bool) -func (_USDT *USDTTransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.Transfer(&_USDT.TransactOpts, recipient, amount) +func (_ERC20 *ERC20TransactorSession) Transfer(recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.Transfer(&_ERC20.TransactOpts, recipient, amount) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) -func (_USDT *USDTTransactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.contract.Transact(opts, "transferFrom", sender, recipient, amount) +func (_ERC20 *ERC20Transactor) TransferFrom(opts *bind.TransactOpts, sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.contract.Transact(opts, "transferFrom", sender, recipient, amount) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) -func (_USDT *USDTSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.TransferFrom(&_USDT.TransactOpts, sender, recipient, amount) +func (_ERC20 *ERC20Session) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.TransferFrom(&_ERC20.TransactOpts, sender, recipient, amount) } // TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. // // Solidity: function transferFrom(address sender, address recipient, uint256 amount) returns(bool) -func (_USDT *USDTTransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { - return _USDT.Contract.TransferFrom(&_USDT.TransactOpts, sender, recipient, amount) +func (_ERC20 *ERC20TransactorSession) TransferFrom(sender common.Address, recipient common.Address, amount *big.Int) (*types.Transaction, error) { + return _ERC20.Contract.TransferFrom(&_ERC20.TransactOpts, sender, recipient, amount) } -// USDTApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the USDT contract. -type USDTApprovalIterator struct { - Event *USDTApproval // Event containing the contract specifics and raw log +// ERC20ApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the ERC20 contract. +type ERC20ApprovalIterator struct { + Event *ERC20Approval // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -508,7 +509,7 @@ type USDTApprovalIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *USDTApprovalIterator) Next() bool { +func (it *ERC20ApprovalIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -517,7 +518,7 @@ func (it *USDTApprovalIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(USDTApproval) + it.Event = new(ERC20Approval) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -532,7 +533,7 @@ func (it *USDTApprovalIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(USDTApproval) + it.Event = new(ERC20Approval) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -548,19 +549,19 @@ func (it *USDTApprovalIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *USDTApprovalIterator) Error() error { +func (it *ERC20ApprovalIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *USDTApprovalIterator) Close() error { +func (it *ERC20ApprovalIterator) Close() error { it.sub.Unsubscribe() return nil } -// USDTApproval represents a Approval event raised by the USDT contract. -type USDTApproval struct { +// ERC20Approval represents a Approval event raised by the ERC20 contract. +type ERC20Approval struct { Owner common.Address Spender common.Address Value *big.Int @@ -570,7 +571,7 @@ type USDTApproval struct { // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. // // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_USDT *USDTFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*USDTApprovalIterator, error) { +func (_ERC20 *ERC20Filterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*ERC20ApprovalIterator, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -581,17 +582,17 @@ func (_USDT *USDTFilterer) FilterApproval(opts *bind.FilterOpts, owner []common. spenderRule = append(spenderRule, spenderItem) } - logs, sub, err := _USDT.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + logs, sub, err := _ERC20.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) if err != nil { return nil, err } - return &USDTApprovalIterator{contract: _USDT.contract, event: "Approval", logs: logs, sub: sub}, nil + return &ERC20ApprovalIterator{contract: _ERC20.contract, event: "Approval", logs: logs, sub: sub}, nil } // WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. // // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_USDT *USDTFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *USDTApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { +func (_ERC20 *ERC20Filterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *ERC20Approval, owner []common.Address, spender []common.Address) (event.Subscription, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -602,7 +603,7 @@ func (_USDT *USDTFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *USDT spenderRule = append(spenderRule, spenderItem) } - logs, sub, err := _USDT.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + logs, sub, err := _ERC20.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) if err != nil { return nil, err } @@ -612,8 +613,8 @@ func (_USDT *USDTFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *USDT select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(USDTApproval) - if err := _USDT.contract.UnpackLog(event, "Approval", log); err != nil { + event := new(ERC20Approval) + if err := _ERC20.contract.UnpackLog(event, "Approval", log); err != nil { return err } event.Raw = log @@ -637,18 +638,18 @@ func (_USDT *USDTFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *USDT // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. // // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_USDT *USDTFilterer) ParseApproval(log types.Log) (*USDTApproval, error) { - event := new(USDTApproval) - if err := _USDT.contract.UnpackLog(event, "Approval", log); err != nil { +func (_ERC20 *ERC20Filterer) ParseApproval(log types.Log) (*ERC20Approval, error) { + event := new(ERC20Approval) + if err := _ERC20.contract.UnpackLog(event, "Approval", log); err != nil { return nil, err } event.Raw = log return event, nil } -// USDTTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the USDT contract. -type USDTTransferIterator struct { - Event *USDTTransfer // Event containing the contract specifics and raw log +// ERC20TransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the ERC20 contract. +type ERC20TransferIterator struct { + Event *ERC20Transfer // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -662,7 +663,7 @@ type USDTTransferIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *USDTTransferIterator) Next() bool { +func (it *ERC20TransferIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -671,7 +672,7 @@ func (it *USDTTransferIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(USDTTransfer) + it.Event = new(ERC20Transfer) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -686,7 +687,7 @@ func (it *USDTTransferIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(USDTTransfer) + it.Event = new(ERC20Transfer) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -702,19 +703,19 @@ func (it *USDTTransferIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *USDTTransferIterator) Error() error { +func (it *ERC20TransferIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *USDTTransferIterator) Close() error { +func (it *ERC20TransferIterator) Close() error { it.sub.Unsubscribe() return nil } -// USDTTransfer represents a Transfer event raised by the USDT contract. -type USDTTransfer struct { +// ERC20Transfer represents a Transfer event raised by the ERC20 contract. +type ERC20Transfer struct { From common.Address To common.Address Value *big.Int @@ -724,7 +725,7 @@ type USDTTransfer struct { // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. // // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_USDT *USDTFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*USDTTransferIterator, error) { +func (_ERC20 *ERC20Filterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*ERC20TransferIterator, error) { var fromRule []interface{} for _, fromItem := range from { @@ -735,17 +736,17 @@ func (_USDT *USDTFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.A toRule = append(toRule, toItem) } - logs, sub, err := _USDT.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + logs, sub, err := _ERC20.contract.FilterLogs(opts, "Transfer", fromRule, toRule) if err != nil { return nil, err } - return &USDTTransferIterator{contract: _USDT.contract, event: "Transfer", logs: logs, sub: sub}, nil + return &ERC20TransferIterator{contract: _ERC20.contract, event: "Transfer", logs: logs, sub: sub}, nil } // WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. // // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_USDT *USDTFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *USDTTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { +func (_ERC20 *ERC20Filterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *ERC20Transfer, from []common.Address, to []common.Address) (event.Subscription, error) { var fromRule []interface{} for _, fromItem := range from { @@ -756,7 +757,7 @@ func (_USDT *USDTFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *USDT toRule = append(toRule, toItem) } - logs, sub, err := _USDT.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + logs, sub, err := _ERC20.contract.WatchLogs(opts, "Transfer", fromRule, toRule) if err != nil { return nil, err } @@ -766,8 +767,8 @@ func (_USDT *USDTFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *USDT select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(USDTTransfer) - if err := _USDT.contract.UnpackLog(event, "Transfer", log); err != nil { + event := new(ERC20Transfer) + if err := _ERC20.contract.UnpackLog(event, "Transfer", log); err != nil { return err } event.Raw = log @@ -791,9 +792,9 @@ func (_USDT *USDTFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *USDT // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. // // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_USDT *USDTFilterer) ParseTransfer(log types.Log) (*USDTTransfer, error) { - event := new(USDTTransfer) - if err := _USDT.contract.UnpackLog(event, "Transfer", log); err != nil { +func (_ERC20 *ERC20Filterer) ParseTransfer(log types.Log) (*ERC20Transfer, error) { + event := new(ERC20Transfer) + if err := _ERC20.contract.UnpackLog(event, "Transfer", log); err != nil { return nil, err } event.Raw = log diff --git a/e2e/contracts/erc20/USDT.json b/e2e/contracts/erc20/USDT.json deleted file mode 100644 index fb7239aa54..0000000000 --- a/e2e/contracts/erc20/USDT.json +++ /dev/null @@ -1,280 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "USDT", - "sourceName": "contracts/USDT.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "uint8", - "name": "decimals_", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x60806040523480156200001157600080fd5b5060405162000bb138038062000bb183398101604081905262000034916200014c565b600362000042848262000260565b50600462000051838262000260565b506005805460ff191660ff92909216919091179055505033600090815260208190526040902066038d7ea4c6800090556200032c565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620000af57600080fd5b81516001600160401b0380821115620000cc57620000cc62000087565b604051601f8301601f19908116603f01168101908282118183101715620000f757620000f762000087565b816040528381526020925086838588010111156200011457600080fd5b600091505b8382101562000138578582018301518183018401529082019062000119565b600093810190920192909252949350505050565b6000806000606084860312156200016257600080fd5b83516001600160401b03808211156200017a57600080fd5b62000188878388016200009d565b945060208601519150808211156200019f57600080fd5b50620001ae868287016200009d565b925050604084015160ff81168114620001c657600080fd5b809150509250925092565b600181811c90821680620001e657607f821691505b6020821081036200020757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200025b57600081815260208120601f850160051c81016020861015620002365750805b601f850160051c820191505b81811015620002575782815560010162000242565b5050505b505050565b81516001600160401b038111156200027c576200027c62000087565b62000294816200028d8454620001d1565b846200020d565b602080601f831160018114620002cc5760008415620002b35750858301515b600019600386901b1c1916600185901b17855562000257565b600085815260208120601f198616915b82811015620002fd57888601518255948401946001909101908401620002dc565b50858210156200031c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b610875806200033c6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806342966c681161007157806342966c681461012957806370a082311461013e57806395d89b4114610167578063a0712d681461016f578063a9059cbb14610182578063dd62ed3e1461019557600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101ce565b6040516100c3919061068b565b60405180910390f35b6100df6100da3660046106f5565b610260565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461071f565b610277565b60055460405160ff90911681526020016100c3565b61013c61013736600461075b565b61032d565b005b6100f361014c366004610774565b6001600160a01b031660009081526020819052604090205490565b6100b6610354565b61013c61017d36600461075b565b610363565b6100df6101903660046106f5565b610382565b6100f36101a3366004610796565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101dd906107c9565b80601f0160208091040260200160405190810160405280929190818152602001828054610209906107c9565b80156102565780601f1061022b57610100808354040283529160200191610256565b820191906000526020600020905b81548152906001019060200180831161023957829003601f168201915b5050505050905090565b600061026d33848461038f565b5060015b92915050565b60006102848484846104b3565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561030e5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610322853361031d8685610819565b61038f565b506001949350505050565b336000908152602081905260408120805483929061034c908490610819565b909155505050565b6060600480546101dd906107c9565b336000908152602081905260408120805483929061034c90849061082c565b600061026d3384846104b3565b6001600160a01b0383166103f15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610305565b6001600160a01b0382166104525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610305565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610305565b6001600160a01b0382166105795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610305565b6001600160a01b038316600090815260208190526040902054818110156105f15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610305565b6105fb8282610819565b6001600160a01b03808616600090815260208190526040808220939093559085168152908120805484929061063190849061082c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161067d91815260200190565b60405180910390a350505050565b600060208083528351808285015260005b818110156106b85785810183015185820160400152820161069c565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146106f057600080fd5b919050565b6000806040838503121561070857600080fd5b610711836106d9565b946020939093013593505050565b60008060006060848603121561073457600080fd5b61073d846106d9565b925061074b602085016106d9565b9150604084013590509250925092565b60006020828403121561076d57600080fd5b5035919050565b60006020828403121561078657600080fd5b61078f826106d9565b9392505050565b600080604083850312156107a957600080fd5b6107b2836106d9565b91506107c0602084016106d9565b90509250929050565b600181811c908216806107dd57607f821691505b6020821081036107fd57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561027157610271610803565b808201808211156102715761027161080356fea26469706673582212202be4005b8bbb29132ec10f55a7ffcfb97074f1c7504254b1a3048764592668bb64736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806342966c681161007157806342966c681461012957806370a082311461013e57806395d89b4114610167578063a0712d681461016f578063a9059cbb14610182578063dd62ed3e1461019557600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101ce565b6040516100c3919061068b565b60405180910390f35b6100df6100da3660046106f5565b610260565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461071f565b610277565b60055460405160ff90911681526020016100c3565b61013c61013736600461075b565b61032d565b005b6100f361014c366004610774565b6001600160a01b031660009081526020819052604090205490565b6100b6610354565b61013c61017d36600461075b565b610363565b6100df6101903660046106f5565b610382565b6100f36101a3366004610796565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101dd906107c9565b80601f0160208091040260200160405190810160405280929190818152602001828054610209906107c9565b80156102565780601f1061022b57610100808354040283529160200191610256565b820191906000526020600020905b81548152906001019060200180831161023957829003601f168201915b5050505050905090565b600061026d33848461038f565b5060015b92915050565b60006102848484846104b3565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561030e5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610322853361031d8685610819565b61038f565b506001949350505050565b336000908152602081905260408120805483929061034c908490610819565b909155505050565b6060600480546101dd906107c9565b336000908152602081905260408120805483929061034c90849061082c565b600061026d3384846104b3565b6001600160a01b0383166103f15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610305565b6001600160a01b0382166104525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610305565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105175760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610305565b6001600160a01b0382166105795760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610305565b6001600160a01b038316600090815260208190526040902054818110156105f15760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610305565b6105fb8282610819565b6001600160a01b03808616600090815260208190526040808220939093559085168152908120805484929061063190849061082c565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161067d91815260200190565b60405180910390a350505050565b600060208083528351808285015260005b818110156106b85785810183015185820160400152820161069c565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146106f057600080fd5b919050565b6000806040838503121561070857600080fd5b610711836106d9565b946020939093013593505050565b60008060006060848603121561073457600080fd5b61073d846106d9565b925061074b602085016106d9565b9150604084013590509250925092565b60006020828403121561076d57600080fd5b5035919050565b60006020828403121561078657600080fd5b61078f826106d9565b9392505050565b600080604083850312156107a957600080fd5b6107b2836106d9565b91506107c0602084016106d9565b90509250929050565b600181811c908216806107dd57607f821691505b6020821081036107fd57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561027157610271610803565b808201808211156102715761027161080356fea26469706673582212202be4005b8bbb29132ec10f55a7ffcfb97074f1c7504254b1a3048764592668bb64736f6c63430008110033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/e2e/contracts/erc20/bindings.go b/e2e/contracts/erc20/bindings.go index 3d8c4e505f..3d4134015e 100644 --- a/e2e/contracts/erc20/bindings.go +++ b/e2e/contracts/erc20/bindings.go @@ -1,5 +1,3 @@ -//go:generate sh -c "cat USDT.json | jq .abi > USDT.abi" -//go:generate sh -c "cat USDT.json | jq .bytecode | tr -d '\"' > USDT.bin" -//go:generate sh -c "abigen --abi USDT.abi --bin USDT.bin --pkg erc20 --type USDT --out USDT.go" +//go:generate sh -c "abigen --bin ERC20.bin --abi ERC20.abi --pkg erc20 --type ERC20 --out ERC20.go" package erc20 diff --git a/e2e/e2etests/e2etests.go b/e2e/e2etests/e2etests.go index 37fc744502..70bdc6de94 100644 --- a/e2e/e2etests/e2etests.go +++ b/e2e/e2etests/e2etests.go @@ -67,7 +67,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMultipleERC20DepositName, - "deposit USDT ERC20 into ZEVM in multiple deposits", + "deposit ERC20 into ZEVM in multiple deposits", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount", DefaultValue: "1000000000"}, runner.ArgDefinition{Description: "count", DefaultValue: "3"}, @@ -117,7 +117,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingName, - "goerli->goerli message passing (sending ZETA only)", + "evm->evm message passing (sending ZETA only)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, @@ -125,7 +125,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestZRC20SwapName, - "swap ZRC20 USDT for ZRC20 ETH", + "swap ZRC20 ERC20 for ZRC20 ETH", []runner.ArgDefinition{}, TestZRC20Swap, ), @@ -153,7 +153,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingRevertFailName, - "goerli->goerli message passing (revert fail)", + "evm->evm message passing (revert fail)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, @@ -161,7 +161,7 @@ var AllE2ETests = []runner.E2ETest{ ), runner.NewE2ETest( TestMessagePassingRevertSuccessName, - "goerli->goerli message passing (revert success)", + "evm->evm message passing (revert success)", []runner.ArgDefinition{ runner.ArgDefinition{Description: "amount in azeta", DefaultValue: "10000000000000000000"}, }, diff --git a/e2e/e2etests/test_bitcoin_withdraw.go b/e2e/e2etests/test_bitcoin_withdraw.go index d484aff840..edd779b595 100644 --- a/e2e/e2etests/test_bitcoin_withdraw.go +++ b/e2e/e2etests/test_bitcoin_withdraw.go @@ -30,6 +30,8 @@ func TestBitcoinWithdraw(r *runner.E2ERunner, args []string) { } amount := big.NewInt(int64(withdrawalAmountSat)) + r.SetBtcAddress(r.Name, false) + WithdrawBitcoin(r, amount) } @@ -49,15 +51,17 @@ func TestBitcoinWithdrawRestricted(r *runner.E2ERunner, args []string) { } amount := big.NewInt(int64(withdrawalAmountSat)) + r.SetBtcAddress(r.Name, false) + WithdrawBitcoinRestricted(r, amount) } func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) *btcjson.TxRawResult { - tx, err := r.BTCZRC20.Approve(r.ZevmAuth, r.BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee + tx, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.BTCZRC20Addr, big.NewInt(amount.Int64()*2)) // approve more to cover withdraw fee if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("approve receipt status is not 1")) } @@ -66,11 +70,11 @@ func withdrawBTCZRC20(r *runner.E2ERunner, to btcutil.Address, amount *big.Int) stop := r.MineBlocks() // withdraw 'amount' of BTC from ZRC20 to BTC address - tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte(to.EncodeAddress()), amount) + tx, err = r.BTCZRC20.Withdraw(r.ZEVMAuth, []byte(to.EncodeAddress()), amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("withdraw receipt status is not 1")) } @@ -145,7 +149,7 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // panic(err) // } // r.Logger.Info("BTCZRC20Addr: %s", BTCZRC20Addr.Hex()) -// BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, r.ZevmClient) +// BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, r.ZEVMClient) // if err != nil { // panic(err) // } @@ -159,11 +163,11 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // // approve the ZRC20 contract to spend 1 BTC from the deployer address // { // // approve more to cover withdraw fee -// tx, err := BTCZRC20.Approve(r.ZevmAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) +// tx, err := BTCZRC20.Approve(r.ZEVMAuth, BTCZRC20Addr, totalAmount.Mul(totalAmount, big.NewInt(100))) // if err != nil { // panic(err) // } -// receipt := config.MustWaitForTxReceipt(r.ZevmClient, tx, r.Logger) +// receipt := config.MustWaitForTxReceipt(r.ZEVMClient, tx, r.Logger) // r.Logger.Info("approve receipt: status %d", receipt.Status) // if receipt.Status != 1 { // panic(fmt.Errorf("approve receipt status is not 1")) @@ -185,11 +189,11 @@ func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // panic(err) // } // r.Logger.Info("withdraw gas fee: %d", gasFee) -// tx, err := BTCZRC20.Withdraw(r.ZevmAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), amount) +// tx, err := BTCZRC20.Withdraw(r.ZEVMAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), amount) // if err != nil { // panic(err) // } -// receipt := config.MustWaitForTxReceipt(r.ZevmClient, tx, r.Logger) +// receipt := config.MustWaitForTxReceipt(r.ZEVMClient, tx, r.Logger) // r.Logger.Info("withdraw receipt: status %d", receipt.Status) // if receipt.Status != 1 { // panic(fmt.Errorf("withdraw receipt status is not 1")) diff --git a/e2e/e2etests/test_bitcoin_withdraw_invalid.go b/e2e/e2etests/test_bitcoin_withdraw_invalid.go index 3b6953a3d3..d168826493 100644 --- a/e2e/e2etests/test_bitcoin_withdraw_invalid.go +++ b/e2e/e2etests/test_bitcoin_withdraw_invalid.go @@ -26,6 +26,8 @@ func TestBitcoinWithdrawToInvalidAddress(r *runner.E2ERunner, args []string) { } amount := big.NewInt(int64(withdrawalAmountSat)) + r.SetBtcAddress(r.Name, false) + WithdrawToInvalidAddress(r, amount) } @@ -33,11 +35,11 @@ func WithdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) { approvalAmount := 1000000000000000000 // approve the ZRC20 contract to spend approvalAmount BTC from the deployer address. // the actual amount transferred is provided as test arg BTC, but we approve more to cover withdraw fee - tx, err := r.BTCZRC20.Approve(r.ZevmAuth, r.BTCZRC20Addr, big.NewInt(int64(approvalAmount))) + tx, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.BTCZRC20Addr, big.NewInt(int64(approvalAmount))) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic(fmt.Errorf("approve receipt status is not 1")) } @@ -46,11 +48,11 @@ func WithdrawToInvalidAddress(r *runner.E2ERunner, amount *big.Int) { stop := r.MineBlocks() // withdraw amount provided as test arg BTC from ZRC20 to BTC legacy address - tx, err = r.BTCZRC20.Withdraw(r.ZevmAuth, []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3"), amount) + tx, err = r.BTCZRC20.Withdraw(r.ZEVMAuth, []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3"), amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic(fmt.Errorf("withdraw receipt status is successful for an invalid BTC address")) } diff --git a/e2e/e2etests/test_context.go b/e2e/e2etests/test_context.go index 6600283dbb..eeb9c62ea9 100644 --- a/e2e/e2etests/test_context.go +++ b/e2e/e2etests/test_context.go @@ -31,12 +31,12 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { panic(err) } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", signedTx.To().String()) r.Logger.Info(" value: %d", signedTx.Value()) @@ -63,7 +63,7 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { if bytes.Compare(eventIter.Event.Origin, r.DeployerAddress.Bytes()) != 0 { panic("origin mismatch") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index 66eedc2d31..34aa6e3d23 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -13,52 +13,52 @@ import ( ) func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { - r.ZevmAuth.GasLimit = 10000000 + r.ZEVMAuth.GasLimit = 10000000 // TODO: move into setup and skip it if already initialized // https://github.com/zeta-chain/node-private/issues/88 // it is kept as is for now to be consistent with the old implementation // if the tx fails due to already initialized, it will be ignored - _, err := r.UniswapV2Factory.CreatePair(r.ZevmAuth, r.USDTZRC20Addr, r.BTCZRC20Addr) + _, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.BTCZRC20Addr) if err != nil { r.Logger.Print("ℹ️create pair error") } - txUSDTApprove, err := r.USDTZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + txERC20ZRC20Approve, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - txBTCApprove, err := r.BTCZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + txBTCApprove, err := r.BTCZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } // Fund ZEVMSwapApp with gas ZRC20s - txTransferETH, err := r.ETHZRC20.Transfer(r.ZevmAuth, r.ZEVMSwapAppAddr, big.NewInt(1e7)) + txTransferETH, err := r.ETHZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e7)) if err != nil { panic(err) } - txTransferBTC, err := r.BTCZRC20.Transfer(r.ZevmAuth, r.ZEVMSwapAppAddr, big.NewInt(1e6)) + txTransferBTC, err := r.BTCZRC20.Transfer(r.ZEVMAuth, r.ZEVMSwapAppAddr, big.NewInt(1e6)) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txUSDTApprove, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { - panic("usdt approve failed") + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txERC20ZRC20Approve, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + panic("ZRC20 ERC20 approve failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txBTCApprove, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txBTCApprove, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("btc approve failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txTransferETH, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txTransferETH, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("ETH ZRC20 transfer failed") } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txTransferBTC, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txTransferBTC, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("BTC ZRC20 transfer failed") } - // Add 100 USDT liq and 0.001 BTC + // Add 100 erc20 zrc20 liq and 0.001 BTC txAddLiquidity, err := r.UniswapV2Router.AddLiquidity( - r.ZevmAuth, - r.USDTZRC20Addr, + r.ZEVMAuth, + r.ERC20ZRC20Addr, r.BTCZRC20Addr, big.NewInt(1e8), big.NewInt(1e8), @@ -71,7 +71,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { panic(fmt.Sprintf("Error liq %s", err.Error())) } - if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, txAddLiquidity, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txAddLiquidity, r.Logger, r.ReceiptTimeout); receipt.Status != 1 { panic("add liq receipt status is not 1") } @@ -87,8 +87,8 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("memobytes(%d) %x", len(memobytes), memobytes) msg = append(msg, memobytes...) - r.Logger.Info("***** First test: USDT -> BTC") - // Should deposit USDT for swap, swap for BTC and withdraw BTC + r.Logger.Info("***** First test: ERC20 -> BTC") + // Should deposit ERC20 for swap, swap for BTC and withdraw BTC txHash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, big.NewInt(8e7), msg) cctx1 := utils.WaitCctxMinedByInTxHash(r.Ctx, txHash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) @@ -118,14 +118,14 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("cctx2 outbound tx hash %s", cctx2.GetCurrentOutTxParam().OutboundTxHash) - r.Logger.Info("******* Second test: BTC -> USDT") + r.Logger.Info("******* Second test: BTC -> ERC20ZRC20") utxos, err := r.BtcRPCClient.ListUnspent() if err != nil { panic(err) } r.Logger.Info("#utxos %d", len(utxos)) - r.Logger.Info("memo address %s", r.USDTZRC20Addr) - memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.USDTZRC20Addr, r.DeployerAddress.Bytes()) + r.Logger.Info("memo address %s", r.ERC20ZRC20Addr) + memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.ERC20ZRC20Addr, r.DeployerAddress.Bytes()) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_donation.go b/e2e/e2etests/test_donation.go index 0428f6229d..fbf4670c3e 100644 --- a/e2e/e2etests/test_donation.go +++ b/e2e/e2etests/test_donation.go @@ -26,7 +26,7 @@ func TestDonationEther(r *runner.E2ERunner, args []string) { r.Logger.EVMTransaction(*txDonation, "donation") // check contract deployment receipt - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, txDonation, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, txDonation, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "donation") if receipt.Status != 1 { panic("donation tx failed") diff --git a/e2e/e2etests/test_erc20_multiple_deposits.go b/e2e/e2etests/test_erc20_multiple_deposits.go index 053e3f596a..d48b0fe2ac 100644 --- a/e2e/e2etests/test_erc20_multiple_deposits.go +++ b/e2e/e2etests/test_erc20_multiple_deposits.go @@ -26,7 +26,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { panic("Invalid number of deposits specified for TestMultipleERC20Deposit.") } - initialBal, err := r.USDTZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } @@ -37,7 +37,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { } // check new balance is increased by amount * count - bal, err := r.USDTZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } @@ -50,7 +50,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Hash { // deploy depositor - depositorAddr, _, depositor, err := testcontract.DeployDepositor(r.GoerliAuth, r.GoerliClient, r.ERC20CustodyAddr) + depositorAddr, _, depositor, err := testcontract.DeployDepositor(r.EVMAuth, r.EVMClient, r.ERC20CustodyAddr) if err != nil { panic(err) } @@ -58,22 +58,22 @@ func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Has fullAmount := big.NewInt(0).Mul(amount, count) // approve - tx, err := r.USDTERC20.Approve(r.GoerliAuth, depositorAddr, fullAmount) + tx, err := r.ERC20.Approve(r.EVMAuth, depositorAddr, fullAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } - r.Logger.Info("USDT Approve receipt tx hash: %s", tx.Hash().Hex()) + r.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) // deposit - tx, err = depositor.RunDeposits(r.GoerliAuth, r.DeployerAddress.Bytes(), r.USDTERC20Addr, amount, []byte{}, count) + tx, err = depositor.RunDeposits(r.EVMAuth, r.DeployerAddress.Bytes(), r.ERC20Addr, amount, []byte{}, count) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposits failed") } @@ -87,6 +87,6 @@ func MultipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Has r.Logger.Info("Multiple deposit event: ") r.Logger.Info(" Amount: %d, ", event.Amount) } - r.Logger.Info("gas limit %d", r.ZevmAuth.GasLimit) + r.Logger.Info("gas limit %d", r.ZEVMAuth.GasLimit) return tx.Hash() } diff --git a/e2e/e2etests/test_erc20_multiple_withdraws.go b/e2e/e2etests/test_erc20_multiple_withdraws.go index 0d3a69ef8e..3991165818 100644 --- a/e2e/e2etests/test_erc20_multiple_withdraws.go +++ b/e2e/e2etests/test_erc20_multiple_withdraws.go @@ -33,56 +33,56 @@ func TestMultipleWithdraws(r *runner.E2ERunner, args []string) { } // deploy withdrawer - withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(r.ZevmAuth, r.ZevmClient) + withdrawerAddr, _, withdrawer, err := testcontract.DeployWithdrawer(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } // approve - tx, err := r.USDTZRC20.Approve(r.ZevmAuth, withdrawerAddr, approvedAmount) + tx, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, withdrawerAddr, approvedAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } - r.Logger.Info("USDT ZRC20 approve receipt: status %d", receipt.Status) + r.Logger.Info("ERC20 ZRC20 approve receipt: status %d", receipt.Status) // approve gas token - tx, err = r.ETHZRC20.Approve(r.ZevmAuth, withdrawerAddr, approvedAmount) + tx, err = r.ETHZRC20.Approve(r.ZEVMAuth, withdrawerAddr, approvedAmount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve gas token failed") } r.Logger.Info("eth zrc20 approve receipt: status %d", receipt.Status) // check the balance - bal, err := r.USDTZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } - r.Logger.Info("balance of deployer on USDT ZRC20: %d", bal) + r.Logger.Info("balance of deployer on ERC20 ZRC20: %d", bal) if bal.Int64() < totalWithdrawal.Int64() { - panic("not enough USDT ZRC20 balance!") + panic("not enough ERC20 ZRC20 balance!") } // withdraw tx, err = withdrawer.RunWithdraws( - r.ZevmAuth, + r.ZEVMAuth, r.DeployerAddress.Bytes(), - r.USDTZRC20Addr, + r.ERC20ZRC20Addr, withdrawalAmount, numberOfWithdrawals, ) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } diff --git a/e2e/e2etests/test_erc20_refund.go b/e2e/e2etests/test_erc20_refund.go index 9a725d5997..4d378f91b5 100644 --- a/e2e/e2etests/test_erc20_refund.go +++ b/e2e/e2etests/test_erc20_refund.go @@ -15,7 +15,7 @@ import ( func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { // Get the initial balance of the deployer - initialBal, err := r.USDTZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } @@ -25,7 +25,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { amount := big.NewInt(1e4) // send the deposit - inTxHash, err := sendInvalidUSDTDeposit(r, amount) + inTxHash, err := sendInvalidERC20Deposit(r, amount) if err != nil { panic(err) } @@ -52,7 +52,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { } // Check that the erc20 in the aborted cctx was refunded on ZetaChain - newBalance, err := r.USDTZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + newBalance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } @@ -72,18 +72,18 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Liquidity pool created") - goerliBalance, err := r.USDTERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + erc20Balance, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } // send the deposit amount = big.NewInt(1e7) - inTxHash, err = sendInvalidUSDTDeposit(r, amount) + inTxHash, err = sendInvalidERC20Deposit(r, amount) if err != nil { panic(err) } - goerliBalanceAfterSend := big.NewInt(0).Sub(goerliBalance, amount) + erc20BalanceAfterSend := big.NewInt(0).Sub(erc20Balance, amount) // there is a liquidity pool, therefore the cctx should revert cctx = utils.WaitCctxMinedByInTxHash(r.Ctx, inTxHash, r.CctxClient, r.Logger, r.CctxTimeout) @@ -99,7 +99,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { // get revert tx revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - receipt, err := r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) + receipt, err := r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -107,32 +107,32 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { panic("expected the revert tx receipt to have status 1; got 0") } - // check that the erc20 in the reverted cctx was refunded on Goerli - goerliBalanceAfterRefund, err := r.USDTERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + // check that the erc20 in the reverted cctx was refunded on EVM + erc20BalanceAfterRefund, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { panic(err) } // the new balance must be higher than the previous one because of the revert refund - if goerliBalanceAfterSend.Cmp(goerliBalanceAfterRefund) != -1 { + if erc20BalanceAfterSend.Cmp(erc20BalanceAfterRefund) != -1 { panic(fmt.Sprintf( "expected balance to be higher after refund than after send %s < %s", - goerliBalanceAfterSend.String(), - goerliBalanceAfterRefund.String(), + erc20BalanceAfterSend.String(), + erc20BalanceAfterRefund.String(), )) } // it must also be lower than the previous balance + the amount because of the gas fee for the revert tx - if goerliBalanceAfterRefund.Cmp(goerliBalance) != -1 { + if erc20BalanceAfterRefund.Cmp(erc20Balance) != -1 { panic(fmt.Sprintf( "expected balance to be lower after refund than before send %s < %s", - goerliBalanceAfterRefund.String(), - goerliBalance.String()), + erc20BalanceAfterRefund.String(), + erc20Balance.String()), ) } r.Logger.Info("ERC20 CCTX successfully reverted") - r.Logger.Info("\tbalance before refund: %s", goerliBalance.String()) + r.Logger.Info("\tbalance before refund: %s", erc20Balance.String()) r.Logger.Info("\tamount: %s", amount.String()) - r.Logger.Info("\tbalance after refund: %s", goerliBalanceAfterRefund.String()) + r.Logger.Info("\tbalance after refund: %s", erc20BalanceAfterRefund.String()) } func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { @@ -140,31 +140,31 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { txHash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, amount, []byte{}) utils.WaitCctxMinedByInTxHash(r.Ctx, txHash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) - tx, err := r.USDTZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e10)) + tx, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e10)) if err != nil { return err } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return errors.New("approve failed") } - previousValue := r.ZevmAuth.Value - r.ZevmAuth.Value = big.NewInt(1e10) + previousValue := r.ZEVMAuth.Value + r.ZEVMAuth.Value = big.NewInt(1e10) tx, err = r.UniswapV2Router.AddLiquidityETH( - r.ZevmAuth, - r.USDTZRC20Addr, + r.ZEVMAuth, + r.ERC20ZRC20Addr, amount, big.NewInt(0), big.NewInt(0), r.DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) - r.ZevmAuth.Value = previousValue + r.ZEVMAuth.Value = previousValue if err != nil { return err } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return fmt.Errorf("add liquidity failed") } @@ -172,19 +172,18 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { return nil } -func sendInvalidUSDTDeposit(r *runner.E2ERunner, amount *big.Int) (string, error) { - USDT := r.USDTERC20 - tx, err := USDT.Approve(r.GoerliAuth, r.ERC20CustodyAddr, amount) +func sendInvalidERC20Deposit(r *runner.E2ERunner, amount *big.Int) (string, error) { + tx, err := r.ERC20.Approve(r.EVMAuth, r.ERC20CustodyAddr, amount) if err != nil { return "", err } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) - r.Logger.Info("USDT Approve receipt tx hash: %s", tx.Hash().Hex()) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) tx, err = r.ERC20Custody.Deposit( - r.GoerliAuth, + r.EVMAuth, r.DeployerAddress.Bytes(), - r.USDTERC20Addr, + r.ERC20Addr, amount, []byte("this is an invalid msg that will cause the contract to revert"), ) @@ -192,12 +191,12 @@ func sendInvalidUSDTDeposit(r *runner.E2ERunner, amount *big.Int) (string, error return "", err } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", tx.Hash().String(), tx.To().Hex(), tx.Nonce()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", tx.Hash().String(), tx.To().Hex(), tx.Nonce()) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { return "", errors.New("expected the tx receipt to have status 1; got 0") } - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", tx.To().String()) r.Logger.Info(" value: %d", tx.Value()) diff --git a/e2e/e2etests/test_erc20_withdraw.go b/e2e/e2etests/test_erc20_withdraw.go index 5817a269bf..26959c0eac 100644 --- a/e2e/e2etests/test_erc20_withdraw.go +++ b/e2e/e2etests/test_erc20_withdraw.go @@ -25,25 +25,25 @@ func TestERC20Withdraw(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.USDTZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ERC20ZRC20Addr, approvedAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.Info("eth zrc20 approve receipt: status %d", receipt.Status) // withdraw - tx, err = r.USDTZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err = r.ERC20ZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Receipt txhash %s status %d", receipt.TxHash, receipt.Status) for _, log := range receipt.Logs { - event, err := r.USDTZRC20.ParseWithdrawal(*log) + event, err := r.ERC20ZRC20.ParseWithdrawal(*log) if err != nil { continue } @@ -61,11 +61,11 @@ func TestERC20Withdraw(r *runner.E2ERunner, args []string) { verifyTransferAmountFromCCTX(r, cctx, withdrawalAmount.Int64()) } -// verifyTransferAmountFromCCTX verifies the transfer amount from the CCTX on Goerli +// verifyTransferAmountFromCCTX verifies the transfer amount from the CCTX on EVM func verifyTransferAmountFromCCTX(r *runner.E2ERunner, cctx *crosschaintypes.CrossChainTx, amount int64) { r.Logger.Info("outTx hash %s", cctx.GetCurrentOutTxParam().OutboundTxHash) - receipt, err := r.GoerliClient.TransactionReceipt( + receipt, err := r.EVMClient.TransactionReceipt( r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash), ) @@ -74,7 +74,7 @@ func verifyTransferAmountFromCCTX(r *runner.E2ERunner, cctx *crosschaintypes.Cro } r.Logger.Info("Receipt txhash %s status %d", receipt.TxHash, receipt.Status) for _, log := range receipt.Logs { - event, err := r.USDTERC20.ParseTransfer(*log) + event, err := r.ERC20.ParseTransfer(*log) if err != nil { continue } diff --git a/e2e/e2etests/test_eth_deposit.go b/e2e/e2etests/test_eth_deposit.go index d7e1663c1a..bfcc33e1a8 100644 --- a/e2e/e2etests/test_eth_deposit.go +++ b/e2e/e2etests/test_eth_deposit.go @@ -48,27 +48,27 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Deploying example contract") - exampleAddr, _, exampleContract, err := testcontract.DeployExample(r.ZevmAuth, r.ZevmClient) + exampleAddr, _, exampleContract, err := testcontract.DeployExample(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } r.Logger.Info("Example contract deployed") // preparing tx - goerliClient := r.GoerliClient + evmClient := r.EVMClient gasLimit := uint64(23000) - gasPrice, err := goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } - nonce, err := goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } data := append(exampleAddr.Bytes(), []byte("hello sailors")...) tx := ethtypes.NewTransaction(nonce, r.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(r.Ctx) + chainID, err := evmClient.NetworkID(r.Ctx) if err != nil { panic(err) } @@ -82,11 +82,11 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Sending a cross-chain call to example contract") - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("tx failed") } @@ -106,18 +106,18 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { r.Logger.Info("Cross-chain call succeeded") r.Logger.Info("Deploying reverter contract") - reverterAddr, _, _, err := testcontract.DeployReverter(r.ZevmAuth, r.ZevmClient) + reverterAddr, _, _, err := testcontract.DeployReverter(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } r.Logger.Info("Example reverter deployed") // preparing tx for reverter - gasPrice, err = goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err = evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } - nonce, err = goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err = evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } @@ -130,12 +130,12 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { } r.Logger.Info("Sending a cross-chain call to reverter contract") - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("tx failed") } @@ -162,22 +162,22 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestDepositAndCallRefund.") } - goerliClient := r.GoerliClient + evmClient := r.EVMClient - nonce, err := goerliClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) if err != nil { panic(err) } gasLimit := uint64(23000) // in units - gasPrice, err := goerliClient.SuggestGasPrice(r.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(r.Ctx) if err != nil { panic(err) } data := append(r.BTCZRC20Addr.Bytes(), []byte("hello sailors")...) // this data tx := ethtypes.NewTransaction(nonce, r.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(r.Ctx) + chainID, err := evmClient.NetworkID(r.Ctx) if err != nil { panic(err) } @@ -190,13 +190,13 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - err = goerliClient.SendTransaction(r.Ctx, signedTx) + err = evmClient.SendTransaction(r.Ctx, signedTx) if err != nil { panic(err) } - r.Logger.Info("GOERLI tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) - r.Logger.Info("GOERLI tx receipt: %d", receipt.Status) + r.Logger.Info("EVM tx sent: %s; to %s, nonce %d", signedTx.Hash().String(), signedTx.To().Hex(), signedTx.Nonce()) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("EVM tx receipt: %d", receipt.Status) r.Logger.Info(" tx hash: %s", receipt.TxHash.String()) r.Logger.Info(" to: %s", signedTx.To().String()) r.Logger.Info(" value: %d", signedTx.Value()) @@ -206,13 +206,13 @@ func TestDepositAndCallRefund(r *runner.E2ERunner, args []string) { cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.Info("cctx status message: %s", cctx.CctxStatus.StatusMessage) revertTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - r.Logger.Info("GOERLI revert tx receipt: status %d", receipt.Status) + r.Logger.Info("EVM revert tx receipt: status %d", receipt.Status) - tx, _, err := r.GoerliClient.TransactionByHash(r.Ctx, ethcommon.HexToHash(revertTxHash)) + tx, _, err := r.EVMClient.TransactionByHash(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } - receipt, err := r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) + receipt, err := r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(revertTxHash)) if err != nil { panic(err) } @@ -285,7 +285,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -304,7 +304,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -339,7 +339,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } diff --git a/e2e/e2etests/test_eth_withdraw.go b/e2e/e2etests/test_eth_withdraw.go index bc9f7907ee..66e0385642 100644 --- a/e2e/e2etests/test_eth_withdraw.go +++ b/e2e/e2etests/test_eth_withdraw.go @@ -27,26 +27,26 @@ func TestEtherWithdraw(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.ETHZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvedAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "approve") - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } r.Logger.EVMReceipt(*receipt, "approve") // withdraw - tx, err = r.ETHZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err = r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "withdraw") - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } @@ -78,13 +78,13 @@ func TestEtherWithdrawRestricted(r *runner.E2ERunner, args []string) { } // approve - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, r.ETHZRC20Addr, approvedAmount) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, approvedAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "approve") - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } @@ -92,13 +92,13 @@ func TestEtherWithdrawRestricted(r *runner.E2ERunner, args []string) { // withdraw restrictedAddress := ethcommon.HexToAddress(testutils.RestrictedEVMAddressTest) - tx, err = r.ETHZRC20.Withdraw(r.ZevmAuth, restrictedAddress.Bytes(), withdrawalAmount) + tx, err = r.ETHZRC20.Withdraw(r.ZEVMAuth, restrictedAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } r.Logger.EVMTransaction(*tx, "withdraw to restricted address") - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("withdraw failed") } diff --git a/e2e/e2etests/test_message_passing.go b/e2e/e2etests/test_message_passing.go index 6dbe8addae..c01c2a92ac 100644 --- a/e2e/e2etests/test_message_passing.go +++ b/e2e/e2etests/test_message_passing.go @@ -23,20 +23,20 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassing.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } r.Logger.Info("Approving ConnectorEth to spend deployer's ZetaEth") - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.ConnectorEthAddr, amount) if err != nil { panic(err) } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -55,7 +55,7 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { } r.Logger.Info("ConnectorEth.Send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -82,7 +82,7 @@ func TestMessagePassing(r *runner.E2ERunner, args []string) { cctx.CctxStatus.StatusMessage, )) } - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -113,18 +113,18 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassingRevertFail.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.ConnectorEthAddr, amount) if err != nil { panic(err) } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -142,7 +142,7 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("ConnectorEth.Send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } @@ -160,7 +160,7 @@ func TestMessagePassingRevertFail(r *runner.E2ERunner, args []string) { // expect revert tx to fail cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, receipt.TxHash.String(), r.CctxClient, r.Logger, r.CctxTimeout) - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(cctx.GetCurrentOutTxParam().OutboundTxHash)) if err != nil { panic(err) } @@ -183,12 +183,12 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestMessagePassingRevertSuccess.") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - auth := r.GoerliAuth + auth := r.EVMAuth tx, err := r.ZetaEth.Approve(auth, r.TestDAppAddr, amount) if err != nil { @@ -196,14 +196,14 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { } r.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } r.Logger.Info("Approve tx receipt: %d", receipt.Status) r.Logger.Info("Calling TestDApp.SendHello on contract address %s", r.TestDAppAddr.Hex()) - testDApp, err := testdapp.NewTestDApp(r.TestDAppAddr, r.GoerliClient) + testDApp, err := testdapp.NewTestDApp(r.TestDAppAddr, r.EVMClient) if err != nil { panic(err) } @@ -221,7 +221,7 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("TestDApp.SendHello tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("TestDApp.SendHello tx receipt: status %d", receipt.Status) cctx := utils.WaitCctxMinedByInTxHash(r.Ctx, receipt.TxHash.String(), r.CctxClient, r.Logger, r.CctxTimeout) @@ -229,7 +229,7 @@ func TestMessagePassingRevertSuccess(r *runner.E2ERunner, args []string) { panic("expected cctx to be reverted") } outTxHash := cctx.GetCurrentOutTxParam().OutboundTxHash - receipt, err = r.GoerliClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(outTxHash)) + receipt, err = r.EVMClient.TransactionReceipt(r.Ctx, ethcommon.HexToHash(outTxHash)) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_pause_zrc20.go b/e2e/e2etests/test_pause_zrc20.go index e357e622e5..0635fc6623 100644 --- a/e2e/e2etests/test_pause_zrc20.go +++ b/e2e/e2etests/test_pause_zrc20.go @@ -15,24 +15,24 @@ import ( func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Setup vault used to test zrc20 interactions r.Logger.Info("Deploying vault") - vaultAddr, _, vaultContract, err := vault.DeployVault(r.ZevmAuth, r.ZevmClient) + vaultAddr, _, vaultContract, err := vault.DeployVault(r.ZEVMAuth, r.ZEVMClient) if err != nil { panic(err) } // Approving vault to spend ZRC20 - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("Vault approval should succeed") } - tx, err = r.USDTZRC20.Approve(r.ZevmAuth, vaultAddr, big.NewInt(1e18)) + tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, vaultAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("Vault approval should succeed") } @@ -64,52 +64,52 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Try operations with ETH ZRC20 r.Logger.Info("Can no longer do operations on ETH ZRC20") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("transfer should fail") } - tx, err = r.ETHZRC20.Burn(r.ZevmAuth, big.NewInt(1e5)) + tx, err = r.ETHZRC20.Burn(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("burn should fail") } // Operation on a contract that interact with ETH ZRC20 should fail r.Logger.Info("Vault contract can no longer interact with ETH ZRC20: %s", r.ETHZRC20Addr.Hex()) - tx, err = vaultContract.Deposit(r.ZevmAuth, r.ETHZRC20Addr, big.NewInt(1e5)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 1 { panic("deposit should fail") } r.Logger.Info("Operations all failed") - // Check we can still interact with USDT ZRC20 + // Check we can still interact with ERC20 ZRC20 r.Logger.Info("Check other ZRC20 can still be operated") - tx, err = r.USDTZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e3)) + tx, err = r.ERC20ZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e3)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { - panic("USDT transfer should succeed") + panic("ERC20 ZRC20 transfer should succeed") } - tx, err = vaultContract.Deposit(r.ZevmAuth, r.USDTZRC20Addr, big.NewInt(1e3)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ERC20ZRC20Addr, big.NewInt(1e3)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { - panic("USDT vault deposit should succeed") + panic("ERC20 ZRC20 vault deposit should succeed") } // Check deposit revert when paused @@ -117,7 +117,7 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.GoerliClient, signedTx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, signedTx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit eth tx failed") } @@ -154,29 +154,29 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { // Try operations with ETH ZRC20 r.Logger.Info("Can do operations on ETH ZRC20 again") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, sample.EthAddress(), big.NewInt(1e5)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, sample.EthAddress(), big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("transfer should succeed") } - tx, err = r.ETHZRC20.Burn(r.ZevmAuth, big.NewInt(1e5)) + tx, err = r.ETHZRC20.Burn(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("burn should succeed") } // Can deposit tokens into the vault again - tx, err = vaultContract.Deposit(r.ZevmAuth, r.ETHZRC20Addr, big.NewInt(1e5)) + tx, err = vaultContract.Deposit(r.ZEVMAuth, r.ETHZRC20Addr, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { panic("deposit should succeed") } diff --git a/e2e/e2etests/test_stress_btc_withdraw.go b/e2e/e2etests/test_stress_btc_withdraw.go index f97b0d0349..dc7579e877 100644 --- a/e2e/e2etests/test_stress_btc_withdraw.go +++ b/e2e/e2etests/test_stress_btc_withdraw.go @@ -30,6 +30,8 @@ func TestStressBTCWithdraw(r *runner.E2ERunner, args []string) { panic("Invalid number of withdrawals specified for TestStressBTCWithdraw.") } + r.SetBtcAddress(r.Name, false) + r.Logger.Print("starting stress test of %d withdraws", numWithdraws) // create a wait group to wait for all the withdraws to complete @@ -44,14 +46,14 @@ func TestStressBTCWithdraw(r *runner.E2ERunner, args []string) { for i := 0; i < numWithdraws; i++ { i := i tx, err := r.BTCZRC20.Withdraw( - r.ZevmAuth, + r.ZEVMAuth, []byte(r.BTCDeployerAddress.EncodeAddress()), big.NewInt(int64(satAmount)), ) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { //r.Logger.Info("index %d: withdraw evm tx failed", index) panic(fmt.Sprintf("index %d: withdraw btc tx %s failed", i, tx.Hash().Hex())) diff --git a/e2e/e2etests/test_stress_eth_deposit.go b/e2e/e2etests/test_stress_eth_deposit.go index d59426335a..df41473ea2 100644 --- a/e2e/e2etests/test_stress_eth_deposit.go +++ b/e2e/e2etests/test_stress_eth_deposit.go @@ -37,7 +37,7 @@ func TestStressEtherDeposit(r *runner.E2ERunner, args []string) { // send the deposits for i := 0; i < numDeposits; i++ { i := i - hash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, depositAmount, []byte{}) + hash := r.DepositEtherWithAmount(false, depositAmount) r.Logger.Print("index %d: starting deposit, tx hash: %s", i, hash.Hex()) eg.Go(func() error { diff --git a/e2e/e2etests/test_stress_eth_withdraw.go b/e2e/e2etests/test_stress_eth_withdraw.go index ebbffdba34..3be0467069 100644 --- a/e2e/e2etests/test_stress_eth_withdraw.go +++ b/e2e/e2etests/test_stress_eth_withdraw.go @@ -31,6 +31,12 @@ func TestStressEtherWithdraw(r *runner.E2ERunner, args []string) { panic("Invalid number of withdrawals specified for TestStressEtherWithdraw.") } + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, r.ETHZRC20Addr, big.NewInt(1e18)) + if err != nil { + panic(err) + } + r.WaitForTxReceiptOnZEVM(tx) + r.Logger.Print("starting stress test of %d withdraws", numWithdraws) // create a wait group to wait for all the withdraws to complete @@ -39,11 +45,11 @@ func TestStressEtherWithdraw(r *runner.E2ERunner, args []string) { // send the withdraws for i := 0; i < numWithdraws; i++ { i := i - tx, err := r.ETHZRC20.Withdraw(r.ZevmAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status == 0 { //r.Logger.Info("index %d: withdraw evm tx failed", index) panic(fmt.Sprintf("index %d: withdraw evm tx %s failed", i, tx.Hash().Hex())) diff --git a/e2e/e2etests/test_update_bytecode.go b/e2e/e2etests/test_update_bytecode.go index 9feb4a9d4e..6bf5bf9f70 100644 --- a/e2e/e2etests/test_update_bytecode.go +++ b/e2e/e2etests/test_update_bytecode.go @@ -16,11 +16,11 @@ import ( func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // Random approval approved := sample.EthAddress() - tx, err := r.ETHZRC20.Approve(r.ZevmAuth, approved, big.NewInt(1e10)) + tx, err := r.ETHZRC20.Approve(r.ZEVMAuth, approved, big.NewInt(1e10)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("approval failed") } @@ -28,8 +28,8 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // Deploy the TestZRC20 contract r.Logger.Info("Deploying contract with new bytecode") newZRC20Address, tx, newZRC20Contract, err := testzrc20.DeployTestZRC20( - r.ZevmAuth, - r.ZevmClient, + r.ZEVMAuth, + r.ZEVMClient, big.NewInt(5), // #nosec G701 test - always in range uint8(common.CoinType_Gas), @@ -39,7 +39,7 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } // Wait for the contract to be deployed - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("contract deployment failed") } @@ -137,15 +137,15 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Can interact with the new code of the contract") - testZRC20Contract, err := testzrc20.NewTestZRC20(r.ETHZRC20Addr, r.ZevmClient) + testZRC20Contract, err := testzrc20.NewTestZRC20(r.ETHZRC20Addr, r.ZEVMClient) if err != nil { panic(err) } - tx, err = testZRC20Contract.UpdateNewField(r.ZevmAuth, big.NewInt(1e10)) + tx, err = testZRC20Contract.UpdateNewField(r.ZEVMAuth, big.NewInt(1e10)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("update new field failed") } @@ -158,11 +158,11 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { } r.Logger.Info("Interacting with the bytecode contract doesn't disrupt the zrc20 contract") - tx, err = newZRC20Contract.UpdateNewField(r.ZevmAuth, big.NewInt(1e5)) + tx, err = newZRC20Contract.UpdateNewField(r.ZEVMAuth, big.NewInt(1e5)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("update new field failed") } @@ -183,11 +183,11 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { // can continue to operate the ZRC20 r.Logger.Info("Checking the ZRC20 can continue to operate after state change") - tx, err = r.ETHZRC20.Transfer(r.ZevmAuth, approved, big.NewInt(1e14)) + tx, err = r.ETHZRC20.Transfer(r.ZEVMAuth, approved, big.NewInt(1e14)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) if receipt.Status != 1 { panic("transfer failed") } diff --git a/e2e/e2etests/test_zeta_withdraw.go b/e2e/e2etests/test_zeta_withdraw.go index 463c659db9..fd5d91cd14 100644 --- a/e2e/e2etests/test_zeta_withdraw.go +++ b/e2e/e2etests/test_zeta_withdraw.go @@ -23,38 +23,38 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestZetaWithdraw.") } - r.ZevmAuth.Value = amount - tx, err := r.WZeta.Deposit(r.ZevmAuth) + r.ZEVMAuth.Value = amount + tx, err := r.WZeta.Deposit(r.ZEVMAuth) if err != nil { panic(err) } - r.ZevmAuth.Value = big.NewInt(0) + r.ZEVMAuth.Value = big.NewInt(0) r.Logger.Info("wzeta deposit tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "wzeta deposit") if receipt.Status == 0 { panic("deposit failed") } - chainID, err := r.GoerliClient.ChainID(r.Ctx) + chainID, err := r.EVMClient.ChainID(r.Ctx) if err != nil { panic(err) } - tx, err = r.WZeta.Approve(r.ZevmAuth, r.ConnectorZEVMAddr, amount) + tx, err = r.WZeta.Approve(r.ZEVMAuth, r.ConnectorZEVMAddr, amount) if err != nil { panic(err) } r.Logger.Info("wzeta approve tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "wzeta approve") if receipt.Status == 0 { panic(fmt.Sprintf("approve failed, logs: %+v", receipt.Logs)) } - tx, err = r.ConnectorZEVM.Send(r.ZevmAuth, connectorzevm.ZetaInterfacesSendInput{ + tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: chainID, DestinationAddress: r.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(400_000), @@ -66,7 +66,7 @@ func TestZetaWithdraw(r *runner.E2ERunner, args []string) { panic(err) } r.Logger.Info("send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "send") if receipt.Status == 0 { panic(fmt.Sprintf("send failed, logs: %+v", receipt.Logs)) @@ -107,34 +107,34 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestZetaWithdrawBTCRevert.") } - r.ZevmAuth.Value = amount - tx, err := r.WZeta.Deposit(r.ZevmAuth) + r.ZEVMAuth.Value = amount + tx, err := r.WZeta.Deposit(r.ZEVMAuth) if err != nil { panic(err) } - r.ZevmAuth.Value = big.NewInt(0) + r.ZEVMAuth.Value = big.NewInt(0) r.Logger.Info("Deposit tx hash: %s", tx.Hash().Hex()) - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "Deposit") if receipt.Status != 1 { panic("Deposit failed") } - tx, err = r.WZeta.Approve(r.ZevmAuth, r.ConnectorZEVMAddr, big.NewInt(1e18)) + tx, err = r.WZeta.Approve(r.ZEVMAuth, r.ConnectorZEVMAddr, big.NewInt(1e18)) if err != nil { panic(err) } r.Logger.Info("wzeta.approve tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "Approve") if receipt.Status != 1 { panic("Approve failed") } lessThanAmount := amount.Div(amount, big.NewInt(10)) // 1/10 of amount - tx, err = r.ConnectorZEVM.Send(r.ZevmAuth, connectorzevm.ZetaInterfacesSendInput{ + tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(common.BtcRegtestChain().ChainId), DestinationAddress: r.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(400_000), @@ -147,7 +147,7 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { } r.Logger.Info("send tx hash: %s", tx.Hash().Hex()) - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.EVMReceipt(*receipt, "send") if receipt.Status != 0 { panic("Was able to send ZETA to BTC") diff --git a/e2e/e2etests/test_zrc20_swap.go b/e2e/e2etests/test_zrc20_swap.go index 9e02b650e7..0954fb0b7d 100644 --- a/e2e/e2etests/test_zrc20_swap.go +++ b/e2e/e2etests/test_zrc20_swap.go @@ -15,43 +15,43 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { // https://github.com/zeta-chain/node-private/issues/88 // it is kept as is for now to be consistent with the old implementation // if the tx fails due to already initialized, it will be ignored - tx, err := r.UniswapV2Factory.CreatePair(r.ZevmAuth, r.USDTZRC20Addr, r.ETHZRC20Addr) + tx, err := r.UniswapV2Factory.CreatePair(r.ZEVMAuth, r.ERC20ZRC20Addr, r.ETHZRC20Addr) if err != nil { r.Logger.Print("ℹ️create pair error") } else { - utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) } - usdtEthPair, err := r.UniswapV2Factory.GetPair(&bind.CallOpts{}, r.USDTZRC20Addr, r.ETHZRC20Addr) + zrc20EthPair, err := r.UniswapV2Factory.GetPair(&bind.CallOpts{}, r.ERC20ZRC20Addr, r.ETHZRC20Addr) if err != nil { panic(err) } - r.Logger.Info("USDT-ETH pair receipt pair addr %s", usdtEthPair.Hex()) + r.Logger.Info("ZRC20-ETH pair receipt pair addr %s", zrc20EthPair.Hex()) - tx, err = r.USDTZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) - r.Logger.Info("USDT ZRC20 approval receipt txhash %s status %d", receipt.TxHash, receipt.Status) + receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("ERC20 ZRC20 approval receipt txhash %s status %d", receipt.TxHash, receipt.Status) - tx, err = r.ETHZRC20.Approve(r.ZevmAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) + tx, err = r.ETHZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e18)) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("ETH ZRC20 approval receipt txhash %s status %d", receipt.TxHash, receipt.Status) // temporarily increase gas limit to 400000 - previousGasLimit := r.ZevmAuth.GasLimit + previousGasLimit := r.ZEVMAuth.GasLimit defer func() { - r.ZevmAuth.GasLimit = previousGasLimit + r.ZEVMAuth.GasLimit = previousGasLimit }() - r.ZevmAuth.GasLimit = 400000 + r.ZEVMAuth.GasLimit = 400000 tx, err = r.UniswapV2Router.AddLiquidity( - r.ZevmAuth, - r.USDTZRC20Addr, + r.ZEVMAuth, + r.ERC20ZRC20Addr, r.ETHZRC20Addr, big.NewInt(90000), big.NewInt(1000), @@ -63,7 +63,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Add liquidity receipt txhash %s status %d", receipt.TxHash, receipt.Status) balETHBefore, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) @@ -72,18 +72,18 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { } ethOutAmout := big.NewInt(1) tx, err = r.UniswapV2Router.SwapExactTokensForTokens( - r.ZevmAuth, + r.ZEVMAuth, big.NewInt(1000), ethOutAmout, - []ethcommon.Address{r.USDTZRC20Addr, r.ETHZRC20Addr}, + []ethcommon.Address{r.ERC20ZRC20Addr, r.ETHZRC20Addr}, r.DeployerAddress, big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZevmClient, tx, r.Logger, r.ReceiptTimeout) - r.Logger.Info("Swap USDT for ETH ZRC20 %s status %d", receipt.TxHash, receipt.Status) + receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) + r.Logger.Info("Swap ERC20 ZRC20 for ETH ZRC20 %s status %d", receipt.TxHash, receipt.Status) balETHAfter, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) if err != nil { diff --git a/e2e/runner/accounting.go b/e2e/runner/accounting.go index 495a881bc6..5edc8abc8a 100644 --- a/e2e/runner/accounting.go +++ b/e2e/runner/accounting.go @@ -24,14 +24,14 @@ func (runner *E2ERunner) CheckZRC20ReserveAndSupply() error { if err := runner.checkEthTSSBalance(); err != nil { return err } - if err := runner.checkUsdtTSSBalance(); err != nil { + if err := runner.checkERC20TSSBalance(); err != nil { return err } return runner.checkZetaTSSBalance() } func (runner *E2ERunner) checkEthTSSBalance() error { - tssBal, err := runner.GoerliClient.BalanceAt(runner.Ctx, runner.TSSAddress, nil) + tssBal, err := runner.EVMClient.BalanceAt(runner.Ctx, runner.TSSAddress, nil) if err != nil { return err } @@ -80,19 +80,19 @@ func (runner *E2ERunner) CheckBtcTSSBalance() error { return nil } -func (runner *E2ERunner) checkUsdtTSSBalance() error { - usdtBal, err := runner.USDTERC20.BalanceOf(&bind.CallOpts{}, runner.ERC20CustodyAddr) +func (runner *E2ERunner) checkERC20TSSBalance() error { + erc20Balance, err := runner.ERC20.BalanceOf(&bind.CallOpts{}, runner.ERC20CustodyAddr) if err != nil { return err } - zrc20Supply, err := runner.USDTZRC20.TotalSupply(&bind.CallOpts{}) + erc20zrc20Supply, err := runner.ERC20ZRC20.TotalSupply(&bind.CallOpts{}) if err != nil { return err } - if usdtBal.Cmp(zrc20Supply) < 0 { - return fmt.Errorf("USDT: TSS balance (%d) < ZRC20 TotalSupply (%d) ", usdtBal, zrc20Supply) + if erc20Balance.Cmp(erc20zrc20Supply) < 0 { + return fmt.Errorf("ERC20: TSS balance (%d) < ZRC20 TotalSupply (%d) ", erc20Balance, erc20zrc20Supply) } - runner.Logger.Info("USDT: TSS balance (%d) >= ZRC20 TotalSupply (%d)", usdtBal, zrc20Supply) + runner.Logger.Info("ERC20: TSS balance (%d) >= ERC20 ZRC20 TotalSupply (%d)", erc20Balance, erc20zrc20Supply) return nil } diff --git a/e2e/runner/balances.go b/e2e/runner/balances.go index 3147a60eda..19acfd1509 100644 --- a/e2e/runner/balances.go +++ b/e2e/runner/balances.go @@ -32,7 +32,7 @@ type AccountBalancesDiff struct { // GetAccountBalances returns the account balances of the accounts used in the E2E test func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, error) { // zevm - zetaZeta, err := runner.ZevmClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) + zetaZeta, err := runner.ZEVMClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) if err != nil { return AccountBalances{}, err } @@ -44,7 +44,7 @@ func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, erro if err != nil { return AccountBalances{}, err } - zetaErc20, err := runner.USDTZRC20.BalanceOf(&bind.CallOpts{}, runner.DeployerAddress) + zetaErc20, err := runner.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, runner.DeployerAddress) if err != nil { return AccountBalances{}, err } @@ -54,7 +54,7 @@ func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, erro } // evm - evmEth, err := runner.GoerliClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) + evmEth, err := runner.EVMClient.BalanceAt(runner.Ctx, runner.DeployerAddress, nil) if err != nil { return AccountBalances{}, err } @@ -62,7 +62,7 @@ func (runner *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, erro if err != nil { return AccountBalances{}, err } - evmErc20, err := runner.USDTERC20.BalanceOf(&bind.CallOpts{}, runner.DeployerAddress) + evmErc20, err := runner.ERC20.BalanceOf(&bind.CallOpts{}, runner.DeployerAddress) if err != nil { return AccountBalances{}, err } diff --git a/e2e/runner/evm.go b/e2e/runner/evm.go index c8a1e1905c..119b93d79a 100644 --- a/e2e/runner/evm.go +++ b/e2e/runner/evm.go @@ -22,47 +22,47 @@ func (runner *E2ERunner) WaitForTxReceiptOnEvm(tx *ethtypes.Transaction) { }() runner.Lock() - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("tx failed") } } -// MintUSDTOnEvm mints USDT on EVM -// amountUSDT is a multiple of 1e18 -func (runner *E2ERunner) MintUSDTOnEvm(amountUSDT int64) { +// MintERC20OnEvm mints ERC20 on EVM +// amount is a multiple of 1e18 +func (runner *E2ERunner) MintERC20OnEvm(amountERC20 int64) { defer func() { runner.Unlock() }() runner.Lock() - amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountUSDT)) + amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountERC20)) - tx, err := runner.USDTERC20.Mint(runner.GoerliAuth, amount) + tx, err := runner.ERC20.Mint(runner.EVMAuth, amount) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("mint failed") } runner.Logger.Info("Mint receipt tx hash: %s", tx.Hash().Hex()) } -// SendUSDTOnEvm sends USDT to an address on EVM -// this allows the USDT contract deployer to funds other accounts on EVM -// amountUSDT is a multiple of 1e18 -func (runner *E2ERunner) SendUSDTOnEvm(address ethcommon.Address, amountUSDT int64) *ethtypes.Transaction { - // the deployer might be sending USDT in different goroutines +// SendERC20OnEvm sends ERC20 to an address on EVM +// this allows the ERC20 contract deployer to funds other accounts on EVM +// amountERC20 is a multiple of 1e18 +func (runner *E2ERunner) SendERC20OnEvm(address ethcommon.Address, amountERC20 int64) *ethtypes.Transaction { + // the deployer might be sending ERC20 in different goroutines defer func() { runner.Unlock() }() runner.Lock() - amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountUSDT)) + amount := big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(amountERC20)) // transfer - tx, err := runner.USDTERC20.Transfer(runner.GoerliAuth, address, amount) + tx, err := runner.ERC20.Transfer(runner.EVMAuth, address, amount) if err != nil { panic(err) } @@ -76,33 +76,34 @@ func (runner *E2ERunner) DepositERC20() ethcommon.Hash { } func (runner *E2ERunner) DepositERC20WithAmountAndMessage(to ethcommon.Address, amount *big.Int, msg []byte) ethcommon.Hash { - // reset allowance, necessary for USDT - tx, err := runner.USDTERC20.Approve(runner.GoerliAuth, runner.ERC20CustodyAddr, big.NewInt(0)) + // reset allowance, necessary for ERC20 + tx, err := runner.ERC20.Approve(runner.EVMAuth, runner.ERC20CustodyAddr, big.NewInt(0)) if err != nil { panic(err) } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } - runner.Logger.Info("USDT Approve receipt tx hash: %s", tx.Hash().Hex()) + runner.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) - tx, err = runner.USDTERC20.Approve(runner.GoerliAuth, runner.ERC20CustodyAddr, amount) + tx, err = runner.ERC20.Approve(runner.EVMAuth, runner.ERC20CustodyAddr, amount) if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("approve failed") } - runner.Logger.Info("USDT Approve receipt tx hash: %s", tx.Hash().Hex()) + runner.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) - tx, err = runner.ERC20Custody.Deposit(runner.GoerliAuth, to.Bytes(), runner.USDTERC20Addr, amount, msg) + tx, err = runner.ERC20Custody.Deposit(runner.EVMAuth, to.Bytes(), runner.ERC20Addr, amount, msg) runner.Logger.Info("TX: %v", tx) + if err != nil { panic(err) } - receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("deposit failed") } @@ -136,7 +137,7 @@ func (runner *E2ERunner) DepositEtherWithAmount(testHeader bool, amount *big.Int } runner.Logger.EVMTransaction(*signedTx, "send to TSS") - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, signedTx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, signedTx, runner.Logger, runner.ReceiptTimeout) if receipt.Status == 0 { panic("deposit failed") } @@ -151,23 +152,23 @@ func (runner *E2ERunner) DepositEtherWithAmount(testHeader bool, amount *big.Int return signedTx.Hash() } -// SendEther sends ethers to the TSS on Goerli +// SendEther sends ethers to the TSS on EVM func (runner *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []byte) (*ethtypes.Transaction, error) { - goerliClient := runner.GoerliClient + evmClient := runner.EVMClient - nonce, err := goerliClient.PendingNonceAt(runner.Ctx, runner.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(runner.Ctx, runner.DeployerAddress) if err != nil { return nil, err } gasLimit := uint64(30000) // in units - gasPrice, err := goerliClient.SuggestGasPrice(runner.Ctx) + gasPrice, err := evmClient.SuggestGasPrice(runner.Ctx) if err != nil { return nil, err } tx := ethtypes.NewTransaction(nonce, runner.TSSAddress, value, gasLimit, gasPrice, data) - chainID, err := goerliClient.NetworkID(runner.Ctx) + chainID, err := evmClient.NetworkID(runner.Ctx) if err != nil { return nil, err } @@ -181,7 +182,7 @@ func (runner *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []b if err != nil { return nil, err } - err = goerliClient.SendTransaction(runner.Ctx, signedTx) + err = evmClient.SendTransaction(runner.Ctx, signedTx) if err != nil { return nil, err } @@ -199,7 +200,7 @@ func (runner *E2ERunner) ProveEthTransaction(receipt *ethtypes.Receipt) { // #nosec G701 test - always in range txIndex := int(receipt.TransactionIndex) - block, err := runner.GoerliClient.BlockByHash(runner.Ctx, blockHash) + block, err := runner.EVMClient.BlockByHash(runner.Ctx, blockHash) if err != nil { panic(err) } diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index 28bfc90d09..22f549b296 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -44,8 +44,8 @@ type E2ERunner struct { FungibleAdminMnemonic string // rpc clients - ZevmClient *ethclient.Client - GoerliClient *ethclient.Client + ZEVMClient *ethclient.Client + EVMClient *ethclient.Client BtcRPCClient *rpcclient.Client // grpc clients @@ -59,8 +59,8 @@ type E2ERunner struct { ZetaTxServer txserver.ZetaTxServer // evm auth - GoerliAuth *bind.TransactOpts - ZevmAuth *bind.TransactOpts + EVMAuth *bind.TransactOpts + ZEVMAuth *bind.TransactOpts // contracts ZetaEthAddr ethcommon.Address @@ -69,10 +69,10 @@ type E2ERunner struct { ConnectorEth *zetaconnectoreth.ZetaConnectorEth ERC20CustodyAddr ethcommon.Address ERC20Custody *erc20custody.ERC20Custody - USDTERC20Addr ethcommon.Address - USDTERC20 *erc20.USDT - USDTZRC20Addr ethcommon.Address - USDTZRC20 *zrc20.ZRC20 + ERC20Addr ethcommon.Address + ERC20 *erc20.ERC20 + ERC20ZRC20Addr ethcommon.Address + ERC20ZRC20 *zrc20.ZRC20 ETHZRC20Addr ethcommon.Address ETHZRC20 *zrc20.ZRC20 BTCZRC20Addr ethcommon.Address @@ -115,7 +115,7 @@ func NewE2ERunner( deployerAddress ethcommon.Address, deployerPrivateKey string, fungibleAdminMnemonic string, - goerliClient *ethclient.Client, + evmClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, zetaTxServer txserver.ZetaTxServer, @@ -123,7 +123,7 @@ func NewE2ERunner( authClient authtypes.QueryClient, bankClient banktypes.QueryClient, observerClient observertypes.QueryClient, - goerliAuth *bind.TransactOpts, + evmAuth *bind.TransactOpts, zevmAuth *bind.TransactOpts, btcRPCClient *rpcclient.Client, logger *Logger, @@ -137,8 +137,8 @@ func NewE2ERunner( DeployerPrivateKey: deployerPrivateKey, FungibleAdminMnemonic: fungibleAdminMnemonic, - ZevmClient: zevmClient, - GoerliClient: goerliClient, + ZEVMClient: zevmClient, + EVMClient: evmClient, ZetaTxServer: zetaTxServer, CctxClient: cctxClient, FungibleClient: fungibleClient, @@ -146,8 +146,8 @@ func NewE2ERunner( BankClient: bankClient, ObserverClient: observerClient, - GoerliAuth: goerliAuth, - ZevmAuth: zevmAuth, + EVMAuth: evmAuth, + ZEVMAuth: zevmAuth, BtcRPCClient: btcRPCClient, Logger: logger, @@ -166,8 +166,8 @@ func (runner *E2ERunner) CopyAddressesFrom(other *E2ERunner) (err error) { runner.ZetaEthAddr = other.ZetaEthAddr runner.ConnectorEthAddr = other.ConnectorEthAddr runner.ERC20CustodyAddr = other.ERC20CustodyAddr - runner.USDTERC20Addr = other.USDTERC20Addr - runner.USDTZRC20Addr = other.USDTZRC20Addr + runner.ERC20Addr = other.ERC20Addr + runner.ERC20ZRC20Addr = other.ERC20ZRC20Addr runner.ETHZRC20Addr = other.ETHZRC20Addr runner.BTCZRC20Addr = other.BTCZRC20Addr runner.UniswapV2FactoryAddr = other.UniswapV2FactoryAddr @@ -180,60 +180,60 @@ func (runner *E2ERunner) CopyAddressesFrom(other *E2ERunner) (err error) { runner.SystemContractAddr = other.SystemContractAddr // create instances of contracts - runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.GoerliClient) + runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.EVMClient) if err != nil { return err } - runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.GoerliClient) + runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.EVMClient) if err != nil { return err } - runner.ERC20Custody, err = erc20custody.NewERC20Custody(runner.ERC20CustodyAddr, runner.GoerliClient) + runner.ERC20Custody, err = erc20custody.NewERC20Custody(runner.ERC20CustodyAddr, runner.EVMClient) if err != nil { return err } - runner.USDTERC20, err = erc20.NewUSDT(runner.USDTERC20Addr, runner.GoerliClient) + runner.ERC20, err = erc20.NewERC20(runner.ERC20Addr, runner.EVMClient) if err != nil { return err } - runner.USDTZRC20, err = zrc20.NewZRC20(runner.USDTZRC20Addr, runner.ZevmClient) + runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.ETHZRC20, err = zrc20.NewZRC20(runner.ETHZRC20Addr, runner.ZevmClient) + runner.ETHZRC20, err = zrc20.NewZRC20(runner.ETHZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.BTCZRC20, err = zrc20.NewZRC20(runner.BTCZRC20Addr, runner.ZevmClient) + runner.BTCZRC20, err = zrc20.NewZRC20(runner.BTCZRC20Addr, runner.ZEVMClient) if err != nil { return err } - runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZevmClient) + runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZEVMClient) if err != nil { return err } - runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZevmClient) + runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZEVMClient) if err != nil { return err } - runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZevmClient) + runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZEVMClient) if err != nil { return err } - runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZevmClient) + runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZEVMClient) if err != nil { return err } - runner.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(runner.ZEVMSwapAppAddr, runner.ZevmClient) + runner.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(runner.ZEVMSwapAppAddr, runner.ZEVMClient) if err != nil { return err } - runner.ContextApp, err = contextapp.NewContextApp(runner.ContextAppAddr, runner.ZevmClient) + runner.ContextApp, err = contextapp.NewContextApp(runner.ContextAppAddr, runner.ZEVMClient) if err != nil { return err } - runner.SystemContract, err = systemcontract.NewSystemContract(runner.SystemContractAddr, runner.ZevmClient) + runner.SystemContract, err = systemcontract.NewSystemContract(runner.SystemContractAddr, runner.ZEVMClient) if err != nil { return err } @@ -258,7 +258,7 @@ func (runner *E2ERunner) PrintContractAddresses() { runner.Logger.Print(" --- 📜zEVM contracts ---") runner.Logger.Print("SystemContract: %s", runner.SystemContractAddr.Hex()) runner.Logger.Print("ETHZRC20: %s", runner.ETHZRC20Addr.Hex()) - runner.Logger.Print("USDTZRC20: %s", runner.USDTZRC20Addr.Hex()) + runner.Logger.Print("ERC20ZRC20: %s", runner.ERC20ZRC20Addr.Hex()) runner.Logger.Print("BTCZRC20: %s", runner.BTCZRC20Addr.Hex()) runner.Logger.Print("UniswapFactory: %s", runner.UniswapV2FactoryAddr.Hex()) runner.Logger.Print("UniswapRouter: %s", runner.UniswapV2RouterAddr.Hex()) @@ -274,5 +274,5 @@ func (runner *E2ERunner) PrintContractAddresses() { runner.Logger.Print("ZetaEth: %s", runner.ZetaEthAddr.Hex()) runner.Logger.Print("ConnectorEth: %s", runner.ConnectorEthAddr.Hex()) runner.Logger.Print("ERC20Custody: %s", runner.ERC20CustodyAddr.Hex()) - runner.Logger.Print("USDTERC20: %s", runner.USDTERC20Addr.Hex()) + runner.Logger.Print("ERC20: %s", runner.ERC20Addr.Hex()) } diff --git a/e2e/runner/setup_evm.go b/e2e/runner/setup_evm.go index 9ffb68056e..5b95095344 100644 --- a/e2e/runner/setup_evm.go +++ b/e2e/runner/setup_evm.go @@ -28,14 +28,14 @@ func (runner *E2ERunner) SetEVMContractsFromConfig() { // Set ZetaEthAddr runner.ZetaEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ZetaEthAddress) - runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.GoerliClient) + runner.ZetaEth, err = zetaeth.NewZetaEth(runner.ZetaEthAddr, runner.EVMClient) if err != nil { panic(err) } // Set ConnectorEthAddr runner.ConnectorEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ConnectorEthAddr) - runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.GoerliClient) + runner.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(runner.ConnectorEthAddr, runner.EVMClient) if err != nil { panic(err) } @@ -43,7 +43,7 @@ func (runner *E2ERunner) SetEVMContractsFromConfig() { // SetupEVM setup contracts on EVM for e2e test func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { - runner.Logger.Print("⚙️ setting up Goerli network") + runner.Logger.Print("⚙️ setting up EVM network") startTime := time.Now() defer func() { runner.Logger.Info("EVM setup took %s\n", time.Since(startTime)) @@ -58,7 +58,7 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { } conf := config.DefaultConfig() - runner.Logger.InfoLoud("Deploy ZetaETH ConnectorETH ERC20Custody USDT\n") + runner.Logger.InfoLoud("Deploy ZetaETH ConnectorETH ERC20Custody ERC20\n") // donate to the TSS address to avoid account errors because deploying gas token ZRC20 will automatically mint // gas token on ZetaChain to initialize the pool @@ -69,8 +69,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ZetaEth contract") zetaEthAddr, txZetaEth, ZetaEth, err := zetaeth.DeployZetaEth( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, runner.DeployerAddress, big.NewInt(21_000_000_000), ) @@ -84,8 +84,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ZetaConnectorEth contract") connectorEthAddr, txConnector, ConnectorEth, err := zetaconnectoreth.DeployZetaConnectorEth( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, zetaEthAddr, runner.TSSAddress, runner.DeployerAddress, @@ -102,8 +102,8 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("Deploying ERC20Custody contract") erc20CustodyAddr, txCustody, ERC20Custody, err := erc20custody.DeployERC20Custody( - runner.GoerliAuth, - runner.GoerliClient, + runner.EVMAuth, + runner.EVMClient, runner.DeployerAddress, runner.DeployerAddress, big.NewInt(0), @@ -117,17 +117,17 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.ERC20Custody = ERC20Custody runner.Logger.Info("ERC20Custody contract address: %s, tx hash: %s", erc20CustodyAddr.Hex(), txCustody.Hash().Hex()) - runner.Logger.Info("Deploying USDT contract") - usdtAddr, txUSDT, usdt, err := erc20.DeployUSDT(runner.GoerliAuth, runner.GoerliClient, "USDT", "USDT", 6) + runner.Logger.Info("Deploying ERC20 contract") + erc20Addr, txERC20, erc20, err := erc20.DeployERC20(runner.EVMAuth, runner.EVMClient, "TESTERC20", "TESTERC20", 6) if err != nil { panic(err) } - runner.USDTERC20 = usdt - runner.USDTERC20Addr = usdtAddr - runner.Logger.Info("USDT contract address: %s, tx hash: %s", usdtAddr.Hex(), txUSDT.Hash().Hex()) + runner.ERC20 = erc20 + runner.ERC20Addr = erc20Addr + runner.Logger.Info("ERC20 contract address: %s, tx hash: %s", erc20Addr.Hex(), txERC20.Hash().Hex()) // deploy TestDApp contract - appAddr, txApp, _, err := testdapp.DeployTestDApp(runner.GoerliAuth, runner.GoerliClient, runner.ConnectorEthAddr, runner.ZetaEthAddr) + appAddr, txApp, _, err := testdapp.DeployTestDApp(runner.EVMAuth, runner.EVMClient, runner.ConnectorEthAddr, runner.ZetaEthAddr) if err != nil { panic(err) } @@ -135,43 +135,43 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { runner.Logger.Info("TestDApp contract address: %s, tx hash: %s", appAddr.Hex(), txApp.Hash().Hex()) // check contract deployment receipt - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txDonation, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { - panic("GOERLI donation tx failed") + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txDonation, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + panic("EVM donation tx failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txZetaEth, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txZetaEth, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ZetaEth deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txConnector, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txConnector, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ZetaConnectorEth deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { panic("ERC20Custody deployment failed") } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txUSDT, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { - panic("USDT deployment failed") + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txERC20, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + panic("ERC20 deployment failed") } - receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txApp, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("TestDApp deployment failed") } // initialize custody contract - runner.Logger.Info("Whitelist USDT") - txWhitelist, err := ERC20Custody.Whitelist(runner.GoerliAuth, usdtAddr) + runner.Logger.Info("Whitelist ERC20") + txWhitelist, err := ERC20Custody.Whitelist(runner.EVMAuth, erc20Addr) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txWhitelist, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { - panic("USDT whitelist failed") + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txWhitelist, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + panic("ERC20 whitelist failed") } runner.Logger.Info("Set TSS address") - txCustody, err = ERC20Custody.UpdateTSSAddress(runner.GoerliAuth, runner.TSSAddress) + txCustody, err = ERC20Custody.UpdateTSSAddress(runner.EVMAuth, runner.TSSAddress) if err != nil { panic(err) } - if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { - panic("USDT update TSS address failed") + if receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, txCustody, runner.Logger, runner.ReceiptTimeout); receipt.Status != 1 { + panic("ERC20 update TSS address failed") } runner.Logger.Info("TSS set receipt tx hash: %s", txCustody.Hash().Hex()) diff --git a/e2e/runner/setup_zeta.go b/e2e/runner/setup_zeta.go index 47db7a4c9c..bb058a87d6 100644 --- a/e2e/runner/setup_zeta.go +++ b/e2e/runner/setup_zeta.go @@ -74,45 +74,45 @@ func (runner *E2ERunner) SetZEVMContracts() { }() // deploy system contracts and ZRC20 contracts on ZetaChain - uniswapV2FactoryAddr, uniswapV2RouterAddr, zevmConnectorAddr, wzetaAddr, usdtZRC20Addr, err := runner.ZetaTxServer.DeploySystemContractsAndZRC20( + uniswapV2FactoryAddr, uniswapV2RouterAddr, zevmConnectorAddr, wzetaAddr, erc20zrc20Addr, err := runner.ZetaTxServer.DeploySystemContractsAndZRC20( e2eutils.FungibleAdminName, - runner.USDTERC20Addr.Hex(), + runner.ERC20Addr.Hex(), ) if err != nil { panic(err) } - // Set USDTZRC20Addr - runner.USDTZRC20Addr = ethcommon.HexToAddress(usdtZRC20Addr) - runner.USDTZRC20, err = zrc20.NewZRC20(runner.USDTZRC20Addr, runner.ZevmClient) + // Set ERC20ZRC20Addr + runner.ERC20ZRC20Addr = ethcommon.HexToAddress(erc20zrc20Addr) + runner.ERC20ZRC20, err = zrc20.NewZRC20(runner.ERC20ZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } // UniswapV2FactoryAddr runner.UniswapV2FactoryAddr = ethcommon.HexToAddress(uniswapV2FactoryAddr) - runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZevmClient) + runner.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(runner.UniswapV2FactoryAddr, runner.ZEVMClient) if err != nil { panic(err) } // UniswapV2RouterAddr runner.UniswapV2RouterAddr = ethcommon.HexToAddress(uniswapV2RouterAddr) - runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZevmClient) + runner.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(runner.UniswapV2RouterAddr, runner.ZEVMClient) if err != nil { panic(err) } // ZevmConnectorAddr runner.ConnectorZEVMAddr = ethcommon.HexToAddress(zevmConnectorAddr) - runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZevmClient) + runner.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(runner.ConnectorZEVMAddr, runner.ZEVMClient) if err != nil { panic(err) } // WZetaAddr runner.WZetaAddr = ethcommon.HexToAddress(wzetaAddr) - runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZevmClient) + runner.WZeta, err = wzeta.NewWETH9(runner.WZetaAddr, runner.ZEVMClient) if err != nil { panic(err) } @@ -129,7 +129,7 @@ func (runner *E2ERunner) SetZEVMContracts() { SystemContract, err := systemcontract.NewSystemContract( systemContractAddr, - runner.ZevmClient, + runner.ZEVMClient, ) if err != nil { panic(err) @@ -144,8 +144,8 @@ func (runner *E2ERunner) SetZEVMContracts() { // deploy ZEVMSwapApp and ContextApp zevmSwapAppAddr, txZEVMSwapApp, zevmSwapApp, err := zevmswap.DeployZEVMSwapApp( - runner.ZevmAuth, - runner.ZevmClient, + runner.ZEVMAuth, + runner.ZEVMClient, runner.UniswapV2RouterAddr, runner.SystemContractAddr, ) @@ -153,19 +153,19 @@ func (runner *E2ERunner) SetZEVMContracts() { panic(err) } - contextAppAddr, txContextApp, contextApp, err := contextapp.DeployContextApp(runner.ZevmAuth, runner.ZevmClient) + contextAppAddr, txContextApp, contextApp, err := contextapp.DeployContextApp(runner.ZEVMAuth, runner.ZEVMClient) if err != nil { panic(err) } - receipt := e2eutils.MustWaitForTxReceipt(runner.Ctx, runner.ZevmClient, txZEVMSwapApp, runner.Logger, runner.ReceiptTimeout) + receipt := e2eutils.MustWaitForTxReceipt(runner.Ctx, runner.ZEVMClient, txZEVMSwapApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("ZEVMSwapApp deployment failed") } runner.ZEVMSwapAppAddr = zevmSwapAppAddr runner.ZEVMSwapApp = zevmSwapApp - receipt = e2eutils.MustWaitForTxReceipt(runner.Ctx, runner.ZevmClient, txContextApp, runner.Logger, runner.ReceiptTimeout) + receipt = e2eutils.MustWaitForTxReceipt(runner.Ctx, runner.ZEVMClient, txContextApp, runner.Logger, runner.ReceiptTimeout) if receipt.Status != 1 { panic("ContextApp deployment failed") } @@ -183,7 +183,7 @@ func (runner *E2ERunner) SetupETHZRC20() { panic("eth zrc20 not found") } runner.ETHZRC20Addr = ethZRC20Addr - ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, runner.ZevmClient) + ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } @@ -198,7 +198,7 @@ func (runner *E2ERunner) SetupBTCZRC20() { } runner.BTCZRC20Addr = BTCZRC20Addr runner.Logger.Info("BTCZRC20Addr: %s", BTCZRC20Addr.Hex()) - BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, runner.ZevmClient) + BTCZRC20, err := zrc20.NewZRC20(BTCZRC20Addr, runner.ZEVMClient) if err != nil { panic(err) } diff --git a/e2e/runner/zeta.go b/e2e/runner/zeta.go index e4bbf99ccc..046e14d706 100644 --- a/e2e/runner/zeta.go +++ b/e2e/runner/zeta.go @@ -4,14 +4,26 @@ import ( "fmt" "math/big" - utils2 "github.com/zeta-chain/zetacore/e2e/utils" - ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" + "github.com/zeta-chain/zetacore/e2e/utils" "github.com/zeta-chain/zetacore/x/crosschain/types" ) +// WaitForTxReceiptOnZEVM waits for a tx receipt on ZEVM +func (runner *E2ERunner) WaitForTxReceiptOnZEVM(tx *ethtypes.Transaction) { + defer func() { + runner.Unlock() + }() + runner.Lock() + + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.ZEVMClient, tx, runner.Logger, runner.ReceiptTimeout) + if receipt.Status != 1 { + panic("tx failed") + } +} + // WaitForMinedCCTX waits for a cctx to be mined from a tx func (runner *E2ERunner) WaitForMinedCCTX(txHash ethcommon.Hash) { defer func() { @@ -19,7 +31,7 @@ func (runner *E2ERunner) WaitForMinedCCTX(txHash ethcommon.Hash) { }() runner.Lock() - cctx := utils2.WaitCctxMinedByInTxHash(runner.Ctx, txHash.Hex(), runner.CctxClient, runner.Logger, runner.CctxTimeout) + cctx := utils.WaitCctxMinedByInTxHash(runner.Ctx, txHash.Hex(), runner.CctxClient, runner.Logger, runner.CctxTimeout) if cctx.CctxStatus.Status != types.CctxStatus_OutboundMined { panic(fmt.Sprintf("expected cctx status to be mined; got %s, message: %s", cctx.CctxStatus.Status.String(), @@ -39,7 +51,7 @@ func (runner *E2ERunner) SendZetaOnEvm(address ethcommon.Address, zetaAmount int amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(zetaAmount)) - tx, err := runner.ZetaEth.Transfer(runner.GoerliAuth, address, amount) + tx, err := runner.ZetaEth.Transfer(runner.EVMAuth, address, amount) if err != nil { panic(err) } @@ -56,25 +68,25 @@ func (runner *E2ERunner) DepositZeta() ethcommon.Hash { // DepositZetaWithAmount deposits ZETA on ZetaChain from the ZETA smart contract on EVM with the specified amount func (runner *E2ERunner) DepositZetaWithAmount(to ethcommon.Address, amount *big.Int) ethcommon.Hash { - tx, err := runner.ZetaEth.Approve(runner.GoerliAuth, runner.ConnectorEthAddr, amount) + tx, err := runner.ZetaEth.Approve(runner.EVMAuth, runner.ConnectorEthAddr, amount) if err != nil { panic(err) } runner.Logger.Info("Approve tx hash: %s", tx.Hash().Hex()) - receipt := utils2.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt := utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) runner.Logger.EVMReceipt(*receipt, "approve") if receipt.Status != 1 { panic("approve tx failed") } // query the chain ID using zevm client - zetaChainID, err := runner.ZevmClient.ChainID(runner.Ctx) + zetaChainID, err := runner.ZEVMClient.ChainID(runner.Ctx) if err != nil { panic(err) } - tx, err = runner.ConnectorEth.Send(runner.GoerliAuth, zetaconnectoreth.ZetaInterfacesSendInput{ + tx, err = runner.ConnectorEth.Send(runner.EVMAuth, zetaconnectoreth.ZetaInterfacesSendInput{ // TODO: allow user to specify destination chain id // https://github.com/zeta-chain/node-private/issues/41 DestinationChainId: zetaChainID, @@ -89,7 +101,7 @@ func (runner *E2ERunner) DepositZetaWithAmount(to ethcommon.Address, amount *big } runner.Logger.Info("Send tx hash: %s", tx.Hash().Hex()) - receipt = utils2.MustWaitForTxReceipt(runner.Ctx, runner.GoerliClient, tx, runner.Logger, runner.ReceiptTimeout) + receipt = utils.MustWaitForTxReceipt(runner.Ctx, runner.EVMClient, tx, runner.Logger, runner.ReceiptTimeout) runner.Logger.EVMReceipt(*receipt, "send") if receipt.Status != 1 { panic(fmt.Sprintf("expected tx receipt status to be 1; got %d", receipt.Status)) diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index beeaad600b..910224d567 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -178,8 +178,8 @@ func (zts ZetaTxServer) BroadcastTx(account string, msg sdktypes.Msg) (*sdktypes } // DeploySystemContractsAndZRC20 deploys the system contracts and ZRC20 contracts -// returns the addresses of uniswap factory, router and usdt zrc20 -func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, usdtERC20Addr string) (string, string, string, string, string, error) { +// returns the addresses of uniswap factory, router and erc20 zrc20 +func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, erc20Addr string) (string, string, string, string, string, error) { // retrieve account acc, err := zts.clientCtx.Keyring.Key(account) if err != nil { @@ -259,10 +259,10 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, usdtERC20Addr str return "", "", "", "", "", fmt.Errorf("failed to deploy btc zrc20: %s", err.Error()) } - // deploy usdt zrc20 + // deploy erc20 zrc20 res, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( addr.String(), - usdtERC20Addr, + erc20Addr, common.GoerliLocalnetChain().ChainId, 6, "USDT", @@ -271,18 +271,18 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, usdtERC20Addr str 100000, )) if err != nil { - return "", "", "", "", "", fmt.Errorf("failed to deploy usdt zrc20: %s", err.Error()) + return "", "", "", "", "", fmt.Errorf("failed to deploy erc20 zrc20: %s", err.Error()) } - // fetch the usdt zrc20 contract address and remove the quotes - usdtZRC20Addr, err := fetchAttribute(res, "Contract") + // fetch the erc20 zrc20 contract address and remove the quotes + erc20zrc20Addr, err := fetchAttribute(res, "Contract") if err != nil { - return "", "", "", "", "", fmt.Errorf("failed to fetch usdt zrc20 contract address: %s", err.Error()) + return "", "", "", "", "", fmt.Errorf("failed to fetch erc20 zrc20 contract address: %s", err.Error()) } - if !ethcommon.IsHexAddress(usdtZRC20Addr) { - return "", "", "", "", "", fmt.Errorf("invalid address in event: %s", usdtZRC20Addr) + if !ethcommon.IsHexAddress(erc20zrc20Addr) { + return "", "", "", "", "", fmt.Errorf("invalid address in event: %s", erc20zrc20Addr) } - return uniswapV2FactoryAddr, uniswapV2RouterAddr, zevmConnectorAddr, wzetaAddr, usdtZRC20Addr, nil + return uniswapV2FactoryAddr, uniswapV2RouterAddr, zevmConnectorAddr, wzetaAddr, erc20zrc20Addr, nil } // FundEmissionsPool funds the emissions pool with the given amount diff --git a/readme.md b/readme.md index 7ae0f1337e..b4ba24455f 100644 --- a/readme.md +++ b/readme.md @@ -105,74 +105,187 @@ To create a release simply execute the publish-release workflow and follow the s Once the release is approved the pipeline will continue and will publish the releases with the title / version you specified in the user input. - -Here is the formatted documentation in Markdown: - --- +## Full Deployment Guide for Zetacored and Bitcoin Nodes -### Starting Full Zetacored Nodes - -#### Step 1: Choose the Network +This guide details deploying Zetacored nodes on both ZetaChain mainnet and Athens3 (testnet), alongside setting up a Bitcoin node for mainnet. The setup utilizes Docker Compose with environment variables for a streamlined deployment process. -To start a node, use the `make` command with the `DOCKER_TAG` of the image you wish to use from Docker Hub. +### Deploying Zetacored Nodes -- **For Mainnet:** +#### Launching a Node +**For Mainnet:** +- Use the `make` command with a specified Docker tag to initiate a mainnet Zetacored node. ```shell - # Use this command to start a mainnet node with a specific Docker tag - make mainnet-zetarpc-node DOCKER_TAG={THE_DOCKER_TAG_FROM_DOCKER_HUB_YOU_WANT_TO_USE} - # Example: - make mainnet-zetarpc-node DOCKER_TAG=ubuntu-v12.3.0-docker-test + make mainnet-zetarpc-node DOCKER_TAG=ubuntu-v14.0.1 ``` -- **For Athens3:** - +**For Athens3 (Testnet):** +- Similar command structure for Athens3, ensuring the correct Docker tag is used. ```shell - # The command is the same for Athens3, just ensure you're specifying the correct Docker tag - make mainnet-zetarpc-node DOCKER_TAG={THE_DOCKER_TAG_FROM_DOCKER_HUB_YOU_WANT_TO_USE} - # Example: - make mainnet-zetarpc-node DOCKER_TAG=ubuntu-v12.3.0-docker-test + make testnet-zetarpc-node DOCKER_TAG=ubuntu-v14.0.1 + ``` + +#### Modifying the Sync Type + +**To change the sync type for your node:** +- Edit docker-compose.yml in contrib/{NETWORK}/zetacored/. +- Set RESTORE_TYPE to your desired method (snapshot, snapshot-archive, statesync). + +#### Zetacored Environment Variables + +| Variable | Description | +|----------|-------------| +| `DAEMON_HOME` | Daemon's home directory (`/root/.zetacored`). | +| `NETWORK` | Network identifier: `mainnet` or `athens3` (for testnet). | +| `RESTORE_TYPE` | Node restoration method: `snapshot`, `snapshot-archive`, `statesync`. | +| `SNAPSHOT_API` | API URL for fetching snapshots. | +| `TRUST_HEIGHT_DIFFERENCE_STATE_SYNC` | Trust height difference for state synchronization. | +| `CHAIN_ID` | Chain ID for the network. | +| `VISOR_NAME` | Visor software name, typically `cosmovisor`. | +| `DAEMON_NAME` | Daemon software name, `zetacored`. | +| `DAEMON_ALLOW_DOWNLOAD_BINARIES` | Enable daemon to download binaries. | +| `DAEMON_RESTART_AFTER_UPGRADE` | Restart daemon after software upgrade. | +| `UNSAFE_SKIP_BACKUP` | Skip backup during potentially unsafe operations. | +| `CLIENT_DAEMON_NAME` | Client daemon name, such as `zetaclientd`. | +| `CLIENT_DAEMON_ARGS` | Extra arguments for the client daemon. | +| `CLIENT_SKIP_UPGRADE` | Skip client software upgrade. | +| `CLIENT_START_PROCESS` | Begin client process start-up. | +| `MONIKER` | Node's moniker or nickname. | +| `RE_DO_START_SEQUENCE` | Restart node setup from scratch if necessary. | + +### Bitcoin Node Setup for Mainnet + +**Restoring a BTC Watcher Node:** +- To deploy a Bitcoin mainnet node, specify the `DOCKER_TAG` for your Docker image. + ```shell + make mainnet-bitcoind-node DOCKER_TAG=36-mainnet ``` -**Note:** The default configuration is to restore from state sync. This process will download the necessary configurations and information from [Zeta-Chain Network Config](https://github.com/zeta-chain/network-config) and configure the node for state sync restore. +#### Bitcoin Node Environment Variables -#### Changing the Sync Type +| Variable | Description | +|----------|-------------| +| `bitcoin_username` | Username for Bitcoin RPC. | +| `bitcoin_password` | Password for Bitcoin RPC. | +| `NETWORK_HEIGHT_URL` | URL to fetch the latest block height. | +| `WALLET_NAME` | Name of the Bitcoin wallet. | +| `WALLET_ADDRESS` | Bitcoin wallet address for transactions. | +| `SNAPSHOT_URL` | URL for downloading the blockchain snapshot. | +| `SNAPSHOT_RESTORE` | Enable restoration from snapshot. | +| `CLEAN_SNAPSHOT` | Clean existing data before restoring snapshot. | +| `DOWNLOAD_SNAPSHOT` | Download the snapshot if not present. | -If you wish to change the sync type, you will need to modify the `docker-compose.yml` file located in `contrib/{NETWORK}/zetacored/`. +### Docker Compose Configurations -Change the following values according to your needs: +#### Zetacored Mainnet ```yaml -# Possible values for RESTORE_TYPE are "snapshot", "snapshot-archive", or "statesync" -RESTORE_TYPE: "statesync" -MONIKER: "local-test" -RE_DO_START_SEQUENCE: "false" +version: '3.8' +services: + zetachain_mainnet_rpc: + platform: linux/amd64 + image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14.0.1} + environment: + DAEMON_HOME: "/root/.zetacored" + NETWORK: mainnet + RESTORE_TYPE: "snapshot" + SNAPSHOT_API: https://snapshots.zetachain.com + TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000 + CHAIN_ID: "zetachain_7000-1" + VISOR_NAME: "cosmovisor" + DAEMON_NAME: "zetacored" + DAEMON_ALLOW_DOWNLOAD_BINARIES: "false" + DAEMON_RESTART_AFTER_UPGRADE: "true" + UNSAFE_SKIP_BACKUP: "true" + CLIENT_DAEMON_NAME: "zetaclientd" + CLIENT_DAEMON_ARGS: "" + CLIENT_SKIP_UPGRADE: "true" + CLIENT_START_PROCESS: "false" + MONIKER: local-test + RE_DO_START_SEQUENCE: "false" + ports: + - "26656:26656" + - "1317:1317" + - "8545:8545" + - "8546:8546" + - "26657:26657" + - "9090:9090" + - "9091:9091" + volumes: + + + - zetacored_data_mainnet:/root/.zetacored/ + entrypoint: bash /scripts/start.sh +volumes: + zetacored_data_mainnet: ``` -To perform a snapshot restore from the latest snapshot, simply change the `RESTORE_TYPE` to either `snapshot` or `snapshot-archive`. - ---- - -Here's the formatted documentation in Markdown for starting a full Bitcoind Mainnet node: +#### Zetacored Athens3/Testnet ---- - -### Starting Full Bitcoind Mainnet Node - -#### Step 1: Restore a Mainnet BTC Watcher Node - -To restore a mainnet BTC watcher node from a BTC snapshot, run the following `make` command and specify the `DOCKER_TAG` with the image you want to use from Docker Hub. - -```commandline -make mainnet-bitcoind-node DOCKER_TAG={DOCKER_TAG_FROM_DOCKER_HUB_TO_USE} -# Example: -make mainnet-bitcoind-node DOCKER_TAG=36-mainnet +```yaml +version: '3.8' +services: + zetachain_testnet_rpc: + platform: linux/amd64 + image: zetachain/zetacored:${DOCKER_TAG:-ubuntu-v14-testnet} + environment: + DAEMON_HOME: "/root/.zetacored" + NETWORK: athens3 + RESTORE_TYPE: "snapshot" + SNAPSHOT_API: https://snapshots.zetachain.com + TRUST_HEIGHT_DIFFERENCE_STATE_SYNC: 40000 + CHAIN_ID: "athens_7001-1" + VISOR_NAME: "cosmovisor" + DAEMON_NAME: "zetacored" + DAEMON_ALLOW_DOWNLOAD_BINARIES: "false" + DAEMON_RESTART_AFTER_UPGRADE: "true" + UNSAFE_SKIP_BACKUP: "true" + CLIENT_DAEMON_NAME: "zetaclientd" + CLIENT_DAEMON_ARGS: "" + CLIENT_SKIP_UPGRADE: "true" + CLIENT_START_PROCESS: "false" + MONIKER: local-test + RE_DO_START_SEQUENCE: "false" + ports: + - "26656:26656" + - "1317:1317" + - "8545:8545" + - "8546:8546" + - "26657:26657" + - "9090:9090" + - "9091:9091" + volumes: + - zetacored_data_athens3:/root/.zetacored/ + entrypoint: bash /scripts/start.sh +volumes: + zetacored_data_athens3: ``` -#### Updating the TSS Address - -If you need to update the TSS (Threshold Signature Scheme) address being watched, please edit the `docker-compose.yml` file located at `contrib/mainnet/bitcoind/docker-compose.yml`. +#### Bitcoin Mainnet Node -To update, simply change the user and password you wish to use, and the TSS address to watch. Then, run the command provided above to apply your changes. +```yaml +version: '3' +services: + bitcoin: + image: zetachain/bitcoin:${DOCKER_TAG:-36-mainnet} + platform: linux/amd64 + environment: + - bitcoin_username=test + - bitcoin_password=test + - NETWORK_HEIGHT_URL=https://blockstream.info/api/blocks/tip/height + - WALLET_NAME=tssMainnet + - WALLET_ADDRESS=bc1qm24wp577nk8aacckv8np465z3dvmu7ry45el6y + - SNAPSHOT_URL=https://storage.googleapis.com/bitcoin-rpc-snapshots-prod/bitcoind-mainnet-2024-02-20-00-22-06.tar.gz + - SNAPSHOT_RESTORE=true + - CLEAN_SNAPSHOT=true + - DOWNLOAD_SNAPSHOT=true + volumes: + - bitcoin_data:/root/ + ports: + - 8332:8332 +volumes: + bitcoin_data: +``` ---- \ No newline at end of file +Replace placeholders in Docker Compose files and `make` commands with actual values appropriate for your deployment scenario. This complete setup guide is designed to facilitate the deployment and management of Zetacored and Bitcoin nodes in various environments. \ No newline at end of file diff --git a/testutil/keeper/emissions.go b/testutil/keeper/emissions.go index a359d93249..e61f6cd76e 100644 --- a/testutil/keeper/emissions.go +++ b/testutil/keeper/emissions.go @@ -15,18 +15,15 @@ import ( ) type EmissionMockOptions struct { - UseBankMock bool - UseStakingMock bool - UseObserverMock bool - UseAccountMock bool + UseBankMock bool + UseStakingMock bool + UseObserverMock bool + UseAccountMock bool + UseParamStoreMock bool } func EmissionsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { - return EmissionKeeperWithMockOptions(t, EmissionMockOptions{ - UseBankMock: false, - UseStakingMock: false, - UseObserverMock: false, - }) + return EmissionKeeperWithMockOptions(t, EmissionMockOptions{}) } func EmissionKeeperWithMockOptions( t testing.TB, @@ -91,18 +88,31 @@ func EmissionKeeperWithMockOptions( observerKeeper = emissionsmocks.NewEmissionObserverKeeper(t) } + var paramStore types.ParamStore + if mockOptions.UseParamStoreMock { + mock := emissionsmocks.NewEmissionParamStore(t) + // mock this method for the keeper constructor + mock.On("HasKeyTable").Maybe().Return(true) + paramStore = mock + } else { + paramStore = sdkKeepers.ParamsKeeper.Subspace(types.ModuleName) + } + k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - sdkKeepers.ParamsKeeper.Subspace(types.ModuleName), + paramStore, authtypes.FeeCollectorName, bankKeeper, stakingKeeper, observerKeeper, authKeeper, ) - k.SetParams(ctx, types.DefaultParams()) + + if !mockOptions.UseParamStoreMock { + k.SetParams(ctx, types.DefaultParams()) + } return k, ctx, sdkKeepers, zetaKeepers } @@ -112,3 +122,9 @@ func GetEmissionsBankMock(t testing.TB, keeper *keeper.Keeper) *emissionsmocks.E require.True(t, ok) return cbk } + +func GetEmissionsParamStoreMock(t testing.TB, keeper *keeper.Keeper) *emissionsmocks.EmissionParamStore { + m, ok := keeper.GetParamStore().(*emissionsmocks.EmissionParamStore) + require.True(t, ok) + return m +} diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 8e2a40b9cb..d100894b02 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -555,24 +555,6 @@ func (_m *CrosschainObserverKeeper) GetObserverSet(ctx types.Context) (observert return r0, r1 } -// GetParams provides a mock function with given fields: ctx -func (_m *CrosschainObserverKeeper) GetParams(ctx types.Context) observertypes.Params { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetParams") - } - - var r0 observertypes.Params - if rf, ok := ret.Get(0).(func(types.Context) observertypes.Params); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(observertypes.Params) - } - - return r0 -} - // GetPendingNonces provides a mock function with given fields: ctx, tss, chainID func (_m *CrosschainObserverKeeper) GetPendingNonces(ctx types.Context, tss string, chainID int64) (observertypes.PendingNonces, bool) { ret := _m.Called(ctx, tss, chainID) diff --git a/testutil/keeper/mocks/emissions/param_store.go b/testutil/keeper/mocks/emissions/param_store.go new file mode 100644 index 0000000000..f9923f3d94 --- /dev/null +++ b/testutil/keeper/mocks/emissions/param_store.go @@ -0,0 +1,76 @@ +// Code generated by mockery v2.38.0. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + + types "github.com/cosmos/cosmos-sdk/types" +) + +// EmissionParamStore is an autogenerated mock type for the EmissionParamStore type +type EmissionParamStore struct { + mock.Mock +} + +// GetParamSetIfExists provides a mock function with given fields: ctx, ps +func (_m *EmissionParamStore) GetParamSetIfExists(ctx types.Context, ps paramstypes.ParamSet) { + _m.Called(ctx, ps) +} + +// HasKeyTable provides a mock function with given fields: +func (_m *EmissionParamStore) HasKeyTable() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for HasKeyTable") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// SetParamSet provides a mock function with given fields: ctx, ps +func (_m *EmissionParamStore) SetParamSet(ctx types.Context, ps paramstypes.ParamSet) { + _m.Called(ctx, ps) +} + +// WithKeyTable provides a mock function with given fields: table +func (_m *EmissionParamStore) WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace { + ret := _m.Called(table) + + if len(ret) == 0 { + panic("no return value specified for WithKeyTable") + } + + var r0 paramstypes.Subspace + if rf, ok := ret.Get(0).(func(paramstypes.KeyTable) paramstypes.Subspace); ok { + r0 = rf(table) + } else { + r0 = ret.Get(0).(paramstypes.Subspace) + } + + return r0 +} + +// NewEmissionParamStore creates a new instance of EmissionParamStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEmissionParamStore(t interface { + mock.TestingT + Cleanup(func()) +}) *EmissionParamStore { + mock := &EmissionParamStore{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 3010f8faaf..83cdb37bcc 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -6,8 +6,6 @@ import ( mock "github.com/stretchr/testify/mock" common "github.com/zeta-chain/zetacore/common" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" - types "github.com/cosmos/cosmos-sdk/types" ) @@ -16,24 +14,6 @@ type FungibleObserverKeeper struct { mock.Mock } -// GetParams provides a mock function with given fields: ctx -func (_m *FungibleObserverKeeper) GetParams(ctx types.Context) observertypes.Params { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetParams") - } - - var r0 observertypes.Params - if rf, ok := ret.Get(0).(func(types.Context) observertypes.Params); ok { - r0 = rf(ctx) - } else { - r0 = ret.Get(0).(observertypes.Params) - } - - return r0 -} - // GetSupportedChains provides a mock function with given fields: ctx func (_m *FungibleObserverKeeper) GetSupportedChains(ctx types.Context) []*common.Chain { ret := _m.Called(ctx) diff --git a/testutil/keeper/mocks/mocks.go b/testutil/keeper/mocks/mocks.go index 0da231a7e5..1180fca27a 100644 --- a/testutil/keeper/mocks/mocks.go +++ b/testutil/keeper/mocks/mocks.go @@ -94,6 +94,11 @@ type EmissionObserverKeeper interface { emissionstypes.ObserverKeeper } +//go:generate mockery --name EmissionParamStore --filename param_store.go --case underscore --output ./emissions +type EmissionParamStore interface { + emissionstypes.ParamStore +} + /** * Observer Mocks */ diff --git a/testutil/sample/common.go b/testutil/sample/common.go index d32ca30274..86eef50a71 100644 --- a/testutil/sample/common.go +++ b/testutil/sample/common.go @@ -1,16 +1,9 @@ package sample import ( - "context" - "math/big" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/rlp" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/ethereum" ) func Chain(chainID int64) *common.Chain { @@ -30,63 +23,6 @@ func PubKeySet() *common.PubKeySet { return &pubKeySet } -func EthHeader() (header1, header2, header3 *ethtypes.Header, err error) { - url := "https://rpc.ankr.com/eth_goerli" - client, err := ethclient.Dial(url) - if err != nil { - return - } - bn := int64(9889649) - block, err := client.BlockByNumber(context.Background(), big.NewInt(bn)) - if err != nil { - return - } - header1 = block.Header() - - block, err = client.BlockByNumber(context.Background(), big.NewInt(bn+1)) - if err != nil { - return - } - header2 = block.Header() - - block, err = client.BlockByNumber(context.Background(), big.NewInt(bn+2)) - if err != nil { - return - } - header2 = block.Header() - return -} - -func Proof() (txIndex int64, block *ethtypes.Block, header ethtypes.Header, headerRLP []byte, proof *common.Proof, tx *ethtypes.Transaction, err error) { - txIndex = int64(9) - url := "https://rpc.ankr.com/eth_goerli" - client, err := ethclient.Dial(url) - if err != nil { - return - } - bn := int64(9889649) - block, err = client.BlockByNumber(context.Background(), big.NewInt(bn)) - if err != nil { - return - } - headerRLP, _ = rlp.EncodeToBytes(block.Header()) - err = rlp.DecodeBytes(headerRLP, &header) - if err != nil { - return - } - tr := ethereum.NewTrie(block.Transactions()) - var b []byte - ib := rlp.AppendUint64(b, uint64(txIndex)) - p := ethereum.NewProof() - err = tr.Prove(ib, 0, p) - if err != nil { - return - } - proof = common.NewEthereumProof(p) - tx = block.Transactions()[txIndex] - return -} - func EventIndex() uint64 { r := newRandFromSeed(1) return r.Uint64() diff --git a/x/authority/types/message_update_policies_test.go b/x/authority/types/message_update_policies_test.go index 0b03f3acb2..def81cfad6 100644 --- a/x/authority/types/message_update_policies_test.go +++ b/x/authority/types/message_update_policies_test.go @@ -3,9 +3,11 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/authority/types" ) @@ -49,3 +51,53 @@ func TestMsgUpdatePolicies_ValidateBasic(t *testing.T) { }) } } + +func TestMsgUpdatePolicies_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgUpdatePolicies + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgUpdatePolicies(signer, sample.Policies()), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgUpdatePolicies("invalid", sample.Policies()), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdatePolicies_Type(t *testing.T) { + msg := types.NewMsgUpdatePolicies(sample.AccAddress(), sample.Policies()) + require.Equal(t, types.TypeMsgUpdatePolicies, msg.Type()) +} + +func TestMsgUpdatePolicies_Route(t *testing.T) { + msg := types.NewMsgUpdatePolicies(sample.AccAddress(), sample.Policies()) + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdatePolicies_GetSignBytes(t *testing.T) { + msg := types.NewMsgUpdatePolicies(sample.AccAddress(), sample.Policies()) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go index e3662f2567..50e8164eb7 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go @@ -16,7 +16,7 @@ import ( ) func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_index int64, chainID int64, header ethtypes.Header, headerRLP []byte, block *ethtypes.Block) { - params := zk.ObserverKeeper.GetParams(ctx) + params := zk.ObserverKeeper.GetParamsIfExists(ctx) zk.ObserverKeeper.SetParams(ctx, params) zk.ObserverKeeper.SetBlockHeader(ctx, common.BlockHeader{ Height: block.Number().Int64(), @@ -43,79 +43,6 @@ func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_inde } func TestMsgServer_AddToInTxTracker(t *testing.T) { - t.Run("add proof based tracker with correct proof", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := int64(5) - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - CoinType: common.CoinType_Zeta, - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - }) - require.NoError(t, err) - _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) - require.True(t, found) - }) - - t.Run("fail to add proof based tracker with wrong tx hash", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getValidEthChainID(t) - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: "fake_hash", - CoinType: common.CoinType_Zeta, - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - }) - require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) - _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) - require.False(t, found) - }) - - t.Run("fail to add proof based tracker with wrong chain id", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getValidEthChainID(t) - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ - Creator: sample.AccAddress(), - ChainId: 97, - TxHash: tx.Hash().Hex(), - CoinType: common.CoinType_Zeta, - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - }) - require.ErrorIs(t, err, observertypes.ErrSupportedChains) - _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) - require.False(t, found) - }) - t.Run("fail normal user submit without proof", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) tx_hash := "string" @@ -198,4 +125,78 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { _, found = k.GetInTxTracker(ctx, chainID, tx_hash) require.False(t, found) }) + + // Commented out as these tests don't work without using RPC + // TODO: Reenable these tests + // https://github.com/zeta-chain/node/issues/1875 + //t.Run("add proof based tracker with correct proof", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := int64(5) + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // CoinType: common.CoinType_Zeta, + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // }) + // require.NoError(t, err) + // _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) + // require.True(t, found) + //}) + //t.Run("fail to add proof based tracker with wrong tx hash", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getValidEthChainID(t) + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: "fake_hash", + // CoinType: common.CoinType_Zeta, + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // }) + // require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) + // _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) + // require.False(t, found) + //}) + //t.Run("fail to add proof based tracker with wrong chain id", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getValidEthChainID(t) + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToInTxTracker(ctx, &types.MsgAddToInTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: 97, + // TxHash: tx.Hash().Hex(), + // CoinType: common.CoinType_Zeta, + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // }) + // require.ErrorIs(t, err, observertypes.ErrSupportedChains) + // _, found := k.GetInTxTracker(ctx, chainID, tx.Hash().Hex()) + // require.False(t, found) + //}) } diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go index 424af23e15..24174733b0 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker_test.go @@ -5,8 +5,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/ethereum" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -20,8 +18,21 @@ func getEthereumChainID() int64 { } -func setupTssAndNonceToCctx(k *keeper.Keeper, ctx sdk.Context, chainId, nonce int64) { +// setEnabledChain sets the chain as enabled in chain params +func setEnabledChain(ctx sdk.Context, zk keepertest.ZetaKeepers, chainID int64) { + zk.ObserverKeeper.SetChainParamsList(ctx, observertypes.ChainParamsList{ChainParams: []*observertypes.ChainParams{ + { + ChainId: chainID, + ConnectorContractAddress: sample.EthAddress().Hex(), + BallotThreshold: sdk.OneDec(), + MinObserverDelegation: sdk.OneDec(), + IsSupported: true, + }, + }}) +} +// setupTssAndNonceToCctx sets tss and nonce to cctx +func setupTssAndNonceToCctx(k *keeper.Keeper, ctx sdk.Context, chainId, nonce int64) { tssPubKey := "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p" k.GetObserverKeeper().SetTSS(ctx, observertypes.TSS{ TssPubkey: tssPubKey, @@ -59,17 +70,15 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) chainID := getEthereumChainID() - txIndex, block, header, headerRLP, _, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) setupTssAndNonceToCctx(k, ctx, chainID, 0) + setEnabledChain(ctx, zk, chainID) msgServer := keeper.NewMsgServerImpl(*k) - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + _, err := msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ Creator: admin, ChainId: chainID, - TxHash: tx.Hash().Hex(), + TxHash: sample.Hash().Hex(), Proof: nil, BlockHash: "", TxIndex: 0, @@ -90,10 +99,8 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupEmergency, true) chainID := getEthereumChainID() - txIndex, block, header, headerRLP, _, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) setupTssAndNonceToCctx(k, ctx, chainID, 0) + setEnabledChain(ctx, zk, chainID) k.SetOutTxTracker(ctx, types.OutTxTracker{ ChainId: chainID, @@ -114,10 +121,10 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { msgServer := keeper.NewMsgServerImpl(*k) - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + _, err := msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ Creator: admin, ChainId: chainID, - TxHash: tx.Hash().Hex(), + TxHash: sample.Hash().Hex(), Proof: nil, BlockHash: "", TxIndex: 0, @@ -129,220 +136,223 @@ func TestMsgServer_AddToOutTxTracker(t *testing.T) { require.Equal(t, 2, len(tracker.HashList)) }) - t.Run("fail add proof based tracker with wrong chainID", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: 97, - TxHash: tx.Hash().Hex(), - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.ErrorIs(t, err, observertypes.ErrSupportedChains) - _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.False(t, found) - }) - - t.Run("fail add proof based tracker with wrong nonce", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, 1) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: 1, - }) - require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) - _, found := k.GetOutTxTracker(ctx, chainID, 1) - require.False(t, found) - }) - - t.Run("fail add proof based tracker with wrong tx_hash", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - - msgServer := keeper.NewMsgServerImpl(*k) - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: "wrong_hash", - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) - _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.False(t, found) - }) - - t.Run("fail proof based tracker with incorrect proof", func(t *testing.T) { - - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, _, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - Proof: common.NewEthereumProof(ethereum.NewProof()), - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.ErrorIs(t, err, types.ErrProofVerificationFail) - _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.False(t, found) - }) - - t.Run("add proof based tracker with correct proof", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.NoError(t, err) - _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.True(t, found) - }) - - t.Run("add proven txHash even if length of hashList is already 2", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - k.SetOutTxTracker(ctx, types.OutTxTracker{ - ChainId: chainID, - Nonce: tx.Nonce(), - HashList: []*types.TxHashList{ - { - TxHash: "hash1", - TxSigner: sample.AccAddress(), - Proved: false, - }, - { - TxHash: "hash2", - TxSigner: sample.AccAddress(), - Proved: false, - }, - }, - }) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.NoError(t, err) - tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.True(t, found) - require.Equal(t, 3, len(tracker.HashList)) - // Proven tracker is prepended to the list - require.True(t, tracker.HashList[0].Proved) - require.False(t, tracker.HashList[1].Proved) - require.False(t, tracker.HashList[2].Proved) - }) - - t.Run("add proof for existing txHash", func(t *testing.T) { - k, ctx, _, zk := keepertest.CrosschainKeeper(t) - - chainID := getEthereumChainID() - - txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() - require.NoError(t, err) - setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) - setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) - k.SetOutTxTracker(ctx, types.OutTxTracker{ - ChainId: chainID, - Nonce: tx.Nonce(), - HashList: []*types.TxHashList{ - { - TxHash: tx.Hash().Hex(), - TxSigner: sample.AccAddress(), - Proved: false, - }, - }, - }) - tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.True(t, found) - require.False(t, tracker.HashList[0].Proved) - - msgServer := keeper.NewMsgServerImpl(*k) - - _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - ChainId: chainID, - TxHash: tx.Hash().Hex(), - Proof: proof, - BlockHash: block.Hash().Hex(), - TxIndex: txIndex, - Nonce: tx.Nonce(), - }) - require.NoError(t, err) - tracker, found = k.GetOutTxTracker(ctx, chainID, tx.Nonce()) - require.True(t, found) - require.Equal(t, 1, len(tracker.HashList)) - require.True(t, tracker.HashList[0].Proved) - }) + // Commented out as these tests don't work without using RPC + // TODO: Reenable these tests + // https://github.com/zeta-chain/node/issues/1875 + //t.Run("fail add proof based tracker with wrong chainID", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: 97, + // TxHash: tx.Hash().Hex(), + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.ErrorIs(t, err, observertypes.ErrSupportedChains) + // _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.False(t, found) + //}) + // + //t.Run("fail add proof based tracker with wrong nonce", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, 1) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: 1, + // }) + // require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) + // _, found := k.GetOutTxTracker(ctx, chainID, 1) + // require.False(t, found) + //}) + // + //t.Run("fail add proof based tracker with wrong tx_hash", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: "wrong_hash", + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.ErrorIs(t, err, types.ErrTxBodyVerificationFail) + // _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.False(t, found) + //}) + // + //t.Run("fail proof based tracker with incorrect proof", func(t *testing.T) { + // + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, _, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // Proof: common.NewEthereumProof(ethereum.NewProof()), + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.ErrorIs(t, err, types.ErrProofVerificationFail) + // _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.False(t, found) + //}) + // + //t.Run("add proof based tracker with correct proof", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.NoError(t, err) + // _, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.True(t, found) + //}) + // + //t.Run("add proven txHash even if length of hashList is already 2", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // k.SetOutTxTracker(ctx, types.OutTxTracker{ + // ChainId: chainID, + // Nonce: tx.Nonce(), + // HashList: []*types.TxHashList{ + // { + // TxHash: "hash1", + // TxSigner: sample.AccAddress(), + // Proved: false, + // }, + // { + // TxHash: "hash2", + // TxSigner: sample.AccAddress(), + // Proved: false, + // }, + // }, + // }) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.NoError(t, err) + // tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.True(t, found) + // require.Equal(t, 3, len(tracker.HashList)) + // // Proven tracker is prepended to the list + // require.True(t, tracker.HashList[0].Proved) + // require.False(t, tracker.HashList[1].Proved) + // require.False(t, tracker.HashList[2].Proved) + //}) + // + //t.Run("add proof for existing txHash", func(t *testing.T) { + // k, ctx, _, zk := keepertest.CrosschainKeeper(t) + // + // chainID := getEthereumChainID() + // + // txIndex, block, header, headerRLP, proof, tx, err := sample.Proof() + // require.NoError(t, err) + // setupVerificationParams(zk, ctx, txIndex, chainID, header, headerRLP, block) + // setupTssAndNonceToCctx(k, ctx, chainID, int64(tx.Nonce())) + // k.SetOutTxTracker(ctx, types.OutTxTracker{ + // ChainId: chainID, + // Nonce: tx.Nonce(), + // HashList: []*types.TxHashList{ + // { + // TxHash: tx.Hash().Hex(), + // TxSigner: sample.AccAddress(), + // Proved: false, + // }, + // }, + // }) + // tracker, found := k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.True(t, found) + // require.False(t, tracker.HashList[0].Proved) + // + // msgServer := keeper.NewMsgServerImpl(*k) + // + // _, err = msgServer.AddToOutTxTracker(ctx, &types.MsgAddToOutTxTracker{ + // Creator: sample.AccAddress(), + // ChainId: chainID, + // TxHash: tx.Hash().Hex(), + // Proof: proof, + // BlockHash: block.Hash().Hex(), + // TxIndex: txIndex, + // Nonce: tx.Nonce(), + // }) + // require.NoError(t, err) + // tracker, found = k.GetOutTxTracker(ctx, chainID, tx.Nonce()) + // require.True(t, found) + // require.Equal(t, 1, len(tracker.HashList)) + // require.True(t, tracker.HashList[0].Proved) + //}) } diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 4286bbf48b..6f77d4c2dc 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -33,7 +33,6 @@ type BankKeeper interface { type ObserverKeeper interface { GetObserverSet(ctx sdk.Context) (val observertypes.ObserverSet, found bool) GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) - GetParams(ctx sdk.Context) (params observertypes.Params) GetChainParamsByChainID(ctx sdk.Context, chainID int64) (params *observertypes.ChainParams, found bool) GetNodeAccount(ctx sdk.Context, address string) (nodeAccount observertypes.NodeAccount, found bool) GetAllNodeAccount(ctx sdk.Context) (nodeAccounts []observertypes.NodeAccount) diff --git a/x/crosschain/types/message_abort_stuck_cctx.go b/x/crosschain/types/message_abort_stuck_cctx.go index 102290ab9b..47c383276b 100644 --- a/x/crosschain/types/message_abort_stuck_cctx.go +++ b/x/crosschain/types/message_abort_stuck_cctx.go @@ -43,5 +43,8 @@ func (msg *MsgAbortStuckCCTX) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } + if len(msg.CctxIndex) != 66 { + return ErrInvalidCCTXIndex + } return nil } diff --git a/x/crosschain/types/message_abort_stuck_cctx_test.go b/x/crosschain/types/message_abort_stuck_cctx_test.go index 40bdcf4794..14b1e82d78 100644 --- a/x/crosschain/types/message_abort_stuck_cctx_test.go +++ b/x/crosschain/types/message_abort_stuck_cctx_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,24 +13,23 @@ import ( func TestMsgAbortStuckCCTX_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgAbortStuckCCTX + msg *types.MsgAbortStuckCCTX err error }{ { name: "invalid address", - msg: types.MsgAbortStuckCCTX{ - Creator: "invalid_address", - CctxIndex: "cctx_index", - }, - err: sdkerrors.ErrInvalidAddress, + msg: types.NewMsgAbortStuckCCTX("invalid_address", "cctx_index"), + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid cctx index", + msg: types.NewMsgAbortStuckCCTX(sample.AccAddress(), "cctx_index"), + err: types.ErrInvalidCCTXIndex, }, { name: "valid", - msg: types.MsgAbortStuckCCTX{ - Creator: sample.AccAddress(), - CctxIndex: "cctx_index", - }, - err: nil, + msg: types.NewMsgAbortStuckCCTX(sample.AccAddress(), sample.GetCctxIndexFromString("test")), + err: nil, }, } for _, tt := range tests { @@ -43,3 +43,53 @@ func TestMsgAbortStuckCCTX_ValidateBasic(t *testing.T) { }) } } + +func TestMsgAbortStuckCCTX_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgAbortStuckCCTX + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgAbortStuckCCTX(signer, "cctx_index"), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgAbortStuckCCTX("invalid", "cctx_index"), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgAbortStuckCCTX_Type(t *testing.T) { + msg := types.NewMsgAbortStuckCCTX(sample.AccAddress(), "cctx_index") + require.Equal(t, types.TypeMsgAbortStuckCCTX, msg.Type()) +} + +func TestMsgAbortStuckCCTX_Route(t *testing.T) { + msg := types.NewMsgAbortStuckCCTX(sample.AccAddress(), "cctx_index") + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgAbortStuckCCTX_GetSignBytes(t *testing.T) { + msg := types.NewMsgAbortStuckCCTX(sample.AccAddress(), "cctx_index") + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_add_to_in_tx_tracker_test.go b/x/crosschain/types/message_add_to_in_tx_tracker_test.go index c05272224f..2200f04421 100644 --- a/x/crosschain/types/message_add_to_in_tx_tracker_test.go +++ b/x/crosschain/types/message_add_to_in_tx_tracker_test.go @@ -4,6 +4,7 @@ import ( "testing" errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -14,37 +15,56 @@ import ( func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgAddToInTxTracker + msg *types.MsgAddToInTxTracker err error }{ { name: "invalid address", - msg: types.MsgAddToInTxTracker{ - Creator: "invalid_address", - ChainId: common.GoerliChain().ChainId, - TxHash: "hash", - CoinType: common.CoinType_Gas, - }, + msg: types.NewMsgAddToInTxTracker( + "invalid_address", + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid chain id", - msg: types.MsgAddToInTxTracker{ + msg: types.NewMsgAddToInTxTracker( + sample.AccAddress(), + 42, + common.CoinType_Gas, + "hash", + ), + err: errorsmod.Wrapf(types.ErrInvalidChainID, "chain id (%d)", 42), + }, + { + name: "invalid proof", + msg: &types.MsgAddToInTxTracker{ Creator: sample.AccAddress(), - ChainId: 42, - TxHash: "hash", + ChainId: common.ZetaTestnetChain().ChainId, CoinType: common.CoinType_Gas, + Proof: &common.Proof{}, }, - err: errorsmod.Wrapf(types.ErrInvalidChainID, "chain id (%d)", 42), + err: errorsmod.Wrapf(types.ErrProofVerificationFail, "chain id %d does not support proof-based trackers", common.ZetaTestnetChain().ChainId), }, { - name: "valid", - msg: types.MsgAddToInTxTracker{ + name: "invalid coin type", + msg: &types.MsgAddToInTxTracker{ Creator: sample.AccAddress(), - ChainId: common.GoerliChain().ChainId, - TxHash: "hash", - CoinType: common.CoinType_Gas, + ChainId: common.ZetaTestnetChain().ChainId, + CoinType: 5, }, + err: errorsmod.Wrapf(types.ErrProofVerificationFail, "coin-type not supported"), + }, + { + name: "valid", + msg: types.NewMsgAddToInTxTracker( + sample.AccAddress(), + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ), err: nil, }, } @@ -59,3 +79,78 @@ func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { }) } } + +func TestMsgAddToInTxTracker_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgAddToInTxTracker + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgAddToInTxTracker( + signer, + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgAddToInTxTracker( + "invalid_address", + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgAddToInTxTracker_Type(t *testing.T) { + msg := types.NewMsgAddToInTxTracker( + sample.AccAddress(), + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ) + require.Equal(t, types.TypeMsgAddToInTxTracker, msg.Type()) +} + +func TestMsgAddToInTxTracker_Route(t *testing.T) { + msg := types.NewMsgAddToInTxTracker( + sample.AccAddress(), + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ) + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgAddToInTxTracker_GetSignBytes(t *testing.T) { + msg := types.NewMsgAddToInTxTracker( + sample.AccAddress(), + common.GoerliChain().ChainId, + common.CoinType_Gas, + "hash", + ) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_add_to_out_tx_tracker.go b/x/crosschain/types/message_add_to_out_tx_tracker.go index 44d7b7f3e0..45084ec7b3 100644 --- a/x/crosschain/types/message_add_to_out_tx_tracker.go +++ b/x/crosschain/types/message_add_to_out_tx_tracker.go @@ -58,7 +58,7 @@ func (msg *MsgAddToOutTxTracker) ValidateBasic() error { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } if msg.ChainId < 0 { - return cosmoserrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "chain id (%d)", msg.ChainId) } return nil } diff --git a/x/crosschain/types/message_add_to_out_tx_tracker_test.go b/x/crosschain/types/message_add_to_out_tx_tracker_test.go index 8a06041989..2fc4631835 100644 --- a/x/crosschain/types/message_add_to_out_tx_tracker_test.go +++ b/x/crosschain/types/message_add_to_out_tx_tracker_test.go @@ -3,29 +3,56 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func TestMsgAddToWatchList_ValidateBasic(t *testing.T) { +func TestMsgAddToOutTxTracker_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgAddToOutTxTracker + msg *types.MsgAddToOutTxTracker err error }{ { name: "invalid address", - msg: types.MsgAddToOutTxTracker{ - Creator: "invalid_address", - }, + msg: types.NewMsgAddToOutTxTracker( + "invalid", + 1, + 1, + "", + nil, + "", + 1, + ), err: sdkerrors.ErrInvalidAddress, - }, { + }, + { + name: "invalid chain id", + msg: types.NewMsgAddToOutTxTracker( + sample.AccAddress(), + -1, + 1, + "", + nil, + "", + 1, + ), + err: sdkerrors.ErrInvalidChainID, + }, + { name: "valid address", - msg: types.MsgAddToOutTxTracker{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgAddToOutTxTracker( + sample.AccAddress(), + 1, + 1, + "", + nil, + "", + 1, + ), }, } for _, tt := range tests { @@ -39,3 +66,63 @@ func TestMsgAddToWatchList_ValidateBasic(t *testing.T) { }) } } + +func TestMsgAddToOutTxTracker_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgAddToOutTxTracker + panics bool + }{ + { + name: "valid signer", + msg: types.MsgAddToOutTxTracker{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgAddToOutTxTracker{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgAddToOutTxTracker_Type(t *testing.T) { + msg := types.MsgAddToOutTxTracker{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgAddToOutTxTracker, msg.Type()) +} + +func TestMsgAddToOutTxTracker_Route(t *testing.T) { + msg := types.MsgAddToOutTxTracker{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgAddToOutTxTracker_GetSignBytes(t *testing.T) { + msg := types.MsgAddToOutTxTracker{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_gas_price_voter.go b/x/crosschain/types/message_gas_price_voter.go index a42d9b692e..e21fa80dce 100644 --- a/x/crosschain/types/message_gas_price_voter.go +++ b/x/crosschain/types/message_gas_price_voter.go @@ -46,7 +46,7 @@ func (msg *MsgGasPriceVoter) ValidateBasic() error { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } if msg.ChainId < 0 { - return cosmoserrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "chain id (%d)", msg.ChainId) } return nil } diff --git a/x/crosschain/types/message_gas_price_voter_test.go b/x/crosschain/types/message_gas_price_voter_test.go new file mode 100644 index 0000000000..1c8ec9bd47 --- /dev/null +++ b/x/crosschain/types/message_gas_price_voter_test.go @@ -0,0 +1,123 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + common "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func TestMsgGasPriceVoter_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg *types.MsgGasPriceVoter + err error + }{ + { + name: "invalid address", + msg: types.NewMsgGasPriceVoter( + "invalid", + 1, + 1, + "1000", + 1, + ), + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid chain id", + msg: types.NewMsgGasPriceVoter( + sample.AccAddress(), + -1, + 1, + "1000", + 1, + ), + err: sdkerrors.ErrInvalidChainID, + }, + { + name: "valid address", + msg: types.NewMsgGasPriceVoter( + sample.AccAddress(), + 1, + 1, + "1000", + 1, + ), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgGasPriceVoter_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgGasPriceVoter + panics bool + }{ + { + name: "valid signer", + msg: types.MsgGasPriceVoter{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgGasPriceVoter{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgGasPriceVoter_Type(t *testing.T) { + msg := types.MsgGasPriceVoter{ + Creator: sample.AccAddress(), + } + require.Equal(t, common.GasPriceVoter.String(), msg.Type()) +} + +func TestMsgGasPriceVoter_Route(t *testing.T) { + msg := types.MsgGasPriceVoter{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgGasPriceVoter_GetSignBytes(t *testing.T) { + msg := types.MsgGasPriceVoter{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_migrate_tss_funds.go b/x/crosschain/types/message_migrate_tss_funds.go index b667f4192c..ec5076caa0 100644 --- a/x/crosschain/types/message_migrate_tss_funds.go +++ b/x/crosschain/types/message_migrate_tss_funds.go @@ -8,6 +8,8 @@ import ( "github.com/zeta-chain/zetacore/common" ) +const TypeMsgMigrateTssFunds = "MigrateTssFunds" + var _ sdk.Msg = &MsgMigrateTssFunds{} func NewMsgMigrateTssFunds(creator string, chainID int64, amount sdkmath.Uint) *MsgMigrateTssFunds { @@ -23,7 +25,7 @@ func (msg *MsgMigrateTssFunds) Route() string { } func (msg *MsgMigrateTssFunds) Type() string { - return "MigrateTssFunds" + return TypeMsgMigrateTssFunds } func (msg *MsgMigrateTssFunds) GetSigners() []sdk.AccAddress { diff --git a/x/crosschain/types/message_migrate_tss_funds_test.go b/x/crosschain/types/message_migrate_tss_funds_test.go index a03a4e9ef4..e3461982f9 100644 --- a/x/crosschain/types/message_migrate_tss_funds_test.go +++ b/x/crosschain/types/message_migrate_tss_funds_test.go @@ -4,49 +4,60 @@ import ( "testing" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func TestNewMsgMigrateTssFunds(t *testing.T) { +func TestNewMsgMigrateTssFunds_ValidateBasic(t *testing.T) { + keeper.SetConfig(false) tests := []struct { name string - msg types.MsgMigrateTssFunds + msg *types.MsgMigrateTssFunds error bool }{ { name: "invalid creator", - msg: types.MsgMigrateTssFunds{ - Creator: "invalid_address", - ChainId: common.DefaultChainsList()[0].ChainId, - Amount: sdkmath.NewUintFromString("100000"), - }, + msg: types.NewMsgMigrateTssFunds( + "invalid address", + common.DefaultChainsList()[0].ChainId, + sdkmath.NewUintFromString("100000"), + ), error: true, }, { name: "invalid chain id", - msg: types.MsgMigrateTssFunds{ - Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", - ChainId: 999, - Amount: sdkmath.NewUintFromString("100000"), - }, + msg: types.NewMsgMigrateTssFunds( + sample.AccAddress(), + 999, + sdkmath.NewUintFromString("100000"), + ), + error: true, + }, + { + name: "invalid amount", + msg: types.NewMsgMigrateTssFunds( + sample.AccAddress(), + common.DefaultChainsList()[0].ChainId, + sdkmath.NewUintFromString("0"), + ), error: true, }, { name: "valid msg", - msg: types.MsgMigrateTssFunds{ - Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", - ChainId: common.DefaultChainsList()[0].ChainId, - Amount: sdkmath.NewUintFromString("100000"), - }, + msg: types.NewMsgMigrateTssFunds( + sample.AccAddress(), + common.DefaultChainsList()[0].ChainId, + sdkmath.NewUintFromString("100000"), + ), error: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - keeper.SetConfig(false) err := tt.msg.ValidateBasic() if tt.error { require.Error(t, err) @@ -57,3 +68,73 @@ func TestNewMsgMigrateTssFunds(t *testing.T) { }) } } + +func TestNewMsgMigrateTssFunds_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgMigrateTssFunds + panics bool + }{ + { + name: "valid signer", + msg: types.MsgMigrateTssFunds{ + Creator: signer, + ChainId: common.DefaultChainsList()[0].ChainId, + Amount: sdkmath.NewUintFromString("100000"), + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgMigrateTssFunds{ + Creator: "invalid_address", + ChainId: common.DefaultChainsList()[0].ChainId, + Amount: sdkmath.NewUintFromString("100000"), + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestNewMsgMigrateTssFunds_Type(t *testing.T) { + msg := types.MsgMigrateTssFunds{ + Creator: sample.AccAddress(), + ChainId: common.DefaultChainsList()[0].ChainId, + Amount: sdkmath.NewUintFromString("100000"), + } + require.Equal(t, types.TypeMsgMigrateTssFunds, msg.Type()) +} + +func TestNewMsgMigrateTssFunds_Route(t *testing.T) { + msg := types.MsgMigrateTssFunds{ + Creator: sample.AccAddress(), + ChainId: common.DefaultChainsList()[0].ChainId, + Amount: sdkmath.NewUintFromString("100000"), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestNewMsgMigrateTssFunds_GetSignBytes(t *testing.T) { + msg := types.MsgMigrateTssFunds{ + Creator: sample.AccAddress(), + ChainId: common.DefaultChainsList()[0].ChainId, + Amount: sdkmath.NewUintFromString("100000"), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_refund_aborted_test.go b/x/crosschain/types/message_refund_aborted_test.go index 40c432881b..b02b3dab56 100644 --- a/x/crosschain/types/message_refund_aborted_test.go +++ b/x/crosschain/types/message_refund_aborted_test.go @@ -3,12 +3,13 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) -func TestNewMsgRefundAbortedCCTX(t *testing.T) { +func TestMsgRefundAbortedCCTX_ValidateBasic(t *testing.T) { t.Run("successfully validate message", func(t *testing.T) { cctx := sample.CrossChainTx(t, "test") msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), cctx.Index, "") @@ -34,3 +35,53 @@ func TestNewMsgRefundAbortedCCTX(t *testing.T) { require.ErrorContains(t, msg.ValidateBasic(), "invalid address") }) } + +func TestMsgRefundAbortedCCTX_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgRefundAbortedCCTX + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgRefundAbortedCCTX(signer, "test", ""), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgRefundAbortedCCTX("invalid", "invalid", ""), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgRefundAbortedCCTX_Type(t *testing.T) { + msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), "test", "") + require.Equal(t, types.RefundAborted, msg.Type()) +} + +func TestMsgRefundAbortedCCTX_Route(t *testing.T) { + msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), "test", "") + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgRefundAbortedCCTX_GetSignBytes(t *testing.T) { + msg := types.NewMsgRefundAbortedCCTX(sample.AccAddress(), "test", "") + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_remove_from_out_tx_tracker.go b/x/crosschain/types/message_remove_from_out_tx_tracker.go index 145d20a76c..3a6d1a9ffc 100644 --- a/x/crosschain/types/message_remove_from_out_tx_tracker.go +++ b/x/crosschain/types/message_remove_from_out_tx_tracker.go @@ -45,7 +45,7 @@ func (msg *MsgRemoveFromOutTxTracker) ValidateBasic() error { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } if msg.ChainId < 0 { - return cosmoserrors.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId) + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "chain id (%d)", msg.ChainId) } return nil } diff --git a/x/crosschain/types/message_remove_from_out_tx_tracker_test.go b/x/crosschain/types/message_remove_from_out_tx_tracker_test.go new file mode 100644 index 0000000000..737b2e4d48 --- /dev/null +++ b/x/crosschain/types/message_remove_from_out_tx_tracker_test.go @@ -0,0 +1,96 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/sample" + + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func TestMsgRemoveFromOutTxTracker_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg *types.MsgRemoveFromOutTxTracker + err error + }{ + { + name: "valid message", + msg: types.NewMsgRemoveFromOutTxTracker(sample.AccAddress(), 1, 0), + }, + { + name: "invalid creator address", + msg: types.NewMsgRemoveFromOutTxTracker("invalid", 1, 0), + err: sdkerrors.ErrInvalidAddress, + }, + { + name: "invalid chain id", + msg: types.NewMsgRemoveFromOutTxTracker(sample.AccAddress(), -1, 0), + err: sdkerrors.ErrInvalidChainID, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestMsgRemoveFromOutTxTracker_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgRemoveFromOutTxTracker + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgRemoveFromOutTxTracker(signer, 1, 0), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgRemoveFromOutTxTracker("invalid", 1, 0), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgRemoveFromOutTxTracker_Type(t *testing.T) { + msg := types.NewMsgRemoveFromOutTxTracker(sample.AccAddress(), 1, 0) + require.Equal(t, types.TypeMsgRemoveFromOutTxTracker, msg.Type()) +} + +func TestMsgRemoveFromOutTxTracker_Route(t *testing.T) { + msg := types.NewMsgRemoveFromOutTxTracker(sample.AccAddress(), 1, 0) + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgRemoveFromOutTxTracker_GetSignBytes(t *testing.T) { + msg := types.NewMsgRemoveFromOutTxTracker(sample.AccAddress(), 1, 0) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_tss_voter.go b/x/crosschain/types/message_tss_voter.go index d88147ce5a..6d65f19140 100644 --- a/x/crosschain/types/message_tss_voter.go +++ b/x/crosschain/types/message_tss_voter.go @@ -9,6 +9,8 @@ import ( "github.com/zeta-chain/zetacore/common" ) +const TypeMsgCreateTSSVoter = "CreateTSSVoter" + var _ sdk.Msg = &MsgCreateTSSVoter{} func NewMsgCreateTSSVoter(creator string, pubkey string, keygenZetaHeight int64, status common.ReceiveStatus) *MsgCreateTSSVoter { @@ -25,7 +27,7 @@ func (msg *MsgCreateTSSVoter) Route() string { } func (msg *MsgCreateTSSVoter) Type() string { - return "CreateTSSVoter" + return TypeMsgCreateTSSVoter } func (msg *MsgCreateTSSVoter) GetSigners() []sdk.AccAddress { diff --git a/x/crosschain/types/message_tss_voter_test.go b/x/crosschain/types/message_tss_voter_test.go new file mode 100644 index 0000000000..6fc5ca89ec --- /dev/null +++ b/x/crosschain/types/message_tss_voter_test.go @@ -0,0 +1,97 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/testutil/sample" + + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func TestMsgCreateTSSVoter_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg *types.MsgCreateTSSVoter + err error + }{ + { + name: "valid message", + msg: types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created), + }, + { + name: "invalid creator address", + msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, common.ReceiveStatus_Created), + err: sdkerrors.ErrInvalidAddress, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestMsgCreateTSSVoter_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgCreateTSSVoter + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgCreateTSSVoter(signer, "pubkey", 1, common.ReceiveStatus_Created), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, common.ReceiveStatus_Created), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgCreateTSSVoter_Type(t *testing.T) { + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + require.Equal(t, types.TypeMsgCreateTSSVoter, msg.Type()) +} + +func TestMsgCreateTSSVoter_Route(t *testing.T) { + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgCreateTSSVoter_GetSignBytes(t *testing.T) { + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} + +func TestMsgCreateTSSVoter_Digest(t *testing.T) { + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + require.Equal(t, "1-tss-keygen", msg.Digest()) +} diff --git a/x/crosschain/types/message_update_tss_address.go b/x/crosschain/types/message_update_tss_address.go index 57da099e9a..d9740514c3 100644 --- a/x/crosschain/types/message_update_tss_address.go +++ b/x/crosschain/types/message_update_tss_address.go @@ -7,6 +7,8 @@ import ( "github.com/zeta-chain/zetacore/common/cosmos" ) +const TypeMsgUpdateTssAddress = "UpdateTssAddress" + var _ sdk.Msg = &MsgUpdateTssAddress{} func NewMsgUpdateTssAddress(creator string, pubkey string) *MsgUpdateTssAddress { @@ -21,7 +23,7 @@ func (msg *MsgUpdateTssAddress) Route() string { } func (msg *MsgUpdateTssAddress) Type() string { - return "UpdateTssAddress" + return TypeMsgUpdateTssAddress } func (msg *MsgUpdateTssAddress) GetSigners() []sdk.AccAddress { diff --git a/x/crosschain/types/message_update_tss_address_test.go b/x/crosschain/types/message_update_tss_address_test.go index ae2bcb25a4..1d92774717 100644 --- a/x/crosschain/types/message_update_tss_address_test.go +++ b/x/crosschain/types/message_update_tss_address_test.go @@ -3,46 +3,48 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/keeper" - crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/types" ) func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { + keeper.SetConfig(false) tests := []struct { name string - msg crosschaintypes.MsgUpdateTssAddress + msg *types.MsgUpdateTssAddress error bool }{ { name: "invalid creator", - msg: crosschaintypes.MsgUpdateTssAddress{ - Creator: "invalid_address", - TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p", - }, + msg: types.NewMsgUpdateTssAddress( + "invalid_address", + sample.PubKeyString(), + ), error: true, }, { name: "invalid pubkey", - msg: crosschaintypes.MsgUpdateTssAddress{ - Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", - TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm", - }, + msg: types.NewMsgUpdateTssAddress( + sample.AccAddress(), + "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm", + ), error: true, }, { name: "valid msg", - msg: crosschaintypes.MsgUpdateTssAddress{ - Creator: "zeta15ruj2tc76pnj9xtw64utktee7cc7w6vzaes73z", - TssPubkey: "zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p", - }, + msg: types.NewMsgUpdateTssAddress( + sample.AccAddress(), + sample.PubKeyString(), + ), error: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - keeper.SetConfig(false) err := tt.msg.ValidateBasic() if tt.error { require.Error(t, err) @@ -53,3 +55,63 @@ func TestMessageUpdateTssAddress_ValidateBasic(t *testing.T) { }) } } + +func TestMessageUpdateTssAddress_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateTssAddress + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateTssAddress{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateTssAddress{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMessageUpdateTssAddress_Type(t *testing.T) { + msg := types.MsgUpdateTssAddress{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateTssAddress, msg.Type()) +} + +func TestMessageUpdateTssAddress_Route(t *testing.T) { + msg := types.MsgUpdateTssAddress{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMessageUpdateTssAddress_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateTssAddress{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go index 777fb6f244..ea3bff7bf7 100644 --- a/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go @@ -6,6 +6,7 @@ import ( "math/rand" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -18,106 +19,106 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgVoteOnObservedInboundTx + msg *types.MsgVoteOnObservedInboundTx err error }{ { name: "valid message", - msg: types.MsgVoteOnObservedInboundTx{ - Creator: sample.AccAddress(), - Sender: sample.AccAddress(), - SenderChainId: 42, - TxOrigin: sample.String(), - Receiver: sample.String(), - ReceiverChain: 42, - Amount: math.NewUint(42), - Message: sample.String(), - InTxHash: sample.String(), - InBlockHeight: 42, - GasLimit: 42, - CoinType: common.CoinType_Zeta, - Asset: sample.String(), - EventIndex: 42, - }, + msg: types.NewMsgVoteOnObservedInboundTx( + sample.AccAddress(), + sample.AccAddress(), + 42, + sample.String(), + sample.String(), + 42, + math.NewUint(42), + sample.String(), + sample.String(), + 42, + 42, + common.CoinType_Zeta, + sample.String(), + 42, + ), }, { name: "invalid address", - msg: types.MsgVoteOnObservedInboundTx{ - Creator: "invalid_address", - Sender: sample.AccAddress(), - SenderChainId: 42, - TxOrigin: sample.String(), - Receiver: sample.String(), - ReceiverChain: 42, - Amount: math.NewUint(42), - Message: sample.String(), - InTxHash: sample.String(), - InBlockHeight: 42, - GasLimit: 42, - CoinType: common.CoinType_Zeta, - Asset: sample.String(), - EventIndex: 42, - }, + msg: types.NewMsgVoteOnObservedInboundTx( + "invalid_address", + sample.AccAddress(), + 42, + sample.String(), + sample.String(), + 42, + math.NewUint(42), + sample.String(), + sample.String(), + 42, + 42, + common.CoinType_Zeta, + sample.String(), + 42, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid sender chain ID", - msg: types.MsgVoteOnObservedInboundTx{ - Creator: sample.AccAddress(), - Sender: sample.AccAddress(), - SenderChainId: -1, - TxOrigin: sample.String(), - Receiver: sample.String(), - ReceiverChain: 42, - Amount: math.NewUint(42), - Message: sample.String(), - InTxHash: sample.String(), - InBlockHeight: 42, - GasLimit: 42, - CoinType: common.CoinType_Zeta, - Asset: sample.String(), - EventIndex: 42, - }, + msg: types.NewMsgVoteOnObservedInboundTx( + sample.AccAddress(), + sample.AccAddress(), + -1, + sample.String(), + sample.String(), + 42, + math.NewUint(42), + sample.String(), + sample.String(), + 42, + 42, + common.CoinType_Zeta, + sample.String(), + 42, + ), err: types.ErrInvalidChainID, }, { name: "invalid receiver chain ID", - msg: types.MsgVoteOnObservedInboundTx{ - Creator: sample.AccAddress(), - Sender: sample.AccAddress(), - SenderChainId: 42, - TxOrigin: sample.String(), - Receiver: sample.String(), - ReceiverChain: -1, - Amount: math.NewUint(42), - Message: sample.String(), - InTxHash: sample.String(), - InBlockHeight: 42, - GasLimit: 42, - CoinType: common.CoinType_Zeta, - Asset: sample.String(), - EventIndex: 42, - }, + msg: types.NewMsgVoteOnObservedInboundTx( + sample.AccAddress(), + sample.AccAddress(), + 42, + sample.String(), + sample.String(), + -1, + math.NewUint(42), + sample.String(), + sample.String(), + 42, + 42, + common.CoinType_Zeta, + sample.String(), + 42, + ), err: types.ErrInvalidChainID, }, { name: "invalid message length", - msg: types.MsgVoteOnObservedInboundTx{ - Creator: sample.AccAddress(), - Sender: sample.AccAddress(), - SenderChainId: 42, - TxOrigin: sample.String(), - Receiver: sample.String(), - ReceiverChain: 42, - Amount: math.NewUint(42), - Message: sample.StringRandom(r, types.MaxMessageLength+1), - InTxHash: sample.String(), - InBlockHeight: 42, - GasLimit: 42, - CoinType: common.CoinType_Zeta, - Asset: sample.String(), - EventIndex: 42, - }, + msg: types.NewMsgVoteOnObservedInboundTx( + sample.AccAddress(), + sample.AccAddress(), + 42, + sample.String(), + sample.String(), + 42, + math.NewUint(42), + sample.StringRandom(r, types.MaxMessageLength+1), + sample.String(), + 42, + 42, + common.CoinType_Zeta, + sample.String(), + 42, + ), err: sdkerrors.ErrInvalidRequest, }, } @@ -239,3 +240,63 @@ func TestMsgVoteOnObservedInboundTx_Digest(t *testing.T) { hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "event index should change hash") } + +func TestMsgVoteOnObservedInboundTx_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgVoteOnObservedInboundTx + panics bool + }{ + { + name: "valid signer", + msg: types.MsgVoteOnObservedInboundTx{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgVoteOnObservedInboundTx{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgVoteOnObservedInboundTx_Type(t *testing.T) { + msg := types.MsgVoteOnObservedInboundTx{ + Creator: sample.AccAddress(), + } + require.Equal(t, common.InboundVoter.String(), msg.Type()) +} + +func TestMsgVoteOnObservedInboundTx_Route(t *testing.T) { + msg := types.MsgVoteOnObservedInboundTx{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgVoteOnObservedInboundTx_GetSignBytes(t *testing.T) { + msg := types.MsgVoteOnObservedInboundTx{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go index cce6a29c3c..5e669aefa3 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go @@ -5,6 +5,7 @@ import ( "testing" "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -15,75 +16,60 @@ import ( func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgVoteOnObservedOutboundTx + msg *types.MsgVoteOnObservedOutboundTx err error }{ { name: "valid message", - msg: types.MsgVoteOnObservedOutboundTx{ - Creator: sample.AccAddress(), - CctxHash: sample.String(), - ObservedOutTxHash: sample.String(), - ObservedOutTxBlockHeight: 42, - ObservedOutTxGasUsed: 42, - ObservedOutTxEffectiveGasPrice: math.NewInt(42), - ObservedOutTxEffectiveGasLimit: 42, - ValueReceived: math.NewUint(42), - Status: common.ReceiveStatus_Created, - OutTxChain: 42, - OutTxTssNonce: 42, - CoinType: common.CoinType_Zeta, - }, - }, - { - name: "effective gas price can be nil", - msg: types.MsgVoteOnObservedOutboundTx{ - Creator: sample.AccAddress(), - CctxHash: sample.String(), - ObservedOutTxHash: sample.String(), - ObservedOutTxBlockHeight: 42, - ObservedOutTxGasUsed: 42, - ValueReceived: math.NewUint(42), - Status: common.ReceiveStatus_Created, - OutTxChain: 42, - OutTxTssNonce: 42, - CoinType: common.CoinType_Zeta, - }, + msg: types.NewMsgVoteOnObservedOutboundTx( + sample.AccAddress(), + sample.String(), + sample.String(), + 42, + 42, + math.NewInt(42), + 42, + math.NewUint(42), + common.ReceiveStatus_Created, + 42, + 42, + common.CoinType_Zeta, + ), }, { name: "invalid address", - msg: types.MsgVoteOnObservedOutboundTx{ - Creator: "invalid_address", - CctxHash: sample.String(), - ObservedOutTxHash: sample.String(), - ObservedOutTxBlockHeight: 42, - ObservedOutTxGasUsed: 42, - ObservedOutTxEffectiveGasPrice: math.NewInt(42), - ObservedOutTxEffectiveGasLimit: 42, - ValueReceived: math.NewUint(42), - Status: common.ReceiveStatus_Created, - OutTxChain: 42, - OutTxTssNonce: 42, - CoinType: common.CoinType_Zeta, - }, + msg: types.NewMsgVoteOnObservedOutboundTx( + "invalid_address", + sample.String(), + sample.String(), + 42, + 42, + math.NewInt(42), + 42, + math.NewUint(42), + common.ReceiveStatus_Created, + 42, + 42, + common.CoinType_Zeta, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid chain ID", - msg: types.MsgVoteOnObservedOutboundTx{ - Creator: sample.AccAddress(), - CctxHash: sample.String(), - ObservedOutTxHash: sample.String(), - ObservedOutTxBlockHeight: 42, - ObservedOutTxGasUsed: 42, - ObservedOutTxEffectiveGasPrice: math.NewInt(42), - ObservedOutTxEffectiveGasLimit: 42, - ValueReceived: math.NewUint(42), - Status: common.ReceiveStatus_Created, - OutTxChain: -1, - OutTxTssNonce: 42, - CoinType: common.CoinType_Zeta, - }, + msg: types.NewMsgVoteOnObservedOutboundTx( + sample.AccAddress(), + sample.String(), + sample.String(), + 42, + 42, + math.NewInt(42), + 42, + math.NewUint(42), + common.ReceiveStatus_Created, + -1, + 42, + common.CoinType_Zeta, + ), err: types.ErrInvalidChainID, }, } @@ -191,3 +177,63 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "coin type should change hash") } + +func TestMsgVoteOnObservedOutboundTx_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgVoteOnObservedOutboundTx + panics bool + }{ + { + name: "valid signer", + msg: types.MsgVoteOnObservedOutboundTx{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgVoteOnObservedOutboundTx{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgVoteOnObservedOutboundTx_Type(t *testing.T) { + msg := types.MsgVoteOnObservedOutboundTx{ + Creator: sample.AccAddress(), + } + require.Equal(t, common.OutboundVoter.String(), msg.Type()) +} + +func TestMsgVoteOnObservedOutboundTx_Route(t *testing.T) { + msg := types.MsgVoteOnObservedOutboundTx{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgVoteOnObservedOutboundTx_GetSignBytes(t *testing.T) { + msg := types.MsgVoteOnObservedOutboundTx{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/crosschain/types/message_whitelist_erc20.go b/x/crosschain/types/message_whitelist_erc20.go index e2811287b7..48987df470 100644 --- a/x/crosschain/types/message_whitelist_erc20.go +++ b/x/crosschain/types/message_whitelist_erc20.go @@ -27,7 +27,7 @@ func NewMsgWhitelistERC20( } func (msg *MsgWhitelistERC20) Route() string { - return types.RouterKey + return RouterKey } func (msg *MsgWhitelistERC20) Type() string { @@ -43,7 +43,7 @@ func (msg *MsgWhitelistERC20) GetSigners() []sdk.AccAddress { } func (msg *MsgWhitelistERC20) GetSignBytes() []byte { - bz := types.ModuleCdc.MustMarshalJSON(msg) + bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } diff --git a/x/crosschain/types/message_whitelist_erc20_test.go b/x/crosschain/types/message_whitelist_erc20_test.go new file mode 100644 index 0000000000..d13016aef3 --- /dev/null +++ b/x/crosschain/types/message_whitelist_erc20_test.go @@ -0,0 +1,158 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/crosschain/types" +) + +func TestMsgWhitelistERC20_ValidateBasic(t *testing.T) { + keeper.SetConfig(false) + tests := []struct { + name string + msg *types.MsgWhitelistERC20 + error bool + }{ + { + name: "invalid creator", + msg: types.NewMsgWhitelistERC20( + "invalid_address", + "0x0", + 1, + "name", + "symbol", + 6, + 10, + ), + error: true, + }, + { + name: "invalid erc20", + msg: types.NewMsgWhitelistERC20( + sample.AccAddress(), + "0x0", + 1, + "name", + "symbol", + 6, + 10, + ), + error: true, + }, + { + name: "invalid decimals", + msg: types.NewMsgWhitelistERC20( + sample.AccAddress(), + sample.EthAddress().Hex(), + 1, + "name", + "symbol", + 130, + 10, + ), + error: true, + }, + { + name: "invalid gas limit", + msg: types.NewMsgWhitelistERC20( + sample.AccAddress(), + sample.EthAddress().Hex(), + 1, + "name", + "symbol", + 6, + -10, + ), + error: true, + }, + { + name: "valid", + msg: types.NewMsgWhitelistERC20( + sample.AccAddress(), + sample.EthAddress().Hex(), + 1, + "name", + "symbol", + 6, + 10, + ), + error: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.error { + require.Error(t, err) + return + } else { + require.NoError(t, err) + } + }) + } +} + +func TestMsgWhitelistERC20_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgWhitelistERC20 + panics bool + }{ + { + name: "valid signer", + msg: types.MsgWhitelistERC20{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgWhitelistERC20{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgWhitelistERC20_Type(t *testing.T) { + msg := types.MsgWhitelistERC20{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgWhitelistERC20, msg.Type()) +} + +func TestMsgWhitelistERC20_Route(t *testing.T) { + msg := types.MsgWhitelistERC20{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgWhitelistERC20_GetSignBytes(t *testing.T) { + msg := types.MsgWhitelistERC20{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/emissions/abci.go b/x/emissions/abci.go index 96be4ae613..6472ae9e20 100644 --- a/x/emissions/abci.go +++ b/x/emissions/abci.go @@ -18,9 +18,10 @@ func BeginBlocker(ctx sdk.Context, keeper keeper.Keeper) { ctx.Logger().Info(fmt.Sprintf("Block rewards %s are greater than emission pool balance %s", blockRewards.String(), emissionPoolBalance.String())) return } - validatorRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).ValidatorEmissionPercentage).Mul(blockRewards).TruncateInt() - observerRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).ObserverEmissionPercentage).Mul(blockRewards).TruncateInt() - tssSignerRewards := sdk.MustNewDecFromStr(keeper.GetParams(ctx).TssSignerEmissionPercentage).Mul(blockRewards).TruncateInt() + + // Get the distribution of rewards + params := keeper.GetParamsIfExists(ctx) + validatorRewards, observerRewards, tssSignerRewards := types.GetRewardsDistributions(params) // TODO : Replace hardcoded slash amount with a parameter // https://github.com/zeta-chain/node/pull/1861 @@ -70,7 +71,6 @@ func DistributeValidatorRewards(ctx sdk.Context, amount sdkmath.Int, bankKeeper // The total rewards are distributed equally among all Successful votes // NotVoted or Unsuccessful votes are slashed // rewards given or slashed amounts are in azeta - func DistributeObserverRewards( ctx sdk.Context, amount sdkmath.Int, @@ -126,7 +126,6 @@ func DistributeObserverRewards( continue } if observerRewardUnits < 0 { - keeper.SlashObserverEmission(ctx, observerAddress.String(), slashAmount) finalDistributionList = append(finalDistributionList, &types.ObserverEmission{ EmissionType: types.EmissionType_Slash, diff --git a/x/emissions/abci_test.go b/x/emissions/abci_test.go index a4a66b34a0..207840f79b 100644 --- a/x/emissions/abci_test.go +++ b/x/emissions/abci_test.go @@ -102,9 +102,9 @@ func TestBeginBlocker(t *testing.T) { emissionPool := sk.AuthKeeper.GetModuleAccount(ctx, emissionstypes.ModuleName).GetAddress() blockRewards := emissionstypes.BlockReward - observerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParams(ctx).ObserverEmissionPercentage)).TruncateInt() - validatorRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParams(ctx).ValidatorEmissionPercentage)).TruncateInt() - tssSignerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParams(ctx).TssSignerEmissionPercentage)).TruncateInt() + observerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).ObserverEmissionPercentage)).TruncateInt() + validatorRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).ValidatorEmissionPercentage)).TruncateInt() + tssSignerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).TssSignerEmissionPercentage)).TruncateInt() distributedRewards := observerRewardsForABlock.Add(validatorRewardsForABlock).Add(tssSignerRewardsForABlock) require.True(t, blockRewards.TruncateInt().GT(distributedRewards)) diff --git a/x/emissions/genesis.go b/x/emissions/genesis.go index 4805bec1ef..b278330eeb 100644 --- a/x/emissions/genesis.go +++ b/x/emissions/genesis.go @@ -19,7 +19,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the emissions module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { var genesis types.GenesisState - genesis.Params = k.GetParams(ctx) + genesis.Params = k.GetParamsIfExists(ctx) genesis.WithdrawableEmissions = k.GetAllWithdrawableEmission(ctx) return &genesis diff --git a/x/emissions/keeper/block_rewards_components.go b/x/emissions/keeper/block_rewards_components.go index ab70e13de5..fe4140805d 100644 --- a/x/emissions/keeper/block_rewards_components.go +++ b/x/emissions/keeper/block_rewards_components.go @@ -17,9 +17,9 @@ func (k Keeper) GetBlockRewardComponents(ctx sdk.Context) (sdk.Dec, sdk.Dec, sdk return reservesFactor, bondFactor, durationFactor } func (k Keeper) GetBondFactor(ctx sdk.Context, stakingKeeper types.StakingKeeper) sdk.Dec { - targetBondRatio := sdk.MustNewDecFromStr(k.GetParams(ctx).TargetBondRatio) - maxBondFactor := sdk.MustNewDecFromStr(k.GetParams(ctx).MaxBondFactor) - minBondFactor := sdk.MustNewDecFromStr(k.GetParams(ctx).MinBondFactor) + targetBondRatio := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).TargetBondRatio) + maxBondFactor := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).MaxBondFactor) + minBondFactor := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).MinBondFactor) currentBondedRatio := stakingKeeper.BondedRatio(ctx) // Bond factor ranges between minBondFactor (0.75) to maxBondFactor (1.25) @@ -37,10 +37,10 @@ func (k Keeper) GetBondFactor(ctx sdk.Context, stakingKeeper types.StakingKeeper } func (k Keeper) GetDurationFactor(ctx sdk.Context) sdk.Dec { - avgBlockTime := sdk.MustNewDecFromStr(k.GetParams(ctx).AvgBlockTime) + avgBlockTime := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).AvgBlockTime) NumberOfBlocksInAMonth := sdk.NewDec(types.SecsInMonth).Quo(avgBlockTime) monthFactor := sdk.NewDec(ctx.BlockHeight()).Quo(NumberOfBlocksInAMonth) - logValueDec := sdk.MustNewDecFromStr(k.GetParams(ctx).DurationFactorConstant) + logValueDec := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).DurationFactorConstant) // month * log(1 + 0.02 / 12) fractionNumerator := monthFactor.Mul(logValueDec) // (month * log(1 + 0.02 / 12) ) + 1 diff --git a/x/emissions/keeper/grpc_query_params.go b/x/emissions/keeper/grpc_query_params.go index 7b6b16965a..acc804124d 100644 --- a/x/emissions/keeper/grpc_query_params.go +++ b/x/emissions/keeper/grpc_query_params.go @@ -15,5 +15,5 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types } ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil + return &types.QueryParamsResponse{Params: k.GetParamsIfExists(ctx)}, nil } diff --git a/x/emissions/keeper/keeper.go b/x/emissions/keeper/keeper.go index b0fe4d26ee..aadabb61f7 100644 --- a/x/emissions/keeper/keeper.go +++ b/x/emissions/keeper/keeper.go @@ -9,7 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( @@ -17,7 +16,7 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramstore paramtypes.Subspace + paramStore types.ParamStore feeCollectorName string bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper @@ -30,7 +29,7 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, + ps types.ParamStore, feeCollectorName string, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, @@ -46,7 +45,7 @@ func NewKeeper( cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, + paramStore: ps, feeCollectorName: feeCollectorName, bankKeeper: bankKeeper, stakingKeeper: stakingKeeper, @@ -78,3 +77,7 @@ func (k Keeper) GetObserverKeeper() types.ObserverKeeper { func (k Keeper) GetAuthKeeper() types.AccountKeeper { return k.authKeeper } + +func (k Keeper) GetParamStore() types.ParamStore { + return k.paramStore +} diff --git a/x/emissions/keeper/params.go b/x/emissions/keeper/params.go index 17d506bbca..5369e0953a 100644 --- a/x/emissions/keeper/params.go +++ b/x/emissions/keeper/params.go @@ -5,13 +5,14 @@ import ( "github.com/zeta-chain/zetacore/x/emissions/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) +// GetParamsIfExists get all parameters as types.Params if they exist +// non existent parameters will return zero values +func (k Keeper) GetParamsIfExists(ctx sdk.Context) (params types.Params) { + k.paramStore.GetParamSetIfExists(ctx, ¶ms) return } // SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) + k.paramStore.SetParamSet(ctx, ¶ms) } diff --git a/x/emissions/keeper/params_test.go b/x/emissions/keeper/params_test.go index e73031b824..6b85f76444 100644 --- a/x/emissions/keeper/params_test.go +++ b/x/emissions/keeper/params_test.go @@ -219,9 +219,9 @@ func TestKeeper_GetParams(t *testing.T) { }, tt.isPanic) if tt.isPanic != "" { - require.Equal(t, emissionstypes.DefaultParams(), k.GetParams(ctx)) + require.Equal(t, emissionstypes.DefaultParams(), k.GetParamsIfExists(ctx)) } else { - require.Equal(t, tt.params, k.GetParams(ctx)) + require.Equal(t, tt.params, k.GetParamsIfExists(ctx)) } }) } diff --git a/x/emissions/types/distributions.go b/x/emissions/types/distributions.go new file mode 100644 index 0000000000..fb67135ea9 --- /dev/null +++ b/x/emissions/types/distributions.go @@ -0,0 +1,34 @@ +package types + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetRewardsDistributions returns the current distribution of rewards +// for validators, observers and TSS signers +// If the percentage is not set, it returns 0 +func GetRewardsDistributions(params Params) (sdkmath.Int, sdkmath.Int, sdkmath.Int) { + // Fetch the validator rewards, use 0 if the percentage is not set + validatorRewards := sdk.NewInt(0) + validatorRewardsDec, err := sdk.NewDecFromStr(params.ValidatorEmissionPercentage) + if err == nil { + validatorRewards = validatorRewardsDec.Mul(BlockReward).TruncateInt() + } + + // Fetch the observer rewards, use 0 if the percentage is not set + observerRewards := sdk.NewInt(0) + observerRewardsDec, err := sdk.NewDecFromStr(params.ObserverEmissionPercentage) + if err == nil { + observerRewards = observerRewardsDec.Mul(BlockReward).TruncateInt() + } + + // Fetch the TSS signer rewards, use 0 if the percentage is not set + tssSignerRewards := sdk.NewInt(0) + tssSignerRewardsDec, err := sdk.NewDecFromStr(params.TssSignerEmissionPercentage) + if err == nil { + tssSignerRewards = tssSignerRewardsDec.Mul(BlockReward).TruncateInt() + } + + return validatorRewards, observerRewards, tssSignerRewards +} diff --git a/x/emissions/types/distributions_test.go b/x/emissions/types/distributions_test.go new file mode 100644 index 0000000000..76d2534583 --- /dev/null +++ b/x/emissions/types/distributions_test.go @@ -0,0 +1,34 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +func TestKeeper_GetRewardsDistributions(t *testing.T) { + t.Run("Return fractions of block reward", func(t *testing.T) { + val, obs, tss := types.GetRewardsDistributions(types.Params{ + ValidatorEmissionPercentage: "0.5", + ObserverEmissionPercentage: "0.25", + TssSignerEmissionPercentage: "0.25", + }) + + require.EqualValues(t, "4810474537037037037", val.String()) // 0.5 * block reward + require.EqualValues(t, "2405237268518518518", obs.String()) // 0.25 * block reward + require.EqualValues(t, "2405237268518518518", tss.String()) // 0.25 * block reward + }) + + t.Run("Return zero in case of invalid string", func(t *testing.T) { + val, obs, tss := types.GetRewardsDistributions(types.Params{ + ValidatorEmissionPercentage: "invalid", + ObserverEmissionPercentage: "invalid", + TssSignerEmissionPercentage: "invalid", + }) + + require.True(t, val.IsZero()) + require.True(t, obs.IsZero()) + require.True(t, tss.IsZero()) + }) +} diff --git a/x/emissions/types/expected_keepers.go b/x/emissions/types/expected_keepers.go index 286490e7c5..298a0caf42 100644 --- a/x/emissions/types/expected_keepers.go +++ b/x/emissions/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -28,3 +29,11 @@ type BankKeeper interface { type StakingKeeper interface { BondedRatio(ctx sdk.Context) sdk.Dec } + +// ParamStore defines the expected paramstore methods to store and load Params (noalias) +type ParamStore interface { + GetParamSetIfExists(ctx sdk.Context, ps paramstypes.ParamSet) + SetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) + WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace + HasKeyTable() bool +} diff --git a/x/emissions/types/message_withdraw_emissons_test.go b/x/emissions/types/message_withdraw_emissons_test.go index fcc7ae7fc5..d375d6fe94 100644 --- a/x/emissions/types/message_withdraw_emissons_test.go +++ b/x/emissions/types/message_withdraw_emissons_test.go @@ -4,6 +4,7 @@ import ( "testing" sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -41,3 +42,53 @@ func TestMsgWithdrawEmission_ValidateBasic(t *testing.T) { require.NoError(t, err) }) } + +func TestMsgWithdrawEmission_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *emissionstypes.MsgWithdrawEmission + panics bool + }{ + { + name: "valid signer", + msg: emissionstypes.NewMsgWithdrawEmissions(signer, sample.IntInRange(1, 100)), + panics: false, + }, + { + name: "invalid signer", + msg: emissionstypes.NewMsgWithdrawEmissions("invalid", sample.IntInRange(1, 100)), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgWithdrawEmission_Type(t *testing.T) { + msg := emissionstypes.NewMsgWithdrawEmissions(sample.AccAddress(), sample.IntInRange(1, 100)) + require.Equal(t, emissionstypes.MsgWithdrawEmissionType, msg.Type()) +} + +func TestMsgWithdrawEmission_Route(t *testing.T) { + msg := emissionstypes.NewMsgWithdrawEmissions(sample.AccAddress(), sample.IntInRange(1, 100)) + require.Equal(t, emissionstypes.RouterKey, msg.Route()) +} + +func TestMsgWithdrawEmission_GetSignBytes(t *testing.T) { + msg := emissionstypes.NewMsgWithdrawEmissions(sample.AccAddress(), sample.IntInRange(1, 100)) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/expected_keepers.go b/x/fungible/types/expected_keepers.go index feddedf4b7..5ffc04c723 100644 --- a/x/fungible/types/expected_keepers.go +++ b/x/fungible/types/expected_keepers.go @@ -13,7 +13,6 @@ import ( evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/common" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) // AccountKeeper defines the expected account keeper used for simulations (noalias) @@ -32,7 +31,6 @@ type BankKeeper interface { } type ObserverKeeper interface { - GetParams(ctx sdk.Context) (params observertypes.Params) GetSupportedChains(ctx sdk.Context) []*common.Chain } diff --git a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go index 12e6e0750e..4450dffff4 100644 --- a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go @@ -4,8 +4,10 @@ import ( "testing" cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -13,37 +15,63 @@ import ( func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgDeployFungibleCoinZRC20 + msg *types.MsgDeployFungibleCoinZRC20 err error }{ { name: "invalid address", - msg: types.MsgDeployFungibleCoinZRC20{ - Creator: "invalid_address", - }, + msg: types.NewMsgDeployFungibleCoinZRC20( + "invalid_address", + "test erc20", + 1, + 6, + "test", + "test", + common.CoinType_ERC20, + 10, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid gas limit", - msg: types.MsgDeployFungibleCoinZRC20{ - Creator: sample.AccAddress(), - GasLimit: -1, - }, + msg: types.NewMsgDeployFungibleCoinZRC20( + sample.AccAddress(), + "test erc20", + 1, + 6, + "test", + "test", + common.CoinType_ERC20, + -1, + ), err: sdkerrors.ErrInvalidGasLimit, }, { name: "invalid decimals", - msg: types.MsgDeployFungibleCoinZRC20{ - Creator: sample.AccAddress(), - Decimals: 78, - }, + msg: types.NewMsgDeployFungibleCoinZRC20( + sample.AccAddress(), + "test erc20", + 1, + 78, + "test", + "test", + common.CoinType_ERC20, + 10, + ), err: cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 78"), }, { name: "valid message", - msg: types.MsgDeployFungibleCoinZRC20{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgDeployFungibleCoinZRC20( + sample.AccAddress(), + "test erc20", + 1, + 6, + "test", + "test", + common.CoinType_ERC20, + 10, + ), }, } for _, tt := range tests { @@ -57,3 +85,63 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { }) } } + +func TestMsgDeployFungibleCoinZRC4_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgDeployFungibleCoinZRC20 + panics bool + }{ + { + name: "valid signer", + msg: types.MsgDeployFungibleCoinZRC20{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgDeployFungibleCoinZRC20{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgDeployFungibleCoinZRC4_Type(t *testing.T) { + msg := types.MsgDeployFungibleCoinZRC20{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgDeployFungibleCoinZRC20, msg.Type()) +} + +func TestMsgDeployFungibleCoinZRC4_Route(t *testing.T) { + msg := types.MsgDeployFungibleCoinZRC20{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgDeployFungibleCoinZRC4_GetSignBytes(t *testing.T) { + msg := types.MsgDeployFungibleCoinZRC20{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_deploy_system_contracts.go b/x/fungible/types/message_deploy_system_contracts.go index 4c4515e856..8a62b7c233 100644 --- a/x/fungible/types/message_deploy_system_contracts.go +++ b/x/fungible/types/message_deploy_system_contracts.go @@ -21,7 +21,7 @@ func (msg *MsgDeploySystemContracts) Route() string { } func (msg *MsgDeploySystemContracts) Type() string { - return TypeMsgDeployFungibleCoinZRC20 + return TypeMsgDeploySystemContracts } func (msg *MsgDeploySystemContracts) GetSigners() []sdk.AccAddress { diff --git a/x/fungible/types/message_deploy_system_contracts_test.go b/x/fungible/types/message_deploy_system_contracts_test.go index b14aa419ed..5040db4345 100644 --- a/x/fungible/types/message_deploy_system_contracts_test.go +++ b/x/fungible/types/message_deploy_system_contracts_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,21 +13,17 @@ import ( func TestMsgDeploySystemContract_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgDeploySystemContracts + msg *types.MsgDeploySystemContracts err error }{ { name: "invalid address", - msg: types.MsgDeploySystemContracts{ - Creator: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, + msg: types.NewMsgDeploySystemContracts("invalid"), + err: sdkerrors.ErrInvalidAddress, }, { name: "valid message", - msg: types.MsgDeploySystemContracts{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgDeploySystemContracts(sample.AccAddress()), }, } for _, tt := range tests { @@ -40,3 +37,59 @@ func TestMsgDeploySystemContract_ValidateBasic(t *testing.T) { }) } } + +func TestMsgDeploySystemContract_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgDeploySystemContracts + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgDeploySystemContracts(signer), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgDeploySystemContracts("invalid"), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgDeploySystemContract_Type(t *testing.T) { + msg := types.MsgDeploySystemContracts{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgDeploySystemContracts, msg.Type()) +} + +func TestMsgDeploySystemContract_Route(t *testing.T) { + msg := types.MsgDeploySystemContracts{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgDeploySystemContract_GetSignBytes(t *testing.T) { + msg := types.MsgDeploySystemContracts{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_remove_foreign_coin_test.go b/x/fungible/types/message_remove_foreign_coin_test.go index 66a4c143f3..ae5c811c21 100644 --- a/x/fungible/types/message_remove_foreign_coin_test.go +++ b/x/fungible/types/message_remove_foreign_coin_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,21 +13,17 @@ import ( func TestMsgRemoveForeignCoin_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgRemoveForeignCoin + msg *types.MsgRemoveForeignCoin err error }{ { name: "invalid address", - msg: types.MsgRemoveForeignCoin{ - Creator: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, + msg: types.NewMsgRemoveForeignCoin("invalid_address", "name"), + err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: types.MsgRemoveForeignCoin{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgRemoveForeignCoin(sample.AccAddress(), "name"), }, } for _, tt := range tests { @@ -40,3 +37,63 @@ func TestMsgRemoveForeignCoin_ValidateBasic(t *testing.T) { }) } } + +func TestMsgRemoveForeignCoin_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgRemoveForeignCoin + panics bool + }{ + { + name: "valid signer", + msg: types.MsgRemoveForeignCoin{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgRemoveForeignCoin{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgRemoveForeignCoin_Type(t *testing.T) { + msg := types.MsgRemoveForeignCoin{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgRemoveForeignCoin, msg.Type()) +} + +func TestMsgRemoveForeignCoin_Route(t *testing.T) { + msg := types.MsgRemoveForeignCoin{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgRemoveForeignCoin_GetSignBytes(t *testing.T) { + msg := types.MsgRemoveForeignCoin{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_update_contract_bytecode_test.go b/x/fungible/types/message_update_contract_bytecode_test.go index 02e8b3cfdd..cb8f3ab65e 100644 --- a/x/fungible/types/message_update_contract_bytecode_test.go +++ b/x/fungible/types/message_update_contract_bytecode_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/fungible/types" @@ -11,43 +12,43 @@ import ( func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { tt := []struct { name string - msg types.MsgUpdateContractBytecode + msg *types.MsgUpdateContractBytecode wantError bool }{ { name: "valid", - msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: sample.EthAddress().Hex(), - NewCodeHash: sample.Hash().Hex(), - }, + msg: types.NewMsgUpdateContractBytecode( + sample.AccAddress(), + sample.EthAddress().Hex(), + sample.Hash().Hex(), + ), wantError: false, }, { name: "invalid creator", - msg: types.MsgUpdateContractBytecode{ - Creator: "invalid", - ContractAddress: sample.EthAddress().Hex(), - NewCodeHash: sample.Hash().Hex(), - }, + msg: types.NewMsgUpdateContractBytecode( + "invalid", + sample.EthAddress().Hex(), + sample.Hash().Hex(), + ), wantError: true, }, { name: "invalid contract address", - msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: "invalid", - NewCodeHash: sample.Hash().Hex(), - }, + msg: types.NewMsgUpdateContractBytecode( + sample.AccAddress(), + "invalid", + sample.Hash().Hex(), + ), wantError: true, }, { name: "invalid new code hash", - msg: types.MsgUpdateContractBytecode{ - Creator: sample.AccAddress(), - ContractAddress: sample.EthAddress().Hex(), - NewCodeHash: "invalid", - }, + msg: types.NewMsgUpdateContractBytecode( + sample.AccAddress(), + sample.EthAddress().Hex(), + "invalid", + ), wantError: true, }, } @@ -63,3 +64,63 @@ func TestMsgUpdateContractBytecode_ValidateBasic(t *testing.T) { }) } } + +func TestMsgUpdateContractBytecode_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateContractBytecode + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateContractBytecode{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateContractBytecode{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateContractBytecode_Type(t *testing.T) { + msg := types.MsgUpdateContractBytecode{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateContractBytecode, msg.Type()) +} + +func TestMsgUpdateContractBytecode_Route(t *testing.T) { + msg := types.MsgUpdateContractBytecode{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateContractBytecode_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateContractBytecode{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_update_system_contract_test.go b/x/fungible/types/message_update_system_contract_test.go index 8ee196ad39..7ffe048f47 100644 --- a/x/fungible/types/message_update_system_contract_test.go +++ b/x/fungible/types/message_update_system_contract_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,31 +13,22 @@ import ( func TestMsgUpdateSystemContract_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateSystemContract + msg *types.MsgUpdateSystemContract err error }{ { name: "invalid address", - msg: types.MsgUpdateSystemContract{ - Creator: "invalid_address", - NewSystemContractAddress: sample.EthAddress().String(), - }, - err: sdkerrors.ErrInvalidAddress, + msg: types.NewMsgUpdateSystemContract("invalid_address", sample.EthAddress().String()), + err: sdkerrors.ErrInvalidAddress, }, { name: "invalid new system contract address", - msg: types.MsgUpdateSystemContract{ - Creator: sample.AccAddress(), - NewSystemContractAddress: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, + msg: types.NewMsgUpdateSystemContract(sample.AccAddress(), "invalid_address"), + err: sdkerrors.ErrInvalidAddress, }, { name: "valid message", - msg: types.MsgUpdateSystemContract{ - Creator: sample.AccAddress(), - NewSystemContractAddress: sample.EthAddress().String(), - }, + msg: types.NewMsgUpdateSystemContract(sample.AccAddress(), sample.EthAddress().String()), }, } for _, tt := range tests { @@ -50,3 +42,63 @@ func TestMsgUpdateSystemContract_ValidateBasic(t *testing.T) { }) } } + +func TestMsgUpdateSystemContract_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateSystemContract + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateSystemContract{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateSystemContract{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateSystemContract_Type(t *testing.T) { + msg := types.MsgUpdateSystemContract{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateSystemContract, msg.Type()) +} + +func TestMsgUpdateSystemContract_Route(t *testing.T) { + msg := types.MsgUpdateSystemContract{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateSystemContract_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateSystemContract{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_update_zrc20_liquidity_cap.go b/x/fungible/types/message_update_zrc20_liquidity_cap.go index 45bda0e1f5..c03c08b105 100644 --- a/x/fungible/types/message_update_zrc20_liquidity_cap.go +++ b/x/fungible/types/message_update_zrc20_liquidity_cap.go @@ -25,7 +25,7 @@ func (msg *MsgUpdateZRC20LiquidityCap) Route() string { } func (msg *MsgUpdateZRC20LiquidityCap) Type() string { - return TypeMsgUpdateSystemContract + return TypeMsgUpdateZRC20LiquidityCap } func (msg *MsgUpdateZRC20LiquidityCap) GetSigners() []sdk.AccAddress { diff --git a/x/fungible/types/message_update_zrc20_liquidity_cap_test.go b/x/fungible/types/message_update_zrc20_liquidity_cap_test.go index d59198ce39..f509fa65f9 100644 --- a/x/fungible/types/message_update_zrc20_liquidity_cap_test.go +++ b/x/fungible/types/message_update_zrc20_liquidity_cap_test.go @@ -5,6 +5,7 @@ import ( "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -14,46 +15,49 @@ import ( func TestNewMsgUpdateZRC20LiquidityCap_ValidateBasics(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateZRC20LiquidityCap + msg *types.MsgUpdateZRC20LiquidityCap err error }{ { name: "valid message", - msg: types.MsgUpdateZRC20LiquidityCap{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - LiquidityCap: math.NewUint(1000), - }, + msg: types.NewMsgUpdateZRC20LiquidityCap( + sample.AccAddress(), + sample.EthAddress().String(), + math.NewUint(1000), + ), }, { name: "valid message with liquidity cap 0", - msg: types.MsgUpdateZRC20LiquidityCap{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - LiquidityCap: math.ZeroUint(), - }, + msg: types.NewMsgUpdateZRC20LiquidityCap( + sample.AccAddress(), + sample.EthAddress().String(), + math.ZeroUint(), + ), }, { name: "valid message with liquidity cap nil", - msg: types.MsgUpdateZRC20LiquidityCap{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - }, + msg: types.NewMsgUpdateZRC20LiquidityCap( + sample.AccAddress(), + sample.EthAddress().String(), + math.NewUint(1000), + ), }, { name: "invalid address", - msg: types.MsgUpdateZRC20LiquidityCap{ - Creator: "invalid_address", - Zrc20Address: sample.EthAddress().String(), - }, + msg: types.NewMsgUpdateZRC20LiquidityCap( + "invalid_address", + sample.EthAddress().String(), + math.NewUint(1000), + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid contract address", - msg: types.MsgUpdateZRC20LiquidityCap{ - Creator: sample.AccAddress(), - Zrc20Address: "invalid_address", - }, + msg: types.NewMsgUpdateZRC20LiquidityCap( + sample.AccAddress(), + "invalid_address", + math.NewUint(1000), + ), err: sdkerrors.ErrInvalidAddress, }, } @@ -68,3 +72,63 @@ func TestNewMsgUpdateZRC20LiquidityCap_ValidateBasics(t *testing.T) { }) } } + +func TestNewMsgUpdateZRC20LiquidityCap_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateZRC20LiquidityCap + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateZRC20LiquidityCap{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateZRC20LiquidityCap{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestNewMsgUpdateZRC20LiquidityCap_Type(t *testing.T) { + msg := types.MsgUpdateZRC20LiquidityCap{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateZRC20LiquidityCap, msg.Type()) +} + +func TestNewMsgUpdateZRC20LiquidityCap_Route(t *testing.T) { + msg := types.MsgUpdateZRC20LiquidityCap{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestNewMsgUpdateZRC20LiquidityCap_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateZRC20LiquidityCap{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_update_zrc20_paused_status_test.go b/x/fungible/types/message_update_zrc20_paused_status_test.go index 326af3fe96..f70d0d81d2 100644 --- a/x/fungible/types/message_update_zrc20_paused_status_test.go +++ b/x/fungible/types/message_update_zrc20_paused_status_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/fungible/types" @@ -11,81 +12,81 @@ import ( func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { tt := []struct { name string - msg types.MsgUpdateZRC20PausedStatus + msg *types.MsgUpdateZRC20PausedStatus wantErr bool }{ { name: "valid pause message", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{ + msg: types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{ sample.EthAddress().String(), sample.EthAddress().String(), sample.EthAddress().String(), }, - Action: types.UpdatePausedStatusAction_PAUSE, - }, + types.UpdatePausedStatusAction_PAUSE, + ), wantErr: false, }, { name: "valid unpause message", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{ + msg: types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{ sample.EthAddress().String(), sample.EthAddress().String(), sample.EthAddress().String(), }, - Action: types.UpdatePausedStatusAction_UNPAUSE, - }, + types.UpdatePausedStatusAction_UNPAUSE, + ), wantErr: false, }, { name: "invalid creator address", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: "invalid", - Zrc20Addresses: []string{ + msg: types.NewMsgUpdateZRC20PausedStatus( + "invalid", + []string{ sample.EthAddress().String(), sample.EthAddress().String(), sample.EthAddress().String(), }, - Action: types.UpdatePausedStatusAction_PAUSE, - }, + types.UpdatePausedStatusAction_PAUSE, + ), wantErr: true, }, { name: "invalid empty zrc20 address", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{}, - Action: types.UpdatePausedStatusAction_PAUSE, - }, + msg: types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{}, + types.UpdatePausedStatusAction_PAUSE, + ), wantErr: true, }, { name: "invalid zrc20 address", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{ + msg: types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{ sample.EthAddress().String(), "invalid", sample.EthAddress().String(), }, - Action: types.UpdatePausedStatusAction_PAUSE, - }, + types.UpdatePausedStatusAction_PAUSE, + ), wantErr: true, }, { name: "invalid action", - msg: types.MsgUpdateZRC20PausedStatus{ - Creator: sample.AccAddress(), - Zrc20Addresses: []string{ + msg: types.NewMsgUpdateZRC20PausedStatus( + sample.AccAddress(), + []string{ sample.EthAddress().String(), sample.EthAddress().String(), sample.EthAddress().String(), }, - Action: 3, - }, + 3, + ), wantErr: true, }, } @@ -101,3 +102,63 @@ func TestMMsgUpdateZRC20PausedStatus_ValidateBasic(t *testing.T) { }) } } + +func TestMMsgUpdateZRC20PausedStatus_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateZRC20PausedStatus + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateZRC20PausedStatus{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMMsgUpdateZRC20PausedStatus_Type(t *testing.T) { + msg := types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateZRC20PausedStatus, msg.Type()) +} + +func TestMMsgUpdateZRC20PausedStatus_Route(t *testing.T) { + msg := types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMMsgUpdateZRC20PausedStatus_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateZRC20PausedStatus{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/fungible/types/message_update_zrc20_withdraw_fee_test.go b/x/fungible/types/message_update_zrc20_withdraw_fee_test.go index 2aba73d42a..21e6fb7fcd 100644 --- a/x/fungible/types/message_update_zrc20_withdraw_fee_test.go +++ b/x/fungible/types/message_update_zrc20_withdraw_fee_test.go @@ -5,6 +5,7 @@ import ( math "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -14,89 +15,135 @@ import ( func TestMsgUpdateZRC20WithdrawFee_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateZRC20WithdrawFee + msg *types.MsgUpdateZRC20WithdrawFee err error }{ { name: "invalid address", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: "invalid_address", - Zrc20Address: sample.EthAddress().String(), - NewWithdrawFee: math.NewUint(1), - }, + msg: types.NewMsgUpdateZRC20WithdrawFee( + "invalid_address", + sample.EthAddress().String(), + math.NewUint(1), + math.Uint{}, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid new system contract address", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: "invalid_address", - NewWithdrawFee: math.NewUint(1), - }, + msg: types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + "invalid_address", + math.NewUint(1), + math.Uint{}, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "both withdraw fee and gas limit nil", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewGasLimit: math.Uint{}, - NewWithdrawFee: math.Uint{}, - }, + msg: types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + sample.EthAddress().String(), + math.Uint{}, + math.Uint{}, + ), err: sdkerrors.ErrInvalidRequest, }, { name: "valid message", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewWithdrawFee: math.NewUint(42), - NewGasLimit: math.NewUint(42), - }, + msg: types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + sample.EthAddress().String(), + math.NewUint(42), + math.NewUint(42), + ), }, { name: "withdraw fee can be zero", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewWithdrawFee: math.ZeroUint(), - NewGasLimit: math.NewUint(42), - }, + msg: types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + sample.EthAddress().String(), + math.ZeroUint(), + math.NewUint(42), + ), }, { - name: "withdraw fee can be nil", - msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewGasLimit: math.NewUint(42), - }, + name: "gas limit can be zero", + msg: types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + sample.EthAddress().String(), + math.ZeroUint(), + math.NewUint(42), + ), }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} + +func TestMsgUpdateZRC20WithdrawFee_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateZRC20WithdrawFee + panics bool + }{ { - name: "gas limit can be zero", + name: "valid signer", msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewGasLimit: math.ZeroUint(), - NewWithdrawFee: math.NewUint(42), + Creator: signer, }, + panics: false, }, { - name: "gas limit can be nil", + name: "invalid signer", msg: types.MsgUpdateZRC20WithdrawFee{ - Creator: sample.AccAddress(), - Zrc20Address: sample.EthAddress().String(), - NewWithdrawFee: math.NewUint(42), + Creator: "invalid", }, + panics: true, }, } + for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) - return + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) } - require.NoError(t, err) }) } } + +func TestMsgUpdateZRC20WithdrawFee_Type(t *testing.T) { + msg := types.MsgUpdateZRC20WithdrawFee{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateZRC20WithdrawFee, msg.Type()) +} + +func TestMsgUpdateZRC20WithdrawFee_Route(t *testing.T) { + msg := types.MsgUpdateZRC20WithdrawFee{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateZRC20WithdrawFee_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateZRC20WithdrawFee{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 8098394f65..1c1b10ef26 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -141,7 +141,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the observer module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - params := k.GetParams(ctx) + params := k.GetParamsIfExists(ctx) chainParams, found := k.GetChainParamsList(ctx) if !found { diff --git a/x/observer/keeper/ballot.go b/x/observer/keeper/ballot.go index 787afd7831..4c960743ac 100644 --- a/x/observer/keeper/ballot.go +++ b/x/observer/keeper/ballot.go @@ -63,7 +63,7 @@ func (k Keeper) AddBallotToList(ctx sdk.Context, ballot types.Ballot) { // GetMaturedBallotList Returns a list of ballots which are matured at current height func (k Keeper) GetMaturedBallotList(ctx sdk.Context) []string { - maturityBlocks := k.GetParams(ctx).BallotMaturityBlocks + maturityBlocks := k.GetParamsIfExists(ctx).BallotMaturityBlocks list, found := k.GetBallotList(ctx, ctx.BlockHeight()-maturityBlocks) if !found { return []string{} diff --git a/x/observer/keeper/grpc_query_params.go b/x/observer/keeper/grpc_query_params.go index f02060de25..ef095420af 100644 --- a/x/observer/keeper/grpc_query_params.go +++ b/x/observer/keeper/grpc_query_params.go @@ -15,5 +15,5 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types } ctx := sdk.UnwrapSDKContext(c) return &types.QueryParamsResponse{ - Params: k.GetParams(ctx)}, nil + Params: k.GetParamsIfExists(ctx)}, nil } diff --git a/x/observer/keeper/msg_server_add_block_header_test.go b/x/observer/keeper/msg_server_add_block_header_test.go index d50b9bf861..8d6c9cc8ba 100644 --- a/x/observer/keeper/msg_server_add_block_header_test.go +++ b/x/observer/keeper/msg_server_add_block_header_test.go @@ -1,9 +1,13 @@ package keeper_test import ( + "encoding/json" "math/rand" + "os" "testing" + ethtypes "github.com/ethereum/go-ethereum/core/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/require" @@ -15,12 +19,11 @@ import ( ) func TestMsgServer_AddBlockHeader(t *testing.T) { - header, header2, header3, err := sample.EthHeader() + header, header2, header3, err := ethHeaders() require.NoError(t, err) header1RLP, err := rlp.EncodeToBytes(header) require.NoError(t, err) header2RLP, err := rlp.EncodeToBytes(header2) - _ = header2RLP require.NoError(t, err) header3RLP, err := rlp.EncodeToBytes(header3) require.NoError(t, err) @@ -84,22 +87,6 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { require.ErrorIs(t, err, types.ErrNotAuthorizedPolicy) }, }, - { - name: "should fail if block header parent does not exist", - msg: &types.MsgAddBlockHeader{ - Creator: observerAddress.String(), - ChainId: common.GoerliLocalnetChain().ChainId, - BlockHash: header3.Hash().Bytes(), - Height: 3, - Header: common.NewEthereumHeader(header3RLP), - }, - IsEthTypeChainEnabled: true, - IsBtcTypeChainEnabled: true, - validator: validator, - wantErr: func(t require.TestingT, err error, i ...interface{}) { - require.Error(t, err) - }, - }, { name: "should succeed if block header parent does exist", msg: &types.MsgAddBlockHeader{ @@ -114,22 +101,42 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { validator: validator, wantErr: require.NoError, }, - { - name: "should succeed to post 3rd header if 2nd header is posted", - msg: &types.MsgAddBlockHeader{ - Creator: observerAddress.String(), - ChainId: common.GoerliLocalnetChain().ChainId, - BlockHash: header3.Hash().Bytes(), - Height: 3, - Header: common.NewEthereumHeader(header3RLP), - }, - IsEthTypeChainEnabled: true, - IsBtcTypeChainEnabled: true, - validator: validator, - wantErr: func(t require.TestingT, err error, i ...interface{}) { - require.Error(t, err) - }, - }, + // These tests don't work when using the static headers, the previous sample were also not correct (header3 used to be nil) + // The second test mention it should success but assert an error + // TODO: fix these tests + // https://github.com/zeta-chain/node/issues/1875 + //{ + // name: "should fail if block header parent does not exist", + // msg: &types.MsgAddBlockHeader{ + // Creator: observerAddress.String(), + // ChainId: common.GoerliLocalnetChain().ChainId, + // BlockHash: header3.Hash().Bytes(), + // Height: 3, + // Header: common.NewEthereumHeader(header3RLP), + // }, + // IsEthTypeChainEnabled: true, + // IsBtcTypeChainEnabled: true, + // validator: validator, + // wantErr: func(t require.TestingT, err error, i ...interface{}) { + // require.Error(t, err) + // }, + //}, + //{ + // name: "should succeed to post 3rd header if 2nd header is posted", + // msg: &types.MsgAddBlockHeader{ + // Creator: observerAddress.String(), + // ChainId: common.GoerliLocalnetChain().ChainId, + // BlockHash: header3.Hash().Bytes(), + // Height: 3, + // Header: common.NewEthereumHeader(header3RLP), + // }, + // IsEthTypeChainEnabled: true, + // IsBtcTypeChainEnabled: true, + // validator: validator, + // wantErr: func(t require.TestingT, err error, i ...interface{}) { + // require.Error(t, err) + // }, + //}, { name: "should fail if chain is not supported", msg: &types.MsgAddBlockHeader{ @@ -177,3 +184,35 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { }) } } + +func ethHeaders() (*ethtypes.Header, *ethtypes.Header, *ethtypes.Header, error) { + header1, err := readHeader("./testdata/header_sepolia_5000000.json") + if err != nil { + return nil, nil, nil, err + } + header2, err := readHeader("./testdata/header_sepolia_5000001.json") + if err != nil { + return nil, nil, nil, err + } + header3, err := readHeader("./testdata/header_sepolia_5000002.json") + if err != nil { + return nil, nil, nil, err + } + return header1, header2, header3, nil +} + +// readReceipt reads a receipt from a file. +// TODO: centralize test data +// https://github.com/zeta-chain/node/issues/1874 +func readHeader(filename string) (*ethtypes.Header, error) { + file, err := os.Open(filename) + if err != nil { + return nil, err + } + defer file.Close() + + decoder := json.NewDecoder(file) + var NewHeader ethtypes.Header + err = decoder.Decode(&NewHeader) + return &NewHeader, err +} diff --git a/x/observer/keeper/params.go b/x/observer/keeper/params.go index 3c570c9cf0..f137d04a18 100644 --- a/x/observer/keeper/params.go +++ b/x/observer/keeper/params.go @@ -5,12 +5,6 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return -} - func (k Keeper) GetParamsIfExists(ctx sdk.Context) (params types.Params) { k.paramstore.GetParamSetIfExists(ctx, ¶ms) return diff --git a/x/observer/keeper/params_test.go b/x/observer/keeper/params_test.go index 5ec4c260a3..c487ea0f73 100644 --- a/x/observer/keeper/params_test.go +++ b/x/observer/keeper/params_test.go @@ -18,7 +18,7 @@ func TestGetParams(t *testing.T) { k.SetParams(ctx, params) - require.EqualValues(t, params, k.GetParams(ctx)) + require.EqualValues(t, params, k.GetParamsIfExists(ctx)) } func TestGenerateAddress(t *testing.T) { diff --git a/x/observer/keeper/testdata/header_sepolia_5000000.json b/x/observer/keeper/testdata/header_sepolia_5000000.json new file mode 100644 index 0000000000..6ea495cf6c --- /dev/null +++ b/x/observer/keeper/testdata/header_sepolia_5000000.json @@ -0,0 +1,19 @@ +{ + "parentHash": "0x69c3f269c0e96530feb9c3ec01ab8c87c77a8c489148d34bdd3ce00d78f00b3c", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0xd9a5179f091d85051d3c982785efd1455cec8699", + "stateRoot": "0xfbc81b7cf76ec579a74fea7d01c93f89e2c5bc3689732697682144c045756594", + "transactionsRoot": "0xe98dcafb82038e90d0403f9717a45eafda1c3d33a9ec898394016e2d3c310310", + "receiptsRoot": "0xb55bea9aa993839f093399911d1cf806cb1ec2be0cbd71a3bb8528aa9ef2fc53", + "logsBloom": "0x106010c449c041421308460893b00352001100308434001001d41128601245a04194424000c10f094a2088b1000400000000008530060ea102a00018002c020214518016002320528254601c08c801960c81c00440c400083c62442c4014c244b0c822088200241080a65025a0022f48a422044300500040608100d15c0003042c48210880e4884034232904881042000239c0084100884009147000455c00251e88442402a0294a40220070000908c0100124c43108801269203162c6020500800bc12b900250a13d0404211657001005003119008800046044a4002841654902fc20000004200200d13b02a00460ad84402400122e8008c214420404d05110", + "difficulty": "0x0", + "number": "0x4c4b40", + "gasLimit": "0x1c9c380", + "gasUsed": "0xea329c", + "timestamp": "0x6592aed4", + "extraData": "0xd883010d05846765746888676f312e32312e34856c696e7578", + "mixHash": "0xfce8b8cf88b975164b8911c51d144db1a5093d60779cb6f64493f30f9062e19b", + "nonce": "0x0000000000000000", + "baseFeePerGas": "0xc11611", + "hash": "0xb4272db0d4b614f464dc067dcf3ca01bd2087070dcf6edbe240571642b2c1825" +} diff --git a/x/observer/keeper/testdata/header_sepolia_5000001.json b/x/observer/keeper/testdata/header_sepolia_5000001.json new file mode 100644 index 0000000000..6fc3984e1e --- /dev/null +++ b/x/observer/keeper/testdata/header_sepolia_5000001.json @@ -0,0 +1,19 @@ +{ + "parentHash": "0x72247ea9191db039158939f7ba958e638a32df4f61a43edcae60cb7a686a2d55", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x0000000000000000000000000000000000000000", + "stateRoot": "0x5910405df02c046e05724df5e8f968ed3dfb26f08d56bab632e3b86c321404b7", + "transactionsRoot": "0x360236313a0d2abdcc7db471cbc98ec0689e8a9f621b03460e690848b2a87ffb", + "receiptsRoot": "0x4ff75b03b1a562bdae4a784c762013f66872e1d40b4396a5b8035af1a088ea20", + "logsBloom": "0x324a3ed48981095002891625002cfa5340d36236807ca219609d044cc0068cee7414644162016b8dce4aca2280657020041fe04e02924218a2382b0482ffc2421924e30b1cb005a0a391cc088d2c798030cf68624084424a6400442ecc18486338478009a60c289bc0e7c0919003a985511124d80555aed14030201a0c005ab29662a104a523b44420a14bc46e9cde48247491300b0be0c008404402744e480dbe88662650a2cfa390004846055ca00494d12704540ac08faaf80b21451e011502402fbf8212706947c08136670441950ad6f0084852e0c540c1fe32869e606980d0122801108b1242682bba9024701d6080d41b123a3b0cc65d6ae52305e01c", + "difficulty": "0x0", + "number": "0x4c4b41", + "gasLimit": "0x1c9c380", + "gasUsed": "0xffe7c6", + "timestamp": "0x6592aee0", + "extraData": "0xd883010d04846765746888676f312e32302e34856c696e7578", + "mixHash": "0x9912e9e1285938d482ecf1ca7267db0f71f51fb10f097970bc5bec8d8aae0e29", + "nonce": "0x0000000000000000", + "baseFeePerGas": "0xc1a591", + "hash": "0x2778643e20fce28c6d2b17a34875debdb796697c7e3dee3d337d5951e030f7ff" +} diff --git a/x/observer/keeper/testdata/header_sepolia_5000002.json b/x/observer/keeper/testdata/header_sepolia_5000002.json new file mode 100644 index 0000000000..07f462bcf5 --- /dev/null +++ b/x/observer/keeper/testdata/header_sepolia_5000002.json @@ -0,0 +1,19 @@ +{ + "parentHash": "0xc9ce6049b108527ad96110010c450a9998e9630ee66914277da8324f0c399995", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "miner": "0x9b7e335088762ad8061c04d08c37902abc8acb87", + "stateRoot": "0x22e42fe5e58f5529cbb61b0abfe4a126f2669de17348786f2c3eec2b7079b62f", + "transactionsRoot": "0x47b3da70c1d5c3efa2648a978e92336e822932cdb470dbba7e26ea052cf1e5c0", + "receiptsRoot": "0x05bbbaea10dd51d2c30df6ad2bc7bea7cfbf295c3a45bfc1c290a0037ae4ee6a", + "logsBloom": "0x8808724c49e01220028896412d1ab0708a918ab4a834041005d7820d400248a0441cd2326041361184200c25124411405504370111928e30e24800dc206402005400300224a810808451c4c8080882858093124000c40208866000264204c040685482882284043a82c5c8815800f96380810c420202004ad8805c10800681041120008d006d114434e11907085241010101a810a709a144c88409088c6100653e88040703a8052a802440620228084411402010384a803f2a419124c416008010090133010016694544440b0504081e0502310104400014d014872a8848694946d040100010501110802700a80434e4041049ac18010940c310235480404314", + "difficulty": "0x0", + "number": "0x4c4b42", + "gasLimit": "0x1c9c380", + "gasUsed": "0xe7637b", + "timestamp": "0x6592aeec", + "extraData": "0xd883010d04846765746888676f312e32312e33856c696e7578", + "mixHash": "0xbad66984cefba9aa08f9a7addbefce294c06fbf245b1823b1438e4de4bb4233b", + "nonce": "0x0000000000000000", + "baseFeePerGas": "0xc48132", + "hash": "0x8562c33583f8e1a3d3755ce79ed86d87b906c80374ff6818e25f9de693a4a7da" +} diff --git a/x/observer/migrations/v3/migrate_test.go b/x/observer/migrations/v3/migrate_test.go index 81e3747517..2ff0b36255 100644 --- a/x/observer/migrations/v3/migrate_test.go +++ b/x/observer/migrations/v3/migrate_test.go @@ -19,7 +19,7 @@ func TestMigrateStore(t *testing.T) { k.SetParams(ctx, params) err := v3.MigrateStore(ctx, k) require.NoError(t, err) - params = k.GetParams(ctx) + params = k.GetParamsIfExists(ctx) require.Len(t, params.AdminPolicy, 0) // update admin policy @@ -42,7 +42,7 @@ func TestMigrateStore(t *testing.T) { k.SetParams(ctx, params) err = v3.MigrateStore(ctx, k) require.NoError(t, err) - params = k.GetParams(ctx) + params = k.GetParamsIfExists(ctx) require.Len(t, params.AdminPolicy, 2) require.Equal(t, params.AdminPolicy[0].PolicyType, types.Policy_Type_group1) require.Equal(t, params.AdminPolicy[1].PolicyType, types.Policy_Type_group2) diff --git a/x/observer/migrations/v4/migrate.go b/x/observer/migrations/v4/migrate.go index 7444c46233..9ca22467a2 100644 --- a/x/observer/migrations/v4/migrate.go +++ b/x/observer/migrations/v4/migrate.go @@ -10,7 +10,6 @@ import ( // observerKeeper prevents circular dependency type observerKeeper interface { - GetParams(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) GetChainParamsList(ctx sdk.Context) (params types.ChainParamsList, found bool) SetChainParamsList(ctx sdk.Context, params types.ChainParamsList) diff --git a/x/observer/migrations/v5/migrate.go b/x/observer/migrations/v5/migrate.go index a626ce192b..2eb261a3f4 100644 --- a/x/observer/migrations/v5/migrate.go +++ b/x/observer/migrations/v5/migrate.go @@ -10,7 +10,7 @@ import ( // observerKeeper prevents circular dependency type observerKeeper interface { - GetParams(ctx sdk.Context) types.Params + GetParamsIfExists(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) GetChainParamsList(ctx sdk.Context) (params types.ChainParamsList, found bool) SetChainParamsList(ctx sdk.Context, params types.ChainParamsList) @@ -64,7 +64,7 @@ func MigrateObserverParams(ctx sdk.Context, observerKeeper observerKeeper) error } // search for the observer params with chain params entry - observerParams := observerKeeper.GetParams(ctx).ObserverParams + observerParams := observerKeeper.GetParamsIfExists(ctx).ObserverParams for _, observerParam := range observerParams { for i := range chainParamsList.ChainParams { // if the chain is found, update the chain params with the observer params diff --git a/x/observer/migrations/v7/migrate.go b/x/observer/migrations/v7/migrate.go index 2d69977f55..414a87a38e 100644 --- a/x/observer/migrations/v7/migrate.go +++ b/x/observer/migrations/v7/migrate.go @@ -8,18 +8,19 @@ import ( // observerKeeper prevents circular dependency type observerKeeper interface { - GetParams(ctx sdk.Context) (params types.Params) + GetParamsIfExists(ctx sdk.Context) (params types.Params) GetAuthorityKeeper() types.AuthorityKeeper } // MigrateStore performs in-place store migrations from v6 to v7 func MigrateStore(ctx sdk.Context, observerKeeper observerKeeper) error { + ctx.Logger().Info("Migrating observer store from v6 to v7") return MigratePolicies(ctx, observerKeeper) } // MigratePolicies migrates policies from observer to authority func MigratePolicies(ctx sdk.Context, observerKeeper observerKeeper) error { - params := observerKeeper.GetParams(ctx) + params := observerKeeper.GetParamsIfExists(ctx) authorityKeeper := observerKeeper.GetAuthorityKeeper() var policies authoritytypes.Policies diff --git a/x/observer/types/message_add_blame_vote_test.go b/x/observer/types/message_add_blame_vote_test.go new file mode 100644 index 0000000000..810cdad433 --- /dev/null +++ b/x/observer/types/message_add_blame_vote_test.go @@ -0,0 +1,132 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestNewMsgAddBlameVoteMsg_ValidateBasic(t *testing.T) { + keeper.SetConfig(false) + tests := []struct { + name string + msg *types.MsgAddBlameVote + error bool + }{ + { + name: "invalid creator", + msg: types.NewMsgAddBlameVoteMsg( + "invalid_address", + 1, + sample.BlameRecordsList(t, 1)[0], + ), + error: true, + }, + { + name: "invalid chain id", + msg: types.NewMsgAddBlameVoteMsg( + sample.AccAddress(), + -1, + sample.BlameRecordsList(t, 1)[0], + ), + error: true, + }, + { + name: "valid", + msg: types.NewMsgAddBlameVoteMsg( + sample.AccAddress(), + 5, + sample.BlameRecordsList(t, 1)[0], + ), + error: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.error { + require.Error(t, err) + return + } else { + require.NoError(t, err) + } + }) + } +} + +func TestNewMsgAddBlameVoteMsg_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgAddBlameVote + panics bool + }{ + { + name: "valid signer", + msg: types.MsgAddBlameVote{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgAddBlameVote{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestNewMsgAddBlameVoteMsg_Type(t *testing.T) { + msg := types.MsgAddBlameVote{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgAddBlameVote, msg.Type()) +} + +func TestNewMsgAddBlameVoteMsg_Route(t *testing.T) { + msg := types.MsgAddBlameVote{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestNewMsgAddBlameVoteMsg_GetSignBytes(t *testing.T) { + msg := types.MsgAddBlameVote{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} + +func TestNewMsgAddBlameVoteMsg_Digest(t *testing.T) { + msg := types.MsgAddBlameVote{ + Creator: sample.AccAddress(), + } + + digest := msg.Digest() + msg.Creator = "" + expectedDigest := crypto.Keccak256Hash([]byte(msg.String())) + require.Equal(t, expectedDigest.Hex(), digest) +} diff --git a/x/observer/types/message_add_block_header_test.go b/x/observer/types/message_add_block_header_test.go new file mode 100644 index 0000000000..f3b86b6bc1 --- /dev/null +++ b/x/observer/types/message_add_block_header_test.go @@ -0,0 +1,177 @@ +package types_test + +import ( + "bytes" + "os" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { + keeper.SetConfig(false) + var header ethtypes.Header + file, err := os.Open("../../../common/testdata/eth_header_18495266.json") + require.NoError(t, err) + defer file.Close() + headerBytes := make([]byte, 4096) + n, err := file.Read(headerBytes) + require.NoError(t, err) + err = header.UnmarshalJSON(headerBytes[:n]) + require.NoError(t, err) + var buffer bytes.Buffer + err = header.EncodeRLP(&buffer) + require.NoError(t, err) + headerData := common.NewEthereumHeader(buffer.Bytes()) + tests := []struct { + name string + msg *types.MsgAddBlockHeader + error bool + }{ + { + name: "invalid creator", + msg: types.NewMsgAddBlockHeader( + "invalid_address", + 1, + []byte{}, + 6, + common.HeaderData{}, + ), + error: true, + }, + { + name: "invalid chain id", + msg: types.NewMsgAddBlockHeader( + sample.AccAddress(), + -1, + []byte{}, + 6, + common.HeaderData{}, + ), + error: true, + }, + { + name: "invalid header", + msg: types.NewMsgAddBlockHeader( + sample.AccAddress(), + 5, + sample.Hash().Bytes(), + 6, + common.HeaderData{}, + ), + error: true, + }, + { + name: "invalid blockHash length", + msg: types.NewMsgAddBlockHeader( + sample.AccAddress(), + 5, + sample.Hash().Bytes()[:31], + 6, + common.HeaderData{}, + ), + error: true, + }, + { + name: "valid", + msg: types.NewMsgAddBlockHeader( + sample.AccAddress(), + 5, + header.Hash().Bytes(), + 18495266, + headerData, + ), + error: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.error { + require.Error(t, err) + return + } else { + require.NoError(t, err) + } + }) + } +} + +func TestMsgAddBlockHeader_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgAddBlockHeader + panics bool + }{ + { + name: "valid signer", + msg: types.MsgAddBlockHeader{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgAddBlockHeader{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgAddBlockHeader_Type(t *testing.T) { + msg := types.MsgAddBlockHeader{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgAddBlockHeader, msg.Type()) +} + +func TestMsgAddBlockHeader_Route(t *testing.T) { + msg := types.MsgAddBlockHeader{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgAddBlockHeader_GetSignBytes(t *testing.T) { + msg := types.MsgAddBlockHeader{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} + +func TestMsgAddBlockHeader_Digest(t *testing.T) { + msg := types.MsgAddBlockHeader{ + Creator: sample.AccAddress(), + } + + digest := msg.Digest() + msg.Creator = "" + expectedDigest := crypto.Keccak256Hash([]byte(msg.String())) + require.Equal(t, expectedDigest.Hex(), digest) +} diff --git a/x/observer/types/message_add_observer_test.go b/x/observer/types/message_add_observer_test.go index b60ade5dc3..455868d49f 100644 --- a/x/observer/types/message_add_observer_test.go +++ b/x/observer/types/message_add_observer_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,50 +13,47 @@ import ( func TestMsgAddObserver_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgAddObserver + msg *types.MsgAddObserver err error }{ - { - name: "invalid msg", - msg: types.MsgAddObserver{ - Creator: "invalid_address", - }, - err: sdkerrors.ErrInvalidAddress, - }, { name: "invalid creator", - msg: types.MsgAddObserver{ - Creator: "invalid_address", - ObserverAddress: sample.AccAddress(), - ZetaclientGranteePubkey: sample.PubKeyString(), - }, + msg: types.NewMsgAddObserver( + "invalid_address", + sample.AccAddress(), + sample.PubKeyString(), + true, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid pubkey", - msg: types.MsgAddObserver{ - Creator: sample.AccAddress(), - ObserverAddress: sample.AccAddress(), - ZetaclientGranteePubkey: "sample.PubKey()", - }, + msg: types.NewMsgAddObserver( + sample.AccAddress(), + sample.AccAddress(), + "sample.PubKey()", + true, + ), err: sdkerrors.ErrInvalidPubKey, }, { name: "invalid observer address", - msg: types.MsgAddObserver{ - Creator: sample.AccAddress(), - ObserverAddress: "invalid_address", - ZetaclientGranteePubkey: sample.PubKeyString(), - }, + msg: types.NewMsgAddObserver( + sample.AccAddress(), + "invalid_address", + sample.PubKeyString(), + true, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: types.MsgAddObserver{ - Creator: sample.AccAddress(), - ObserverAddress: sample.AccAddress(), - ZetaclientGranteePubkey: sample.PubKeyString(), - }, + msg: types.NewMsgAddObserver( + sample.AccAddress(), + sample.AccAddress(), + sample.PubKeyString(), + true, + ), }, } for _, tt := range tests { @@ -69,3 +67,63 @@ func TestMsgAddObserver_ValidateBasic(t *testing.T) { }) } } + +func TestMsgAddObserver_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgAddObserver + panics bool + }{ + { + name: "valid signer", + msg: types.MsgAddObserver{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgAddObserver{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgAddObserver_Type(t *testing.T) { + msg := types.MsgAddObserver{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgAddObserver, msg.Type()) +} + +func TestMsgAddObserver_Route(t *testing.T) { + msg := types.MsgAddObserver{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgAddObserver_GetSignBytes(t *testing.T) { + msg := types.MsgAddObserver{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_crosschain_flags_test.go b/x/observer/types/message_crosschain_flags_test.go index 1ccd1d7040..34af456348 100644 --- a/x/observer/types/message_crosschain_flags_test.go +++ b/x/observer/types/message_crosschain_flags_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -232,3 +233,67 @@ func TestMsgUpdateCrosschainFlags_GetRequiredPolicyType(t *testing.T) { }) } } + +func TestMsgUpdateCrosschainFlags_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgUpdateCrosschainFlags + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgUpdateCrosschainFlags( + signer, + true, + true, + ), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgUpdateCrosschainFlags( + "invalid", + true, + true, + ), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateCrosschainFlags_Type(t *testing.T) { + msg := types.MsgUpdateCrosschainFlags{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateCrosschainFlags, msg.Type()) +} + +func TestMsgUpdateCrosschainFlags_Route(t *testing.T) { + msg := types.MsgUpdateCrosschainFlags{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateCrosschainFlags_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateCrosschainFlags{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_remove_chain_params_test.go b/x/observer/types/message_remove_chain_params_test.go index 10d5a4c777..9168821413 100644 --- a/x/observer/types/message_remove_chain_params_test.go +++ b/x/observer/types/message_remove_chain_params_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -13,31 +14,31 @@ import ( func TestMsgRemoveChainParams_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgRemoveChainParams + msg *types.MsgRemoveChainParams err error }{ { name: "valid message", - msg: types.MsgRemoveChainParams{ - Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, - }, + msg: types.NewMsgRemoveChainParams( + sample.AccAddress(), + common.ExternalChainList()[0].ChainId, + ), }, { name: "invalid address", - msg: types.MsgRemoveChainParams{ - Creator: "invalid_address", - ChainId: common.ExternalChainList()[0].ChainId, - }, + msg: types.NewMsgRemoveChainParams( + "invalid_address", + common.ExternalChainList()[0].ChainId, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid chain ID", - msg: types.MsgRemoveChainParams{ - Creator: sample.AccAddress(), - ChainId: 999, - }, + msg: types.NewMsgRemoveChainParams( + sample.AccAddress(), + 999, + ), err: sdkerrors.ErrInvalidChainID, }, } @@ -52,3 +53,63 @@ func TestMsgRemoveChainParams_ValidateBasic(t *testing.T) { }) } } + +func TestMsgRemoveChainParams_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgRemoveChainParams + panics bool + }{ + { + name: "valid signer", + msg: types.MsgRemoveChainParams{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgRemoveChainParams{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgRemoveChainParams_Type(t *testing.T) { + msg := types.MsgRemoveChainParams{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgRemoveChainParams, msg.Type()) +} + +func TestMsgRemoveChainParams_Route(t *testing.T) { + msg := types.MsgRemoveChainParams{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgRemoveChainParams_GetSignBytes(t *testing.T) { + msg := types.MsgRemoveChainParams{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_update_chain_params_test.go b/x/observer/types/message_update_chain_params_test.go index 3f3efc4e2f..633720d6b7 100644 --- a/x/observer/types/message_update_chain_params_test.go +++ b/x/observer/types/message_update_chain_params_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -13,30 +14,31 @@ import ( func TestMsgUpdateChainParams_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateChainParams + msg *types.MsgUpdateChainParams err error }{ { name: "valid message", - msg: types.MsgUpdateChainParams{ - Creator: sample.AccAddress(), - ChainParams: sample.ChainParams(common.ExternalChainList()[0].ChainId), - }, + msg: types.NewMsgUpdateChainParams( + sample.AccAddress(), + sample.ChainParams(common.ExternalChainList()[0].ChainId), + ), }, { name: "invalid address", - msg: types.MsgUpdateChainParams{ - Creator: "invalid_address", - ChainParams: sample.ChainParams(common.ExternalChainList()[0].ChainId), - }, + msg: types.NewMsgUpdateChainParams( + "invalid_address", + sample.ChainParams(common.ExternalChainList()[0].ChainId), + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid chain params (nil)", - msg: types.MsgUpdateChainParams{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgUpdateChainParams( + sample.AccAddress(), + nil, + ), err: types.ErrInvalidChainParams, }, } @@ -51,3 +53,63 @@ func TestMsgUpdateChainParams_ValidateBasic(t *testing.T) { }) } } + +func TestMsgUpdateChainParams_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateChainParams + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateChainParams{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateChainParams{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateChainParams_Type(t *testing.T) { + msg := types.MsgUpdateChainParams{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateChainParams, msg.Type()) +} + +func TestMsgUpdateChainParams_Route(t *testing.T) { + msg := types.MsgUpdateChainParams{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateChainParams_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateChainParams{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_update_keygen_test.go b/x/observer/types/message_update_keygen_test.go index b7ad69741c..2e494d6dc4 100644 --- a/x/observer/types/message_update_keygen_test.go +++ b/x/observer/types/message_update_keygen_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" @@ -12,20 +13,22 @@ import ( func TestMsgUpdateKeygen_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateKeygen + msg *types.MsgUpdateKeygen err error }{ { name: "invalid address", - msg: types.MsgUpdateKeygen{ - Creator: "invalid_address", - }, + msg: types.NewMsgUpdateKeygen( + "invalid_address", + 1, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: types.MsgUpdateKeygen{ - Creator: sample.AccAddress(), - }, + msg: types.NewMsgUpdateKeygen( + sample.AccAddress(), + 1, + ), }, } for _, tt := range tests { @@ -39,3 +42,63 @@ func TestMsgUpdateKeygen_ValidateBasic(t *testing.T) { }) } } + +func TestMsgUpdateKeygen_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateKeygen + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateKeygen{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateKeygen{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateKeygen_Type(t *testing.T) { + msg := types.MsgUpdateKeygen{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateKeygen, msg.Type()) +} + +func TestMsgUpdateKeygen_Route(t *testing.T) { + msg := types.MsgUpdateKeygen{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateKeygen_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateKeygen{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/observer/types/message_update_observer_test.go b/x/observer/types/message_update_observer_test.go index 0cff6bd25b..041142c0a9 100644 --- a/x/observer/types/message_update_observer_test.go +++ b/x/observer/types/message_update_observer_test.go @@ -3,76 +3,77 @@ package types_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" ) -func TestNewMsgUpdateObserver(t *testing.T) { +func TestNewMsgUpdateObserver_ValidateBasic(t *testing.T) { tests := []struct { name string - msg types.MsgUpdateObserver + msg *types.MsgUpdateObserver err error }{ { name: "invalid creator", - msg: types.MsgUpdateObserver{ - Creator: "invalid_address", - OldObserverAddress: sample.AccAddress(), - NewObserverAddress: sample.AccAddress(), - UpdateReason: types.ObserverUpdateReason_AdminUpdate, - }, + msg: types.NewMsgUpdateObserver( + "invalid_address", + sample.AccAddress(), + sample.AccAddress(), + types.ObserverUpdateReason_AdminUpdate, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid old observer address", - msg: types.MsgUpdateObserver{ - Creator: sample.AccAddress(), - OldObserverAddress: "invalid_address", - NewObserverAddress: sample.AccAddress(), - UpdateReason: types.ObserverUpdateReason_AdminUpdate, - }, + msg: types.NewMsgUpdateObserver( + sample.AccAddress(), + "invalid_address", + sample.AccAddress(), + types.ObserverUpdateReason_AdminUpdate, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "invalid new observer address", - msg: types.MsgUpdateObserver{ - Creator: sample.AccAddress(), - OldObserverAddress: sample.AccAddress(), - NewObserverAddress: "invalid_address", - UpdateReason: types.ObserverUpdateReason_AdminUpdate, - }, + msg: types.NewMsgUpdateObserver( + sample.AccAddress(), + sample.AccAddress(), + "invalid_address", + types.ObserverUpdateReason_AdminUpdate, + ), err: sdkerrors.ErrInvalidAddress, }, { name: "old observer address is not creator", - msg: types.MsgUpdateObserver{ - Creator: sample.AccAddress(), - OldObserverAddress: sample.AccAddress(), - NewObserverAddress: sample.AccAddress(), - UpdateReason: types.ObserverUpdateReason_Tombstoned, - }, + msg: types.NewMsgUpdateObserver( + sample.AccAddress(), + sample.AccAddress(), + sample.AccAddress(), + types.ObserverUpdateReason_Tombstoned, + ), err: types.ErrUpdateObserver, }, { name: "invalid Update Reason", - msg: types.MsgUpdateObserver{ - Creator: sample.AccAddress(), - OldObserverAddress: sample.AccAddress(), - NewObserverAddress: sample.AccAddress(), - UpdateReason: types.ObserverUpdateReason(100), - }, + msg: types.NewMsgUpdateObserver( + sample.AccAddress(), + sample.AccAddress(), + sample.AccAddress(), + types.ObserverUpdateReason(100), + ), err: types.ErrUpdateObserver, }, { name: "valid message", - msg: types.MsgUpdateObserver{ - Creator: sample.AccAddress(), - OldObserverAddress: sample.AccAddress(), - NewObserverAddress: sample.AccAddress(), - UpdateReason: types.ObserverUpdateReason_AdminUpdate, - }, + msg: types.NewMsgUpdateObserver( + sample.AccAddress(), + sample.AccAddress(), + sample.AccAddress(), + types.ObserverUpdateReason_AdminUpdate, + ), }, } for _, tt := range tests { @@ -86,3 +87,63 @@ func TestNewMsgUpdateObserver(t *testing.T) { }) } } + +func TestNewMsgUpdateObserver_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg types.MsgUpdateObserver + panics bool + }{ + { + name: "valid signer", + msg: types.MsgUpdateObserver{ + Creator: signer, + }, + panics: false, + }, + { + name: "invalid signer", + msg: types.MsgUpdateObserver{ + Creator: "invalid", + }, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestNewMsgUpdateObserver_Type(t *testing.T) { + msg := types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.TypeMsgUpdateObserver, msg.Type()) +} + +func TestNewMsgUpdateObserver_Route(t *testing.T) { + msg := types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + } + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestNewMsgUpdateObserver_GetSignBytes(t *testing.T) { + msg := types.MsgUpdateObserver{ + Creator: sample.AccAddress(), + } + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/zetaclient/bitcoin/bitcoin_client.go b/zetaclient/bitcoin/bitcoin_client.go index bb47a6eaa4..34ddc580ab 100644 --- a/zetaclient/bitcoin/bitcoin_client.go +++ b/zetaclient/bitcoin/bitcoin_client.go @@ -292,8 +292,7 @@ func (ob *BTCChainClient) SetLastBlockHeightScanned(height int64) { panic("lastBlockScanned is negative") } atomic.StoreInt64(&ob.lastBlockScanned, height) - // #nosec G701 checked as positive - ob.ts.SetLastScannedBlockNumber((ob.chain.ChainId), uint64(height)) + metrics.LastScannedBlockNumber.WithLabelValues(ob.chain.ChainName.String()).Set(float64(height)) } func (ob *BTCChainClient) GetLastBlockHeightScanned() int64 { @@ -888,7 +887,7 @@ func (ob *BTCChainClient) FetchUTXOS() error { } ob.Mu.Lock() - ob.ts.SetNumberOfUTXOs(len(utxosFiltered)) + metrics.NumberOfUTXO.Set(float64(len(utxosFiltered))) ob.utxos = utxosFiltered ob.Mu.Unlock() return nil diff --git a/zetaclient/bitcoin/bitcoin_client_test.go b/zetaclient/bitcoin/bitcoin_client_test.go index f92f3a01fd..68cb840e0f 100644 --- a/zetaclient/bitcoin/bitcoin_client_test.go +++ b/zetaclient/bitcoin/bitcoin_client_test.go @@ -24,7 +24,7 @@ import ( func MockBTCClientMainnet() *BTCChainClient { return &BTCChainClient{ chain: common.BtcMainnetChain(), - zetaClient: stub.NewZetaCoreBridge(), + zetaClient: stub.NewMockZetaCoreBridge(), Tss: stub.NewTSSMainnet(), } } diff --git a/zetaclient/config/config_chain.go b/zetaclient/config/config_chain.go index ea497a1821..329c650023 100644 --- a/zetaclient/config/config_chain.go +++ b/zetaclient/config/config_chain.go @@ -39,7 +39,7 @@ func New() Config { } var bitcoinConfigRegnet = BTCConfig{ - RPCUsername: "e2e", + RPCUsername: "smoketest", // smoketest is the previous name for E2E test, we keep this name for compatibility between client versions in upgrade test RPCPassword: "123", RPCHost: "bitcoin:18443", RPCParams: "regtest", diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go index 200066f109..69e4e8da2c 100644 --- a/zetaclient/config/types.go +++ b/zetaclient/config/types.go @@ -2,13 +2,10 @@ package config import ( "encoding/json" - "fmt" "strings" "sync" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/zetacore/common" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) // KeyringBackend is the type of keyring backend to use for the hotkey @@ -138,63 +135,3 @@ func (c *Config) GetKeyringBackend() KeyringBackend { defer c.cfgLock.RUnlock() return c.KeyringBackend } - -// TODO: remove this duplicated function https://github.com/zeta-chain/node/issues/1838 -// ValidateChainParams performs some basic checks on core params -func ValidateChainParams(chainParams *observertypes.ChainParams) error { - if chainParams == nil { - return fmt.Errorf("invalid chain params: nil") - } - chain := common.GetChainFromChainID(chainParams.ChainId) - if chain == nil { - return fmt.Errorf("invalid chain params: chain %d not supported", chainParams.ChainId) - } - if chainParams.ConfirmationCount < 1 { - return fmt.Errorf("invalid chain params: ConfirmationCount %d", chainParams.ConfirmationCount) - } - // zeta chain skips the rest of the checks for now - if chain.IsZetaChain() { - return nil - } - - // check tickers - if chainParams.GasPriceTicker < 1 { - return fmt.Errorf("invalid chain params: GasPriceTicker %d", chainParams.GasPriceTicker) - } - if chainParams.InTxTicker < 1 { - return fmt.Errorf("invalid chain params: InTxTicker %d", chainParams.InTxTicker) - } - if chainParams.OutTxTicker < 1 { - return fmt.Errorf("invalid chain params: OutTxTicker %d", chainParams.OutTxTicker) - } - if chainParams.OutboundTxScheduleInterval < 1 { - return fmt.Errorf("invalid chain params: OutboundTxScheduleInterval %d", chainParams.OutboundTxScheduleInterval) - } - if chainParams.OutboundTxScheduleLookahead < 1 { - return fmt.Errorf("invalid chain params: OutboundTxScheduleLookahead %d", chainParams.OutboundTxScheduleLookahead) - } - - // chain type specific checks - if common.IsBitcoinChain(chainParams.ChainId) && chainParams.WatchUtxoTicker < 1 { - return fmt.Errorf("invalid chain params: watchUtxo ticker %d", chainParams.WatchUtxoTicker) - } - if common.IsEVMChain(chainParams.ChainId) { - if !validCoreContractAddress(chainParams.ZetaTokenContractAddress) { - return fmt.Errorf("invalid chain params: zeta token contract address %s", chainParams.ZetaTokenContractAddress) - } - if !validCoreContractAddress(chainParams.ConnectorContractAddress) { - return fmt.Errorf("invalid chain params: connector contract address %s", chainParams.ConnectorContractAddress) - } - if !validCoreContractAddress(chainParams.Erc20CustodyContractAddress) { - return fmt.Errorf("invalid chain params: erc20 custody contract address %s", chainParams.Erc20CustodyContractAddress) - } - } - return nil -} - -func validCoreContractAddress(address string) bool { - if !strings.HasPrefix(address, "0x") { - return false - } - return ethcommon.IsHexAddress(address) -} diff --git a/zetaclient/evm/evm_client.go b/zetaclient/evm/evm_client.go index 55e3850a44..87103b8e37 100644 --- a/zetaclient/evm/evm_client.go +++ b/zetaclient/evm/evm_client.go @@ -69,9 +69,9 @@ type Log struct { type ChainClient struct { chain common.Chain evmClient interfaces.EVMRPCClient + evmJSONRPC interfaces.EVMJSONRPCClient zetaClient interfaces.ZetaCoreBridger Tss interfaces.TSSSigner - evmJSONRPC *ethrpc.EthRPC lastBlockScanned uint64 lastBlock uint64 BlockTimeExternalChain uint64 // block time in seconds @@ -81,7 +81,6 @@ type ChainClient struct { outTxPendingTransactions map[string]*ethtypes.Transaction outTXConfirmedReceipts map[string]*ethtypes.Receipt outTXConfirmedTransactions map[string]*ethtypes.Transaction - OutTxChan chan OutTx // send to this channel if you want something back! stop chan struct{} logger Log coreContext *corecontext.ZetaCoreContext @@ -128,7 +127,6 @@ func NewEVMChainClient( ob.outTxPendingTransactions = make(map[string]*ethtypes.Transaction) ob.outTXConfirmedReceipts = make(map[string]*ethtypes.Receipt) ob.outTXConfirmedTransactions = make(map[string]*ethtypes.Transaction) - ob.OutTxChan = make(chan OutTx, 100) ob.logger.ChainLogger.Info().Msgf("Chain %s endpoint %s", ob.chain.ChainName.String(), evmCfg.Endpoint) client, err := ethclient.Dial(evmCfg.Endpoint) @@ -176,13 +174,13 @@ func (ob *ChainClient) WithLogger(logger zerolog.Logger) { } } -func (ob *ChainClient) WithEvmClient(client *ethclient.Client) { +func (ob *ChainClient) WithEvmClient(client interfaces.EVMRPCClient) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.evmClient = client } -func (ob *ChainClient) WithEvmJSONRPC(client *ethrpc.EthRPC) { +func (ob *ChainClient) WithEvmJSONRPC(client interfaces.EVMJSONRPCClient) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.evmJSONRPC = client @@ -807,7 +805,7 @@ func (ob *ChainClient) CheckTxInclusion(tx *ethtypes.Transaction, receipt *ethty // SetLastBlockHeightScanned set last block height scanned (not necessarily caught up with external block; could be slow/paused) func (ob *ChainClient) SetLastBlockHeightScanned(height uint64) { atomic.StoreUint64(&ob.lastBlockScanned, height) - ob.ts.SetLastScannedBlockNumber(ob.chain.ChainId, height) + metrics.LastScannedBlockNumber.WithLabelValues(ob.chain.ChainName.String()).Set(float64(height)) } // GetLastBlockHeightScanned get last block height scanned (not necessarily caught up with external block; could be slow/paused) @@ -946,13 +944,13 @@ func (ob *ChainClient) observeInTX(sampledLogger zerolog.Logger) error { startBlock, toBlock := ob.calcBlockRangeToScan(confirmedBlockNum, lastScanned, config.MaxBlocksPerPeriod) // task 1: query evm chain for zeta sent logs (read at most 100 blocks in one go) - lastScannedZetaSent := ob.observeZetaSent(startBlock, toBlock) + lastScannedZetaSent := ob.ObserveZetaSent(startBlock, toBlock) // task 2: query evm chain for deposited logs (read at most 100 blocks in one go) - lastScannedDeposited := ob.observeERC20Deposited(startBlock, toBlock) + lastScannedDeposited := ob.ObserveERC20Deposited(startBlock, toBlock) // task 3: query the incoming tx to TSS address (read at most 100 blocks in one go) - lastScannedTssRecvd := ob.observerTSSReceive(startBlock, toBlock, flags) + lastScannedTssRecvd := ob.ObserverTSSReceive(startBlock, toBlock, flags) // note: using lowest height for all 3 events is not perfect, but it's simple and good enough lastScannedLowest := lastScannedZetaSent @@ -975,13 +973,13 @@ func (ob *ChainClient) observeInTX(sampledLogger zerolog.Logger) error { return nil } -// observeZetaSent queries the ZetaSent event from the connector contract and posts to zetabridge +// ObserveZetaSent queries the ZetaSent event from the connector contract and posts to zetabridge // returns the last block successfully scanned -func (ob *ChainClient) observeZetaSent(startBlock, toBlock uint64) uint64 { +func (ob *ChainClient) ObserveZetaSent(startBlock, toBlock uint64) uint64 { // filter ZetaSent logs addrConnector, connector, err := ob.GetConnectorContract() if err != nil { - ob.logger.ChainLogger.Warn().Err(err).Msgf("observeZetaSent: GetConnectorContract error:") + ob.logger.ChainLogger.Warn().Err(err).Msgf("ObserveZetaSent: GetConnectorContract error:") return startBlock - 1 // lastScanned } iter, err := connector.FilterZetaSent(&bind.FilterOpts{ @@ -991,7 +989,7 @@ func (ob *ChainClient) observeZetaSent(startBlock, toBlock uint64) uint64 { }, []ethcommon.Address{}, []*big.Int{}) if err != nil { ob.logger.ChainLogger.Warn().Err(err).Msgf( - "observeZetaSent: FilterZetaSent error from block %d to %d for chain %d", startBlock, toBlock, ob.chain.ChainId) + "ObserveZetaSent: FilterZetaSent error from block %d to %d for chain %d", startBlock, toBlock, ob.chain.ChainId) return startBlock - 1 // lastScanned } @@ -1004,7 +1002,7 @@ func (ob *ChainClient) observeZetaSent(startBlock, toBlock uint64) uint64 { events = append(events, iter.Event) continue } - ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeZetaSent: invalid ZetaSent event in tx %s on chain %d at height %d", + ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("ObserveZetaSent: invalid ZetaSent event in tx %s on chain %d at height %d", iter.Event.Raw.TxHash.Hex(), ob.chain.ChainId, iter.Event.Raw.BlockNumber) } sort.SliceStable(events, func(i, j int) bool { @@ -1030,7 +1028,7 @@ func (ob *ChainClient) observeZetaSent(startBlock, toBlock uint64) uint64 { } // guard against multiple events in the same tx if guard[event.Raw.TxHash.Hex()] { - ob.logger.ExternalChainWatcher.Warn().Msgf("observeZetaSent: multiple remote call events detected in tx %s", event.Raw.TxHash) + ob.logger.ExternalChainWatcher.Warn().Msgf("ObserveZetaSent: multiple remote call events detected in tx %s", event.Raw.TxHash) continue } guard[event.Raw.TxHash.Hex()] = true @@ -1047,13 +1045,13 @@ func (ob *ChainClient) observeZetaSent(startBlock, toBlock uint64) uint64 { return toBlock } -// observeERC20Deposited queries the ERC20CustodyDeposited event from the ERC20Custody contract and posts to zetabridge +// ObserveERC20Deposited queries the ERC20CustodyDeposited event from the ERC20Custody contract and posts to zetabridge // returns the last block successfully scanned -func (ob *ChainClient) observeERC20Deposited(startBlock, toBlock uint64) uint64 { +func (ob *ChainClient) ObserveERC20Deposited(startBlock, toBlock uint64) uint64 { // filter ERC20CustodyDeposited logs addrCustody, erc20custodyContract, err := ob.GetERC20CustodyContract() if err != nil { - ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeERC20Deposited: GetERC20CustodyContract error:") + ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("ObserveERC20Deposited: GetERC20CustodyContract error:") return startBlock - 1 // lastScanned } iter, err := erc20custodyContract.FilterDeposited(&bind.FilterOpts{ @@ -1063,7 +1061,7 @@ func (ob *ChainClient) observeERC20Deposited(startBlock, toBlock uint64) uint64 }, []ethcommon.Address{}) if err != nil { ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf( - "observeERC20Deposited: FilterDeposited error from block %d to %d for chain %d", startBlock, toBlock, ob.chain.ChainId) + "ObserveERC20Deposited: FilterDeposited error from block %d to %d for chain %d", startBlock, toBlock, ob.chain.ChainId) return startBlock - 1 // lastScanned } @@ -1076,7 +1074,7 @@ func (ob *ChainClient) observeERC20Deposited(startBlock, toBlock uint64) uint64 events = append(events, iter.Event) continue } - ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("observeERC20Deposited: invalid Deposited event in tx %s on chain %d at height %d", + ob.logger.ExternalChainWatcher.Warn().Err(err).Msgf("ObserveERC20Deposited: invalid Deposited event in tx %s on chain %d at height %d", iter.Event.Raw.TxHash.Hex(), ob.chain.ChainId, iter.Event.Raw.BlockNumber) } sort.SliceStable(events, func(i, j int) bool { @@ -1103,14 +1101,14 @@ func (ob *ChainClient) observeERC20Deposited(startBlock, toBlock uint64) uint64 tx, _, err := ob.TransactionByHash(event.Raw.TxHash.Hex()) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msgf( - "observeERC20Deposited: error getting transaction for intx %s chain %d", event.Raw.TxHash, ob.chain.ChainId) + "ObserveERC20Deposited: error getting transaction for intx %s chain %d", event.Raw.TxHash, ob.chain.ChainId) return beingScanned - 1 // we have to re-scan from this block next time } sender := ethcommon.HexToAddress(tx.From) // guard against multiple events in the same tx if guard[event.Raw.TxHash.Hex()] { - ob.logger.ExternalChainWatcher.Warn().Msgf("observeERC20Deposited: multiple remote call events detected in tx %s", event.Raw.TxHash) + ob.logger.ExternalChainWatcher.Warn().Msgf("ObserveERC20Deposited: multiple remote call events detected in tx %s", event.Raw.TxHash) continue } guard[event.Raw.TxHash.Hex()] = true @@ -1127,9 +1125,9 @@ func (ob *ChainClient) observeERC20Deposited(startBlock, toBlock uint64) uint64 return toBlock } -// observerTSSReceive queries the incoming gas asset to TSS address and posts to zetabridge +// ObserverTSSReceive queries the incoming gas asset to TSS address and posts to zetabridge // returns the last block successfully scanned -func (ob *ChainClient) observerTSSReceive(startBlock, toBlock uint64, flags observertypes.CrosschainFlags) uint64 { +func (ob *ChainClient) ObserverTSSReceive(startBlock, toBlock uint64, flags observertypes.CrosschainFlags) uint64 { if !ob.GetChainParams().IsSupported { return startBlock - 1 // lastScanned } @@ -1147,27 +1145,12 @@ func (ob *ChainClient) observerTSSReceive(startBlock, toBlock uint64, flags obse } } - // TODO: we can track the total number of 'getBlockByNumber' RPC calls made - block, err := ob.GetBlockByNumberCached(bn) + // observe TSS received gas token in block 'bn' + err := ob.ObserveTSSReceiveInBlock(bn) if err != nil { - ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("observerTSSReceive: error getting block %d for chain %d", bn, ob.chain.ChainId) + ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("ObserverTSSReceive: error observing TSS received token in block %d for chain %d", bn, ob.chain.ChainId) return bn - 1 // we have to re-scan from this block next time } - for i := range block.Transactions { - tx := block.Transactions[i] - if ethcommon.HexToAddress(tx.To) == ob.Tss.EVMAddress() { - receipt, err := ob.evmClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(tx.Hash)) - if err != nil { - ob.logger.ExternalChainWatcher.Err(err).Msgf("observerTSSReceive: error getting receipt for intx %s chain %d", tx.Hash, ob.chain.ChainId) - return bn - 1 // we have to re-scan from this block next time - } - _, err = ob.CheckAndVoteInboundTokenGas(&tx, receipt, true) - if err != nil { - ob.logger.ExternalChainWatcher.Err(err).Msgf("observerTSSReceive: error checking and voting inbound gas asset for intx %s chain %d", tx.Hash, ob.chain.ChainId) - return bn - 1 // we have to re-scan this block next time - } - } - } } // successful processed all gas asset deposits in [startBlock, toBlock] return toBlock diff --git a/zetaclient/evm/evm_signer.go b/zetaclient/evm/evm_signer.go index bdeef1b83a..3692dd666e 100644 --- a/zetaclient/evm/evm_signer.go +++ b/zetaclient/evm/evm_signer.go @@ -616,7 +616,7 @@ func getEVMRPC(endpoint string) (interfaces.EVMRPCClient, *big.Int, ethtypes.Sig if endpoint == stub.EVMRPCEnabled { chainID := big.NewInt(common.BscMainnetChain().ChainId) ethSigner := ethtypes.NewEIP155Signer(chainID) - client := stub.EvmClient{} + client := &stub.MockEvmClient{} return client, chainID, ethSigner, nil } diff --git a/zetaclient/evm/evm_signer_test.go b/zetaclient/evm/evm_signer_test.go index 711db544d1..3bbee44279 100644 --- a/zetaclient/evm/evm_signer_test.go +++ b/zetaclient/evm/evm_signer_test.go @@ -56,7 +56,7 @@ func getNewEvmChainClient() (*ChainClient, error) { coreCTX := corecontext.NewZetaCoreContext(cfg) appCTX := appcontext.NewAppContext(coreCTX, cfg) - return NewEVMChainClient(appCTX, stub.NewZetaCoreBridge(), tss, "", logger, evmcfg, ts) + return NewEVMChainClient(appCTX, stub.NewMockZetaCoreBridge(), tss, "", logger, evmcfg, ts) } func getNewOutTxProcessor() *outtxprocessor.Processor { @@ -85,7 +85,7 @@ func TestSigner_TryProcessOutTx(t *testing.T) { mockChainClient, err := getNewEvmChainClient() require.NoError(t, err) - evmSigner.TryProcessOutTx(cctx, processorManager, "123", mockChainClient, stub.NewZetaCoreBridge(), 123) + evmSigner.TryProcessOutTx(cctx, processorManager, "123", mockChainClient, stub.NewMockZetaCoreBridge(), 123) //Check if cctx was signed and broadcasted list := evmSigner.GetReportedTxList() @@ -280,7 +280,7 @@ func TestSigner_BroadcastOutTx(t *testing.T) { tx, err := evmSigner.SignERC20WithdrawTx(txData) require.NoError(t, err) - evmSigner.BroadcastOutTx(tx, cctx, zerolog.Logger{}, sdktypes.AccAddress{}, stub.NewZetaCoreBridge(), txData) + evmSigner.BroadcastOutTx(tx, cctx, zerolog.Logger{}, sdktypes.AccAddress{}, stub.NewMockZetaCoreBridge(), txData) //Check if cctx was signed and broadcasted list := evmSigner.GetReportedTxList() diff --git a/zetaclient/evm/inbounds.go b/zetaclient/evm/inbounds.go index 5cc08f8126..919ba6f9e2 100644 --- a/zetaclient/evm/inbounds.go +++ b/zetaclient/evm/inbounds.go @@ -354,3 +354,25 @@ func (ob *ChainClient) BuildInboundVoteMsgForTokenSentToTSS(tx *ethrpc.Transacti 0, // not a smart contract call ) } + +// ObserveTSSReceiveInBlock queries the incoming gas asset to TSS address in a single block and posts votes +func (ob *ChainClient) ObserveTSSReceiveInBlock(blockNumber uint64) error { + block, err := ob.GetBlockByNumberCached(blockNumber) + if err != nil { + return errors.Wrapf(err, "error getting block %d for chain %d", blockNumber, ob.chain.ChainId) + } + for i := range block.Transactions { + tx := block.Transactions[i] + if ethcommon.HexToAddress(tx.To) == ob.Tss.EVMAddress() { + receipt, err := ob.evmClient.TransactionReceipt(context.Background(), ethcommon.HexToHash(tx.Hash)) + if err != nil { + return errors.Wrapf(err, "error getting receipt for intx %s chain %d", tx.Hash, ob.chain.ChainId) + } + _, err = ob.CheckAndVoteInboundTokenGas(&tx, receipt, true) + if err != nil { + return errors.Wrapf(err, "error checking and voting inbound gas asset for intx %s chain %d", tx.Hash, ob.chain.ChainId) + } + } + } + return nil +} diff --git a/zetaclient/evm/inbounds_test.go b/zetaclient/evm/inbounds_test.go index 472cdc65ae..0663d71eeb 100644 --- a/zetaclient/evm/inbounds_test.go +++ b/zetaclient/evm/inbounds_test.go @@ -7,6 +7,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" + lru "github.com/hashicorp/golang-lru" "github.com/onrik/ethrpc" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/common" @@ -22,6 +23,9 @@ import ( // MockEVMClient creates a mock ChainClient with custom chain, TSS, params etc func MockEVMClient( chain common.Chain, + evmClient interfaces.EVMRPCClient, + evmJSONRPC interfaces.EVMJSONRPCClient, + zetClient interfaces.ZetaCoreBridger, tss interfaces.TSSSigner, lastBlock uint64, params observertypes.ChainParams) *evm.ChainClient { @@ -30,25 +34,36 @@ func MockEVMClient( Mu: &sync.Mutex{}, } client.WithChain(chain) - client.WithZetaClient(stub.NewZetaCoreBridge()) + client.WithEvmClient(evmClient) + client.WithEvmJSONRPC(evmJSONRPC) + if zetClient != nil { + client.WithZetaClient(zetClient) + } else { + client.WithZetaClient(stub.NewMockZetaCoreBridge()) + } client.SetLastBlockHeight(lastBlock) client.SetChainParams(params) + blockCache, _ := lru.New(1000) + client.WithBlockCache(blockCache) + return client } func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { // load archived ZetaSent intx, receipt and cctx // https://etherscan.io/tx/0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76 - chainID := int64(1) - intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" + chain := common.EthChain() confirmation := uint64(10) + chainID := chain.ChainId + chainParam := stub.MockChainParams(chain.ChainId, confirmation) + intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenZeta(tx, receipt, false) require.NoError(t, err) require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) @@ -58,7 +73,7 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) _, err := ob.CheckAndVoteInboundTokenZeta(tx, receipt, false) require.ErrorContains(t, err, "not been confirmed") }) @@ -68,18 +83,18 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenZeta(tx, receipt, true) require.NoError(t, err) require.Equal(t, "", ballot) }) t.Run("should not act if emitter is not ZetaConnector", func(t *testing.T) { tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) - chainID = 56 // use BSC chain connector require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + chainID = 56 // use BSC chain connector + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) _, err := ob.CheckAndVoteInboundTokenZeta(tx, receipt, true) require.ErrorContains(t, err, "emitter address mismatch") }) @@ -88,16 +103,18 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { // load archived ERC20 intx, receipt and cctx // https://etherscan.io/tx/0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da - chainID := int64(1) - intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" + chain := common.EthChain() confirmation := uint64(10) + chainID := chain.ChainId + chainParam := stub.MockChainParams(chain.ChainId, confirmation) + intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenERC20(tx, receipt, false) require.NoError(t, err) require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) @@ -107,7 +124,7 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) _, err := ob.CheckAndVoteInboundTokenERC20(tx, receipt, false) require.ErrorContains(t, err, "not been confirmed") }) @@ -117,18 +134,18 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenERC20(tx, receipt, true) require.NoError(t, err) require.Equal(t, "", ballot) }) t.Run("should not act if emitter is not ERC20 Custody", func(t *testing.T) { tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) - chainID = 56 // use BSC chain ERC20 custody require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + chainID = 56 // use BSC chain ERC20 custody + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) _, err := ob.CheckAndVoteInboundTokenERC20(tx, receipt, true) require.ErrorContains(t, err, "emitter address mismatch") }) @@ -137,16 +154,18 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { // load archived Gas intx, receipt and cctx // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 - chainID := int64(1) - intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" + chain := common.EthChain() confirmation := uint64(10) + chainID := chain.ChainId + chainParam := stub.MockChainParams(chain.ChainId, confirmation) + intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenGas(tx, receipt, false) require.NoError(t, err) require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) @@ -156,7 +175,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) _, err := ob.CheckAndVoteInboundTokenGas(tx, receipt, false) require.ErrorContains(t, err, "not been confirmed") }) @@ -166,7 +185,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenGas(tx, receipt, false) require.ErrorContains(t, err, "not TSS address") require.Equal(t, "", ballot) @@ -177,7 +196,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenGas(tx, receipt, false) require.ErrorContains(t, err, "not a successful tx") require.Equal(t, "", ballot) @@ -188,7 +207,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - ob := MockEVMClient(common.EthChain(), stub.NewTSSMainnet(), lastBlock, stub.MockChainParams(chainID, confirmation)) + ob := MockEVMClient(chain, nil, nil, nil, stub.NewTSSMainnet(), lastBlock, chainParam) ballot, err := ob.CheckAndVoteInboundTokenGas(tx, receipt, false) require.NoError(t, err) require.Equal(t, "", ballot) @@ -199,12 +218,13 @@ func TestEVM_BuildInboundVoteMsgForZetaSentEvent(t *testing.T) { // load archived ZetaSent receipt // https://etherscan.io/tx/0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76 chainID := int64(1) + chain := common.EthChain() intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" receipt := testutils.LoadEVMIntxReceipt(t, chainID, intxHash, common.CoinType_Zeta) cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, common.CoinType_Zeta) // parse ZetaSent event - ob := MockEVMClient(common.EthChain(), nil, 1, stub.MockChainParams(1, 1)) + ob := MockEVMClient(chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) connector := stub.MockConnectorNonEth(chainID) event := testutils.ParseReceiptZetaSent(receipt, connector) @@ -244,13 +264,14 @@ func TestEVM_BuildInboundVoteMsgForZetaSentEvent(t *testing.T) { func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { // load archived Deposited receipt // https://etherscan.io/tx/0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da - chainID := int64(1) + chain := common.EthChain() + chainID := chain.ChainId intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_ERC20) cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, common.CoinType_ERC20) // parse Deposited event - ob := MockEVMClient(common.EthChain(), nil, 1, stub.MockChainParams(1, 1)) + ob := MockEVMClient(chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) custody := stub.MockERC20Custody(chainID) event := testutils.ParseReceiptERC20Deposited(receipt, custody) sender := ethcommon.HexToAddress(tx.From) @@ -288,7 +309,8 @@ func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { // load archived gas token transfer to TSS // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 - chainID := int64(1) + chain := common.EthChain() + chainID := chain.ChainId intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) @@ -301,7 +323,7 @@ func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { require.NoError(t, evm.ValidateEvmTransaction(txDonation)) // create test compliance config - ob := MockEVMClient(common.EthChain(), nil, 1, stub.MockChainParams(1, 1)) + ob := MockEVMClient(chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) cfg := config.Config{ ComplianceConfig: config.ComplianceConfig{}, } @@ -333,3 +355,62 @@ func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { require.Nil(t, msg) }) } + +func TestEVM_ObserveTSSReceiveInBlock(t *testing.T) { + // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 + chain := common.EthChain() + chainID := chain.ChainId + confirmation := uint64(1) + chainParam := stub.MockChainParams(chain.ChainId, confirmation) + intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" + + // load archived tx and receipt + tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_Gas) + require.NoError(t, evm.ValidateEvmTransaction(tx)) + + // load archived evm block + // https://etherscan.io/block/19363323 + blockNumber := receipt.BlockNumber.Uint64() + block := testutils.LoadEVMBlock(t, chainID, blockNumber, true) + + // create mock client + evmClient := stub.NewMockEvmClient() + evmJSONRPC := stub.NewMockJSONRPCClient() + zetaClient := stub.NewMockZetaCoreBridge() + tss := stub.NewTSSMainnet() + lastBlock := receipt.BlockNumber.Uint64() + confirmation + + t.Run("should observe TSS receive in block", func(t *testing.T) { + ob := MockEVMClient(chain, evmClient, evmJSONRPC, zetaClient, tss, lastBlock, chainParam) + + // feed archived block and receipt + evmJSONRPC.WithBlock(block) + evmClient.WithReceipt(receipt) + err := ob.ObserveTSSReceiveInBlock(blockNumber) + require.NoError(t, err) + }) + t.Run("should not observe on error getting block", func(t *testing.T) { + ob := MockEVMClient(chain, evmClient, evmJSONRPC, zetaClient, tss, lastBlock, chainParam) + err := ob.ObserveTSSReceiveInBlock(blockNumber) + // error getting block is expected because the mock JSONRPC contains no block + require.ErrorContains(t, err, "error getting block") + }) + t.Run("should not observe on error getting receipt", func(t *testing.T) { + ob := MockEVMClient(chain, evmClient, evmJSONRPC, zetaClient, tss, lastBlock, chainParam) + evmJSONRPC.WithBlock(block) + err := ob.ObserveTSSReceiveInBlock(blockNumber) + // error getting block is expected because the mock evmClient contains no receipt + require.ErrorContains(t, err, "error getting receipt") + }) + t.Run("should not observe on error posting vote", func(t *testing.T) { + ob := MockEVMClient(chain, evmClient, evmJSONRPC, zetaClient, tss, lastBlock, chainParam) + + // feed archived block and pause zeta bridge + evmJSONRPC.WithBlock(block) + evmClient.WithReceipt(receipt) + zetaClient.Pause() + err := ob.ObserveTSSReceiveInBlock(blockNumber) + // error posting vote is expected because the mock zetaClient is paused + require.ErrorContains(t, err, "error checking and voting") + }) +} diff --git a/zetaclient/interfaces/interfaces.go b/zetaclient/interfaces/interfaces.go index 422e36cc59..5d9a40fcc9 100644 --- a/zetaclient/interfaces/interfaces.go +++ b/zetaclient/interfaces/interfaces.go @@ -4,6 +4,7 @@ import ( "context" "math/big" + "github.com/onrik/ethrpc" "github.com/zeta-chain/zetacore/zetaclient/keys" "github.com/zeta-chain/zetacore/zetaclient/outtxprocessor" @@ -137,3 +138,9 @@ type EVMRPCClient interface { TransactionReceipt(ctx context.Context, txHash ethcommon.Hash) (*ethtypes.Receipt, error) TransactionSender(ctx context.Context, tx *ethtypes.Transaction, block ethcommon.Hash, index uint) (ethcommon.Address, error) } + +// EVMJSONRPCClient is the interface for EVM JSON RPC client +type EVMJSONRPCClient interface { + EthGetBlockByNumber(number int, withTransactions bool) (*ethrpc.Block, error) + EthGetTransactionByHash(hash string) (*ethrpc.Transaction, error) +} diff --git a/zetaclient/metrics/metrics.go b/zetaclient/metrics/metrics.go index a99db9f760..3325d21156 100644 --- a/zetaclient/metrics/metrics.go +++ b/zetaclient/metrics/metrics.go @@ -16,36 +16,68 @@ type Metrics struct { s *http.Server } +const ZetaClientNamespace = "zetaclient" + var ( PendingTxsPerChain = promauto.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "zetaclient", + Namespace: ZetaClientNamespace, Name: "pending_txs_total", Help: "Number of pending transactions per chain", }, []string{"chain"}) GetFilterLogsPerChain = promauto.NewCounterVec(prometheus.CounterOpts{ - Namespace: "zetaclient", + Namespace: ZetaClientNamespace, Name: "rpc_getFilterLogs_count", Help: "Count of getLogs per chain", }, []string{"chain"}) GetBlockByNumberPerChain = promauto.NewCounterVec(prometheus.CounterOpts{ - Namespace: "zetaclient", + Namespace: ZetaClientNamespace, Name: "rpc_getBlockByNumber_count", Help: "Count of getLogs per chain", }, []string{"chain"}) TssNodeBlamePerPubKey = promauto.NewCounterVec(prometheus.CounterOpts{ - Namespace: "zetaclient", + Namespace: ZetaClientNamespace, Name: "tss_node_blame_count", Help: "Tss node blame counter per pubkey", }, []string{"pubkey"}) HotKeyBurnRate = promauto.NewGauge(prometheus.GaugeOpts{ - Namespace: "zetaclient", + Namespace: ZetaClientNamespace, Name: "hotkey_burn_rate", Help: "Fee burn rate of the hotkey", }) + + NumberOfUTXO = promauto.NewGauge(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "utxo_number", + Help: "Number of UTXOs", + }) + + LastScannedBlockNumber = promauto.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "last_scanned_block_number", + Help: "Last scanned block number per chain", + }, []string{"chain"}) + + LastCoreBlockNumber = promauto.NewGauge(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "last_core_block_number", + Help: "Last core block number", + }) + + Info = promauto.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "info", + Help: "Information about Zetaclient environment", + }, []string{"version"}) + + LastStartTime = promauto.NewGauge(prometheus.GaugeOpts{ + Namespace: ZetaClientNamespace, + Name: "last_start_timestamp_seconds", + Help: "Start time in Unix time", + }) ) func NewMetrics() (*Metrics, error) { diff --git a/zetaclient/metrics/telemetry.go b/zetaclient/metrics/telemetry.go index 07ca32ae35..209bf61fed 100644 --- a/zetaclient/metrics/telemetry.go +++ b/zetaclient/metrics/telemetry.go @@ -2,7 +2,6 @@ package metrics import ( "context" - "encoding/json" "errors" "fmt" "net/http" @@ -12,31 +11,23 @@ import ( "github.com/gorilla/mux" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/zetaclient/types" ) // TelemetryServer provide http endpoint for Tss server type TelemetryServer struct { - logger zerolog.Logger - s *http.Server - p2pid string - lastScannedBlockNumber map[int64]uint64 // chainid => block number - lastCoreBlockNumber int64 - mu sync.Mutex - lastStartTimestamp time.Time - status types.Status - ipAddress string - HotKeyBurnRate *BurnRate + logger zerolog.Logger + s *http.Server + p2pid string + mu sync.Mutex + ipAddress string + HotKeyBurnRate *BurnRate } // NewTelemetryServer should only listen to the loopback func NewTelemetryServer() *TelemetryServer { hs := &TelemetryServer{ - logger: log.With().Str("module", "http").Logger(), - lastScannedBlockNumber: make(map[int64]uint64), - lastStartTimestamp: time.Now(), - HotKeyBurnRate: NewBurnRate(100), + logger: log.With().Str("module", "http").Logger(), + HotKeyBurnRate: NewBurnRate(100), } s := &http.Server{ Addr: ":8123", @@ -48,12 +39,6 @@ func NewTelemetryServer() *TelemetryServer { return hs } -func (t *TelemetryServer) GetLastStartTimestamp() time.Time { - t.mu.Lock() - defer t.mu.Unlock() - return t.lastStartTimestamp -} - // setter/getter for p2pid func (t *TelemetryServer) SetP2PID(p2pid string) { t.mu.Lock() @@ -80,37 +65,6 @@ func (t *TelemetryServer) GetIPAddress() string { return t.ipAddress } -// setter for lastScanned block number -func (t *TelemetryServer) SetLastScannedBlockNumber(chainID int64, blockNumber uint64) { - t.mu.Lock() - t.lastScannedBlockNumber[chainID] = blockNumber - t.mu.Unlock() -} - -func (t *TelemetryServer) GetLastScannedBlockNumber(chainID int64) uint64 { - t.mu.Lock() - defer t.mu.Unlock() - return t.lastScannedBlockNumber[chainID] -} - -func (t *TelemetryServer) SetCoreBlockNumber(blockNumber int64) { - t.mu.Lock() - t.lastCoreBlockNumber = blockNumber - t.mu.Unlock() -} - -func (t *TelemetryServer) GetCoreBlockNumber() int64 { - t.mu.Lock() - defer t.mu.Unlock() - return t.lastCoreBlockNumber -} - -func (t *TelemetryServer) SetNumberOfUTXOs(numberOfUTXOs int) { - t.mu.Lock() - t.status.BTCNumberOfUTXOs = numberOfUTXOs - t.mu.Unlock() -} - func (t *TelemetryServer) AddFeeEntry(block int64, amount int64) { t.mu.Lock() err := t.HotKeyBurnRate.AddFee(amount, block) @@ -125,11 +79,6 @@ func (t *TelemetryServer) Handlers() http.Handler { router := mux.NewRouter() router.Handle("/ping", http.HandlerFunc(t.pingHandler)).Methods(http.MethodGet) router.Handle("/p2p", http.HandlerFunc(t.p2pHandler)).Methods(http.MethodGet) - router.Handle("/version", http.HandlerFunc(t.versionHandler)).Methods(http.MethodGet) - router.Handle("/lastscannedblock", http.HandlerFunc(t.lastScannedBlockHandler)).Methods(http.MethodGet) - router.Handle("/laststarttimestamp", http.HandlerFunc(t.lastStartTimestampHandler)).Methods(http.MethodGet) - router.Handle("/lastcoreblock", http.HandlerFunc(t.lastCoreBlockHandler)).Methods(http.MethodGet) - router.Handle("/status", http.HandlerFunc(t.statusHandler)).Methods(http.MethodGet) router.Handle("/ip", http.HandlerFunc(t.ipHandler)).Methods(http.MethodGet) router.Handle("/hotkeyburnrate", http.HandlerFunc(t.hotKeyFeeBurnRate)).Methods(http.MethodGet) @@ -198,54 +147,6 @@ func (t *TelemetryServer) ipHandler(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, "%s", t.ipAddress) } -func (t *TelemetryServer) lastScannedBlockHandler(w http.ResponseWriter, _ *http.Request) { - //w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - - t.mu.Lock() - defer t.mu.Unlock() - // Convert map to JSON - jsonBytes, err := json.Marshal(t.lastScannedBlockNumber) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - _, err = w.Write(jsonBytes) - if err != nil { - t.logger.Error().Err(err).Msg("Failed to write response") - } -} - -func (t *TelemetryServer) lastCoreBlockHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusOK) - t.mu.Lock() - defer t.mu.Unlock() - fmt.Fprintf(w, "%d", t.lastCoreBlockNumber) -} - -func (t *TelemetryServer) statusHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusOK) - t.mu.Lock() - defer t.mu.Unlock() - s, err := json.MarshalIndent(t.status, "", "\t") - if err != nil { - t.logger.Error().Err(err).Msg("Failed to marshal status") - } - fmt.Fprintf(w, "%s", s) -} - -func (t *TelemetryServer) versionHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, "%s", common.Version) -} - -func (t *TelemetryServer) lastStartTimestampHandler(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(http.StatusOK) - t.mu.Lock() - defer t.mu.Unlock() - fmt.Fprintf(w, "%s", t.lastStartTimestamp.Format(time.RFC3339)) -} - func (t *TelemetryServer) hotKeyFeeBurnRate(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) t.mu.Lock() diff --git a/zetaclient/testdata/evm/chain_1_block_ethrpc_trimmed_19330473.json b/zetaclient/testdata/evm/chain_1_block_ethrpc_trimmed_19330473.json new file mode 100644 index 0000000000..e90f23309d --- /dev/null +++ b/zetaclient/testdata/evm/chain_1_block_ethrpc_trimmed_19330473.json @@ -0,0 +1,2049 @@ +{ + "Number": 19330473, + "Hash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "ParentHash": "0x267d191078b68fbd5be49e0274b6387943c892a4379bbfdedff9fcd45c0626a1", + "Nonce": "0x0000000000000000", + "Sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "LogsBloom": "0x05a54d18e50179d04c029178a3b01da3a2c34a8b5083fa792b2b04a0fc368432c5561425d383204ac138fba5654acb9c8209d0268d6274f01ea36423813eac648588157ac3cd9a7e6f01456f5ea8aaefc4491b11af4c59105c74db798864410c510c682c4e739369a9d157f620914ddd24991e755ab59706861188db541d821eaf0893ea2ced400a65713bec0fb01a761d09d4f10f908428461d154148f024688a87114a73a2bc529ecafcd49c2074bfeca41b2589f0498f87bba86629dd5361f7216c8345145249b246287701aad44931ea1e968758055ccbe5e23f125eff0c22d6ac09b214425a1c2c15acadf39eb0077d9c191178344b3b045b9239d8ac9a", + "TransactionsRoot": "0xd651daaca8c9a603fa2648d474233e8ddc912b9d831716f61f1faf0b4eddeac7", + "StateRoot": "0x29da2506610eee13a06d66c0fe881942da8e8b0413a0b8e19aa425efe6fd77df", + "Miner": "0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97", + "Difficulty": 0, + "TotalDifficulty": 58750003716598352816469, + "ExtraData": "0x546974616e2028746974616e6275696c6465722e78797a29", + "Size": 301417, + "GasLimit": 30000000, + "GasUsed": 18209718, + "Timestamp": 1709177027, + "Uncles": [], + "Transactions": [ + { + "Hash": "0x5bee6e0d1b2741badc5a490692a7e4ef118e3ad6736b206805ad6cfe69c18bdb", + "Nonce": 32, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 0, + "From": "0xe667c8621417c53ddea92375ab93d3f5efdeed18", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 1416723496930938000, + "Gas": 139195, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x0c13995bfdfcff59aee550461de184ec3a3513d11a06318c816dde72dd15e402", + "Nonce": 865356, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 1, + "From": "0x91aae0aafd9d2d730111b395c6871f248d7bd728", + "To": "0x98c3d3183c4b8a650614ad179a1a98be0a8d6b8e", + "Value": 0, + "Gas": 300011, + "GasPrice": 47548888839, + "Input": "0x" + }, + { + "Hash": "0x341f44ef7a89db8bab64aceb26bf36160f24c123c9d89aaa648573c7389f2eb2", + "Nonce": 719917, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 2, + "From": "0x3527439923a63f8c13cf72b8fe80a77f6e572092", + "To": "0xa0425d71cb1d6fb80e65a5361a04096e0672de03", + "Value": 0, + "Gas": 8000000, + "GasPrice": 52548888839, + "Input": "0x" + }, + { + "Hash": "0x7ba81db5dd1235a979179a9db318262771ac566fe87b0649b0536987ac150657", + "Nonce": 1914, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 3, + "From": "0xd93d10900f53a4f445a88d62efff803edfe20980", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 543760, + "GasPrice": 67558888839, + "Input": "0x" + }, + { + "Hash": "0x31ef5d0d7269b243280b7eb2263e2cdedbd3fa34c071759cf15e7c9447960710", + "Nonce": 77, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 4, + "From": "0xf1dfe5db0f757e6af9be2cc2e31725369e0088d5", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 543760, + "GasPrice": 67558888839, + "Input": "0x" + }, + { + "Hash": "0x167eac47b20fe4d1c1aafd9d4d384c047a49a0cdb52b11ae595c1de6b57616a5", + "Nonce": 1287, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 5, + "From": "0x270f4ceead65439c717fdcab0b7d0be6aff90589", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 543760, + "GasPrice": 67558888839, + "Input": "0x" + }, + { + "Hash": "0xeb5ad997da4b3ec54c0e32caf572f7fd177fc9491f898315bcd51698d3a8f95d", + "Nonce": 92, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 6, + "From": "0x8f640bd5a7e64743bb465fda991e8fdc0ceb4424", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 514568, + "GasPrice": 63548888839, + "Input": "0x" + }, + { + "Hash": "0x7e02193f398e276599a5aaad7d4de81009db3cde92dafe5e4ad35e29cd153663", + "Nonce": 227, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 7, + "From": "0xba405e4c0a416881e866e3486538706dd741fcca", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 514568, + "GasPrice": 63548888839, + "Input": "0x" + }, + { + "Hash": "0x2657838b6fe700fe08dd71761324e598106fcf8bc7929f6b3b92e433519c01c7", + "Nonce": 69120, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 8, + "From": "0x337a81113f934b8522459f0ca207eee7aa0f4545", + "To": "0xf8a16864d8de145a266a534174305f881ee2315e", + "Value": 0, + "Gas": 6000000, + "GasPrice": 50548888839, + "Input": "0x" + }, + { + "Hash": "0x252053df6a32c67a82d9298a65acd206ed3ef0be89b78c457bbb120d0de52186", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 9, + "From": "0xcad722685782b3d90470307ebbeca202d62c3b8a", + "To": "0xd523794c879d9ec028960a231f866758e405be34", + "Value": 980107655962837556, + "Gas": 248628, + "GasPrice": 60420315297, + "Input": "0x" + }, + { + "Hash": "0xa1a70772bf216b08883e2d5eedac69ddab262926d2a5dc51128d039eba802e77", + "Nonce": 48, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 10, + "From": "0x6c002142bd8ec3f20a7636e7973ca41888b42f7f", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 0, + "Gas": 194442, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x5b9c8b8b86c5735e4f851471cc233a3dec798f56e9daca8dfc178619c9990913", + "Nonce": 8664, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 11, + "From": "0xee28beaa11e31d10581ee7cfdcb9e95c8d05c53c", + "To": "0xfbeedcfe378866dab6abbafd8b2986f5c1768737", + "Value": 19330473, + "Gas": 450000, + "GasPrice": 47548888839, + "Input": "0x" + }, + { + "Hash": "0x398e5ab7943bbdc985d4d0b40450f4f10688d140d23db996e54ad67fa2bbeef6", + "Nonce": 1776, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 12, + "From": "0x768f1621f176b2010647be124f1f252ca849d6a7", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 587469, + "GasPrice": 57548888839, + "Input": "0x" + }, + { + "Hash": "0x9f7e0e7066c9cebb0523e698ddb26e063220f884b76d0f68fe07ff92fbaa1749", + "Nonce": 1091522, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 13, + "From": "0x6887246668a3b87f54deb3b94ba47a6f63f32985", + "To": "0xff00000000000000000000000000000000000010", + "Value": 0, + "Gas": 1695116, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x0f2a572995704d8d87419258f9d798c8ffd819550865412c21ab2a39fd070c79", + "Nonce": 76, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 14, + "From": "0x11ba386d08b622ca75f15d1ed6e716727aa27cdb", + "To": "0x6c42f24f2619d3de71a72a02a5fc2aa0cde667da", + "Value": 0, + "Gas": 679011, + "GasPrice": 51900000000, + "Input": "0x" + }, + { + "Hash": "0xa4ad716ce930d71f5c99c9fa0f26451f42cf93b16f1cb8e3509a56179bf20602", + "Nonce": 8381, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 15, + "From": "0x1e01eb96bafa7815d90b790329f1ceabed868181", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 0, + "Gas": 513906, + "GasPrice": 52548888839, + "Input": "0x" + }, + { + "Hash": "0xcdd852efd3dbf10190b567eded010bf3ac46555aac1b47aebee90ea828a132d4", + "Nonce": 2444, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 16, + "From": "0xc8d5cf84e1aa38ffa9e5e532fc97b2f6e1c4740c", + "To": "0x1111111254eeb25477b68fb85ed929f73a960582", + "Value": 0, + "Gas": 166301, + "GasPrice": 54324000000, + "Input": "0x" + }, + { + "Hash": "0x23d5604ef20576c43e63d3e1b07e7dbcf81b5629bd968498b5f6bd6f04bc6aee", + "Nonce": 36197, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 17, + "From": "0x051acf8d69a18d6a6e4dd063b39501e69704ac50", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 250000, + "GasPrice": 62000000000, + "Input": "0x" + }, + { + "Hash": "0x2c80a8a3bb3e48012a347c621bfb5edb4ab8f3b3f8dfa294c220b79d3907bca4", + "Nonce": 5951, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 18, + "From": "0x70ad6a24abd247fce9b87b2e85972049cc0170ad", + "To": "0xb62bdeda5d1e7a03a615b793e949c19d158c6b46", + "Value": 0, + "Gas": 425000, + "GasPrice": 50048888839, + "Input": "0x" + }, + { + "Hash": "0x9d9e3abb9b5bdb46b0518db5f46ff9dfd19bad2a78677de22286216582b85d76", + "Nonce": 43954, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 19, + "From": "0xc1e2a676c2cf7c8120e927396642324b4a3c0e75", + "To": "0x000000000dfde7deaf24138722987c9a6991e2d4", + "Value": 0, + "Gas": 600000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0xe74f94622c7a2e46631394dc64777f6c8c65610202d7a81d9e0f5995ccd85354", + "Nonce": 122, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 20, + "From": "0xd54ec19313e39293dec6b86adad6713e4aaa11d0", + "To": "0x663dc15d3c1ac63ff12e45ab68fea3f0a883c251", + "Value": 1000000000000000, + "Gas": 361252, + "GasPrice": 49948888839, + "Input": "0x" + }, + { + "Hash": "0xc0b383d4e0735054415ee6e43c7b02d4f3daae50192dd8a3c3e2b2092cd3bddf", + "Nonce": 12005, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 21, + "From": "0x5acf4e865604ab620fb84acc047b990f2d2856fd", + "To": "0xf3f04555f8fda510bfc77820fd6eb8446f59e72d", + "Value": 0, + "Gas": 384855, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0xc9986543cd16efe7c8721a952c22ae682438092e0d695631de8d80e276997c74", + "Nonce": 82954, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 22, + "From": "0x2a4a7afa40a9d03b425752fb4cfd5f0ff5b3964c", + "To": "0x478238a1c8b862498c74d0647329aef9ea6819ed", + "Value": 0, + "Gas": 740000, + "GasPrice": 48912763532, + "Input": "0x" + }, + { + "Hash": "0xd01b0102d2aaebff16b0948286bff2e3e608527b1f9374d10b33cefd952db4cf", + "Nonce": 458436, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 23, + "From": "0x477b8d5ef7c2c42db84deb555419cd817c336b6f", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 96082, + "GasPrice": 54473432550, + "Input": "0x" + }, + { + "Hash": "0x0b25476c3d3ddec226669cfcad1569c5d16f8c3e44e16bba9462f01758acf168", + "Nonce": 151971, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 24, + "From": "0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 100000, + "GasPrice": 53336252238, + "Input": "0x" + }, + { + "Hash": "0x29a099996fd425797f48b4efbc521d23eb5b27baa8c1ed863d1089592839557e", + "Nonce": 9928, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 25, + "From": "0x147b12c06d9e8e3837280f783fd8070848d4412e", + "To": "0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5", + "Value": 0, + "Gas": 115204, + "GasPrice": 50031355791, + "Input": "0x" + }, + { + "Hash": "0x49dbad8af7ea4dd6e05bbf0b1bdd4eef3c90f1876b0bf902cf4dfdfb35786488", + "Nonce": 266, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 26, + "From": "0x6f1e9f00c32d11a366405a1811389a088f7bc46b", + "To": "0x72c60bfffef18dca51db32b52b819a951b6ddbed", + "Value": 0, + "Gas": 120000, + "GasPrice": 52548888839, + "Input": "0x" + }, + { + "Hash": "0x1e29f0736e1e26d28373e05f0eeb3b7da5cb808372979693cbb26d9ba56942e2", + "Nonce": 43, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 27, + "From": "0xf319661f8a3d9055acd7465ef81583440194f91c", + "To": "0xa397a8c2086c554b531c02e29f3291c9704b00c7", + "Value": 0, + "Gas": 274471, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x5482b876b39ba649e1e762f015baacaa61d8278d63be31e894a23fbc3b189eab", + "Nonce": 2134, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 28, + "From": "0xc645677ce475e6bb1d14a42d0be45da24b636c99", + "To": "0x00000000000000adc04c56bf30ac9d3c0aaf14dc", + "Value": 350000000000000000, + "Gas": 210218, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xc8b9ad09aa7fc266bb7c25929f77e4df2afb9869f7a030e88a6309f7d5e1e808", + "Nonce": 24, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 29, + "From": "0x059f2909875a4d309e9750361eaae03e14fe3d58", + "To": "0x72c60bfffef18dca51db32b52b819a951b6ddbed", + "Value": 0, + "Gas": 56421, + "GasPrice": 50548888839, + "Input": "0x" + }, + { + "Hash": "0x63e93a33f662ba39aa5ee3caa63b9e56d6fa4b4b1e0fbbe5ceac0b74e7b6895e", + "Nonce": 2502215, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 30, + "From": "0xf89d7b9c864f589bbf53a82105107622b35eaa40", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 90000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x2ba11f551f8130d19869d1e749016e61d5487e9d66f67d52e39f7d84f7f88191", + "Nonce": 9077862, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 31, + "From": "0x28c6c06298d514db089934071355e5743bf21d60", + "To": "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24", + "Value": 0, + "Gas": 207128, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0xcc4413ee408069d6d9d50c8e1f17df8e5d483cda50de6128bc941c7942fcc99c", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 32, + "From": "0x341468f2b13155c4c0ff4c6f727189821e09f1cb", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x0db56ba3ff4ba73b12d7abae6c63add8ad47133094dd2c3950511586ccdfe67e", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 33, + "From": "0x14aff39623f752f9a190d6cf0140bbd7d8754e6b", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0xbf6f3a77df707bfdeb7dbb40a41f8cc895609a2e053e593745d2c36ecd19a689", + "Nonce": 2, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 34, + "From": "0xdb8250f7be41362bd7245c2f8a200a62ebc2489a", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x5681005e4a6a3538761efa55dcbb7f2a3f82dfcb9bb597aba7ace344b81a88c0", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 35, + "From": "0xbcda3d2714c7a16752610a1a639c31024cc2eb77", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x24d7f9fe3de7e6ab5a812eaf9e0fbc8e9d8a52ca5546f27132ae288ae176b7ae", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 36, + "From": "0x457fefbde35d635f198cde14a9bc31ae1c62fa28", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x82d81463b5074deca126bff83beef3722d04afb5b310cfaded1509cf3927cc51", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 37, + "From": "0x3f8934cbb4584f4d1f0d723f532920d916da2384", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 59533, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x7990fda5113774b18a34279fb025d50e97b6997b6f98b5756006625f21473688", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 38, + "From": "0xf3cb1448109eb769bbe3a254c47f6c5054fed057", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 84000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xe01c7a56342f619e8007904f15af64e67a1d29ad6877abadb2e8b888884e6bc7", + "Nonce": 29402, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 39, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x06450dee7fd2fb8e39061434babcfc05599a6fb8", + "Value": 0, + "Gas": 50948, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x5a82e744641c74badff4df9bceb1ca00c920af42a8ef011504a07b9bf8924532", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 40, + "From": "0x75a7d1cf30156157e2d68be10f3fc4479b3c8606", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 64000, + "GasPrice": 48336252238, + "Input": "0x" + }, + { + "Hash": "0xf421f19c805272d9b4395ebc5265d6da785d3f21610473738ee18572608b7ccc", + "Nonce": 18944, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 41, + "From": "0x22a82147a80747cfb1562e0f72f6be39f18b5f76", + "To": "0x40864568f679c10ac9e72211500096a5130770fa", + "Value": 0, + "Gas": 11000000, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0xacf927dd81243412a557e43be957841e9fe5d933331acfed537e67c17594385b", + "Nonce": 1441, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 42, + "From": "0x6fb3dbc55cf59a1e5eb71ae973900768ff83258d", + "To": "0x6b175474e89094c44da98b954eedeac495271d0f", + "Value": 0, + "Gas": 62196, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0x56a989c393b60418e8dcad21861fb173f26cbd9ace6c38fe37338548b1b530a0", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 43, + "From": "0xf99f7a261ace91f73d0c675c538420c680b5185a", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 46085, + "GasPrice": 48050284419, + "Input": "0x" + }, + { + "Hash": "0x977625bfecff53b416d41bbc45121f207c48083226c92515269a146005428560", + "Nonce": 1071, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 44, + "From": "0xe916778c679adda1d506d1783c7a5a3e49bc6056", + "To": "0x0df596ad12f927e41ec317af7dd666ca3574845f", + "Value": 0, + "Gas": 64000, + "GasPrice": 48336252238, + "Input": "0x" + }, + { + "Hash": "0xf8194e8f3b2a6b173e70490df4b4557e8d34d80440fd3b9c931fda269419378d", + "Nonce": 30, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 45, + "From": "0xd7ed1433ad6fcf2cd393fd5e72b63c4e5fc6f3aa", + "To": "0xd1d2eb1b1e90b638588728b4130137d262c87cae", + "Value": 0, + "Gas": 55000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0x5ef4e7fe0c62cae78f2a05d859f2f028db31c62023e51110749f5089ac7a4e97", + "Nonce": 199, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 46, + "From": "0x7154b682e8fdb4207c035d2f037ad6448bbb8581", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 0, + "Gas": 356240, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0x9a1b2c12715ddc52fd81535f2bfa98a65b2774b0a9ef9753523968beeb33266b", + "Nonce": 2, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 47, + "From": "0xbad22e79a5b9309114a1ca3fcfc9cfe11474241a", + "To": "0x253553366da8546fc250f225fe3d25d0c782303b", + "Value": 1492833416759225, + "Gas": 588404, + "GasPrice": 47598888839, + "Input": "0x" + }, + { + "Hash": "0xf1d7bdc606994fd5fbc5c9b29b86080ae2cba8d0027797b5e78396edd9cd25f2", + "Nonce": 15, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 48, + "From": "0xd29297fbc7717ae056742bff56c76a231e232e05", + "To": "0x00000000ede6d8d217c60f93191c060747324bca", + "Value": 0, + "Gas": 1013974, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x8dc1cf3dfe14fb2594bce70cdc98ccbaf60a4cded5add1c050106a1908d340da", + "Nonce": 18, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 49, + "From": "0x17bbf977991336100f444d97e39cfb4f13a213f9", + "To": "0x68b429161ec09a6c1d65ba70727ab1faa5bc4026", + "Value": 0, + "Gas": 68026, + "GasPrice": 47628888839, + "Input": "0x" + }, + { + "Hash": "0x4e8460b89fd983c06e5303105f0a228be7f64a5c21ffb4c3bb15fbacabe71478", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 50, + "From": "0x36bb3e0a7823f39826b79a3f1f4d2bf1bb3c5767", + "To": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "Value": 0, + "Gas": 50000, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0x59d0f7e63988e79724b45b673e52844ba7f5764a9301a9e2eae40e7df45790f2", + "Nonce": 6, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 51, + "From": "0x10ee730e8c4f19dce08d4548b3de8045e8b87e9f", + "To": "0x808507121b80c02388fad14726482e061b8da827", + "Value": 0, + "Gas": 60664, + "GasPrice": 47628888839, + "Input": "0x" + }, + { + "Hash": "0x09c2cab6cf4a951a55e1af620e7a1478520f60bc5ad9493da639247dbba80b92", + "Nonce": 6, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 52, + "From": "0x5cf88277ac14867a1e21e319db3f7a2691dab6d3", + "To": "0x13f4ea83d0bd40e75c8222255bc855a974568dd4", + "Value": 0, + "Gas": 271485, + "GasPrice": 47562888595, + "Input": "0x" + }, + { + "Hash": "0xfa5b3a5ca053e1c13afc665443f96b30a0709dbc3003f1a6e1bb862983c2fd48", + "Nonce": 25, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 53, + "From": "0xa34f5b8c3493e710bc27fccf071e6b021ca18a08", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 0, + "Gas": 258530, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x72439934df548b919204bc6eaee2955bda5ef72573163469f435eda159767762", + "Nonce": 18, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 54, + "From": "0xbde1f1dac1e001a272cb083962179d8a152c551b", + "To": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "Value": 0, + "Gas": 85067, + "GasPrice": 47598888839, + "Input": "0x" + }, + { + "Hash": "0xe2ca844813c39450eb4d6a29f18e949a9d1410977e96a9a885f1de60b682e210", + "Nonce": 802, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 55, + "From": "0x334022d77bfc9e8aa5b34907873457c545d9faf2", + "To": "0x1a0ad011913a150f69f6a19df447a0cfd9551054", + "Value": 0, + "Gas": 958579, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x8a0bb204842e7ee03022614256e441ed333c6a74acbb1407672fb888c150ae33", + "Nonce": 326, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 56, + "From": "0x63126fdc6111f874ada547b9d7deb607503463a7", + "To": "0x500bfddf51e77da46ce7c8ca00ef153335420fb4", + "Value": 0, + "Gas": 44955, + "GasPrice": 47647888839, + "Input": "0x" + }, + { + "Hash": "0x67ae0da37ee873c8b58c6556b0a7c56fa93c2ba31b91b781c2712b9d86435962", + "Nonce": 43, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 57, + "From": "0x8d40a76ad48f05b8041f58430d3e903afb49dd44", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 0, + "Gas": 210315, + "GasPrice": 47562888595, + "Input": "0x" + }, + { + "Hash": "0x48136ab67c5d2a4e7a04168cceb9b32a35601b82e947bc94e276f9783a42d9b7", + "Nonce": 2199, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 58, + "From": "0xd605b8c680c34f15d7aaf597494fd839f75eba18", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 0, + "Gas": 226411, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xc31582514217131df5ecfa98f6a1c109f099d060d493699b6bc6e86297c602b3", + "Nonce": 4174, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 59, + "From": "0x7a6b049d83554da1175d65be3f6264a74a05ae17", + "To": "0x29469395eaf6f95920e59f858042f0e28d98a20b", + "Value": 0, + "Gas": 161687, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xc18b766e65a6ee620f377b7164dccd1510852d5027fc37f568ad8e59b459f5a6", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 60, + "From": "0x65ea5ecbe773e1ac344727d2534d9402e29cb8f5", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 250000000000000000, + "Gas": 208940, + "GasPrice": 47563634797, + "Input": "0x" + }, + { + "Hash": "0x1eaa0f39ba31d67be255e7d3af73b8697018cf3195afbf163b8eb8e4a964b70d", + "Nonce": 1500, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 61, + "From": "0x54c04155f5ffda3e6bf81ae76bf8fc6ebd6a2c05", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 6000000000000000000, + "Gas": 212673, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x9c37ea5b81385211d034f26714bee77380a3e014460a7bba2b935131fc392b5b", + "Nonce": 579, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 62, + "From": "0xa14368e5a732611adc565f3cad488f30d0023166", + "To": "0xb2ecfe4e4d61f8790bbb9de2d1259b9e2410cea5", + "Value": 0, + "Gas": 152191, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x88638b75a3078b51330670ba7ee25f6704fe8fb6366e6725c107632bd7358b33", + "Nonce": 94, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 63, + "From": "0xf2215488e721386d93d764cb63dae81ffa85989a", + "To": "0xec2432a227440139ddf1044c3fea7ae03203933e", + "Value": 0, + "Gas": 129878, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x2a84c9bbfc12a16d075ae9c0e7e7d5632c9af8114560eeaf5415e6b3830d1d8d", + "Nonce": 4091, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 64, + "From": "0xe14b4585795befea1b08a4317b46ca218000ac93", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 500000000000000000, + "Gas": 180666, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x9b60ea1aeb4a7eeda09663e9f4299ee6829fa22168c1bd17d7e67dbf56d005d3", + "Nonce": 1365, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 65, + "From": "0x0028109b8b6ca54e7e1c372cfc2a68b7e477cd43", + "To": "0x3bdca51226202fc2a64211aa35a8d95d61c6ca99", + "Value": 0, + "Gas": 206076, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xaf40f5ec304afc4e472dcfb0092e414f3e54b1f87c5a99b61a63efbe17da7399", + "Nonce": 9209, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 66, + "From": "0x24a9ee0ee55f08813924734cd703ab41c045c643", + "To": "0x1111111254eeb25477b68fb85ed929f73a960582", + "Value": 0, + "Gas": 157232, + "GasPrice": 47563634797, + "Input": "0x" + }, + { + "Hash": "0x899e838f75dd574d44f088db7bc0f118cdd7e7176b0f8031b6cab1c25d92be6f", + "Nonce": 9, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 67, + "From": "0xc16822f9109ea30a58d3572d02a6de2c80ac02d1", + "To": "0x5f6ae08b8aeb7078cf2f96afb089d7c9f51da47d", + "Value": 900000000000000000, + "Gas": 125810, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xde8f572e197f11e6837b5f6c6a5e673aa7251f7855a4848d79af10c7ca13127e", + "Nonce": 7273, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 68, + "From": "0xdda42f12b8b2ccc6717c053a2b772bad24b08cbd", + "To": "0x9d39a5de30e57443bff2a8307a4256c8797a3497", + "Value": 0, + "Gas": 145800, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x9719a79d81ab3a15bc7d88c96c4edf4f52d9dbea98351e259dbad342bec55594", + "Nonce": 53, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 69, + "From": "0xdf0f1ef01bb8b994efbadec67f1a4eab05651fe7", + "To": "0x3328f7f4a1d1c57c35df56bbf0c9dcafca309c49", + "Value": 120000000000000000, + "Gas": 3000000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x57f11c80b1e1f06c483f61f107005bbc9f09e8404e2c7954668f4a39c69303b0", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 70, + "From": "0x306c113ba7c60121bec46d170628796607ca2410", + "To": "0xe03f81bcb9f7876a1a64f9ece379df1e189ebdc8", + "Value": 7322726194273998, + "Gas": 21000, + "GasPrice": 56582707735, + "Input": "0x" + }, + { + "Hash": "0x03636251efc508996a2ebd590ed8736e3bbe0a3ff9c499b8c2ab924a8ed66350", + "Nonce": 8, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 71, + "From": "0xb83a8df4b68d18e3d85e6d708244f3d09e995899", + "To": "0xa5fc7bc086a0c07688f09ffea3917052b83d3a2e", + "Value": 48456575324369561, + "Gas": 25200, + "GasPrice": 50375597873, + "Input": "0x" + }, + { + "Hash": "0x689e68d62fd6645b107189e439e7539e2babce2d69deeb595b83dedda9cf1ee4", + "Nonce": 15, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 72, + "From": "0xecaa84f671320b817832d69004f9408ee46642d1", + "To": "0x808d0aee8db7e7c74faf4b264333afe8c9ccdba4", + "Value": 998959473334381000, + "Gas": 21000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x5ab8572fda8661d6627ac76e05a46808aa2efb922e6061c750c0488f9154d31b", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 73, + "From": "0x20e7fb230e12f1a1e51e986fb9b7c613c3904494", + "To": "0x808d0aee8db7e7c74faf4b264333afe8c9ccdba4", + "Value": 55670053334381000, + "Gas": 21000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x2da537de7f841c6bc9dd185d522a1160090147a51ce434b36bac5dbd1f8869ce", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 74, + "From": "0x38d43560972227d51c5c6394234a7f24c7b10b42", + "To": "0x808d0aee8db7e7c74faf4b264333afe8c9ccdba4", + "Value": 11890263334381000, + "Gas": 21000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0x1efdc55822942555bdac56c955f6b5689a72d89b8d0c7f144c0c3caff341a1a6", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 75, + "From": "0xac7459107f545d0fc131199f360f4635af3a79df", + "To": "0x808d0aee8db7e7c74faf4b264333afe8c9ccdba4", + "Value": 83809303334381000, + "Gas": 21000, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0xb9012da1b2c7df70c2511ea0326eacd38e5ee98114ef0ac4173b165fe6b6e82c", + "Nonce": 6231082, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 76, + "From": "0x56eddb7aa87536c09ccc2793473599fd21a8b17f", + "To": "0x9b935c8336b825970a9434c3f78df91f6b5f8d50", + "Value": 1768895550000000000, + "Gas": 207128, + "GasPrice": 49548888839, + "Input": "0x" + }, + { + "Hash": "0xa86f930e7a2a63bd1243db9af08c34dc0f509b23fe250a1530bde1d6b1eb1d48", + "Nonce": 1864, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 77, + "From": "0xb6f30f6fff1fbc6597c6e32a8865b1bccfe84c5d", + "To": "0xb0999731f7c2581844658a9d2ced1be0077b7397", + "Value": 10000000000000000, + "Gas": 53793, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x60d2cbe80d21bfa0cac4f5c79b484c33c42f4f46fd0529575cd70431d04851ee", + "Nonce": 24223, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 78, + "From": "0xe795d3de925c970cbef7c691f9c39505202afaca", + "To": "0x76da499494e8f6abcf0f664447b4ad28b17d535a", + "Value": 50270000000000000, + "Gas": 21000, + "GasPrice": 49000000000, + "Input": "0x" + }, + { + "Hash": "0x61f05f0c8a97fd5e17767c5d253a844a239f066e86f695d274ebcb43a103bee6", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 79, + "From": "0x0c521549dda8e9f615061a300314f9327ff10a75", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 462768287051891733, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x7756d1e8d4b884047d190758c52f75a91b1e11ba3ee272897be0414e7e05cc21", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 80, + "From": "0xed5d47f643dbcd64096e4399b486a5448af8a9c9", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 776842068302016208, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x8e2bd179ee3bdd484342b4ba3eb4780e448bbcd2b7ca8f351f5000f7273250a5", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 81, + "From": "0x01aa8a859d6b3dfdfc3f63d7062dfb3f338569c9", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 3707370000000000, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x792a13933220d317b3426eff47b61fdef525610ac865c9379ba6668140db805b", + "Nonce": 1132, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 82, + "From": "0xec129edf84da5b5f08646287094382a1ba2be81d", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 2691841796684382, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x479efae546660b04b64931e63049a1f5df7fa7bcc4225a03a19bf272ede60e7e", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 83, + "From": "0x66a7ce4255ec75a3df27a5158ab4107dc42902fa", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 12058320359425533, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x74b6d1968d9c98f20a6e8b148f11d21bc3ea85f27481bdfd51c2f35d697ad250", + "Nonce": 35, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 84, + "From": "0x03c8bd4e8b328d351d2683e20f1ac4ad40722837", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 2198094609990875520, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x84c46064dfeb21a91b7a56ace478a15c5a0dd43f8ff803b56bf2315f2763e6a7", + "Nonce": 2, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 85, + "From": "0x50085d3cc268a7054ae1ded2e956ec5193d261ec", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 2150976788762877156, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x21b0e4dc76491ca3c31f9d926b8b6afaaa84f2370fba645a6884a602b8b46efc", + "Nonce": 4, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 86, + "From": "0xce237f7fb5aebf96972780f6e79a0db11f50fbfc", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 16578017150183975, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x515db3b4bab7fa0788df13f8eb913a4034cb0fcb37f2d4f42d28907666b694cf", + "Nonce": 22, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 87, + "From": "0x86ef12fbece63a18d80f2eabd81a4706d7e35071", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 42529768051405192, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xe0ecbb0f7c5b2fcfca8c91a5a3346a3aad979f79c5ebf40d842cc1960dec42f5", + "Nonce": 83, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 88, + "From": "0x2b992826fe89d44fc7f07b9f8c00ed8044232a47", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 8411773680572080, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xb1c99449c28e8ec77d2b702867c1eb9a5ab14dca6b33101a412c0e935a241bdc", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 89, + "From": "0x9122ab4d401274136117d6d5636d40edbb235b4f", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 3999077726144250130, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xbe84ac778a8918852741f26b0254c280c7a0f7fc2e5ebaebebccf0b8c0ae71ac", + "Nonce": 12, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 90, + "From": "0xc87785da0dd6226809e6b715d70710436b9013b5", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 21742364570290170, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xc27253ed1ca9495b9e4057c7b6cdc0ee60306776601d465d2faa0785216cd49a", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 91, + "From": "0xff06ab0d2ff3d7fb0a9bb2fed17404ba90734568", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 26972374121195485, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x0e41f1276c56987ad0b66361614bd066d878de214bb7f08bee818542b5514609", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 92, + "From": "0x30a1344d200e4c0e048d6dba93cc786a867514f8", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 7634516628410000, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xfe945134cad8513e751db4dc712c187f696bdbd2a39ea97f4f79b70cf55379cb", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 93, + "From": "0xb1d24bf0f6d54b8527231a1a1fe812f92523505f", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 7524752371580930, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xe466533d07d274fcbc1205ec840a52a1bed23a9bb66a55e9acca53055b250673", + "Nonce": 6, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 94, + "From": "0xb3568635218c1efac483a1bdec41aed08fc15de5", + "To": "0xa9d1e08c7793af67e9d92fe308d5697fb81d3e43", + "Value": 498828636624236675, + "Gas": 23300, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x215e1cd032cbec84e5549cd955e6d8cf44f483df4f3668f450b00e384068580e", + "Nonce": 960462, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 95, + "From": "0x6081258689a75d253d87ce902a8de3887239fe80", + "To": "0x25a8e4634ab19a6c49d3cf1a0ff1b5e20e3e8834", + "Value": 1760689100000000, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xd5ebb2dbe96fe6d97d344bd70355a756f691f518f14493b33e92738778a7d350", + "Nonce": 6882, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 96, + "From": "0x01b7a710bab5fe81564feed292b631896c7f0a53", + "To": "0x108ab2f19995b00dbc7f279296dd14448da8328d", + "Value": 3573262641172520, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x5b59d52bcd79e4632c22e74b911bc61285d9afe54418563f7b199dafa238c626", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 97, + "From": "0x56fec52ef29ce01b7d29698b96c94e5906a6c69c", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 569988216421831016, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0x2a1113bd1a869f52ec4d1bbcf811b94581a038430b6806e75b8c09f5d14581fd", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 98, + "From": "0x821c0e818ab6fb03f9f54d536c705f554f07b340", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 34633538809596195, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xf64cd1a3890cbf0edcc5f732fd34ff9896d2334282f5f943c5ff4a3d67c853d4", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 99, + "From": "0x2e7bb229a8174f705aefd619fcf4f09f5e32a015", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 5757192435004000, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xc6c44bd646f6882b3921cb1a9480abb30b61e7d0f27be8847cf0e286a4631f7b", + "Nonce": 8, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 100, + "From": "0xf2d3600dbc36a3d5bb8edb497b9d1b5a72040f8b", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 379756371914635899, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xe2cffea80d923c4f28dcc4a8e3e0ed1ea8e9a4f06ab4d6f83df0e51cc82fd2bc", + "Nonce": 12, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 101, + "From": "0x5038ee2d5fd2f0882d93de981e0d1948e925d41f", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 55855263972735000, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xbcd296d46802e367ea89cc8325387cb478e21a6d41e68c3ed71e562a1aa17ef9", + "Nonce": 4, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 102, + "From": "0x2a392e4d9612b2dd13bcdead01553bfb2da31e07", + "To": "0x95a9bd206ae52c4ba8eecfc93d18eacdd41c88cc", + "Value": 22022413995598520, + "Gas": 21000, + "GasPrice": 48548888839, + "Input": "0x" + }, + { + "Hash": "0xff4d706971881b6d796b08fc9b483ae0fe7c062a822c365ddd900b5a054e6ac4", + "Nonce": 13, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 103, + "From": "0x6ec5c96b2d142dbe089e0695d855a139129e9ee7", + "To": "0x5a7d87c42bc19993cde05fe9283431af7cb60735", + "Value": 150000000000000000, + "Gas": 21000, + "GasPrice": 48048888839, + "Input": "0x" + }, + { + "Hash": "0x30a61ee639a59645616969912d9a301df1d7d949d9b83d9f1e4cc0bb46088c81", + "Nonce": 39, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 104, + "From": "0x3168c5cb525998fca7780efa73c5769495faa813", + "To": "0x4e69e175f8a21a3ab9e1fa99f36c45734cf8600b", + "Value": 5000000000000000, + "Gas": 21000, + "GasPrice": 48048888839, + "Input": "0x" + }, + { + "Hash": "0x0d7495e7ce3b09aeb56d157e98899bc655f1813a1cd3831870aacbfbff4a04c9", + "Nonce": 15, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 105, + "From": "0x8418a8ed7fa1ded5882cf94aff001c7904a7be5c", + "To": "0xaf5323a542651a844be3b2c0d52e4f0f0dfe086d", + "Value": 1616741584510527773, + "Gas": 21000, + "GasPrice": 48048888839, + "Input": "0x" + }, + { + "Hash": "0x3c005eeaa9e7984f552dab48edcee960bab3a7ad43ce99bd31e935ca7914dc56", + "Nonce": 1013320, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 106, + "From": "0xa4e5961b58dbe487639929643dcb1dc3848daf5e", + "To": "0x61ee5aaced0063c06ded69ce4325af5c571ae752", + "Value": 5424350000000000, + "Gas": 22000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0xd28184c4005790955d76746ba263f058e9cfc1dc25b166befd7d67ce23832a10", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 107, + "From": "0x254493aedff08427c23f1d1b836c6eae8a744461", + "To": "0x077d360f11d220e4d5d831430c81c26c9be7c4a4", + "Value": 28329090000000000, + "Gas": 22000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0xfad63a744af9d33038825461d0f6e84640cbdbfd11cab5b1ef1eb9a88a7f71dc", + "Nonce": 1043002, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 108, + "From": "0x077d360f11d220e4d5d831430c81c26c9be7c4a4", + "To": "0xee9fda27eab28306ac66685a4d4c3a1208d35653", + "Value": 166210860000000000, + "Gas": 60000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0x8d39bd123d74eaccde632fbe78138b4e7f8fe0448a9d980a2513bc94b800035c", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 109, + "From": "0x432b2637e3bbe8333e90e03191664d7547f29d80", + "To": "0x077d360f11d220e4d5d831430c81c26c9be7c4a4", + "Value": 28943990000000000, + "Gas": 22000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0xce377e372d440c9363e481e447afd74afb4fe20a58e6943ceab8d7e944e48e48", + "Nonce": 2004683, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 110, + "From": "0xa7efae728d2936e78bda97dc267687568dd593f3", + "To": "0x68210ab6751e22e6da1ef0f2775e0cf24605f2c0", + "Value": 10300000000000000, + "Gas": 210000, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0x6060290431252299f0b1d6c5cea973963695dbb11f39ceb84f77026c47ca638f", + "Nonce": 1049017, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 111, + "From": "0xf7858da8a6617f7c6d0ff2bcafdb6d2eedf64840", + "To": "0x5615c4420a748dfab816444525c42e712f7c4d21", + "Value": 942231000000000000, + "Gas": 210000, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0x4617b64e1978ae7971848ddab6e96f235345622bd259521d09ee99ca744a127d", + "Nonce": 2, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 112, + "From": "0x5f7feb96ff866ddcf7d8ee66b28871f1471f40cd", + "To": "0x5f6ae08b8aeb7078cf2f96afb089d7c9f51da47d", + "Value": 20000000000000000, + "Gas": 102242, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xfbf3a065ec8501850a1a3e4621c430db75f0546badff8ff2d82330864323eec0", + "Nonce": 889, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 113, + "From": "0x40e4587954c57ade62f3753a970e26eec6330831", + "To": "0xa0c68c638235ee32657e8f720a23cec1bfc77c77", + "Value": 185874839935350428, + "Gas": 111592, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x756305e0f8bbb11ba297dd031ee5cd081cfd09466cb5b9b8c6f2b8e603f50b0e", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 114, + "From": "0x9b05eaf9bcf2140bd28ecdfb9110c541cc7dbf69", + "To": "0xa7606281f7808167b5faf89f4d898685a8b87549", + "Value": 0, + "Gas": 47659, + "GasPrice": 47564242815, + "Input": "0x" + }, + { + "Hash": "0xd1496bdf94edb7b1f6792c9af5505dffeae43906dfc298480df9b88b98770714", + "Nonce": 13, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 115, + "From": "0x40594aee4f3bad820236dfca99b6e1dafa66e45d", + "To": "0xd9a442856c234a39a81a089c06451ebaa4306a72", + "Value": 0, + "Gas": 51760, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x7075039ec476e9be1623f356c2fc4545428e01da851749804b7e74d4c73a53d7", + "Nonce": 128, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 116, + "From": "0x0847cc113a7899eca102964a6be39f3874fdc84e", + "To": "0xff3f8227c3b0241848e1420ec77d61aee2ad5f67", + "Value": 0, + "Gas": 46546, + "GasPrice": 47563634797, + "Input": "0x" + }, + { + "Hash": "0x5c80539bf17c55d82179ce4501ff61215422067c4ba1424c087dfc167e72c1fe", + "Nonce": 3, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 117, + "From": "0x1e601320e64e0edde73e136911fffd04767bddd8", + "To": "0x4c9edd5852cd905f086c759e8383e09bff1e68b3", + "Value": 0, + "Gas": 70464, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x8d897b787c1f419bef334c0947d32c86960bdf6775460faecee751bb38ca5caf", + "Nonce": 807, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 118, + "From": "0x1bccea07ae47ae3c5f8207e253fcf733d19412ed", + "To": "0xfaba6f8e4a5e8ab82f62fe7c39859fa577269be3", + "Value": 0, + "Gas": 46976, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x898b8023a05933eb967f4caeb56b78ff12c162231c0a7368ba8e7bce0580ecf0", + "Nonce": 38, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 119, + "From": "0x7f1652e05388a237a4ff2125c2a5e497ed83ecc4", + "To": "0x72c60bfffef18dca51db32b52b819a951b6ddbed", + "Value": 0, + "Gas": 46957, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x832d821aee6b370c7f7f236d02bdf51301ae3658e21ec85339a7be748d6c4582", + "Nonce": 907, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 120, + "From": "0x0db858b5ea8ce6cb34344d3db780e7bcbc9aa2bf", + "To": "0xfc6ccc11c91577842c4843a335eac4a586ba6ae0", + "Value": 0, + "Gas": 46318, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xec34e6ba055c320d73ef36362fadf8db7842fc2a056673502d863380e026456b", + "Nonce": 238, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 121, + "From": "0x0e19f9d69c46a9f49389d6a427e04c97097f992c", + "To": "0x72c60bfffef18dca51db32b52b819a951b6ddbed", + "Value": 0, + "Gas": 47017, + "GasPrice": 47558888839, + "Input": "0x" + }, + { + "Hash": "0x35e665990950b0355d79be7290c719aeff7cd092dbd64efc5fec49152bb78927", + "Nonce": 123, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 122, + "From": "0x108613c231792bb14f041719ecbf7b18789926ca", + "To": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", + "Value": 0, + "Gas": 426890, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x370d7de27634e11a9365ca1acb5738cbdff2bacc85bc0bbe01493c1952201816", + "Nonce": 38, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 123, + "From": "0x4095e294a12a0d8d98fc602fcd3e0fb3b96c477a", + "To": "0x5e809a85aa182a9921edd10a4163745bb3e36284", + "Value": 10150000000000002, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x446a45102acd665e95de4a498feb9e71a31f843143a687de8878b440878d3a6f", + "Nonce": 224, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 124, + "From": "0xce0135aef6c807f822d5de6ca3ffd6bcc170d941", + "To": "0x58e2cacfa2322acaa56682eeba09a47a028840c8", + "Value": 200000000000000000, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xcee22c01572d92df51e6a3b5022f92a0b458ee4a4f339b7f8e8bb3da3e365265", + "Nonce": 271, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 125, + "From": "0xd435aa3217020db4b9fa3a6ddd7edaadee9cadca", + "To": "0xb2692e4d0a5333d20b08182aefc9a2e956a719c2", + "Value": 29372543721031329, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xb9e70e0882d81f80e9d4f3dd031081598822f77e23d5f18562520b5b11981eb4", + "Nonce": 10379, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 126, + "From": "0x006f0537ed493f7f84340dc6c417a8381c6b1035", + "To": "0x7e8139f246776bcfa2cc9a77111ed98d3a08560e", + "Value": 11407000000000000, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x2d33465c8fd4ea2ce1ce4c0a35a0331e5152f8301a06079e1c2dd9d8e537943d", + "Nonce": 2, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 127, + "From": "0xe06d48db6fe0f6fe53cf6a5ac4705afe27c44489", + "To": "0x2501111b3a5bb30608a06b1b8c182e777f7e6c1a", + "Value": 46739280024215673, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x3991d63319b2e541058ceca5038e755237663cce54979a057354dbd2b97df6b8", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 128, + "From": "0xc318c7f0060447674584ec3c013da9387f6f8f8e", + "To": "0x6507337007e9779cdd49b369108f722cfe5190e5", + "Value": 1000000000000000000, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0x00c7d3846f5d9d1e6e862bcf837107096dd4ab1a43db63082f203437ee24a0a1", + "Nonce": 66, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 129, + "From": "0x2c7a652f55dc40983e914e0fd638479ace6a1f75", + "To": "0x7ef265e7c167891fe20b1bffd0e5076d8484b264", + "Value": 50000000000000000, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532", + "Nonce": 18, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 130, + "From": "0xf829fa7069680b8c37a8086b37d4a24697e5003b", + "To": "0x70e967acfcc17c3941e87562161406d41676fd83", + "Value": 4000000000000000, + "Gas": 21000, + "GasPrice": 47562901998, + "Input": "0x" + }, + { + "Hash": "0xa32fa55ad570ee943de6a69681f85809cff9611bb489dc59620c6c9634278860", + "Nonce": 6, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 131, + "From": "0x1a301f7e9c7f4372cb886dafc32c03505ae8a347", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 5853241671568000, + "Gas": 225269, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x68498ef50ae339f64f587508686d2070beb59a4fd704824abefbb3b846692bfe", + "Nonce": 36, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 132, + "From": "0xd9026bf9bccf9865c1b7ef3890e88141adc96b04", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 58663498837720000, + "Gas": 153186, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0xac5f5cbe533cd6d42f4562f08aa306ce0433ab4e6df5ea4356d09eef65efdc78", + "Nonce": 95, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 133, + "From": "0xbf0ecd6003e6fe86254b4e432578e47fbffd0c79", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 24052034523465200, + "Gas": 156789, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x29bd93d2ee05bd9e2abfe0b4fd52e5374516e64665b4560966b013495f335bd5", + "Nonce": 46, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 134, + "From": "0x65327701f0fde489341e7825d42ab727ba24a141", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 14665874709430000, + "Gas": 151857, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0xcd576979151ddf22017c3ed40169c41b08057ee34853e790c78e0503599ffb66", + "Nonce": 27, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 135, + "From": "0xd437ab1447edfe0cd8d3b6427efd7b29216c557d", + "To": "0x5946aeaab44e65eb370ffaa6a7ef2218cff9b47d", + "Value": 0, + "Gas": 76658, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x2352fddc3824473acdc0cb61256fb56c32db0fd1db41244b42b4ad1bb7d7dadc", + "Nonce": 17332, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 136, + "From": "0xa0d55532fa467db182780b6adaf34817ee99054d", + "To": "0x5db209f7f4cbd7011b486b8d99e5ae616947a138", + "Value": 0, + "Gas": 181540, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x9ae881cb9e534096347f0a937a16342fb6626885dd385f55f64f461a9913b3cb", + "Nonce": 349, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 137, + "From": "0xeb85679cdf6182f3531e6bd260acaabc84945837", + "To": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "Value": 0, + "Gas": 39792, + "GasPrice": 47549888842, + "Input": "0x" + }, + { + "Hash": "0x1ef9ed16e2e0b41ab18042a4bdaeaf726a71776687a0c242577146e21c62514c", + "Nonce": 22337, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 138, + "From": "0x42f5e0a60685a75b4a63bb2bb971193fd23f5869", + "To": "0x42f5e0a60685a75b4a63bb2bb971193fd23f5869", + "Value": 0, + "Gas": 400000, + "GasPrice": 47549998839, + "Input": "0x" + }, + { + "Hash": "0x24177294b901a1b673a6df33837e2b0006190bff20f9392c836b8ca46e26d052", + "Nonce": 0, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 139, + "From": "0xba8e558bd0677ac300489420138785cc3a37a223", + "To": "0x13e0a14da2ff4e2aa3c911c485ef56d29cbd7e1c", + "Value": 5866349883772000, + "Gas": 21000, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0xfb04f84490fd405f0150eccda7080425d9196a65d71a46574aa88cebe235f146", + "Nonce": 1, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 140, + "From": "0x31524adb04b2482291a0ffe376ff5c60dc16ab7e", + "To": "0x4908fd52a3fd7344675abf143f3922bb7b26a77c", + "Value": 1975540117349000, + "Gas": 21000, + "GasPrice": 47549888839, + "Input": "0x" + }, + { + "Hash": "0x18ad5408e52be20570b1f4ec929425f3f09d7ea8231e5dda5407defa11916997", + "Nonce": 29403, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 141, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x0800394f6e23dd539929c8b77a3d45c96f76aefc", + "Value": 0, + "Gas": 50456, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x8b21c64aa243aeaaabcc0810a837099c0ba65b33cffa0e7d232191717c094898", + "Nonce": 29404, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 142, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x0c572544a4ee47904d54aaa6a970af96b6f00e1b", + "Value": 0, + "Gas": 59302, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0xe6a766bff4149b232e7b86cdb49d21d81d5dee485642f241f1315be86e19adf1", + "Nonce": 29405, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 143, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x26c8afbbfe1ebaca03c2bb082e69d0476bffe099", + "Value": 0, + "Gas": 50847, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0xe482f176072f558851718fb8c53e8165d2e5b7f37da8bd38d9d7066e4850d531", + "Nonce": 29406, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 144, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x34be5b8c30ee4fde069dc878989686abe9884470", + "Value": 0, + "Gas": 50683, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x92295ce76ba313185935046487d1a324c5e35ee35e4b3130ccb499b0f31ef57e", + "Nonce": 29407, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 145, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x38e382f74dfb84608f3c1f10187f6bef5951de93", + "Value": 0, + "Gas": 50456, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x26adefddd3ce81f98b531a485703b22111945b95947d45f5ba4b578c595aa0be", + "Nonce": 29408, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 146, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x41545f8b9472d758bb669ed8eaeeecd7a9c4ec29", + "Value": 0, + "Gas": 62306, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x9fc91528d534ce6d97fd06216334f91c4555ccbb39fe1dfcbe3dfaf1ad76caaa", + "Nonce": 29409, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 147, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x42baf1f659d765c65ade5bb7e08eb2c680360d9d", + "Value": 0, + "Gas": 74354, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0xe7825e407a5e4bac4ccbfee2650b1c7450fb2e52b14a7763a442123a48ee1ce7", + "Nonce": 29410, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 148, + "From": "0x13307b8854a95946b54a904100afd0767a7a577b", + "To": "0x476c5e26a75bd202a9683ffd34359c0cc15be0ff", + "Value": 0, + "Gas": 52932, + "GasPrice": 49048888839, + "Input": "0x" + }, + { + "Hash": "0x6f58d988f08ab702a26a9956a42d6ad13292f6a806ad457b5446ac8efef565f9", + "Nonce": 1043003, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 149, + "From": "0x077d360f11d220e4d5d831430c81c26c9be7c4a4", + "To": "0xefa63e9b5177fbafb2e587ab9d12fdf37870922a", + "Value": 164375120000000000, + "Gas": 60000, + "GasPrice": 49000000000, + "Input": "0x" + }, + { + "Hash": "0x17c01eaedf2642baa1ca4350378d56fbbc7a7315171d10a2cefb72bba8848ec8", + "Nonce": 1043004, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 150, + "From": "0x077d360f11d220e4d5d831430c81c26c9be7c4a4", + "To": "0x21d688bf078f68ee2f9e6b52817d9e2a8469998f", + "Value": 38413030000000000, + "Gas": 60000, + "GasPrice": 49000000000, + "Input": "0x" + }, + { + "Hash": "0xfe58a80dd77a06efdf25fbb4529ce7c6f4343e200704a88d6e288b832f526d5c", + "Nonce": 1013321, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 151, + "From": "0xa4e5961b58dbe487639929643dcb1dc3848daf5e", + "To": "0x839a35b9468007d8cb3a5bc9af31ead7242b916e", + "Value": 5424350000000000, + "Gas": 22000, + "GasPrice": 48000000000, + "Input": "0x" + }, + { + "Hash": "0x2e0ac6c2af639e879774284835b815b051de19c36cfaa3153e558e88bcf5db95", + "Nonce": 19, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 152, + "From": "0xbde1f1dac1e001a272cb083962179d8a152c551b", + "To": "0x1111111254eeb25477b68fb85ed929f73a960582", + "Value": 0, + "Gas": 275732, + "GasPrice": 47598888839, + "Input": "0x" + }, + { + "Hash": "0xb8a3727333b506b64769aed2e9b0e7c29637a8c333744e8f159abae458e33d3c", + "Nonce": 18945, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 153, + "From": "0x22a82147a80747cfb1562e0f72f6be39f18b5f76", + "To": "0x40864568f679c10ac9e72211500096a5130770fa", + "Value": 0, + "Gas": 11000000, + "GasPrice": 47648888839, + "Input": "0x" + }, + { + "Hash": "0x076b0ef1e4482f2b85f7f6c36152686281041191099bb1597e692ddfe6477b05", + "Nonce": 7, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 154, + "From": "0x10ee730e8c4f19dce08d4548b3de8045e8b87e9f", + "To": "0xdef1c0ded9bec7f1a1670819833240f027b25eff", + "Value": 0, + "Gas": 161459, + "GasPrice": 47628888839, + "Input": "0x" + }, + { + "Hash": "0xef85516883c377de4a7671d372b0e5d7721af7a9bb6e42ba97a0c88d3db58720", + "Nonce": 224600, + "BlockHash": "0x5f30ff0388dff58fd28c666b6eecdd7642c9b1adfbd943caeb2ae7a6d8ce9eba", + "BlockNumber": 19330473, + "TransactionIndex": 155, + "From": "0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97", + "To": "0x388c818ca8b9251b393131c08a736a67ccb19297", + "Value": 81116746339497983, + "Gas": 22111, + "GasPrice": 47548888839, + "Input": "0x" + } + ] +} diff --git a/zetaclient/testutils/stub/core_bridge.go b/zetaclient/testutils/stub/core_bridge.go index 1bf06be84b..d9172636c3 100644 --- a/zetaclient/testutils/stub/core_bridge.go +++ b/zetaclient/testutils/stub/core_bridge.go @@ -1,6 +1,7 @@ package stub import ( + "errors" "math/big" "cosmossdk.io/math" @@ -14,118 +15,189 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/testutils" ) -var _ interfaces.ZetaCoreBridger = &ZetaCoreBridge{} +const ErrMsgPaused = "zeta core bridge is paused" -type ZetaCoreBridge struct { +var _ interfaces.ZetaCoreBridger = &MockZetaCoreBridge{} + +type MockZetaCoreBridge struct { + paused bool zetaChain common.Chain } -func (z ZetaCoreBridge) PostVoteInbound(_, _ uint64, _ *cctxtypes.MsgVoteOnObservedInboundTx) (string, string, error) { +func NewMockZetaCoreBridge() *MockZetaCoreBridge { + zetaChain, err := common.ZetaChainFromChainID("zetachain_7000-1") + if err != nil { + panic(err) + } + return &MockZetaCoreBridge{ + paused: false, + zetaChain: zetaChain, + } +} + +func (z *MockZetaCoreBridge) PostVoteInbound(_, _ uint64, _ *cctxtypes.MsgVoteOnObservedInboundTx) (string, string, error) { + if z.paused { + return "", "", errors.New(ErrMsgPaused) + } return "", "", nil } -func (z ZetaCoreBridge) PostVoteOutbound(_ string, _ string, _ uint64, _ uint64, _ *big.Int, _ uint64, _ *big.Int, _ common.ReceiveStatus, _ common.Chain, _ uint64, _ common.CoinType) (string, string, error) { +func (z *MockZetaCoreBridge) PostVoteOutbound(_ string, _ string, _ uint64, _ uint64, _ *big.Int, _ uint64, _ *big.Int, _ common.ReceiveStatus, _ common.Chain, _ uint64, _ common.CoinType) (string, string, error) { + if z.paused { + return "", "", errors.New(ErrMsgPaused) + } return "", "", nil } -func (z ZetaCoreBridge) PostGasPrice(_ common.Chain, _ uint64, _ string, _ uint64) (string, error) { +func (z *MockZetaCoreBridge) PostGasPrice(_ common.Chain, _ uint64, _ string, _ uint64) (string, error) { + if z.paused { + return "", errors.New(ErrMsgPaused) + } return "", nil } -func (z ZetaCoreBridge) PostAddBlockHeader(_ int64, _ []byte, _ int64, _ common.HeaderData) (string, error) { +func (z *MockZetaCoreBridge) PostAddBlockHeader(_ int64, _ []byte, _ int64, _ common.HeaderData) (string, error) { + if z.paused { + return "", errors.New(ErrMsgPaused) + } return "", nil } -func (z ZetaCoreBridge) GetBlockHeaderStateByChain(_ int64) (observerTypes.QueryGetBlockHeaderStateResponse, error) { +func (z *MockZetaCoreBridge) GetBlockHeaderStateByChain(_ int64) (observerTypes.QueryGetBlockHeaderStateResponse, error) { + if z.paused { + return observerTypes.QueryGetBlockHeaderStateResponse{}, errors.New(ErrMsgPaused) + } return observerTypes.QueryGetBlockHeaderStateResponse{}, nil } -func (z ZetaCoreBridge) PostBlameData(_ *blame.Blame, _ int64, _ string) (string, error) { +func (z *MockZetaCoreBridge) PostBlameData(_ *blame.Blame, _ int64, _ string) (string, error) { + if z.paused { + return "", errors.New(ErrMsgPaused) + } return "", nil } -func (z ZetaCoreBridge) AddTxHashToOutTxTracker(_ int64, _ uint64, _ string, _ *common.Proof, _ string, _ int64) (string, error) { +func (z *MockZetaCoreBridge) AddTxHashToOutTxTracker(_ int64, _ uint64, _ string, _ *common.Proof, _ string, _ int64) (string, error) { + if z.paused { + return "", errors.New(ErrMsgPaused) + } return "", nil } -func (z ZetaCoreBridge) GetKeys() *keys.Keys { +func (z *MockZetaCoreBridge) GetKeys() *keys.Keys { return &keys.Keys{} } -func (z ZetaCoreBridge) GetBlockHeight() (int64, error) { +func (z *MockZetaCoreBridge) GetBlockHeight() (int64, error) { + if z.paused { + return 0, errors.New(ErrMsgPaused) + } return 0, nil } -func (z ZetaCoreBridge) GetZetaBlockHeight() (int64, error) { +func (z *MockZetaCoreBridge) GetZetaBlockHeight() (int64, error) { + if z.paused { + return 0, errors.New(ErrMsgPaused) + } return 0, nil } -func (z ZetaCoreBridge) GetLastBlockHeightByChain(_ common.Chain) (*cctxtypes.LastBlockHeight, error) { +func (z *MockZetaCoreBridge) GetLastBlockHeightByChain(_ common.Chain) (*cctxtypes.LastBlockHeight, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return &cctxtypes.LastBlockHeight{}, nil } -func (z ZetaCoreBridge) ListPendingCctx(_ int64) ([]*cctxtypes.CrossChainTx, uint64, error) { +func (z *MockZetaCoreBridge) ListPendingCctx(_ int64) ([]*cctxtypes.CrossChainTx, uint64, error) { + if z.paused { + return nil, 0, errors.New(ErrMsgPaused) + } return []*cctxtypes.CrossChainTx{}, 0, nil } -func (z ZetaCoreBridge) GetPendingNoncesByChain(_ int64) (observerTypes.PendingNonces, error) { +func (z *MockZetaCoreBridge) GetPendingNoncesByChain(_ int64) (observerTypes.PendingNonces, error) { + if z.paused { + return observerTypes.PendingNonces{}, errors.New(ErrMsgPaused) + } return observerTypes.PendingNonces{}, nil } -func (z ZetaCoreBridge) GetCctxByNonce(_ int64, _ uint64) (*cctxtypes.CrossChainTx, error) { +func (z *MockZetaCoreBridge) GetCctxByNonce(_ int64, _ uint64) (*cctxtypes.CrossChainTx, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return &cctxtypes.CrossChainTx{}, nil } -func (z ZetaCoreBridge) GetOutTxTracker(_ common.Chain, _ uint64) (*cctxtypes.OutTxTracker, error) { +func (z *MockZetaCoreBridge) GetOutTxTracker(_ common.Chain, _ uint64) (*cctxtypes.OutTxTracker, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return &cctxtypes.OutTxTracker{}, nil } -func (z ZetaCoreBridge) GetAllOutTxTrackerByChain(_ int64, _ interfaces.Order) ([]cctxtypes.OutTxTracker, error) { +func (z *MockZetaCoreBridge) GetAllOutTxTrackerByChain(_ int64, _ interfaces.Order) ([]cctxtypes.OutTxTracker, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return []cctxtypes.OutTxTracker{}, nil } -func (z ZetaCoreBridge) GetCrosschainFlags() (observerTypes.CrosschainFlags, error) { +func (z *MockZetaCoreBridge) GetCrosschainFlags() (observerTypes.CrosschainFlags, error) { + if z.paused { + return observerTypes.CrosschainFlags{}, errors.New(ErrMsgPaused) + } return observerTypes.CrosschainFlags{}, nil } -func (z ZetaCoreBridge) GetObserverList() ([]string, error) { +func (z *MockZetaCoreBridge) GetObserverList() ([]string, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return []string{}, nil } -func (z ZetaCoreBridge) GetKeyGen() (*observerTypes.Keygen, error) { +func (z *MockZetaCoreBridge) GetKeyGen() (*observerTypes.Keygen, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return &observerTypes.Keygen{}, nil } -func (z ZetaCoreBridge) GetBtcTssAddress(_ int64) (string, error) { +func (z *MockZetaCoreBridge) GetBtcTssAddress(_ int64) (string, error) { + if z.paused { + return "", errors.New(ErrMsgPaused) + } return testutils.TSSAddressBTCMainnet, nil } -func (z ZetaCoreBridge) GetInboundTrackersForChain(_ int64) ([]cctxtypes.InTxTracker, error) { +func (z *MockZetaCoreBridge) GetInboundTrackersForChain(_ int64) ([]cctxtypes.InTxTracker, error) { + if z.paused { + return nil, errors.New(ErrMsgPaused) + } return []cctxtypes.InTxTracker{}, nil } -func (z ZetaCoreBridge) GetLogger() *zerolog.Logger { +func (z *MockZetaCoreBridge) GetLogger() *zerolog.Logger { return nil } -func (z ZetaCoreBridge) ZetaChain() common.Chain { +func (z *MockZetaCoreBridge) ZetaChain() common.Chain { return z.zetaChain } -func (z ZetaCoreBridge) Pause() { -} - -func (z ZetaCoreBridge) Unpause() { +func (z *MockZetaCoreBridge) Pause() { + z.paused = true } -func (z ZetaCoreBridge) GetZetaHotKeyBalance() (math.Int, error) { - return math.NewInt(0), nil +func (z *MockZetaCoreBridge) Unpause() { + z.paused = false } -func NewZetaCoreBridge() *ZetaCoreBridge { - zetaChain, err := common.ZetaChainFromChainID("zetachain_7000-1") - if err != nil { - panic(err) +func (z *MockZetaCoreBridge) GetZetaHotKeyBalance() (math.Int, error) { + if z.paused { + return math.NewInt(0), errors.New(ErrMsgPaused) } - return &ZetaCoreBridge{zetaChain: zetaChain} + return math.NewInt(0), nil } diff --git a/zetaclient/testutils/stub/evm_json_rpc.go b/zetaclient/testutils/stub/evm_json_rpc.go new file mode 100644 index 0000000000..cd80966660 --- /dev/null +++ b/zetaclient/testutils/stub/evm_json_rpc.go @@ -0,0 +1,75 @@ +package stub + +import ( + "errors" + + "github.com/onrik/ethrpc" + "github.com/zeta-chain/zetacore/zetaclient/interfaces" +) + +// EvmClient interface +var _ interfaces.EVMJSONRPCClient = &MockJSONRPCClient{} + +// MockJSONRPCClient is a mock implementation of the EVMJSONRPCClient interface +type MockJSONRPCClient struct { + Blocks []*ethrpc.Block + Transactions []*ethrpc.Transaction +} + +// NewMockJSONRPCClient creates a new mock JSON RPC client +func NewMockJSONRPCClient() *MockJSONRPCClient { + client := &MockJSONRPCClient{} + return client.Reset() +} + +// EthGetBlockByNumber returns a pre-loaded block or nil +func (e *MockJSONRPCClient) EthGetBlockByNumber(_ int, _ bool) (*ethrpc.Block, error) { + // pop a block from the list + if len(e.Blocks) > 0 { + block := e.Blocks[len(e.Blocks)-1] + e.Blocks = e.Blocks[:len(e.Blocks)-1] + return block, nil + } + return nil, errors.New("no block found") +} + +// EthGetTransactionByHash returns a pre-loaded transaction or nil +func (e *MockJSONRPCClient) EthGetTransactionByHash(_ string) (*ethrpc.Transaction, error) { + // pop a transaction from the list + if len(e.Transactions) > 0 { + tx := e.Transactions[len(e.Transactions)-1] + e.Transactions = e.Transactions[:len(e.Transactions)-1] + return tx, nil + } + return nil, errors.New("no transaction found") +} + +// Reset clears the mock data +func (e *MockJSONRPCClient) Reset() *MockJSONRPCClient { + e.Blocks = []*ethrpc.Block{} + e.Transactions = []*ethrpc.Transaction{} + return e +} + +// ---------------------------------------------------------------------------- +// Feed data to the mock JSON RPC client for testing +// ---------------------------------------------------------------------------- +func (e *MockJSONRPCClient) WithBlock(block *ethrpc.Block) *MockJSONRPCClient { + e.Blocks = append(e.Blocks, block) + return e +} + +func (e *MockJSONRPCClient) WithBlocks(blocks []*ethrpc.Block) *MockJSONRPCClient { + e.Blocks = append(e.Blocks, blocks...) + return e +} + +func (e *MockJSONRPCClient) WithTransaction(tx *ethrpc.Transaction) *MockJSONRPCClient { + e.Transactions = append(e.Transactions, tx) + return e +} + +func (e *MockJSONRPCClient) WithTransactions(txs []*ethrpc.Transaction) *MockJSONRPCClient { + e.Transactions = append(e.Transactions, txs...) + return e +} diff --git a/zetaclient/testutils/stub/evm_rpc.go b/zetaclient/testutils/stub/evm_rpc.go index 05f14fc59b..dd1fd5fedf 100644 --- a/zetaclient/testutils/stub/evm_rpc.go +++ b/zetaclient/testutils/stub/evm_rpc.go @@ -1,6 +1,7 @@ package stub import ( + "errors" "math/big" "github.com/ethereum/go-ethereum" @@ -26,73 +27,103 @@ func (s subscription) Err() <-chan error { } // EvmClient interface -var _ interfaces.EVMRPCClient = EvmClient{} +var _ interfaces.EVMRPCClient = &MockEvmClient{} -type EvmClient struct { +type MockEvmClient struct { + Receipts []*ethtypes.Receipt } -func (e EvmClient) SubscribeFilterLogs(_ context.Context, _ ethereum.FilterQuery, _ chan<- ethtypes.Log) (ethereum.Subscription, error) { +func NewMockEvmClient() *MockEvmClient { + client := &MockEvmClient{} + return client.Reset() +} + +func (e *MockEvmClient) SubscribeFilterLogs(_ context.Context, _ ethereum.FilterQuery, _ chan<- ethtypes.Log) (ethereum.Subscription, error) { return subscription{}, nil } -func (e EvmClient) CodeAt(_ context.Context, _ ethcommon.Address, _ *big.Int) ([]byte, error) { +func (e *MockEvmClient) CodeAt(_ context.Context, _ ethcommon.Address, _ *big.Int) ([]byte, error) { return []byte{}, nil } -func (e EvmClient) CallContract(_ context.Context, _ ethereum.CallMsg, _ *big.Int) ([]byte, error) { +func (e *MockEvmClient) CallContract(_ context.Context, _ ethereum.CallMsg, _ *big.Int) ([]byte, error) { return []byte{}, nil } -func (e EvmClient) HeaderByNumber(_ context.Context, _ *big.Int) (*ethtypes.Header, error) { +func (e *MockEvmClient) HeaderByNumber(_ context.Context, _ *big.Int) (*ethtypes.Header, error) { return ðtypes.Header{}, nil } -func (e EvmClient) PendingCodeAt(_ context.Context, _ ethcommon.Address) ([]byte, error) { +func (e *MockEvmClient) PendingCodeAt(_ context.Context, _ ethcommon.Address) ([]byte, error) { return []byte{}, nil } -func (e EvmClient) PendingNonceAt(_ context.Context, _ ethcommon.Address) (uint64, error) { +func (e *MockEvmClient) PendingNonceAt(_ context.Context, _ ethcommon.Address) (uint64, error) { return 0, nil } -func (e EvmClient) SuggestGasPrice(_ context.Context) (*big.Int, error) { +func (e *MockEvmClient) SuggestGasPrice(_ context.Context) (*big.Int, error) { return big.NewInt(0), nil } -func (e EvmClient) SuggestGasTipCap(_ context.Context) (*big.Int, error) { +func (e *MockEvmClient) SuggestGasTipCap(_ context.Context) (*big.Int, error) { return big.NewInt(0), nil } -func (e EvmClient) EstimateGas(_ context.Context, _ ethereum.CallMsg) (gas uint64, err error) { +func (e *MockEvmClient) EstimateGas(_ context.Context, _ ethereum.CallMsg) (gas uint64, err error) { gas = 0 err = nil return } -func (e EvmClient) SendTransaction(_ context.Context, _ *ethtypes.Transaction) error { +func (e *MockEvmClient) SendTransaction(_ context.Context, _ *ethtypes.Transaction) error { return nil } -func (e EvmClient) FilterLogs(_ context.Context, _ ethereum.FilterQuery) ([]ethtypes.Log, error) { +func (e *MockEvmClient) FilterLogs(_ context.Context, _ ethereum.FilterQuery) ([]ethtypes.Log, error) { return []ethtypes.Log{}, nil } -func (e EvmClient) BlockNumber(_ context.Context) (uint64, error) { +func (e *MockEvmClient) BlockNumber(_ context.Context) (uint64, error) { return 0, nil } -func (e EvmClient) BlockByNumber(_ context.Context, _ *big.Int) (*ethtypes.Block, error) { +func (e *MockEvmClient) BlockByNumber(_ context.Context, _ *big.Int) (*ethtypes.Block, error) { return ðtypes.Block{}, nil } -func (e EvmClient) TransactionByHash(_ context.Context, _ ethcommon.Hash) (tx *ethtypes.Transaction, isPending bool, err error) { +func (e *MockEvmClient) TransactionByHash(_ context.Context, _ ethcommon.Hash) (tx *ethtypes.Transaction, isPending bool, err error) { return ðtypes.Transaction{}, false, nil } -func (e EvmClient) TransactionReceipt(_ context.Context, _ ethcommon.Hash) (*ethtypes.Receipt, error) { - return ðtypes.Receipt{}, nil +func (e *MockEvmClient) TransactionReceipt(_ context.Context, _ ethcommon.Hash) (*ethtypes.Receipt, error) { + // pop a receipt from the list + if len(e.Receipts) > 0 { + receipt := e.Receipts[len(e.Receipts)-1] + e.Receipts = e.Receipts[:len(e.Receipts)-1] + return receipt, nil + } + return nil, errors.New("no receipt found") } -func (e EvmClient) TransactionSender(_ context.Context, _ *ethtypes.Transaction, _ ethcommon.Hash, _ uint) (ethcommon.Address, error) { +func (e *MockEvmClient) TransactionSender(_ context.Context, _ *ethtypes.Transaction, _ ethcommon.Hash, _ uint) (ethcommon.Address, error) { return ethcommon.Address{}, nil } + +func (e *MockEvmClient) Reset() *MockEvmClient { + e.Receipts = []*ethtypes.Receipt{} + return e +} + +// ---------------------------------------------------------------------------- +// Feed data to the mock evm client for testing +// ---------------------------------------------------------------------------- +func (e *MockEvmClient) WithReceipt(receipt *ethtypes.Receipt) *MockEvmClient { + e.Receipts = append(e.Receipts, receipt) + return e +} + +func (e *MockEvmClient) WithReceipts(receipts []*ethtypes.Receipt) *MockEvmClient { + e.Receipts = append(e.Receipts, receipts...) + return e +} diff --git a/zetaclient/zetabridge/zetacore_bridge.go b/zetaclient/zetabridge/zetacore_bridge.go index 9e5a38ca11..babdc505bf 100644 --- a/zetaclient/zetabridge/zetacore_bridge.go +++ b/zetaclient/zetabridge/zetacore_bridge.go @@ -48,11 +48,14 @@ type ZetaCoreBridge struct { } // NewZetaCoreBridge create a new instance of ZetaCoreBridge -func NewZetaCoreBridge(k *keys.Keys, chainIP string, +func NewZetaCoreBridge( + k *keys.Keys, + chainIP string, signerName string, chainID string, hsmMode bool, - telemetry *metrics.TelemetryServer) (*ZetaCoreBridge, error) { + telemetry *metrics.TelemetryServer, +) (*ZetaCoreBridge, error) { // main module logger logger := log.With().Str("module", "CoreBridge").Logger() @@ -205,7 +208,7 @@ func (b *ZetaCoreBridge) UpdateZetaCoreContext(coreContext *corecontext.ZetaCore if plan != nil && bn == plan.Height-1 { // stop zetaclients; notify operator to upgrade and restart b.logger.Warn().Msgf("Active upgrade plan detected and upgrade height reached: %s at height %d; ZetaClient is stopped;"+ "please kill this process, replace zetaclientd binary with upgraded version, and restart zetaclientd", plan.Name, plan.Height) - b.pause <- struct{}{} // notify CoreObserver to stop ChainClients, Signers, and CoreObservder itself + b.pause <- struct{}{} // notify CoreObserver to stop ChainClients, Signers, and CoreObserver itself } chainParams, err := b.GetChainParams() @@ -218,7 +221,7 @@ func (b *ZetaCoreBridge) UpdateZetaCoreContext(coreContext *corecontext.ZetaCore // check and update chain params for each chain for _, chainParam := range chainParams { - err := config.ValidateChainParams(chainParam) + err := observertypes.ValidateChainParams(chainParam) if err != nil { b.logger.Warn().Err(err).Msgf("Invalid chain params for chain %d", chainParam.ChainId) continue diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index 6d3320c746..429c209287 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -168,7 +168,7 @@ func (co *CoreObserver) startCctxScheduler(appContext *appcontext.AppContext) { } // update last processed block number lastBlockNum = bn - co.ts.SetCoreBlockNumber(lastBlockNum) + metrics.LastCoreBlockNumber.Set(float64(lastBlockNum)) } } }