From ec2d0bc9cd747525557d1260579f6cffd2dd08ef Mon Sep 17 00:00:00 2001 From: Kashif Siddiqui Date: Wed, 8 Jul 2026 21:22:38 +0900 Subject: [PATCH 1/3] Add opt-in Hedera broadcast sequence polling config. Wire Transactions.HederaBroadcastValidation TOML into chain-scoped getters for framework HederaBroadcastConfig. Polling stays disabled by default; CCIP can set timeout/interval per chain. Bumps chainlink-framework/chains to framework#108 until merged. --- go.mod | 2 +- go.sum | 2 + pkg/config/chain_scoped_transactions.go | 16 +++++ .../chain_scoped_transactions_hedera_test.go | 67 +++++++++++++++++++ pkg/config/toml/config.go | 38 ++++++++++- pkg/config/toml/config_test.go | 9 +++ pkg/config/toml/defaults/Hedera_Mainnet.toml | 5 ++ pkg/config/toml/defaults/Hedera_Testnet.toml | 5 ++ pkg/config/toml/docs.toml | 7 ++ pkg/config/toml/testdata/config-full.toml | 4 ++ pkg/txmgr/test_helpers.go | 3 + 11 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 pkg/config/chain_scoped_transactions_hedera_test.go diff --git a/go.mod b/go.mod index efdf23c82a..fd03437a5e 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/smartcontractkit/chainlink-data-streams v0.1.15-0.20260522094612-5f9f748bd87a github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20260423135514-5b1a7565a99c - github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c + github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451 github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260602131523-5168ac1ba014 diff --git a/go.sum b/go.sum index b05d459841..8b68d8e0eb 100644 --- a/go.sum +++ b/go.sum @@ -674,6 +674,8 @@ github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-202604231355 github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20260423135514-5b1a7565a99c/go.mod h1:HcwehCao5k5C2NGuKJUVoX/AYtoH6njGFiV44dBOcY4= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c h1:0c+bCKo47vy/ItRtGa3S/vCpE5LRlgXpGnVKQX8TgjE= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c/go.mod h1:kGprqyjsz6qFNVszOQoHc24wfvCjyipNZFste/3zcbs= +github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451 h1:3j3tAv2qbxjARglEAXxrya+fvXc7LaGp2cj45t/1T/I= +github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451/go.mod h1:kGprqyjsz6qFNVszOQoHc24wfvCjyipNZFste/3zcbs= github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243 h1:vaFBupfFfImQgqOeuC7Muk2GflbYP6Gpi0Y/TLroFU8= github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243/go.mod h1:HG/aei0MgBOpsyRLexdKGtOUO8yjSJO3iUu0Uu8KBm4= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 h1:71PGTkjdFZ0JrloEC2Fs8eHl1b1gmUuH+bq7q23usKk= diff --git a/pkg/config/chain_scoped_transactions.go b/pkg/config/chain_scoped_transactions.go index 5b20480932..9323e362a5 100644 --- a/pkg/config/chain_scoped_transactions.go +++ b/pkg/config/chain_scoped_transactions.go @@ -101,6 +101,22 @@ func (t *transactionsConfig) AutoPurge() AutoPurgeConfig { return &autoPurgeConfig{c: t.c.AutoPurge} } +func (t *transactionsConfig) HederaSequencePollTimeout() *time.Duration { + if t.c.HederaBroadcastValidation.SequencePollTimeout == nil { + return nil + } + d := t.c.HederaBroadcastValidation.SequencePollTimeout.Duration() + return &d +} + +func (t *transactionsConfig) HederaSequencePollInterval() *time.Duration { + if t.c.HederaBroadcastValidation.SequencePollInterval == nil { + return nil + } + d := t.c.HederaBroadcastValidation.SequencePollInterval.Duration() + return &d +} + type autoPurgeConfig struct { c toml.AutoPurgeConfig } diff --git a/pkg/config/chain_scoped_transactions_hedera_test.go b/pkg/config/chain_scoped_transactions_hedera_test.go new file mode 100644 index 0000000000..713b1b4ccc --- /dev/null +++ b/pkg/config/chain_scoped_transactions_hedera_test.go @@ -0,0 +1,67 @@ +package config + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" + "github.com/smartcontractkit/chainlink-evm/pkg/config/toml" +) + +func TestTransactionsConfig_HederaBroadcastValidation(t *testing.T) { + t.Parallel() + + t.Run("returns nil when unset", func(t *testing.T) { + t.Parallel() + + cfg := &transactionsConfig{c: toml.Transactions{}} + assert.Nil(t, cfg.HederaSequencePollTimeout()) + assert.Nil(t, cfg.HederaSequencePollInterval()) + }) + + t.Run("returns configured values", func(t *testing.T) { + t.Parallel() + + timeout := commonconfig.MustNewDuration(30 * time.Second) + interval := commonconfig.MustNewDuration(2 * time.Second) + cfg := &transactionsConfig{c: toml.Transactions{ + HederaBroadcastValidation: toml.HederaBroadcastValidationConfig{ + SequencePollTimeout: timeout, + SequencePollInterval: interval, + }, + }} + + gotTimeout := cfg.HederaSequencePollTimeout() + require.NotNil(t, gotTimeout) + assert.Equal(t, 30*time.Second, *gotTimeout) + + gotInterval := cfg.HederaSequencePollInterval() + require.NotNil(t, gotInterval) + assert.Equal(t, 2*time.Second, *gotInterval) + }) +} + +func TestHederaBroadcastValidationConfig_ValidateConfig(t *testing.T) { + t.Parallel() + + t.Run("accepts valid config", func(t *testing.T) { + t.Parallel() + + cfg := toml.HederaBroadcastValidationConfig{ + SequencePollTimeout: commonconfig.MustNewDuration(time.Second), + } + require.NoError(t, cfg.ValidateConfig()) + }) + + t.Run("rejects interval without timeout", func(t *testing.T) { + t.Parallel() + + cfg := toml.HederaBroadcastValidationConfig{ + SequencePollInterval: commonconfig.MustNewDuration(time.Second), + } + require.Error(t, cfg.ValidateConfig()) + }) +} diff --git a/pkg/config/toml/config.go b/pkg/config/toml/config.go index 2a651dc7a7..d74fb46306 100644 --- a/pkg/config/toml/config.go +++ b/pkg/config/toml/config.go @@ -532,6 +532,9 @@ func (c *Transactions) ValidateConfig() (err error) { err = multierr.Append(err, commonconfig.ErrInvalid{Name: "AutoPurge.Threshold", Value: 0, Msg: "cannot be 0 if auto-purge feature is enabled"}) } } + if err2 := c.HederaBroadcastValidation.ValidateConfig(); err2 != nil { + err = multierr.Append(err, err2) + } return } @@ -545,8 +548,9 @@ type Transactions struct { ResendAfterThreshold *commonconfig.Duration ConfirmationTimeout *commonconfig.Duration - AutoPurge AutoPurgeConfig `toml:",omitempty"` - TransactionManagerV2 TransactionManagerV2Config `toml:",omitempty"` + AutoPurge AutoPurgeConfig `toml:",omitempty"` + HederaBroadcastValidation HederaBroadcastValidationConfig `toml:",omitempty"` + TransactionManagerV2 TransactionManagerV2Config `toml:",omitempty"` } func (t *Transactions) setFrom(f *Transactions) { @@ -575,6 +579,7 @@ func (t *Transactions) setFrom(f *Transactions) { t.ConfirmationTimeout = v } t.AutoPurge.setFrom(&f.AutoPurge) + t.HederaBroadcastValidation.setFrom(&f.HederaBroadcastValidation) t.TransactionManagerV2.setFrom(&f.TransactionManagerV2) } @@ -600,6 +605,35 @@ func (a *AutoPurgeConfig) setFrom(f *AutoPurgeConfig) { } } +// HederaBroadcastValidationConfig controls optional post-send mined-nonce polling on Hedera. +// Unset or zero SequencePollTimeout keeps legacy single-check behavior. +type HederaBroadcastValidationConfig struct { + SequencePollTimeout *commonconfig.Duration `toml:",omitempty"` + SequencePollInterval *commonconfig.Duration `toml:",omitempty"` +} + +func (h *HederaBroadcastValidationConfig) setFrom(f *HederaBroadcastValidationConfig) { + if v := f.SequencePollTimeout; v != nil { + h.SequencePollTimeout = v + } + if v := f.SequencePollInterval; v != nil { + h.SequencePollInterval = v + } +} + +func (h *HederaBroadcastValidationConfig) ValidateConfig() (err error) { + if h.SequencePollTimeout != nil && h.SequencePollTimeout.Duration() <= 0 { + err = multierr.Append(err, commonconfig.ErrInvalid{Name: "HederaBroadcastValidation.SequencePollTimeout", Value: h.SequencePollTimeout, Msg: "must be greater than zero when set"}) + } + if h.SequencePollInterval != nil && h.SequencePollInterval.Duration() <= 0 { + err = multierr.Append(err, commonconfig.ErrInvalid{Name: "HederaBroadcastValidation.SequencePollInterval", Value: h.SequencePollInterval, Msg: "must be greater than zero when set"}) + } + if h.SequencePollInterval != nil && (h.SequencePollTimeout == nil || h.SequencePollTimeout.Duration() <= 0) { + err = multierr.Append(err, commonconfig.ErrMissing{Name: "HederaBroadcastValidation.SequencePollTimeout", Msg: "must be set when SequencePollInterval is set"}) + } + return +} + type TransactionManagerV2Config struct { Enabled *bool `toml:",omitempty"` BlockTime *commonconfig.Duration `toml:",omitempty"` diff --git a/pkg/config/toml/config_test.go b/pkg/config/toml/config_test.go index d4cdf94abd..8417789cd4 100644 --- a/pkg/config/toml/config_test.go +++ b/pkg/config/toml/config_test.go @@ -116,6 +116,8 @@ func TestDefaults_fieldsNotNil(t *testing.T) { unknown.Transactions.AutoPurge.Threshold = ptr(uint32(0)) unknown.Transactions.AutoPurge.MinAttempts = ptr(uint32(0)) unknown.Transactions.AutoPurge.DetectionApiUrl = new(config.URL) + unknown.Transactions.HederaBroadcastValidation.SequencePollTimeout = new(config.Duration) + unknown.Transactions.HederaBroadcastValidation.SequencePollInterval = new(config.Duration) unknown.GasEstimator.BlockHistory.EIP1559FeeCapBufferBlocks = ptr[uint16](10) unknown.GasEstimator.SenderAddress = asEIP55Address(t, "0xae4E781a6218A8031764928E88d457937A954fC3") oracleType := DAOracleOPStack @@ -217,6 +219,9 @@ func TestDocs(t *testing.T) { docDefaults.Transactions.TransactionManagerV2.FastlaneAuctionRequestTimeout = nil docDefaults.Transactions.TransactionManagerV2.FeeBoost = nil + // HederaBroadcastValidation configs are optional and only documented as examples + docDefaults.Transactions.HederaBroadcastValidation = HederaBroadcastValidationConfig{} + // Fallback DA oracle is not set docDefaults.GasEstimator.DAOracle = DAOracle{} @@ -342,6 +347,10 @@ var fullConfig = EVMConfig{ MinAttempts: ptr[uint32](13), DetectionApiUrl: config.MustParseURL("http://example.net"), }, + HederaBroadcastValidation: HederaBroadcastValidationConfig{ + SequencePollTimeout: config.MustNewDuration(30 * time.Second), + SequencePollInterval: config.MustNewDuration(2 * time.Second), + }, TransactionManagerV2: TransactionManagerV2Config{ Enabled: ptr(false), DualBroadcast: ptr(true), diff --git a/pkg/config/toml/defaults/Hedera_Mainnet.toml b/pkg/config/toml/defaults/Hedera_Mainnet.toml index 98015b39da..e28e862bfe 100644 --- a/pkg/config/toml/defaults/Hedera_Mainnet.toml +++ b/pkg/config/toml/defaults/Hedera_Mainnet.toml @@ -30,6 +30,11 @@ EstimateLimit = true # Accounting for Node syncs & avoid re-sending txns before fetching the receipt, setting to 2m ResendAfterThreshold = '2m' +# Optional: wait for mined nonce to advance after a successful send before gas-bumping. +# Omit to keep legacy single-check behavior. CCIP example: 30s timeout, 2s poll interval. +# [Transactions.HederaBroadcastValidation] +# SequencePollTimeout = '30s' +# SequencePollInterval = '2s' [NodePool] SyncThreshold = 10 \ No newline at end of file diff --git a/pkg/config/toml/defaults/Hedera_Testnet.toml b/pkg/config/toml/defaults/Hedera_Testnet.toml index c266d3187c..0b2e1dc5ec 100644 --- a/pkg/config/toml/defaults/Hedera_Testnet.toml +++ b/pkg/config/toml/defaults/Hedera_Testnet.toml @@ -30,6 +30,11 @@ EstimateLimit = true # Accounting for Node syncs & avoid re-sending txns before fetching the receipt, setting to 2m ResendAfterThreshold = '2m' +# Optional: wait for mined nonce to advance after a successful send before gas-bumping. +# Omit to keep legacy single-check behavior. CCIP example: 30s timeout, 2s poll interval. +# [Transactions.HederaBroadcastValidation] +# SequencePollTimeout = '30s' +# SequencePollInterval = '2s' [NodePool] SyncThreshold = 10 \ No newline at end of file diff --git a/pkg/config/toml/docs.toml b/pkg/config/toml/docs.toml index ee8ae0b953..b4708bc16c 100644 --- a/pkg/config/toml/docs.toml +++ b/pkg/config/toml/docs.toml @@ -155,6 +155,13 @@ ReaperThreshold = '168h' # Default # ResendAfterThreshold controls how long to wait before re-broadcasting a transaction that has not yet been confirmed. ResendAfterThreshold = '1m' # Default +[Transactions.HederaBroadcastValidation] +# SequencePollTimeout is the total time to poll the mined nonce after a successful Hedera send. +# Unset keeps legacy single-check behavior. When set, TXM polls until the nonce advances or the timeout elapses. +SequencePollTimeout = '30s' # Example (CCIP) +# SequencePollInterval is the delay between mined nonce checks while polling. Defaults to 2s in TXM when unset. +SequencePollInterval = '2s' # Example + [Transactions.AutoPurge] # Enabled enables or disables automatically purging transactions that have been idenitified as terminally stuck (will never be included on-chain). This feature is only expected to be used by ZK chains. Enabled = false # Default diff --git a/pkg/config/toml/testdata/config-full.toml b/pkg/config/toml/testdata/config-full.toml index 20854c4ed4..271e03ea96 100644 --- a/pkg/config/toml/testdata/config-full.toml +++ b/pkg/config/toml/testdata/config-full.toml @@ -43,6 +43,10 @@ Threshold = 42 MinAttempts = 13 DetectionApiUrl = 'http://example.net' +[Transactions.HederaBroadcastValidation] +SequencePollTimeout = '30s' +SequencePollInterval = '2s' + [Transactions.TransactionManagerV2] Enabled = false BlockTime = '42s' diff --git a/pkg/txmgr/test_helpers.go b/pkg/txmgr/test_helpers.go index a30fce697a..bf72e1af02 100644 --- a/pkg/txmgr/test_helpers.go +++ b/pkg/txmgr/test_helpers.go @@ -171,6 +171,9 @@ func (t *transactionsConfig) ReaperThreshold() time.Duration { return t.e. func (t *transactionsConfig) ResendAfterThreshold() time.Duration { return t.e.ResendAfterThreshold } func (t *transactionsConfig) AutoPurge() evmconfig.AutoPurgeConfig { return t.autoPurge } +func (t *transactionsConfig) HederaSequencePollTimeout() *time.Duration { return nil } +func (t *transactionsConfig) HederaSequencePollInterval() *time.Duration { return nil } + type autoPurgeConfig struct { evmconfig.AutoPurgeConfig } From 45dbff10cbcf7d955802e4c0c6e67070acdbbf34 Mon Sep 17 00:00:00 2001 From: Kashif Siddiqui Date: Wed, 8 Jul 2026 21:33:49 +0900 Subject: [PATCH 2/3] Fix CI: goimports formatting and revert unmerged chains bump. Restore chainlink-framework/chains to the published develop version so go.mod validation passes. Framework#108 must merge before bumping the dependency to enable Hedera sequence polling at runtime. --- go.mod | 2 +- go.sum | 2 -- pkg/config/toml/config.go | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index fd03437a5e..efdf23c82a 100644 --- a/go.mod +++ b/go.mod @@ -35,7 +35,7 @@ require ( github.com/smartcontractkit/chainlink-data-streams v0.1.15-0.20260522094612-5f9f748bd87a github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20260423135514-5b1a7565a99c - github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451 + github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260602131523-5168ac1ba014 diff --git a/go.sum b/go.sum index 8b68d8e0eb..b05d459841 100644 --- a/go.sum +++ b/go.sum @@ -674,8 +674,6 @@ github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-202604231355 github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20260423135514-5b1a7565a99c/go.mod h1:HcwehCao5k5C2NGuKJUVoX/AYtoH6njGFiV44dBOcY4= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c h1:0c+bCKo47vy/ItRtGa3S/vCpE5LRlgXpGnVKQX8TgjE= github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260423135514-5b1a7565a99c/go.mod h1:kGprqyjsz6qFNVszOQoHc24wfvCjyipNZFste/3zcbs= -github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451 h1:3j3tAv2qbxjARglEAXxrya+fvXc7LaGp2cj45t/1T/I= -github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20260708110237-560bb813b451/go.mod h1:kGprqyjsz6qFNVszOQoHc24wfvCjyipNZFste/3zcbs= github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243 h1:vaFBupfFfImQgqOeuC7Muk2GflbYP6Gpi0Y/TLroFU8= github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243/go.mod h1:HG/aei0MgBOpsyRLexdKGtOUO8yjSJO3iUu0Uu8KBm4= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 h1:71PGTkjdFZ0JrloEC2Fs8eHl1b1gmUuH+bq7q23usKk= diff --git a/pkg/config/toml/config.go b/pkg/config/toml/config.go index d74fb46306..9a434919d6 100644 --- a/pkg/config/toml/config.go +++ b/pkg/config/toml/config.go @@ -550,7 +550,7 @@ type Transactions struct { AutoPurge AutoPurgeConfig `toml:",omitempty"` HederaBroadcastValidation HederaBroadcastValidationConfig `toml:",omitempty"` - TransactionManagerV2 TransactionManagerV2Config `toml:",omitempty"` + TransactionManagerV2 TransactionManagerV2Config `toml:",omitempty"` } func (t *Transactions) setFrom(f *Transactions) { From 58489613583dfb0be927c35124498016c5db6bf4 Mon Sep 17 00:00:00 2001 From: Kashif Siddiqui Date: Wed, 8 Jul 2026 21:41:37 +0900 Subject: [PATCH 3/3] Regenerate CONFIG.md for HederaBroadcastValidation docs. Fix docs.toml tag to use exact # Example so config doc generation passes check-tidy. --- CONFIG.md | 21 +++++++++++++++++++++ pkg/config/toml/docs.toml | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CONFIG.md b/CONFIG.md index 3058987a92..36101b145b 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -357,6 +357,27 @@ ResendAfterThreshold = '1m' # Default ``` ResendAfterThreshold controls how long to wait before re-broadcasting a transaction that has not yet been confirmed. +## Transactions.HederaBroadcastValidation +```toml +[Transactions.HederaBroadcastValidation] +SequencePollTimeout = '30s' # Example +SequencePollInterval = '2s' # Example +``` + + +### SequencePollTimeout +```toml +SequencePollTimeout = '30s' # Example +``` +SequencePollTimeout is the total time to poll the mined nonce after a successful Hedera send. +Unset keeps legacy single-check behavior. When set, TXM polls until the nonce advances or the timeout elapses. + +### SequencePollInterval +```toml +SequencePollInterval = '2s' # Example +``` +SequencePollInterval is the delay between mined nonce checks while polling. Defaults to 2s in TXM when unset. + ## Transactions.AutoPurge ```toml [Transactions.AutoPurge] diff --git a/pkg/config/toml/docs.toml b/pkg/config/toml/docs.toml index b4708bc16c..8880388046 100644 --- a/pkg/config/toml/docs.toml +++ b/pkg/config/toml/docs.toml @@ -158,7 +158,7 @@ ResendAfterThreshold = '1m' # Default [Transactions.HederaBroadcastValidation] # SequencePollTimeout is the total time to poll the mined nonce after a successful Hedera send. # Unset keeps legacy single-check behavior. When set, TXM polls until the nonce advances or the timeout elapses. -SequencePollTimeout = '30s' # Example (CCIP) +SequencePollTimeout = '30s' # Example # SequencePollInterval is the delay between mined nonce checks while polling. Defaults to 2s in TXM when unset. SequencePollInterval = '2s' # Example