From 665bf821a86029c2a57746ae323f97bdd20de555 Mon Sep 17 00:00:00 2001 From: irrun Date: Wed, 10 Jul 2024 16:13:02 +0800 Subject: [PATCH] fix: sentry nonce (#15) --- go.mod | 2 +- go.sum | 4 ++-- node/validator.go | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 3a5d61f..50bdf29 100644 --- a/go.mod +++ b/go.mod @@ -152,7 +152,7 @@ require ( replace ( github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.23.0 github.com/cometbft/cometbft => github.com/bnb-chain/greenfield-tendermint v0.0.0-20230417032003-4cda1f296fb2 - github.com/ethereum/go-ethereum => github.com/irrun/bsc v0.0.0-20240613013430-4192215665ec + github.com/ethereum/go-ethereum => github.com/bnb-chain/bsc-builder v1.4.11 github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/prysmaticlabs/grpc-gateway/v2 v2.3.1-0.20210702154020-550e1cd83ec1 github.com/syndtr/goleveldb v1.0.1 => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tendermint/tendermint => github.com/bnb-chain/tendermint v0.31.16 diff --git a/go.sum b/go.sum index e20b709..fa8e322 100644 --- a/go.sum +++ b/go.sum @@ -945,6 +945,8 @@ github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bnb-chain/bsc-builder v1.4.11 h1:sVwUo+k7lfgWIWric2z6qJeUhc+yPwEvkH0X0l0w7us= +github.com/bnb-chain/bsc-builder v1.4.11/go.mod h1:WgxebZxrlA8qZYmUN4w3v2HDISSB/acQp/93l5rvgXk= github.com/bnb-chain/fastssz v0.1.2/go.mod h1:KcabV+OEw2QwgyY8Fc88ZG79CKYkFdu0kKWyfA3dI6o= github.com/bnb-chain/greenfield-tendermint v0.0.0-20230417032003-4cda1f296fb2 h1:jubavYCs/mCFj/g6Utl+l4SfpykdBdWJFPsvb9FcEXU= github.com/bnb-chain/greenfield-tendermint v0.0.0-20230417032003-4cda1f296fb2/go.mod h1:9q11eHNRY9FDwFH+4pompzPNGv//Z3VcfvkELaHJPMs= @@ -2131,8 +2133,6 @@ github.com/iris-contrib/jade v1.1.4/go.mod h1:EDqR+ur9piDl6DUgs6qRrlfzmlx/D5Uybo github.com/iris-contrib/pongo2 v0.0.1/go.mod h1:Ssh+00+3GAZqSQb30AvBRNxBx7rf0GqwkjqxNd0u65g= github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= -github.com/irrun/bsc v0.0.0-20240613013430-4192215665ec h1:7YDPfla/02qaGKF7y44isarrKWjx5+uZWCc+lj+1bWo= -github.com/irrun/bsc v0.0.0-20240613013430-4192215665ec/go.mod h1:lL8ToOvVrlANTjI4adLcacafWolQjdid5x4v1xiipzE= github.com/ishidawataru/sctp v0.0.0-20191218070446-00ab2ac2db07/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg= github.com/ishidawataru/sctp v0.0.0-20210226210310-f2269e66cdee/go.mod h1:co9pwDoBCm1kGxawmb4sPq0cSIOOWNPT4KnHotMP1Zg= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= diff --git a/node/validator.go b/node/validator.go index bc02dba..4ba2d65 100644 --- a/node/validator.go +++ b/node/validator.go @@ -183,12 +183,14 @@ func (n *validator) refresh() { n.payAccountBalance.Store(balance) } - nonce, err := n.client.PendingNonceAt(context.Background(), n.payAccount.Address()) + nonce, err := n.client.NonceAt(context.Background(), n.payAccount.Address(), nil) if err != nil { metrics.ChainError.Inc() log.Errorw("failed to fetch validator payAccount nonce", "err", err) } + log.Infow("refresh payAccount nonce", "address", n.payAccount.Address(), "nonce", nonce) + atomic.StoreUint64(&n.payAccountNonce, nonce) params, err := n.client.MevParams(context.Background())