diff --git a/deployments/compose/ganache/docker-compose.yml b/deployments/compose/ganache/docker-compose.yml deleted file mode 100644 index 2541041f20..0000000000 --- a/deployments/compose/ganache/docker-compose.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: "3" - -services: - ganache: - container_name: ganache - image: trufflesuite/ganache:latest - ports: - - "8545:8545" - command: - - --wallet.hdPath - - m/44'/60'/0' - - --wallet.mnemonic - - test test test test test test test test test test test junk - - --chain.chainId - - "5" \ No newline at end of file diff --git a/deployments/compose/hardhat/docker-compose.yml b/deployments/compose/hardhat/docker-compose.yml new file mode 100644 index 0000000000..41cad0c75a --- /dev/null +++ b/deployments/compose/hardhat/docker-compose.yml @@ -0,0 +1,8 @@ +version: "3" + +services: + hardhat: + container_name: hardhat + image: kwildb/hardhat:latest + ports: + - "8545:8545" diff --git a/extensions/listeners/eth_deposits/deposits.go b/extensions/listeners/eth_deposits/deposits.go index 054a373d6e..e9e6a2afbb 100644 --- a/extensions/listeners/eth_deposits/deposits.go +++ b/extensions/listeners/eth_deposits/deposits.go @@ -71,6 +71,7 @@ func Start(ctx context.Context, service *common.Service, eventstore listeners.Ev if err != nil { return fmt.Errorf("failed to get current block height: %w", err) } + service.Logger.S.Infof("ETH best block: %v", currentHeight) if lastHeight > currentHeight-config.RequiredConfirmations { return fmt.Errorf("starting height is greater than the last confirmed eth block height") diff --git a/test/integration/docker-compose.yml.template b/test/integration/docker-compose.yml.template index fd2e746386..de358ab471 100644 --- a/test/integration/docker-compose.yml.template +++ b/test/integration/docker-compose.yml.template @@ -448,19 +448,12 @@ services: --schema-sync-interval 2 # domain should not be changed, and client should use 'domain' value as the provider, otherwise the test will fail - ganache: - image: trufflesuite/ganache:v7.9.2 + hardhat: + image: kwildb/hardhat:latest ports: - "8545" networks: - {{ .Network }} - command: - - --wallet.hdPath - - m/44'/60'/0' - - --wallet.mnemonic - - test test test test test test test test test test test junk - - --chain.chainId - - "5" networks: {{ .Network }}: diff --git a/test/integration/eth-deployer/deployer.go b/test/integration/eth-deployer/deployer.go index c1675cd818..bab78f8e5c 100644 --- a/test/integration/eth-deployer/deployer.go +++ b/test/integration/eth-deployer/deployer.go @@ -59,6 +59,10 @@ func (d *Deployer) Deploy() error { return err } + auth.GasFeeCap = big.NewInt(1e12) + auth.GasTipCap = big.NewInt(1e6) // avoid SuggestGasTipCap + auth.GasLimit = 3_000_000 + tokenAddr, _, tokenInst, err := contracts.DeployERC20(auth, d.ethClient) if err != nil { return err @@ -71,6 +75,10 @@ func (d *Deployer) Deploy() error { return err } + auth.GasFeeCap = big.NewInt(1e12) + auth.GasTipCap = big.NewInt(1e6) // avoid SuggestGasTipCap + auth.GasLimit = 3_000_000 + escrowAddr, _, escrowInst, err := contracts.DeployEscrow(auth, d.ethClient, tokenAddr) if err != nil { return err @@ -174,9 +182,11 @@ func (d *Deployer) prepareTxAuth(ctx context.Context, sender *ecdsa.PrivateKey) } auth.Nonce = big.NewInt(int64(nonce)) - auth.Value = big.NewInt(0) // in wei - auth.GasLimit = uint64(3000000) // in units - auth.GasPrice = gasPrice + auth.Value = big.NewInt(0) // in wei + // auth.GasPrice = gasPrice + auth.GasTipCap = big.NewInt(1e6) // avoid SuggestGasTipCap + auth.GasFeeCap = gasPrice // big.NewInt(1e16) + auth.GasLimit = 3_000_000 return auth, nil } diff --git a/test/integration/helper.go b/test/integration/helper.go index f4fcc88a78..159996e28d 100644 --- a/test/integration/helper.go +++ b/test/integration/helper.go @@ -60,7 +60,7 @@ var logWaitStrategies = map[string]string{ "node4": "finalized block", "node5": "finalized block", "kgw": "KGW Server started", - "ganache": "RPC Listening on 0.0.0.0:8545", + "hardhat": "Started HTTP and WebSocket JSON-RPC server", "pg0": `listening on IPv4 address "0.0.0.0", port 5432`, "pg1": `listening on IPv4 address "0.0.0.0", port 5432`, "pg2": `listening on IPv4 address "0.0.0.0", port 5432`, @@ -86,8 +86,7 @@ type IntTestConfig struct { SchemaFile string DockerComposeFile string DockerComposeOverrideFile string - GanacheComposeFile string - WithGanache bool + WithETHDevNet bool ExposedHTTPPorts bool WaitTimeout time.Duration @@ -230,9 +229,9 @@ func WithNumByzantineExpiryNodes(n int) HelperOpt { } } -func WithGanache() HelperOpt { +func WithETHDevNet() HelperOpt { return func(r *IntHelper) { - r.cfg.WithGanache = true + r.cfg.WithETHDevNet = true } } @@ -259,7 +258,6 @@ func (r *IntHelper) LoadConfig() { AdminRPC: getEnv("KIT_ADMIN_RPC", "unix:///tmp/admin.sock"), DockerComposeFile: getEnv("KIT_DOCKER_COMPOSE_FILE", "./docker-compose.yml"), DockerComposeOverrideFile: getEnv("KIT_DOCKER_COMPOSE_OVERRIDE_FILE", "./docker-compose.override.yml"), - GanacheComposeFile: getEnv("KIT_GANACHE_COMPOSE_FILE", "./ganache-docker-compose.yml"), } waitTimeout := getEnv("KIT_WAIT_TIMEOUT", "20s") @@ -300,7 +298,6 @@ func (r *IntHelper) generateNodeConfig(homeDir string) { RPCProvider: r.ethDeposit.UnexposedChainRPC, ContractAddress: address, // setting values here since we cannot have the defaults, since - // local ganache is a new network StartingHeight: 0, RequiredConfirmations: r.ethDeposit.confirmations, // TODO: remove this from the r.ethDeposit struct. it is not needed ReconnectionInterval: 30, @@ -363,14 +360,14 @@ func fileExists(path string) bool { return !os.IsNotExist(err) } -func (r *IntHelper) RunGanache(ctx context.Context) { - r.RunDockerComposeWithServices(ctx, []string{"ganache"}) +func (r *IntHelper) RunETHDevNet(ctx context.Context) { + r.RunDockerComposeWithServices(ctx, []string{"hardhat"}) // Get the Escrow address and the ChainRPCURL - ctr, ok := r.containers["ganache"] - require.True(r.t, ok, "failed to get container for service ganache") + ctr, ok := r.containers["hardhat"] + require.True(r.t, ok, "failed to get container for hardhat service") - exposedChainRPC, unexposedChainRPC, err := utils.GanacheWSEndpoints(ctr, ctx) - require.NoError(r.t, err, "failed to get ganache endpoints") + exposedChainRPC, unexposedChainRPC, err := utils.ETHDevNetWSEndpoints(ctr, ctx) + require.NoError(r.t, err, "failed to get hardhat endpoints") // Deploy contracts ethDeployer, err := ethdeployer.NewDeployer(exposedChainRPC, r.cfg.CreatorRawPk, 5) @@ -488,7 +485,7 @@ func (r *IntHelper) RunDockerComposeWithServices(ctx context.Context, services [ // Following steps are done: // 1. Create a temporary directory for current test // 2. Prepare files for docker-compose to run -// 3. Run Ganache ahead if required(for the purpose to populate config for eth-deposit) +// 3. Run ETHDevNet ahead if required(for the purpose to populate config for eth-deposit) // 4. Generate node configuration files // 5. Run docker-compose with the given services func (r *IntHelper) Setup(ctx context.Context, services []string) { @@ -508,10 +505,10 @@ func (r *IntHelper) Setup(ctx context.Context, services []string) { r.prepareDockerCompose(ctx, tmpDir) - if r.cfg.WithGanache { + if r.cfg.WithETHDevNet { // NOTE: it's more natural and easier if able to configure oracle // through kwild cli flags - r.RunGanache(ctx) + r.RunETHDevNet(ctx) } r.generateNodeConfig(tmpDir) diff --git a/test/integration/kwild_test.go b/test/integration/kwild_test.go index 991e854308..93aa8afa7e 100644 --- a/test/integration/kwild_test.go +++ b/test/integration/kwild_test.go @@ -311,7 +311,7 @@ func TestKwildEthDepositOracleIntegration(t *testing.T) { integration.WithBlockInterval(time.Second), integration.WithValidators(4), integration.WithNonValidators(0), - integration.WithGanache(), + integration.WithETHDevNet(), integration.WithGas(), integration.WithEthDepositOracle(true), } @@ -368,7 +368,7 @@ func TestKwildEthDepositOracleExpiryIntegration(t *testing.T) { integration.WithValidators(5), integration.WithNonValidators(0), integration.WithGas(), - integration.WithGanache(), + integration.WithETHDevNet(), integration.WithEthDepositOracle(true), integration.WithNumByzantineExpiryNodes(1), // 1 node listens on a different escrow contract and submits votes for events on the byz contract which never gets approved integration.WithVoteExpiry(4), @@ -413,7 +413,7 @@ func TestKwildEthDepositOracleExpiryRefundIntegration(t *testing.T) { integration.WithValidators(5), integration.WithNonValidators(0), integration.WithGas(), - integration.WithGanache(), + integration.WithETHDevNet(), integration.WithEthDepositOracle(true), integration.WithNumByzantineExpiryNodes(2), // 2 nodes listen on different escrow contracts and submits votes for events on the byz contract which never gets approved. integration.WithVoteExpiry(4), @@ -456,7 +456,7 @@ func TestKwildEthDepositOracleValidatorUpdates(t *testing.T) { integration.WithValidators(6), integration.WithNonValidators(0), integration.WithGas(), - integration.WithGanache(), + integration.WithETHDevNet(), integration.WithEthDepositOracle(true), integration.WithNumByzantineExpiryNodes(2), // 2 nodes listen on different escrow contracts and submits votes for events on the byz contract which never gets approved. } @@ -505,7 +505,7 @@ func TestKwildEthDepositFundTransfer(t *testing.T) { integration.WithValidators(4), integration.WithNonValidators(0), integration.WithGas(), - integration.WithGanache(), + integration.WithETHDevNet(), integration.WithEthDepositOracle(true), } diff --git a/test/utils/container.go b/test/utils/container.go index 1f6d3b89f1..5bcac6ad5a 100644 --- a/test/utils/container.go +++ b/test/utils/container.go @@ -48,11 +48,11 @@ func getEndpoints(ctr *testcontainers.DockerContainer, ctx context.Context, return } -func GanacheHTTPEndpoints(ctr *testcontainers.DockerContainer, ctx context.Context) (string, string, error) { +func ETHDevNetHTTPEndpoints(ctr *testcontainers.DockerContainer, ctx context.Context) (string, string, error) { return getEndpoints(ctr, ctx, "8545", "http") } -func GanacheWSEndpoints(ctr *testcontainers.DockerContainer, ctx context.Context) (string, string, error) { +func ETHDevNetWSEndpoints(ctr *testcontainers.DockerContainer, ctx context.Context) (string, string, error) { return getEndpoints(ctr, ctx, "8545", "ws") }