Skip to content

Commit 26acea0

Browse files
authored
Timeout for waitForTransaction (#1545)
1 parent 40c8084 commit 26acea0

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

relayer/chain/ethereum/connection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ func (co *Connection) waitForTransaction(ctx context.Context, tx *types.Transact
162162
case <-ctx.Done():
163163
return nil, ctx.Err()
164164
case <-time.After(6 * time.Second):
165-
if co.config.CallTimeoutSecs > 0 {
165+
if co.config.PendingTxTimeoutSecs > 0 {
166166
cnt++
167167
log.Info(fmt.Sprintf("waiting for receipt: %d seconds elapsed", cnt*6))
168-
if cnt*6 > co.config.CallTimeoutSecs {
168+
if cnt*6 > co.config.PendingTxTimeoutSecs {
169169
return nil, fmt.Errorf("wait receipt timeout")
170170
}
171171
}

relayer/config/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ type ParachainConfig struct {
1313
}
1414

1515
type EthereumConfig struct {
16-
Endpoint string `mapstructure:"endpoint"`
17-
GasFeeCap uint64 `mapstructure:"gas-fee-cap"`
18-
GasTipCap uint64 `mapstructure:"gas-tip-cap"`
19-
GasLimit uint64 `mapstructure:"gas-limit"`
20-
HeartbeatSecs uint64 `mapstructure:"heartbeat-secs"`
21-
CallTimeoutSecs uint64 `mapstructure:"call-timeout-secs"`
16+
Endpoint string `mapstructure:"endpoint"`
17+
GasFeeCap uint64 `mapstructure:"gas-fee-cap"`
18+
GasTipCap uint64 `mapstructure:"gas-tip-cap"`
19+
GasLimit uint64 `mapstructure:"gas-limit"`
20+
HeartbeatSecs uint64 `mapstructure:"heartbeat-secs"`
21+
PendingTxTimeoutSecs uint64 `mapstructure:"pending-tx-timeout-secs"`
2222
}
2323

2424
type OFACConfig struct {

relayer/relays/parachain/ethereum-writer.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"fmt"
88
"math/big"
99
"strings"
10-
"time"
1110

1211
"golang.org/x/sync/errgroup"
1312

@@ -151,13 +150,6 @@ func (wr *EthereumWriter) WriteChannel(
151150
}
152151
options.Nonce = big.NewInt(0).SetUint64(nonce)
153152

154-
// Add a timeout when calling submit
155-
if wr.config.Ethereum.CallTimeoutSecs > 0 {
156-
ctx, cancel := context.WithTimeout(ctx, time.Second*time.Duration(wr.config.Ethereum.CallTimeoutSecs))
157-
options.Context = ctx
158-
defer cancel()
159-
}
160-
161153
tx, err := wr.gateway.SubmitV1(
162154
options, message, commitmentProof.Proof.InnerHashes, verificationProof,
163155
)

0 commit comments

Comments
 (0)