diff --git a/client/finalizer/finalizer_client_test_utils.go b/client/finalizer/finalizer_client_test_utils.go index 1d3fad1..4b2afa9 100644 --- a/client/finalizer/finalizer_client_test_utils.go +++ b/client/finalizer/finalizer_client_test_utils.go @@ -145,7 +145,7 @@ type sentTxInfo struct { data []byte } -func (eth *testEthClient) SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, data []byte, _ *config.Gas, _ time.Duration) error { +func (eth *testEthClient) SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, data []byte, _ *config.Gas, _ time.Duration, _ bool) error { eth.mu.Lock() defer eth.mu.Unlock() diff --git a/client/finalizer/relay_client.go b/client/finalizer/relay_client.go index 97bc9cb..32dd9cb 100644 --- a/client/finalizer/relay_client.go +++ b/client/finalizer/relay_client.go @@ -149,7 +149,7 @@ func (r *relayContractClient) SubmitPayloads(ctx context.Context, input []byte, } execStatusChan := shared.ExecuteWithRetryChan(func() (string, error) { - err := r.chainClient.SendRawTx(r.privateKey, r.address, input, r.gasConfig, chain.DefaultTxTimeout) + err := r.chainClient.SendRawTx(r.privateKey, r.address, input, r.gasConfig, chain.DefaultTxTimeout, dryRun) if err != nil { if shared.ExistsAsSubstring(nonFatalRelayErrors, err.Error()) { logger.Debugf("Non fatal error sending relay tx for protocol %d: %v", protocolID, err) diff --git a/client/protocol/protocol_client_test.go b/client/protocol/protocol_client_test.go index afbf18b..3f6956f 100644 --- a/client/protocol/protocol_client_test.go +++ b/client/protocol/protocol_client_test.go @@ -204,7 +204,7 @@ type sentTxInfo struct { } func (c *testChainClient) SendRawTx( - privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, _ *clientConfig.Gas, _ time.Duration, + privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, _ *clientConfig.Gas, _ time.Duration, _ bool, ) error { c.sentTxs = append(c.sentTxs, &sentTxInfo{ privateKey: privateKey, diff --git a/client/protocol/submitter.go b/client/protocol/submitter.go index bb802c4..a46a8c7 100644 --- a/client/protocol/submitter.go +++ b/client/protocol/submitter.go @@ -66,7 +66,7 @@ func (s *SubmitterBase) submit(payload []byte) bool { sendResult := <-shared.ExecuteWithRetryAttempts(func(ri int) (any, error) { gasConfig := gasConfigForAttempt(s.gasConfig, ri) logger.Debugf("[Attempt %d] Submitter %s sending tx with gas config: %+v, timeout: %s", ri, s.name, gasConfig, s.submitTimeout) - err := s.chainClient.SendRawTx(s.submitPrivateKey, s.protocolContext.submitContractAddress, payload, gasConfig, s.submitTimeout) + err := s.chainClient.SendRawTx(s.submitPrivateKey, s.protocolContext.submitContractAddress, payload, gasConfig, s.submitTimeout, true) if err != nil { return nil, errors.Wrap(err, fmt.Sprintf("error sending submit tx for submitter %s tx", s.name)) } diff --git a/utils/chain/client.go b/utils/chain/client.go index 032961b..16183d7 100644 --- a/utils/chain/client.go +++ b/utils/chain/client.go @@ -12,7 +12,7 @@ import ( ) type Client interface { - SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, gasConfig *config.Gas, timeout time.Duration) error + SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, gasConfig *config.Gas, timeout time.Duration, dryRun bool) error } type ClientImpl struct { @@ -20,12 +20,12 @@ type ClientImpl struct { } // SendRawTx sends a transaction with payload signed by privateKey to to address. -func (c ClientImpl) SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, gasConfig *config.Gas, timeout time.Duration) error { +func (c ClientImpl) SendRawTx(privateKey *ecdsa.PrivateKey, to common.Address, payload []byte, gasConfig *config.Gas, timeout time.Duration, dryRun bool) error { switch gasConfig.TxType { case 0: - return SendRawTx(c.EthClient, privateKey, to, payload, true, gasConfig, timeout) + return SendRawTx(c.EthClient, privateKey, to, payload, dryRun, gasConfig, timeout) case 2: - return SendRawType2Tx(c.EthClient, privateKey, to, payload, true, gasConfig, timeout) + return SendRawType2Tx(c.EthClient, privateKey, to, payload, dryRun, gasConfig, timeout) default: return errors.New("unsupported tx type: set TxType to 0 or 2") }