From 9f656e9ed8f184dce4f8d41a72c816ef5bfcbc22 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 14 Mar 2024 13:13:31 +0100 Subject: [PATCH] =?UTF-8?q?fix=20a=20situation,=20when=20we=20lose=20trans?= =?UTF-8?q?action=20timeout=20setting=20for=20networks=E2=80=A6=20(#12415)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix a situation, when we lose transaction timeout setting for networks that are not overwritten * add gas limit for Fiji, fix a situation when new networks were ignored * fix lints --- integration-tests/testconfig/default.toml | 1 + integration-tests/testconfig/testconfig.go | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/integration-tests/testconfig/default.toml b/integration-tests/testconfig/default.toml index 06c792be882..1bcb4b3350c 100644 --- a/integration-tests/testconfig/default.toml +++ b/integration-tests/testconfig/default.toml @@ -62,6 +62,7 @@ name = "Fuji" chain_id = "43113" transaction_timeout = "3m" transfer_gas_fee = 21_000 +gas_limit = 8_000_000 # legacy transactions gas_price = 30_000_000_000 # EIP-1559 transactions diff --git a/integration-tests/testconfig/testconfig.go b/integration-tests/testconfig/testconfig.go index c83b67f204b..ee3ce21d3db 100644 --- a/integration-tests/testconfig/testconfig.go +++ b/integration-tests/testconfig/testconfig.go @@ -586,7 +586,7 @@ func handleDefaultConfigOverride(logger zerolog.Logger, filename, configurationN for i, old_network := range oldConfig.Seth.Networks { for _, target_network := range target.Seth.Networks { if old_network.ChainID == target_network.ChainID { - oldConfig.Seth.Networks[i].TxnTimeout = old_network.TxnTimeout + oldConfig.Seth.Networks[i].TxnTimeout = target_network.TxnTimeout } } } @@ -594,14 +594,23 @@ func handleDefaultConfigOverride(logger zerolog.Logger, filename, configurationN // override instead of merging if (newConfig.Seth != nil && len(newConfig.Seth.Networks) > 0) && (oldConfig != nil && oldConfig.Seth != nil && len(oldConfig.Seth.Networks) > 0) { + networksToUse := map[string]*seth.Network{} for i, old_network := range oldConfig.Seth.Networks { for _, new_network := range newConfig.Seth.Networks { if old_network.ChainID == new_network.ChainID { oldConfig.Seth.Networks[i] = new_network + break + } + if _, ok := networksToUse[new_network.ChainID]; !ok { + networksToUse[new_network.ChainID] = new_network } } + networksToUse[old_network.ChainID] = oldConfig.Seth.Networks[i] + } + target.Seth.Networks = []*seth.Network{} + for _, network := range networksToUse { + target.Seth.Networks = append(target.Seth.Networks, network) } - target.Seth.Networks = oldConfig.Seth.Networks } return nil