diff --git a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts index 5a82451c0b..371bea2a10 100644 --- a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts +++ b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts @@ -122,7 +122,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { return l2Network.deployments.execute("CrossChainMessenger", { from: l2Accounts.deployer, log: true, - gasLimit: 3_000_000 + gasLimit: 5_000_000 }, "relayMessage", msg); }; diff --git a/go/config/enclave_cli_flags.go b/go/config/enclave_cli_flags.go index fe010a30d9..586a9e7c2a 100644 --- a/go/config/enclave_cli_flags.go +++ b/go/config/enclave_cli_flags.go @@ -55,14 +55,14 @@ var EnclaveFlags = map[string]*flag.TenFlag{ MaxRollupSizeFlag: flag.NewUint64Flag(MaxRollupSizeFlag, 1024*64, "The maximum size a rollup is allowed to reach"), L2BaseFeeFlag: flag.NewUint64Flag(L2BaseFeeFlag, 1, ""), L2CoinbaseFlag: flag.NewStringFlag(L2CoinbaseFlag, "0xd6C9230053f45F873Cb66D8A02439380a37A4fbF", ""), - GasBatchExecutionLimit: flag.NewUint64Flag(GasBatchExecutionLimit, 10_000_000, "Max gas that can be executed in a single batch"), + GasBatchExecutionLimit: flag.NewUint64Flag(GasBatchExecutionLimit, 30_000_000, "Max gas that can be executed in a single batch"), ObscuroGenesisFlag: flag.NewStringFlag(ObscuroGenesisFlag, "", "The json string with the obscuro genesis"), L1ChainIDFlag: flag.NewInt64Flag(L1ChainIDFlag, 1337, "An integer representing the unique chain id of the Ethereum chain used as an L1 (default 1337)"), ObscuroChainIDFlag: flag.NewInt64Flag(ObscuroChainIDFlag, 443, "An integer representing the unique chain id of the Obscuro chain (default 443)"), UseInMemoryDBFlag: flag.NewBoolFlag(UseInMemoryDBFlag, true, "Whether the enclave will use an in-memory DB rather than persist data"), ProfilerEnabledFlag: flag.NewBoolFlag(ProfilerEnabledFlag, false, "Runs a profiler instance (Defaults to false)"), DebugNamespaceEnabledFlag: flag.NewBoolFlag(DebugNamespaceEnabledFlag, false, "Whether the debug namespace is enabled"), - GasLocalExecutionCapFlag: flag.NewUint64Flag(GasLocalExecutionCapFlag, 12_000_000, "Max gas usage when executing local transactions"), + GasLocalExecutionCapFlag: flag.NewUint64Flag(GasLocalExecutionCapFlag, 40_000_000, "Max gas usage when executing local transactions"), } // enclaveRestrictedFlags are the flags that the enclave can receive ONLY over the Ego signed enclave.json diff --git a/integration/common/constants.go b/integration/common/constants.go index 45a1462c5b..c255c7b457 100644 --- a/integration/common/constants.go +++ b/integration/common/constants.go @@ -83,7 +83,7 @@ func DefaultEnclaveConfig() *config.EnclaveConfig { MaxRollupSize: 1024 * 64, GasPaymentAddress: gethcommon.HexToAddress("0xd6C9230053f45F873Cb66D8A02439380a37A4fbF"), BaseFee: new(big.Int).SetUint64(1), - GasLocalExecutionCapFlag: 10_000_000, - GasBatchExecutionLimit: 12_000_000, + GasLocalExecutionCapFlag: 40_000_000, + GasBatchExecutionLimit: 30_000_000, } } diff --git a/integration/eth2network/eth2_network.go b/integration/eth2network/eth2_network.go index bc85341365..9849099730 100644 --- a/integration/eth2network/eth2_network.go +++ b/integration/eth2network/eth2_network.go @@ -18,6 +18,8 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/ten-protocol/go-ten/integration/datagenerator" "golang.org/x/sync/errgroup" + + gethcommon "github.com/ethereum/go-ethereum/common" ) const ( @@ -206,6 +208,10 @@ func (n *Impl) Start() error { startTime := time.Now() var eg errgroup.Group + if err := n.ensureNoDuplicatedNetwork(); err != nil { + return err + } + // initialize the genesis data on the nodes for _, nodeDataDir := range n.dataDirs { dataDir := nodeDataDir @@ -506,6 +512,11 @@ func (n *Impl) waitForMergeEvent(startTime time.Time) error { } fmt.Printf("Reached the merge block after %s\n", time.Since(startTime)) + + if err = n.prefundedBalancesActive(dial); err != nil { + fmt.Printf("Error prefunding accounts %s\n", err.Error()) + return err + } return nil } @@ -589,6 +600,31 @@ func (n *Impl) gethImportEnodes(enodes []string) error { return nil } +func (n *Impl) prefundedBalancesActive(client *ethclient.Client) error { + for _, addr := range n.preFundedMinerAddrs { + balance, err := client.BalanceAt(context.Background(), gethcommon.HexToAddress(addr), nil) + if err != nil { + return fmt.Errorf("unable to check balance for account %s - %w", addr, err) + } + if balance.Cmp(gethcommon.Big0) == 0 { + return fmt.Errorf("unexpected %s balance for account %s", balance.String(), addr) + } + fmt.Printf("Account %s prefunded with %s", addr, balance.String()) + } + + return nil +} + +func (n *Impl) ensureNoDuplicatedNetwork() error { + for nodeIdx, port := range n.gethWSPorts { + _, err := ethclient.Dial(fmt.Sprintf("ws://127.0.0.1:%d", port)) + if err == nil { + return fmt.Errorf("unexpected geth node %d is active before the network is started", nodeIdx) + } + } + return nil +} + func min(a, b int) int { if a < b { return a