diff --git a/oracle/pkg/node/node.go b/oracle/pkg/node/node.go index 8a5c124d8..43fcf48f8 100644 --- a/oracle/pkg/node/node.go +++ b/oracle/pkg/node/node.go @@ -115,7 +115,7 @@ func NewNode(opts *Options) (*Node, error) { monitorClosed := monitor.Start(ctx) - txnMgr := transactor.NewTransactorWithDefaults( + txnMgr := transactor.NewTransactor( settlementClient, monitor, ) diff --git a/p2p/pkg/node/node.go b/p2p/pkg/node/node.go index 6f9c330b4..68d96ebb1 100644 --- a/p2p/pkg/node/node.go +++ b/p2p/pkg/node/node.go @@ -199,7 +199,7 @@ func NewNode(opts *Options) (*Node, error) { srv.RegisterMetricsCollectors(monitor.Metrics()...) contractsBackend := transactor.NewMetricsWrapper( - transactor.NewTransactorWithDefaults( + transactor.NewTransactor( contractRPC, monitor, ), diff --git a/x/contracts/transactor/transactor.go b/x/contracts/transactor/transactor.go index 3aa8e85aa..b7f2fc1da 100644 --- a/x/contracts/transactor/transactor.go +++ b/x/contracts/transactor/transactor.go @@ -2,10 +2,8 @@ package transactor import ( "context" - "math/big" "time" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -13,8 +11,6 @@ import ( const ( txnRetriesLimit = 3 - defaultGasLimit = 1_000_000 - defaultGasTip = 1_000 ) // Watcher is an interface that is used to manage the lifecycle of a transaction. @@ -41,9 +37,8 @@ type Watcher interface { // of an error, the nonce is put back into the channel so that it can be reused. type Transactor struct { bind.ContractBackend - nonceChan chan uint64 - watcher Watcher - useDefault bool + nonceChan chan uint64 + watcher Watcher } func NewTransactor( @@ -62,15 +57,6 @@ func NewTransactor( } } -func NewTransactorWithDefaults( - backend bind.ContractBackend, - watcher Watcher, -) *Transactor { - t := NewTransactor(backend, watcher) - t.useDefault = true - return t -} - func (t *Transactor) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error) { select { case <-ctx.Done(): @@ -133,17 +119,3 @@ func (t *Transactor) SendTransaction(ctx context.Context, tx *types.Transaction) return nil } - -func (t *Transactor) EstimateGas(ctx context.Context, callMsg ethereum.CallMsg) (gas uint64, err error) { - if t.useDefault { - return defaultGasLimit, nil - } - return t.ContractBackend.EstimateGas(ctx, callMsg) -} - -func (t *Transactor) SuggestGasTipCap(ctx context.Context) (tip *big.Int, err error) { - if t.useDefault { - return big.NewInt(defaultGasTip), nil - } - return t.ContractBackend.SuggestGasTipCap(ctx) -} diff --git a/x/keysigner/keystoresigner.go b/x/keysigner/keystoresigner.go index 74cef2ec8..d0f8aacdc 100644 --- a/x/keysigner/keystoresigner.go +++ b/x/keysigner/keystoresigner.go @@ -77,7 +77,15 @@ func (kss *KeystoreSigner) String() string { } func (kss *KeystoreSigner) GetAuth(chainID *big.Int) (*bind.TransactOpts, error) { - return bind.NewKeyStoreTransactorWithChainID(kss.keystore, kss.account, chainID) + opts, err := bind.NewKeyStoreTransactorWithChainID(kss.keystore, kss.account, chainID) + if err != nil { + return nil, err + } + + opts.GasLimit = 1_000_000 + opts.GasTipCap = big.NewInt(1) + opts.GasFeeCap = big.NewInt(20000000000) + return opts, nil } func (kss *KeystoreSigner) GetAuthWithCtx(ctx context.Context, chainID *big.Int) (*bind.TransactOpts, error) { diff --git a/x/keysigner/privatekeysigner.go b/x/keysigner/privatekeysigner.go index ccbfae319..525524288 100644 --- a/x/keysigner/privatekeysigner.go +++ b/x/keysigner/privatekeysigner.go @@ -59,7 +59,15 @@ func (pks *PrivateKeySigner) GetPrivateKey() (*ecdsa.PrivateKey, error) { } func (pks *PrivateKeySigner) GetAuth(chainID *big.Int) (*bind.TransactOpts, error) { - return bind.NewKeyedTransactorWithChainID(pks.privKey, chainID) + opts, err := bind.NewKeyedTransactorWithChainID(pks.privKey, chainID) + if err != nil { + return nil, err + } + + opts.GasLimit = 1_000_000 + opts.GasTipCap = big.NewInt(1) + opts.GasFeeCap = big.NewInt(20000000000) + return opts, nil } func (pks *PrivateKeySigner) GetAuthWithCtx(ctx context.Context, chainID *big.Int) (*bind.TransactOpts, error) {