-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Move next nonce logic from Keystore to Broadcaster #10108
Conversation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
ff138d2
to
e90fa0c
Compare
2d1d970
to
1c35d23
Compare
a381832
to
0785d14
Compare
0785d14
to
1697ecb
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6149186608 |
eeb93be
to
5e9ed68
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6149498519 |
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6149503267 |
f28e404
to
572dac7
Compare
572dac7
to
0c67dd0
Compare
common/txmgr/sequence_syncer.go
Outdated
type SequenceSyncer[ADDR types.Hashable, TX_HASH types.Hashable, BLOCK_HASH types.Hashable] interface { | ||
Sync(ctx context.Context, addr ADDR) (err error) | ||
type SequenceSyncer[ADDR types.Hashable, TX_HASH types.Hashable, BLOCK_HASH types.Hashable, SEQ types.Sequence] interface { | ||
Sync(ctx context.Context, addr ADDR, localNonce SEQ) (SEQ, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename locaNonce to localSequence
qq := o.q.WithOpts(pg.WithParentCtx(ctx)) | ||
|
||
sql := `SELECT MAX(nonce) FROM evm.txes WHERE from_address = $1 and evm_chain_id = $2` | ||
err = qq.Get(&nonce, sql, fromAddress.String(), chainId.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So lets say there was no entry of evm.txes found for an address. It can happen if the address hasn't been used for some time, and the Reaper cleaned up previous txes that were finalized.
In that case, this query will return 0.
Thus, the caller of this function should handle the 0 case, by fetching nonce from onchain, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please rename the file to TX_MANAGER_ARCHITECTURE?
This seemed to have missed a previous name change.
3dd587e
to
7539ec3
Compare
@@ -957,6 +957,16 @@ func (o *evmTxStore) FindReceiptsPendingConfirmation(ctx context.Context, blockN | |||
return | |||
} | |||
|
|||
func (o *evmTxStore) FindHighestSequence(ctx context.Context, fromAddress common.Address, chainId *big.Int) (nonce evmtypes.Nonce, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an EVM only signature? If not, would 'latest' or 'newest' be more general than 'highest'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. This is generalized for all chains so I can update it to FindLatestSequence
bec4a0a
to
93067b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
SonarQube Quality Gate |
BCI-1552
evm.txes
for addressevm.txes
, check on-chain usingPendingNonceAt
on the clientnext_nonce
from KeyStorenext_nonce
column fromevm.key_states
tablenext_nonce
column fromkeys
tableSync
method to fit new logicGenerateNextSequence
func typeset-next-nonce
flag from the eth keys command since nonces are no longer stored in key state