diff --git a/config/config_test.go b/config/config_test.go index 10f9645d7e..4479f1f96f 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -186,6 +186,14 @@ func Test_Defaults(t *testing.T) { path: "EthTxManager.WaitTxToBeMined", expectedValue: types.NewDuration(2 * time.Minute), }, + { + path: "EthTxManager.WaitTxToBeMined", + expectedValue: types.NewDuration(2 * time.Minute), + }, + { + path: "EthTxManager.ForcedGas", + expectedValue: uint64(0), + }, { path: "PriceGetter.Type", expectedValue: pricegetter.DefaultType, diff --git a/config/default.go b/config/default.go index 6eb76954b6..873a821d10 100644 --- a/config/default.go +++ b/config/default.go @@ -43,6 +43,7 @@ MultiGasProvider = true [EthTxManager] FrequencyToMonitorTxs = "1s" WaitTxToBeMined = "2m" +ForcedGas = 0 [RPC] Host = "0.0.0.0" diff --git a/config/environments/local/local.node.config.toml b/config/environments/local/local.node.config.toml index ee8444a879..89d714b36e 100644 --- a/config/environments/local/local.node.config.toml +++ b/config/environments/local/local.node.config.toml @@ -108,6 +108,7 @@ CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" [EthTxManager] +ForcedGas = 0 PrivateKeys = [ {Path = "/pk/sequencer.keystore", Password = "testonly"}, {Path = "/pk/aggregator.keystore", Password = "testonly"} diff --git a/etherman/etherman.go b/etherman/etherman.go index 9b693f5dee..bb647832d4 100644 --- a/etherman/etherman.go +++ b/etherman/etherman.go @@ -464,12 +464,10 @@ func (etherMan *Client) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVe var newStateRoot [32]byte copy(newStateRoot[:], inputs.NewStateRoot) - log.Info("Proof before trim: ", inputs.FinalProof.Proof) proof, err := encoding.DecodeBytes(&inputs.FinalProof.Proof) if err != nil { return nil, nil, fmt.Errorf("failed to decode proof, err: %w", err) } - log.Info("Proof after trim: %v", common.Bytes2Hex(proof)) const pendStateNum = 0 // TODO hardcoded for now until we implement the pending state feature diff --git a/ethtxmanager/config.go b/ethtxmanager/config.go index 8fd023236c..3bf486bc04 100644 --- a/ethtxmanager/config.go +++ b/ethtxmanager/config.go @@ -12,4 +12,7 @@ type Config struct { // PrivateKeys defines all the key store files that are going // to be read in order to provide the private keys to sign the L1 txs PrivateKeys []types.KeystoreFileConfig `mapstructure:"PrivateKeys"` + + // ForcedGas is the amount of gas to be forced in case of gas estimation error + ForcedGas uint64 `mapstructure:"ForcedGas"` } diff --git a/ethtxmanager/ethtxmanager.go b/ethtxmanager/ethtxmanager.go index acf3a65779..0abc5e4b15 100644 --- a/ethtxmanager/ethtxmanager.go +++ b/ethtxmanager/ethtxmanager.go @@ -70,11 +70,13 @@ func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, // get gas gas, err := c.etherman.EstimateGas(ctx, from, to, value, data) if err != nil { - cad := common.Bytes2Hex(data) - err := fmt.Errorf("failed to estimate gas: %w, data: %v", err, cad) - log.Errorf(err.Error()) - gas = 1000000 - // return err + err := fmt.Errorf("failed to estimate gas: %w, data: %v", err, common.Bytes2Hex(data)) + log.Error(err.Error()) + if c.cfg.ForcedGas > 0 { + gas = c.cfg.ForcedGas + } else { + return err + } } // get gas price gasPrice, err := c.etherman.SuggestedGasPrice(ctx) diff --git a/test/config/debug.node.config.toml b/test/config/debug.node.config.toml index 4534ed187e..bd408d01ea 100644 --- a/test/config/debug.node.config.toml +++ b/test/config/debug.node.config.toml @@ -108,6 +108,7 @@ CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" [EthTxManager] +ForcedGas = 0 PrivateKeys = [ {Path = "../test/sequencer.keystore", Password = "testonly"}, {Path = "../test/aggregator.keystore", Password = "testonly"} diff --git a/test/config/test.node.config.toml b/test/config/test.node.config.toml index 2d24d31d5e..286cc783cd 100644 --- a/test/config/test.node.config.toml +++ b/test/config/test.node.config.toml @@ -108,6 +108,7 @@ CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" [EthTxManager] +ForcedGas = 0 PrivateKeys = [ {Path = "/pk/sequencer.keystore", Password = "testonly"}, {Path = "/pk/aggregator.keystore", Password = "testonly"}