Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Txmv2 #15467

Merged
merged 91 commits into from
Jan 17, 2025
Merged

Txmv2 #15467

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
10e27f7
TXMv2 alpha version
dimriou Oct 11, 2024
174c605
TXM fixes
dimriou Oct 14, 2024
9764be1
Merge branch 'develop' into txmv2
dimriou Oct 14, 2024
adecb3c
Fix
dimriou Oct 14, 2024
79c5a20
Merge branch 'develop' into txmv2
dimriou Oct 21, 2024
b92c3e4
Update orchestrator
dimriou Oct 21, 2024
9821731
Merge branch 'develop' into txmv2
dimriou Oct 21, 2024
610228f
Add builder
dimriou Oct 22, 2024
cc49673
Merge branch 'develop' into txmv2
dimriou Oct 23, 2024
117d8f1
Add txmv2 tests
dimriou Oct 23, 2024
501326c
Merge branch 'develop' into txmv2
dimriou Oct 29, 2024
bfdb9a4
Update retry logic
dimriou Oct 29, 2024
1c18bd7
Add backoff mechanism
dimriou Oct 29, 2024
93889ae
Add multi address support
dimriou Nov 1, 2024
a83d89b
Merge branch 'develop' into txmv2
dimriou Nov 1, 2024
3375df3
Add backoff mechanism for broadcasting and backfilling
dimriou Nov 1, 2024
d596e70
Merge branch 'develop' into txmv2
dimriou Nov 1, 2024
50fd300
Minor fix
dimriou Nov 1, 2024
f004bc4
Add check to dummy keystore
dimriou Nov 1, 2024
2e97d64
Fix inmemory store logging per address
dimriou Nov 2, 2024
80c70e1
Remove unnecessary const
dimriou Nov 4, 2024
5556d84
Merge branch 'develop' into txmv2
dimriou Nov 7, 2024
2dcdbab
Merge branch 'develop' into txmv2
dimriou Nov 7, 2024
25f54be
Merge branch 'develop' into txmv2
dimriou Nov 8, 2024
5704dba
Merge branch 'develop' into txmv2
dimriou Nov 12, 2024
0bfe011
Fix txm to work with enabled addresses from keystore
dimriou Nov 12, 2024
6121fdf
AttemptBuilder fixes
dimriou Nov 13, 2024
f62a9c1
Merge branch 'develop' into txmv2
dimriou Nov 13, 2024
7831151
Add AttemptBuilder close
dimriou Nov 13, 2024
fc33337
Minor updates
dimriou Nov 13, 2024
fc11ca1
Make purgable attempts empty
dimriou Nov 15, 2024
5f5541c
Merge branch 'develop' into txmv2
dimriou Nov 15, 2024
cb38104
Merge branch 'develop' into txmv2
dimriou Nov 15, 2024
d2dc53b
Fix Idempotency in Store Manager
dimriou Nov 15, 2024
9abccc7
Update trigger
dimriou Nov 19, 2024
c2c1c4f
Fix lint
dimriou Nov 19, 2024
18fac77
Merge branch 'develop' into txmv2
dimriou Nov 19, 2024
3250b19
Merge branch 'develop' into txmv2
dimriou Nov 19, 2024
8044bef
Fix more lint
dimriou Nov 19, 2024
5032336
Fix lint
dimriou Nov 19, 2024
feb243a
Fix lint
dimriou Nov 19, 2024
8a4e25f
More lint fixes
dimriou Nov 19, 2024
ee67544
Fix lint
dimriou Nov 20, 2024
d119a13
Merge branch 'develop' into txmv2
dimriou Nov 20, 2024
0f707a1
Fix lint final
dimriou Nov 20, 2024
291bbc0
Fix races
dimriou Nov 20, 2024
d45090b
Update logs
dimriou Nov 25, 2024
43ed971
Fix lint
dimriou Nov 25, 2024
21ff676
Start documentation
dimriou Nov 25, 2024
6036910
Merge branch 'develop' into txmv2
dimriou Nov 25, 2024
887e199
Update DummyKeystore Add method
dimriou Nov 27, 2024
e331d81
Merge branch 'develop' into txmv2
dimriou Nov 27, 2024
cecb0e1
Txmv2 stuck tx detection (#15436)
dimriou Nov 27, 2024
91e35ea
Make nonce nullable
dimriou Nov 27, 2024
78e0690
Update configs
dimriou Nov 27, 2024
79895a7
Add prom metrics
dimriou Nov 28, 2024
7b0a1d1
Add transaction confirmation metric
dimriou Dec 2, 2024
5f55245
Improve logs
dimriou Dec 2, 2024
926bf67
Address feedback
dimriou Dec 3, 2024
a4eacaa
Update tests
dimriou Dec 4, 2024
ecfdfb9
Fix orchestrator log
dimriou Dec 4, 2024
0ff44e9
Fix Nonce log
dimriou Dec 4, 2024
cecb7f6
Improvements
dimriou Dec 4, 2024
103f0d8
Update tests
dimriou Dec 4, 2024
cc0b9eb
Add fixes
dimriou Dec 6, 2024
6a17e0a
Improvements
dimriou Dec 6, 2024
8d870fb
Improve logs
dimriou Dec 9, 2024
a2f1544
Move initialization of nonce
dimriou Dec 10, 2024
5b023a4
Add Beholder metrics
dimriou Dec 10, 2024
86ce03a
Improve InMemoryStorage
dimriou Dec 12, 2024
5b73b73
Support different priceMax per key
dimriou Dec 12, 2024
08f4851
Upgrades
dimriou Dec 13, 2024
ccf8be7
Fix config tests
dimriou Dec 13, 2024
7fb2e3a
Merge branch 'develop' into txmv2
dimriou Dec 13, 2024
98d0b53
Fix docs
dimriou Dec 14, 2024
2fb029e
Fix config test lint
dimriou Dec 16, 2024
6160f8f
Update configs
dimriou Jan 3, 2025
d5c4a40
Reuse transaction states
dimriou Jan 7, 2025
b0f620a
Merge branch 'develop' into txmv2
dimriou Jan 7, 2025
03d5973
Fix docs
dimriou Jan 7, 2025
ab62c24
Deprecate DualBroadcastDetection
dimriou Jan 9, 2025
df39b08
Add health report
dimriou Jan 10, 2025
30f4d48
Merge branch 'develop' into txmv2
dimriou Jan 10, 2025
654c9de
Fix configs
dimriou Jan 10, 2025
973d11c
Bump mockery
dimriou Jan 10, 2025
f1f8599
Update testfiles
dimriou Jan 10, 2025
896ebb5
Update docs
dimriou Jan 13, 2025
ed27139
Address feedback
dimriou Jan 14, 2025
a000026
Add backfill tests
dimriou Jan 15, 2025
e2337f8
Merge branch 'develop' into txmv2
dimriou Jan 15, 2025
067f990
Update docs
dimriou Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ packages:
BalanceMonitor:
config:
dir: "{{ .InterfaceDir }}/../mocks"
github.com/smartcontractkit/chainlink/v2/core/chains/evm/txm:
interfaces:
Client:
TxStore:
AttemptBuilder:
Keystore:
github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr:
interfaces:
ChainConfig:
Expand Down
25 changes: 25 additions & 0 deletions core/chains/evm/config/chain_scoped_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@ func (t *transactionsConfig) MaxQueued() uint64 {
return uint64(*t.c.MaxQueued)
}

func (t *transactionsConfig) TransactionManagerV2() TransactionManagerV2 {
return &transactionManagerV2Config{c: t.c.TransactionManagerV2}
}

type transactionManagerV2Config struct {
c toml.TransactionManagerV2Config
}

func (t *transactionManagerV2Config) Enabled() bool {
return *t.c.Enabled
}

func (t *transactionManagerV2Config) BlockTime() *time.Duration {
d := t.c.BlockTime.Duration()
return &d
}

func (t *transactionManagerV2Config) CustomURL() *url.URL {
return t.c.CustomURL.URL()
}

func (t *transactionManagerV2Config) DualBroadcast() *bool {
return t.c.DualBroadcast
}

func (t *transactionsConfig) AutoPurge() AutoPurgeConfig {
return &autoPurgeConfig{c: t.c.AutoPurge}
}
Expand Down
8 changes: 8 additions & 0 deletions core/chains/evm/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type Transactions interface {
MaxInFlight() uint32
MaxQueued() uint64
AutoPurge() AutoPurgeConfig
TransactionManagerV2() TransactionManagerV2
}

type AutoPurgeConfig interface {
Expand All @@ -120,6 +121,13 @@ type AutoPurgeConfig interface {
DetectionApiUrl() *url.URL
}

type TransactionManagerV2 interface {
Enabled() bool
BlockTime() *time.Duration
CustomURL() *url.URL
DualBroadcast() *bool
}

type GasEstimator interface {
BlockHistory() BlockHistory
FeeHistory() FeeHistory
Expand Down
61 changes: 60 additions & 1 deletion core/chains/evm/config/toml/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net/url"
"slices"
"strconv"
"time"

"github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/pelletier/go-toml/v2"
Expand Down Expand Up @@ -471,6 +472,27 @@ func (c *Chain) ValidateConfig() (err error) {
return
}

func (c *Transactions) ValidateConfig() (err error) {
if c.TransactionManagerV2.Enabled != nil && *c.TransactionManagerV2.Enabled &&
c.TransactionManagerV2.DualBroadcast != nil && *c.TransactionManagerV2.DualBroadcast {
if c.TransactionManagerV2.CustomURL == nil {
err = multierr.Append(err, commonconfig.ErrMissing{Name: "TransactionManagerV2.CustomURL", Msg: "must be set if DualBroadcast is enabled"})
}
if c.AutoPurge.Enabled != nil && !*c.AutoPurge.Enabled {
err = multierr.Append(err, commonconfig.ErrInvalid{Name: "AutoPurge.Enabled", Value: false, Msg: "cannot be false if DualBroadcast is enabled"})
}
if c.AutoPurge.DetectionApiUrl == nil {
err = multierr.Append(err, commonconfig.ErrMissing{Name: "AutoPurge.DetectionApiUrl", Msg: "must be set if DualBroadcast is enabled"})
}
if c.AutoPurge.Threshold == nil {
err = multierr.Append(err, commonconfig.ErrMissing{Name: "AutoPurge.Threshold", Msg: "needs to be set if auto-purge feature is enabled"})
} else if *c.AutoPurge.Threshold == 0 {
err = multierr.Append(err, commonconfig.ErrInvalid{Name: "AutoPurge.Threshold", Value: 0, Msg: "cannot be 0 if auto-purge feature is enabled"})
}
}
return
}

type Transactions struct {
Enabled *bool
ForwardersEnabled *bool
Expand All @@ -480,7 +502,8 @@ type Transactions struct {
ReaperThreshold *commonconfig.Duration
ResendAfterThreshold *commonconfig.Duration

AutoPurge AutoPurgeConfig `toml:",omitempty"`
AutoPurge AutoPurgeConfig `toml:",omitempty"`
TransactionManagerV2 TransactionManagerV2Config `toml:",omitempty"`
}

func (t *Transactions) setFrom(f *Transactions) {
Expand All @@ -506,6 +529,7 @@ func (t *Transactions) setFrom(f *Transactions) {
t.ResendAfterThreshold = v
}
t.AutoPurge.setFrom(&f.AutoPurge)
t.TransactionManagerV2.setFrom(&f.TransactionManagerV2)
}

type AutoPurgeConfig struct {
Expand All @@ -530,6 +554,41 @@ func (a *AutoPurgeConfig) setFrom(f *AutoPurgeConfig) {
}
}

type TransactionManagerV2Config struct {
Enabled *bool `toml:",omitempty"`
BlockTime *commonconfig.Duration `toml:",omitempty"`
CustomURL *commonconfig.URL `toml:",omitempty"`
DualBroadcast *bool `toml:",omitempty"`
}

func (t *TransactionManagerV2Config) setFrom(f *TransactionManagerV2Config) {
if v := f.Enabled; v != nil {
t.Enabled = f.Enabled
}
if v := f.BlockTime; v != nil {
t.BlockTime = f.BlockTime
}
if v := f.CustomURL; v != nil {
t.CustomURL = f.CustomURL
}
if v := f.DualBroadcast; v != nil {
t.DualBroadcast = f.DualBroadcast
}
}

func (t *TransactionManagerV2Config) ValidateConfig() (err error) {
if t.Enabled != nil && *t.Enabled {
if t.BlockTime == nil {
err = multierr.Append(err, commonconfig.ErrMissing{Name: "BlockTime", Msg: "must be set if TransactionManagerV2 feature is enabled"})
return
}
if t.BlockTime.Duration() < 2*time.Second {
err = multierr.Append(err, commonconfig.ErrInvalid{Name: "BlockTime", Msg: "must be equal to or greater than 2 seconds"})
}
}
return
}

type OCR2 struct {
Automation Automation `toml:",omitempty"`
}
Expand Down
3 changes: 3 additions & 0 deletions core/chains/evm/config/toml/defaults/fallback.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ResendAfterThreshold = '1m'
[Transactions.AutoPurge]
Enabled = false

[Transactions.TransactionManagerV2]
Enabled = false

[BalanceMonitor]
Enabled = true

Expand Down
1 change: 1 addition & 0 deletions core/chains/evm/keystore/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ type Eth interface {
CheckEnabled(ctx context.Context, address common.Address, chainID *big.Int) error
EnabledAddressesForChain(ctx context.Context, chainID *big.Int) (addresses []common.Address, err error)
SignTx(ctx context.Context, fromAddress common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
SignMessage(ctx context.Context, address common.Address, message []byte) ([]byte, error)
SubscribeToKeyChanges(ctx context.Context) (ch chan struct{}, unsub func())
}
60 changes: 60 additions & 0 deletions core/chains/evm/keystore/mocks/eth.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading