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

[NONEVM-706][Solana] - Refactor TXM + Rebroadcast Expired Tx functionality #946

Merged
merged 60 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
2d1a82d
refactor so txm owns blockhash assignment
Farber98 Nov 15, 2024
50dfef0
lastValidBlockHeight shouldn't be exported
Farber98 Nov 15, 2024
4e545e2
better comment
Farber98 Nov 15, 2024
4ded53c
refactor sendWithRetry to make it clearer
Farber98 Nov 15, 2024
9e1be6d
confirm loop refactor
Farber98 Nov 18, 2024
7dd2028
fix infinite loop
Farber98 Nov 18, 2024
6c675f2
move accountID inside msg
Farber98 Nov 19, 2024
b0d9426
lint fix
Farber98 Nov 19, 2024
1b38665
base58 does not contain lower l
Farber98 Nov 19, 2024
6923ddf
fix hash errors
Farber98 Nov 19, 2024
462844b
fix generate random hash
Farber98 Nov 19, 2024
fd785d0
remove blockhash as we only need block height
Farber98 Nov 19, 2024
cf958a4
expired tx changes without tests
Farber98 Nov 19, 2024
c5e957b
add maybe to mocks
Farber98 Nov 19, 2024
a505993
expiration tests
Farber98 Nov 19, 2024
adc8b1c
send txes through queue
Farber98 Nov 19, 2024
7d77f99
revert pendingtx leakage of information. overwrite blockhash
Farber98 Nov 20, 2024
92a280b
fix order of confirm loop and not found signature check
Farber98 Nov 20, 2024
2598e19
fix mocks
Farber98 Nov 20, 2024
42b3da1
prevent confirmation loop to mark tx as errored when it needs to be r…
Farber98 Nov 20, 2024
89af1f3
fix test
Farber98 Nov 20, 2024
5e8a0da
fix pointer
Farber98 Nov 20, 2024
75c1dcd
add comments
Farber98 Nov 21, 2024
4ff2d23
reduce rpc calls + refactors
Farber98 Nov 21, 2024
84e423e
tests + check to save rpc calls
Farber98 Nov 21, 2024
7d8319e
address feedback + remove redundant impl
Farber98 Nov 22, 2024
68f3a3e
iface comment
Farber98 Nov 22, 2024
780179f
address feedback on compute unit limit and lastValidBlockHeight assig…
Farber98 Nov 25, 2024
98f0246
blockhash assignment inside txm.sendWithRetry
Farber98 Nov 25, 2024
cbf55f6
address feedback
Farber98 Nov 26, 2024
90daf33
Merge branch 'develop' into nonevm-706-support-custom-bumping-strateg…
Farber98 Nov 26, 2024
77b28cf
refactors after merge
Farber98 Nov 26, 2024
0c4a7d8
fix interactive rebase
Farber98 Nov 26, 2024
849ac48
fix whitespace diffs
Farber98 Nov 26, 2024
20a1548
fix import
Farber98 Nov 26, 2024
a4d4770
fix mocks
Farber98 Nov 26, 2024
56a64da
add on prebroadcaste error
Farber98 Nov 26, 2024
9148d7d
remove rebroadcast count and fix package
Farber98 Nov 27, 2024
caf2cbf
improve docs
Farber98 Nov 27, 2024
1fbd63f
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Nov 28, 2024
5c22af2
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 5, 2024
02ffd1a
fix comparison against blockHeight instead of slotHeight
Farber98 Dec 5, 2024
c00494c
address feedback
Farber98 Dec 5, 2024
6ac30b0
fix lint
Farber98 Dec 5, 2024
36ee4ec
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 5, 2024
0e38174
fix log
Farber98 Dec 5, 2024
d240021
address feedback
Farber98 Dec 6, 2024
4389e13
remove useless slot height
Farber98 Dec 6, 2024
6bcdd8f
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 9, 2024
50dd10f
address feedback
Farber98 Dec 10, 2024
10b0453
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 11, 2024
2ea0c50
validate that tx doesn't exist in any of maps when adding new tx
Farber98 Dec 11, 2024
b5a6927
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 11, 2024
b4b4fd5
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 13, 2024
e7d7680
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 16, 2024
409fd1c
callers set lastValidBlockheight + get blockhash on expiration + inte…
Farber98 Dec 17, 2024
31a65a0
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 17, 2024
1be704a
add enq iface comm to help callers
Farber98 Dec 17, 2024
9ee8977
address feedback
Farber98 Dec 17, 2024
294110f
Merge branch 'develop' into backup-branch-fee-bumping
Farber98 Dec 19, 2024
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
5 changes: 3 additions & 2 deletions docs/relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ chainlink nodes solana create --name=<node-name> --chain-id=<chain-id> --url=<ur
| `OCR2CacheTTL` | stale OCR2 cache deadline | 1m | |
| `TxTimeout` | timeout to send tx to rpc endpoint | 1m | |
| `TxRetryTimeout` | duration for tx to be rebroadcast to rpc, txm stops rebroadcast after timeout | 10s | |
| `TxConfirmTimeout` | duration when confirming a tx signature before signature is discarded as unconfirmed | 30s | |
| `SkipPreflight` | enable or disable preflight checks when sending tx | `true` | `true`, `false` |
| `TxConfirmTimeout` | duration when confirming a tx signature before signature is discarded as unconfirmed | 30s |
| `TxExpirationRebroadcast` | enables or disables transaction rebroadcast if expired. Expiration check is performed every `ConfirmPollPeriod`. A transaction is considered expired if the blockhash it was sent with is 150 blocks older than the latest blockhash. | `false` | `true`, `false` |
| `SkipPreflight` | enables or disables preflight checks when sending tx | `true` | `true`, `false` |
| `Commitment` | Confirmation level for solana state and transactions. ([documentation](https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment)) | `confirmed` | `processed`, `confirmed`, `finalized` |
| `MaxRetries` | Parameter when sending transactions, how many times the RPC node will automatically rebroadcast a tx, default = `0` for custom txm rebroadcasting method, set to `-1` to use the RPC node's default retry strategy | `0` | |
28 changes: 17 additions & 11 deletions pkg/solana/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ import (

// Global solana defaults.
var defaultConfigSet = Chain{
BalancePollPeriod: config.MustNewDuration(5 * time.Second), // poll period for balance monitoring
ConfirmPollPeriod: config.MustNewDuration(500 * time.Millisecond), // polling for tx confirmation
OCR2CachePollPeriod: config.MustNewDuration(time.Second), // cache polling rate
OCR2CacheTTL: config.MustNewDuration(time.Minute), // stale cache deadline
TxTimeout: config.MustNewDuration(time.Minute), // timeout for send tx method in client
TxRetryTimeout: config.MustNewDuration(10 * time.Second), // duration for tx rebroadcasting to RPC node
TxConfirmTimeout: config.MustNewDuration(30 * time.Second), // duration before discarding tx as unconfirmed. Set to 0 to disable discarding tx.
TxRetentionTimeout: config.MustNewDuration(0 * time.Second), // duration to retain transactions after being marked as finalized or errored. Set to 0 to immediately drop transactions.
SkipPreflight: ptr(true), // to enable or disable preflight checks
Commitment: ptr(string(rpc.CommitmentConfirmed)),
MaxRetries: ptr(int64(0)), // max number of retries (default = 0). when config.MaxRetries < 0), interpreted as MaxRetries = nil and rpc node will do a reasonable number of retries
BalancePollPeriod: config.MustNewDuration(5 * time.Second), // poll period for balance monitoring
ConfirmPollPeriod: config.MustNewDuration(500 * time.Millisecond), // polling for tx confirmation
OCR2CachePollPeriod: config.MustNewDuration(time.Second), // cache polling rate
OCR2CacheTTL: config.MustNewDuration(time.Minute), // stale cache deadline
TxTimeout: config.MustNewDuration(time.Minute), // timeout for send tx method in client
TxRetryTimeout: config.MustNewDuration(10 * time.Second), // duration for tx rebroadcasting to RPC node
TxConfirmTimeout: config.MustNewDuration(30 * time.Second), // duration before discarding tx as unconfirmed. Set to 0 to disable discarding tx.
TxExpirationRebroadcast: ptr(false), // to enable rebroadcasting of expired transactions
TxRetentionTimeout: config.MustNewDuration(0 * time.Second), // duration to retain transactions after being marked as finalized or errored. Set to 0 to immediately drop transactions.
SkipPreflight: ptr(true), // to enable or disable preflight checks
Commitment: ptr(string(rpc.CommitmentConfirmed)),
MaxRetries: ptr(int64(0)), // max number of retries (default = 0). when config.MaxRetries < 0), interpreted as MaxRetries = nil and rpc node will do a reasonable number of retries

// fee estimator
FeeEstimatorMode: ptr("fixed"),
Expand All @@ -43,6 +44,7 @@ type Config interface {
TxTimeout() time.Duration
TxRetryTimeout() time.Duration
TxConfirmTimeout() time.Duration
TxExpirationRebroadcast() bool
TxRetentionTimeout() time.Duration
SkipPreflight() bool
Commitment() rpc.CommitmentType
Expand All @@ -68,6 +70,7 @@ type Chain struct {
TxTimeout *config.Duration
TxRetryTimeout *config.Duration
TxConfirmTimeout *config.Duration
TxExpirationRebroadcast *bool
TxRetentionTimeout *config.Duration
SkipPreflight *bool
Commitment *string
Expand Down Expand Up @@ -105,6 +108,9 @@ func (c *Chain) SetDefaults() {
if c.TxConfirmTimeout == nil {
c.TxConfirmTimeout = defaultConfigSet.TxConfirmTimeout
}
if c.TxExpirationRebroadcast == nil {
c.TxExpirationRebroadcast = defaultConfigSet.TxExpirationRebroadcast
}
if c.TxRetentionTimeout == nil {
c.TxRetentionTimeout = defaultConfigSet.TxRetentionTimeout
}
Expand Down
45 changes: 45 additions & 0 deletions pkg/solana/config/mocks/config.go

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

7 changes: 7 additions & 0 deletions pkg/solana/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func setFromChain(c, f *Chain) {
if f.TxConfirmTimeout != nil {
c.TxConfirmTimeout = f.TxConfirmTimeout
}
if f.TxExpirationRebroadcast != nil {
c.TxExpirationRebroadcast = f.TxExpirationRebroadcast
}
if f.TxRetentionTimeout != nil {
c.TxRetentionTimeout = f.TxRetentionTimeout
}
Expand Down Expand Up @@ -241,6 +244,10 @@ func (c *TOMLConfig) TxConfirmTimeout() time.Duration {
return c.Chain.TxConfirmTimeout.Duration()
}

func (c *TOMLConfig) TxExpirationRebroadcast() bool {
return *c.Chain.TxExpirationRebroadcast
}

func (c *TOMLConfig) TxRetentionTimeout() time.Duration {
return c.Chain.TxRetentionTimeout.Duration()
}
Expand Down
Loading
Loading