From 7df020ab1b411812b1f0b14caecab4cfb45dacb5 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 13:42:00 -0800 Subject: [PATCH 01/15] tweak global limit --- core/txpool/txpool.go | 6 +++--- internal/ethapi/api.go | 14 +++++++------- plugin/evm/gossip.go | 2 +- tests/utils/runner/network_manager.go | 4 +++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 46b687bb2d..3b900756ce 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -207,10 +207,10 @@ var DefaultConfig = Config{ PriceLimit: 1, PriceBump: 10, - AccountSlots: 16, - GlobalSlots: 4096 + 1024, // urgent + floating queue capacity with 4:1 ratio + AccountSlots: 102400, + GlobalSlots: 100000, // urgent + floating queue capacity with 4:1 ratio AccountQueue: 64, - GlobalQueue: 1024, + GlobalQueue: 1024000, Lifetime: 3 * time.Hour, } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index bae448634d..673aa61b58 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1854,17 +1854,17 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // Print a log with full tx details for manual investigations and interventions head := b.CurrentBlock() signer := types.MakeSigner(b.ChainConfig(), head.Number, head.Time) - from, err := types.Sender(signer, tx) + _, err := types.Sender(signer, tx) if err != nil { return common.Hash{}, err } - if tx.To() == nil { - addr := crypto.CreateAddress(from, tx.Nonce()) - log.Info("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) - } else { - log.Info("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) - } + // if tx.To() == nil { + // addr := crypto.CreateAddress(from, tx.Nonce()) + // log.Info("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + // } else { + // log.Info("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + // } return tx.Hash(), nil } diff --git a/plugin/evm/gossip.go b/plugin/evm/gossip.go index cee0461313..3f7b623268 100644 --- a/plugin/evm/gossip.go +++ b/plugin/evm/gossip.go @@ -125,7 +125,7 @@ func (g *GossipEthTxPool) Subscribe(ctx context.Context) { } if reset { - log.Debug("resetting bloom filter", "reason", "reached max filled ratio") + log.Info("resetting bloom filter", "reason", "reached max filled ratio") g.mempool.IteratePending(func(tx *types.Transaction) bool { g.bloom.Add(&GossipEthTx{Tx: pendingTx}) diff --git a/tests/utils/runner/network_manager.go b/tests/utils/runner/network_manager.go index ba0cf1e668..a34c31a548 100644 --- a/tests/utils/runner/network_manager.go +++ b/tests/utils/runner/network_manager.go @@ -66,12 +66,14 @@ func NewDefaultANRConfig() ANRConfig { AvalancheGoExecPath: os.ExpandEnv("$GOPATH/src/github.com/ava-labs/avalanchego/build/avalanchego"), PluginDir: os.ExpandEnv("$GOPATH/src/github.com/ava-labs/avalanchego/build/plugins"), GlobalNodeConfig: `{ + "log-level":"info", "log-display-level":"info", "proposervm-use-current-height":true }`, GlobalCChainConfig: `{ "warp-api-enabled": true, - "log-level": "debug" + "log-level": "debug", + "log-display-level": "debug" }`, } // If AVALANCHEGO_BUILD_PATH is populated, override location set by GOPATH From 31d5b5f65053c7591042f66dd127c0d96c48a987 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:25:26 -0800 Subject: [PATCH 02/15] uncomment submit --- go.mod | 5 ++--- go.sum | 10 ++++------ internal/ethapi/api.go | 14 +++++++------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 1a152b8c84..1d3fedc4fb 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/VictoriaMetrics/fastcache v1.10.0 github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b - github.com/ava-labs/avalanchego v1.10.18-rc.16 + github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c github.com/cespare/cp v0.1.0 github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 github.com/davecgh/go-spew v1.1.1 @@ -57,7 +57,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.12.10-rc.4 // indirect + github.com/ava-labs/coreth v0.12.10-rc.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -126,7 +126,6 @@ require ( github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/spaolacci/murmur3 v1.1.0 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/subosito/gotenv v1.3.0 // indirect diff --git a/go.sum b/go.sum index d4d6922ff4..78719eddac 100644 --- a/go.sum +++ b/go.sum @@ -61,10 +61,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b h1:iH6q+S7dmBOYCXrZx+nNlS1HBp72L2msiVCLs39Ls5A= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= -github.com/ava-labs/avalanchego v1.10.18-rc.16 h1:gEH0ZSqbvWKITMk/i6qAeaeEUSAH/BGgfQgxZYAK/ck= -github.com/ava-labs/avalanchego v1.10.18-rc.16/go.mod h1:eJiCzwIhrR9HWeryQ/tRP4w0Kg7bTDJ0t9cxjWxqd6o= -github.com/ava-labs/coreth v0.12.10-rc.4 h1:+Ll3cpi3tZbw37lTa+1a/VnPa7xZktpbAFiuKtDKnIE= -github.com/ava-labs/coreth v0.12.10-rc.4/go.mod h1:8pt5LW6MP/luIdhQA+gvs8LobKE8tP/5APXUiFbfb2c= +github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c h1:7UJ7w1SJ9dWYJwZhVXHqo0ZuOe2B6VkRwgDyLpaxyT8= +github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c/go.mod h1:MFhaH6W7YO/KvvSvyC4yt7p7/jfQwmygAM/stIupl5k= +github.com/ava-labs/coreth v0.12.10-rc.1 h1:6aFUJ9PBusSxCv6L8lNrpxqVvJw/UY81fQdn+UBNTAo= +github.com/ava-labs/coreth v0.12.10-rc.1/go.mod h1:ouQnR+2gKFyzUcufUiCtVU26AqJLOWspoAFI1LwvVVc= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -557,8 +557,6 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= -github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 673aa61b58..4e62090f5b 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1854,17 +1854,17 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c // Print a log with full tx details for manual investigations and interventions head := b.CurrentBlock() signer := types.MakeSigner(b.ChainConfig(), head.Number, head.Time) - _, err := types.Sender(signer, tx) + from, err := types.Sender(signer, tx) if err != nil { return common.Hash{}, err } - // if tx.To() == nil { - // addr := crypto.CreateAddress(from, tx.Nonce()) - // log.Info("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) - // } else { - // log.Info("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) - // } + if tx.To() == nil { + addr := crypto.CreateAddress(from, tx.Nonce()) + log.Debug("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + } else { + log.Debug("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + } return tx.Hash(), nil } From c00a00c9facd9dfd22caf10743630eca8ce13db8 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:27:38 -0800 Subject: [PATCH 03/15] update consts --- plugin/evm/gossip.go | 5 +++-- plugin/evm/vm.go | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/plugin/evm/gossip.go b/plugin/evm/gossip.go index 3f7b623268..e8d7fefcf5 100644 --- a/plugin/evm/gossip.go +++ b/plugin/evm/gossip.go @@ -85,7 +85,7 @@ func (t txGossipHandler) CrossChainAppRequest(context.Context, ids.ID, time.Time } func NewGossipEthTxPool(mempool *txpool.TxPool) (*GossipEthTxPool, error) { - bloom, err := gossip.NewBloomFilter(txGossipBloomMaxItems, txGossipBloomFalsePositiveRate) + bloom, err := gossip.NewBloomFilter(txGossipBloomMinTargetElements, txGossipBloomTargetFalsePositiveRate, txGossipBloomResetFalsePositiveRate) if err != nil { return nil, fmt.Errorf("failed to initialize bloom filter: %w", err) } @@ -115,10 +115,11 @@ func (g *GossipEthTxPool) Subscribe(ctx context.Context) { return case pendingTxs := <-g.pendingTxs: g.lock.Lock() + optimalElements := (g.mempool.PendingSize() + len(pendingTxs.Txs)) * txGossipBloomChurnMultiplier for _, pendingTx := range pendingTxs.Txs { tx := &GossipEthTx{Tx: pendingTx} g.bloom.Add(tx) - reset, err := gossip.ResetBloomFilterIfNeeded(g.bloom, txGossipMaxFalsePositiveRate) + reset, err := gossip.ResetBloomFilterIfNeeded(g.bloom, optimalElements) if err != nil { log.Error("failed to reset bloom filter", "err", err) continue diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index f92eaea1ea..16e25a898d 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -106,15 +106,16 @@ const ( ethTxGossipProtocol = 0x0 // gossip constants - txGossipBloomMaxItems = 8 * 1024 - txGossipBloomFalsePositiveRate = 0.01 - txGossipMaxFalsePositiveRate = 0.05 - txGossipTargetMessageSize = 20 * units.KiB - maxValidatorSetStaleness = time.Minute - txGossipThrottlingPeriod = 10 * time.Second - txGossipThrottlingLimit = 2 - gossipFrequency = 10 * time.Second - txGossipPollSize = 10 + txGossipBloomMinTargetElements = 1024 + txGossipBloomTargetFalsePositiveRate = 0.01 + txGossipBloomResetFalsePositiveRate = 0.05 + txGossipBloomChurnMultiplier = 3 + txGossipTargetMessageSize = 20 * units.KiB + maxValidatorSetStaleness = time.Minute + txGossipThrottlingPeriod = 10 * time.Second + txGossipThrottlingLimit = 2 + gossipFrequency = 10 * time.Second + txGossipPollSize = 10 ) // Define the API endpoints for the VM From 16afebf9eb597d44f4e56ada657694adf3e744b5 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:30:31 -0800 Subject: [PATCH 04/15] update avalanchego version --- scripts/versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/versions.sh b/scripts/versions.sh index c00faf9361..6025f753cf 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.10.18-rc.16'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'790b8a522a5c9068631272ef2df0e3a6e383db6d'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'} # This won't be used, but it's here to make code syncs easier From e7438bb6ad87e459e3c6f636c20ebd325a91e3d8 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:32:20 -0800 Subject: [PATCH 05/15] fix compilation err --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 1d3fedc4fb..76d15f98ec 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.12.10-rc.1 // indirect + github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect diff --git a/go.sum b/go.sum index 78719eddac..fc15ae6ba3 100644 --- a/go.sum +++ b/go.sum @@ -63,8 +63,8 @@ github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4 github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c h1:7UJ7w1SJ9dWYJwZhVXHqo0ZuOe2B6VkRwgDyLpaxyT8= github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c/go.mod h1:MFhaH6W7YO/KvvSvyC4yt7p7/jfQwmygAM/stIupl5k= -github.com/ava-labs/coreth v0.12.10-rc.1 h1:6aFUJ9PBusSxCv6L8lNrpxqVvJw/UY81fQdn+UBNTAo= -github.com/ava-labs/coreth v0.12.10-rc.1/go.mod h1:ouQnR+2gKFyzUcufUiCtVU26AqJLOWspoAFI1LwvVVc= +github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2 h1:Cnz0ekUR9GG2BI/oJPxO6qy1GM7QU59N82rCv3Q5WWU= +github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2/go.mod h1:YHkiBsAxZKgChyWdoeY5uMAhw+eqAfiT+m0oMwHPHuY= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= From 42e013d1ec9f29323a58c2a207ccb863e14488b2 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:38:10 -0800 Subject: [PATCH 06/15] simpler fix --- core/txpool/txpool.go | 8 +++++--- plugin/evm/gossip.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 3b900756ce..cf34b73f82 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -201,16 +201,18 @@ type Config struct { // DefaultConfig contains the default configurations for the transaction // pool. var DefaultConfig = Config{ + NoLocals: true, // TODO: provide in load test config + Journal: "transactions.rlp", Rejournal: time.Hour, PriceLimit: 1, PriceBump: 10, - AccountSlots: 102400, - GlobalSlots: 100000, // urgent + floating queue capacity with 4:1 ratio + AccountSlots: 16, + GlobalSlots: 4096 + 1024, // urgent + floating queue capacity with 4:1 ratio AccountQueue: 64, - GlobalQueue: 1024000, + GlobalQueue: 1024, Lifetime: 3 * time.Hour, } diff --git a/plugin/evm/gossip.go b/plugin/evm/gossip.go index e8d7fefcf5..72dee3985a 100644 --- a/plugin/evm/gossip.go +++ b/plugin/evm/gossip.go @@ -126,7 +126,7 @@ func (g *GossipEthTxPool) Subscribe(ctx context.Context) { } if reset { - log.Info("resetting bloom filter", "reason", "reached max filled ratio") + log.Info("resetting bloom filter", "reason", "reached max filled ratio", "optimal elements", optimalElements) g.mempool.IteratePending(func(tx *types.Transaction) bool { g.bloom.Add(&GossipEthTx{Tx: pendingTx}) From df9a0bffdb4cecd1811990fa205f66a56de5bacc Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 5 Jan 2024 16:43:04 -0800 Subject: [PATCH 07/15] remove mempool configs --- core/txpool/txpool.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index cf34b73f82..46b687bb2d 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -201,8 +201,6 @@ type Config struct { // DefaultConfig contains the default configurations for the transaction // pool. var DefaultConfig = Config{ - NoLocals: true, // TODO: provide in load test config - Journal: "transactions.rlp", Rejournal: time.Hour, From d19ff9f7284392048dc9600d7b00ae0385ad7d91 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Thu, 11 Jan 2024 17:29:50 +0300 Subject: [PATCH 08/15] bump latest avago rc --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/ethapi/api.go | 4 ++-- plugin/evm/gossip.go | 4 ++-- plugin/evm/vm.go | 2 +- scripts/versions.sh | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 76d15f98ec..6f029156d4 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/VictoriaMetrics/fastcache v1.10.0 github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b - github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c + github.com/ava-labs/avalanchego v1.10.18-rc.17 github.com/cespare/cp v0.1.0 github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 github.com/davecgh/go-spew v1.1.1 @@ -57,7 +57,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2 // indirect + github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect diff --git a/go.sum b/go.sum index fc15ae6ba3..451a49676f 100644 --- a/go.sum +++ b/go.sum @@ -61,10 +61,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b h1:iH6q+S7dmBOYCXrZx+nNlS1HBp72L2msiVCLs39Ls5A= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= -github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c h1:7UJ7w1SJ9dWYJwZhVXHqo0ZuOe2B6VkRwgDyLpaxyT8= -github.com/ava-labs/avalanchego v1.10.18-rc.5.0.20240106000936-790b8a522a5c/go.mod h1:MFhaH6W7YO/KvvSvyC4yt7p7/jfQwmygAM/stIupl5k= -github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2 h1:Cnz0ekUR9GG2BI/oJPxO6qy1GM7QU59N82rCv3Q5WWU= -github.com/ava-labs/coreth v0.12.9-rc.9.0.20240106001443-afa748159ba2/go.mod h1:YHkiBsAxZKgChyWdoeY5uMAhw+eqAfiT+m0oMwHPHuY= +github.com/ava-labs/avalanchego v1.10.18-rc.17 h1:ZZxjDy54NDBwMW3b6LtBoDTe5jaJJipCQcq4iUXRskE= +github.com/ava-labs/avalanchego v1.10.18-rc.17/go.mod h1:7+Ao/l/f7PCMeVyYAn7xF0Xy8iX/MMLEr95pyoeURJM= +github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436 h1:s2LATNf3948KEIkgpUONktGKUhaU3rb6/o2b4KA1bcQ= +github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436/go.mod h1:fHAYNaRtIA+rkrHzy8i2HhXyj6dqC64C5ZfiXymZlQM= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 4e62090f5b..bae448634d 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1861,9 +1861,9 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c if tx.To() == nil { addr := crypto.CreateAddress(from, tx.Nonce()) - log.Debug("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + log.Info("Submitted contract creation", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "contract", addr.Hex(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) } else { - log.Debug("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) + log.Info("Submitted transaction", "hash", tx.Hash().Hex(), "from", from, "nonce", tx.Nonce(), "recipient", tx.To(), "value", tx.Value(), "type", tx.Type(), "gasFeeCap", tx.GasFeeCap(), "gasTipCap", tx.GasTipCap(), "gasPrice", tx.GasPrice()) } return tx.Hash(), nil } diff --git a/plugin/evm/gossip.go b/plugin/evm/gossip.go index 72dee3985a..29f7df317b 100644 --- a/plugin/evm/gossip.go +++ b/plugin/evm/gossip.go @@ -126,7 +126,7 @@ func (g *GossipEthTxPool) Subscribe(ctx context.Context) { } if reset { - log.Info("resetting bloom filter", "reason", "reached max filled ratio", "optimal elements", optimalElements) + log.Debug("resetting bloom filter", "reason", "reached max filled ratio") g.mempool.IteratePending(func(tx *types.Transaction) bool { g.bloom.Add(&GossipEthTx{Tx: pendingTx}) @@ -151,7 +151,7 @@ func (g *GossipEthTxPool) Iterate(f func(tx *GossipEthTx) bool) { }) } -func (g *GossipEthTxPool) GetFilter() ([]byte, []byte, error) { +func (g *GossipEthTxPool) GetFilter() ([]byte, []byte) { g.lock.RLock() defer g.lock.RUnlock() diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go index 16e25a898d..8c60da40a9 100644 --- a/plugin/evm/vm.go +++ b/plugin/evm/vm.go @@ -106,7 +106,7 @@ const ( ethTxGossipProtocol = 0x0 // gossip constants - txGossipBloomMinTargetElements = 1024 + txGossipBloomMinTargetElements = 8 * 1024 txGossipBloomTargetFalsePositiveRate = 0.01 txGossipBloomResetFalsePositiveRate = 0.05 txGossipBloomChurnMultiplier = 3 diff --git a/scripts/versions.sh b/scripts/versions.sh index 6025f753cf..b2cb007c06 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'790b8a522a5c9068631272ef2df0e3a6e383db6d'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.10.18-rc.17'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'} # This won't be used, but it's here to make code syncs easier From bc962ba64fea97d4cace15189566b5e9ec8a00fb Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Thu, 11 Jan 2024 17:48:30 +0300 Subject: [PATCH 09/15] fix tests --- plugin/evm/tx_gossip_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/evm/tx_gossip_test.go b/plugin/evm/tx_gossip_test.go index 9044750ada..45bc4a71a6 100644 --- a/plugin/evm/tx_gossip_test.go +++ b/plugin/evm/tx_gossip_test.go @@ -82,9 +82,9 @@ func TestEthTxGossip(t *testing.T) { } // Ask the VM for any new transactions. We should get nothing at first. - emptyBloomFilter, err := gossip.NewBloomFilter(txGossipBloomMaxItems, txGossipBloomFalsePositiveRate) + emptyBloomFilter, err := gossip.NewBloomFilter(txGossipBloomMinTargetElements, txGossipBloomTargetFalsePositiveRate, txGossipBloomResetFalsePositiveRate) require.NoError(err) - emptyBloomFilterBytes, _, err := emptyBloomFilter.Marshal() + emptyBloomFilterBytes, _ := emptyBloomFilter.Marshal() require.NoError(err) request := &sdk.PullGossipRequest{ Filter: emptyBloomFilterBytes, From 86925fe49a8377aa3e69ef21e0a3ba7fb9651d36 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Thu, 18 Jan 2024 23:13:34 +0300 Subject: [PATCH 10/15] update avalanchego --- go.mod | 6 +++--- go.sum | 12 ++++++------ scripts/versions.sh | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 6f029156d4..0aeaee5a13 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/VictoriaMetrics/fastcache v1.10.0 github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b - github.com/ava-labs/avalanchego v1.10.18-rc.17 + github.com/ava-labs/avalanchego v1.10.18 github.com/cespare/cp v0.1.0 github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 github.com/davecgh/go-spew v1.1.1 @@ -43,7 +43,7 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa go.uber.org/goleak v1.2.1 - go.uber.org/mock v0.2.0 + go.uber.org/mock v0.4.0 golang.org/x/crypto v0.17.0 golang.org/x/sync v0.5.0 golang.org/x/sys v0.15.0 @@ -57,7 +57,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/Microsoft/go-winio v0.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436 // indirect + github.com/ava-labs/coreth v0.12.10-rc.5 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect diff --git a/go.sum b/go.sum index 451a49676f..f5344a097f 100644 --- a/go.sum +++ b/go.sum @@ -61,10 +61,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b h1:iH6q+S7dmBOYCXrZx+nNlS1HBp72L2msiVCLs39Ls5A= github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= -github.com/ava-labs/avalanchego v1.10.18-rc.17 h1:ZZxjDy54NDBwMW3b6LtBoDTe5jaJJipCQcq4iUXRskE= -github.com/ava-labs/avalanchego v1.10.18-rc.17/go.mod h1:7+Ao/l/f7PCMeVyYAn7xF0Xy8iX/MMLEr95pyoeURJM= -github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436 h1:s2LATNf3948KEIkgpUONktGKUhaU3rb6/o2b4KA1bcQ= -github.com/ava-labs/coreth v0.12.9-rc.9.0.20240110070856-c8809cc3c436/go.mod h1:fHAYNaRtIA+rkrHzy8i2HhXyj6dqC64C5ZfiXymZlQM= +github.com/ava-labs/avalanchego v1.10.18 h1:ErJ+SJBtN9tVqk3OPRXffpf+MWeQnNZJlBNWQIgAg8A= +github.com/ava-labs/avalanchego v1.10.18/go.mod h1:wqmokVcLXE+9Nfa8wHdGJtjEW35acVf8rkraSZPVBA4= +github.com/ava-labs/coreth v0.12.10-rc.5 h1:FMVvXHssvMQ3Eade7i85Wsx9tuD3kUOFMG8ktHeDTp8= +github.com/ava-labs/coreth v0.12.10-rc.5/go.mod h1:a58HbIBc9jscGc3aL8e7JuG8RfhBBOm63waq1q0YM+U= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -658,8 +658,8 @@ go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJP go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4= -go.uber.org/mock v0.2.0 h1:TaP3xedm7JaAgScZO7tlvlKrqT0p7I6OsdGB5YNSMDU= -go.uber.org/mock v0.2.0/go.mod h1:J0y0rp9L3xiff1+ZBfKxlC1fz2+aO16tw0tsDOixfuM= +go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= +go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= diff --git a/scripts/versions.sh b/scripts/versions.sh index b2cb007c06..d773bf1459 100644 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Don't export them as they're used in the context of other calls -AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.10.18-rc.17'} +AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.10.18'} GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'} # This won't be used, but it's here to make code syncs easier From aa9af2cf20b658e380ab78262842be1bc663628c Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Thu, 18 Jan 2024 23:22:12 +0300 Subject: [PATCH 11/15] fix mockgen --- precompile/contract/mocks.go | 7 ++++++- precompile/precompileconfig/mocks.go | 17 +++++++++++------ scripts/mock.gen.sh | 7 ++----- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/precompile/contract/mocks.go b/precompile/contract/mocks.go index 8a208a7e17..5ab8dbac26 100644 --- a/precompile/contract/mocks.go +++ b/precompile/contract/mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/ava-labs/subnet-evm/precompile/contract (interfaces: BlockContext,AccessibleState) +// +// Generated by this command: +// +// mockgen -package=contract -destination=precompile/contract/mocks.go github.com/ava-labs/subnet-evm/precompile/contract BlockContext,AccessibleState +// // Package contract is a generated GoMock package. package contract @@ -46,7 +51,7 @@ func (m *MockBlockContext) GetPredicateResults(arg0 common.Hash, arg1 common.Add } // GetPredicateResults indicates an expected call of GetPredicateResults. -func (mr *MockBlockContextMockRecorder) GetPredicateResults(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockBlockContextMockRecorder) GetPredicateResults(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPredicateResults", reflect.TypeOf((*MockBlockContext)(nil).GetPredicateResults), arg0, arg1) } diff --git a/precompile/precompileconfig/mocks.go b/precompile/precompileconfig/mocks.go index 8d425daefa..614ec5a522 100644 --- a/precompile/precompileconfig/mocks.go +++ b/precompile/precompileconfig/mocks.go @@ -1,5 +1,10 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/ava-labs/subnet-evm/precompile/precompileconfig (interfaces: Predicater,Config,ChainConfig,Accepter) +// +// Generated by this command: +// +// mockgen -package=precompileconfig -destination=precompile/precompileconfig/mocks.go github.com/ava-labs/subnet-evm/precompile/precompileconfig Predicater,Config,ChainConfig,Accepter +// // Package precompileconfig is a generated GoMock package. package precompileconfig @@ -45,7 +50,7 @@ func (m *MockPredicater) PredicateGas(arg0 []byte) (uint64, error) { } // PredicateGas indicates an expected call of PredicateGas. -func (mr *MockPredicaterMockRecorder) PredicateGas(arg0 interface{}) *gomock.Call { +func (mr *MockPredicaterMockRecorder) PredicateGas(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PredicateGas", reflect.TypeOf((*MockPredicater)(nil).PredicateGas), arg0) } @@ -59,7 +64,7 @@ func (m *MockPredicater) VerifyPredicate(arg0 *PredicateContext, arg1 []byte) er } // VerifyPredicate indicates an expected call of VerifyPredicate. -func (mr *MockPredicaterMockRecorder) VerifyPredicate(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockPredicaterMockRecorder) VerifyPredicate(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "VerifyPredicate", reflect.TypeOf((*MockPredicater)(nil).VerifyPredicate), arg0, arg1) } @@ -96,7 +101,7 @@ func (m *MockConfig) Equal(arg0 Config) bool { } // Equal indicates an expected call of Equal. -func (mr *MockConfigMockRecorder) Equal(arg0 interface{}) *gomock.Call { +func (mr *MockConfigMockRecorder) Equal(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Equal", reflect.TypeOf((*MockConfig)(nil).Equal), arg0) } @@ -152,7 +157,7 @@ func (m *MockConfig) Verify(arg0 ChainConfig) error { } // Verify indicates an expected call of Verify. -func (mr *MockConfigMockRecorder) Verify(arg0 interface{}) *gomock.Call { +func (mr *MockConfigMockRecorder) Verify(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*MockConfig)(nil).Verify), arg0) } @@ -217,7 +222,7 @@ func (m *MockChainConfig) IsDurango(arg0 uint64) bool { } // IsDurango indicates an expected call of IsDurango. -func (mr *MockChainConfigMockRecorder) IsDurango(arg0 interface{}) *gomock.Call { +func (mr *MockChainConfigMockRecorder) IsDurango(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsDurango", reflect.TypeOf((*MockChainConfig)(nil).IsDurango), arg0) } @@ -254,7 +259,7 @@ func (m *MockAccepter) Accept(arg0 *AcceptContext, arg1 common.Hash, arg2 uint64 } // Accept indicates an expected call of Accept. -func (mr *MockAccepterMockRecorder) Accept(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { +func (mr *MockAccepterMockRecorder) Accept(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Accept", reflect.TypeOf((*MockAccepter)(nil).Accept), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } diff --git a/scripts/mock.gen.sh b/scripts/mock.gen.sh index aa548f4cba..ae25b3f587 100755 --- a/scripts/mock.gen.sh +++ b/scripts/mock.gen.sh @@ -13,11 +13,8 @@ if ! [[ "$0" =~ scripts/mock.gen.sh ]]; then exit 255 fi -if ! command -v mockgen &>/dev/null; then - echo "mockgen not found, installing..." - # https://github.com/uber-go/mock - go install -v go.uber.org/mock/mockgen@v0.2.0 -fi +# https://github.com/uber-go/mock +go install -v go.uber.org/mock/mockgen@v0.4.0 if ! command -v go-license &>/dev/null; then echo "go-license not found, installing..." From d252382231803829683c75a38e6981ef3316a49d Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Sat, 20 Jan 2024 20:51:38 +0300 Subject: [PATCH 12/15] bump ANR --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0aeaee5a13..dde3fad98d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/VictoriaMetrics/fastcache v1.10.0 - github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b + github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0 github.com/ava-labs/avalanchego v1.10.18 github.com/cespare/cp v0.1.0 github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 diff --git a/go.sum b/go.sum index f5344a097f..5bd15d9519 100644 --- a/go.sum +++ b/go.sum @@ -59,8 +59,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b h1:iH6q+S7dmBOYCXrZx+nNlS1HBp72L2msiVCLs39Ls5A= -github.com/ava-labs/avalanche-network-runner v1.7.4-0.20231127162258-2f3ceed8ae4b/go.mod h1:aeAm8dgJ1xucQKlYoRDMgYjA0UWGwmaICG9wL0WvseU= +github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0 h1:xNbCMNqenaDr0bb35j27sqwa+C8t8BgRz51vXd6q0QM= +github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0/go.mod h1:B7Ynk/avkCk49CCIWbM4j1UrPlqIi0IHCPAB2MZNvLw= github.com/ava-labs/avalanchego v1.10.18 h1:ErJ+SJBtN9tVqk3OPRXffpf+MWeQnNZJlBNWQIgAg8A= github.com/ava-labs/avalanchego v1.10.18/go.mod h1:wqmokVcLXE+9Nfa8wHdGJtjEW35acVf8rkraSZPVBA4= github.com/ava-labs/coreth v0.12.10-rc.5 h1:FMVvXHssvMQ3Eade7i85Wsx9tuD3kUOFMG8ktHeDTp8= From 1621aae3b2e07ca21828e8319c087dd1b5078300 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Sat, 20 Jan 2024 23:01:28 +0300 Subject: [PATCH 13/15] remove unnecessary log levels --- tests/utils/runner/network_manager.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/utils/runner/network_manager.go b/tests/utils/runner/network_manager.go index a34c31a548..138ce73034 100644 --- a/tests/utils/runner/network_manager.go +++ b/tests/utils/runner/network_manager.go @@ -67,13 +67,11 @@ func NewDefaultANRConfig() ANRConfig { PluginDir: os.ExpandEnv("$GOPATH/src/github.com/ava-labs/avalanchego/build/plugins"), GlobalNodeConfig: `{ "log-level":"info", - "log-display-level":"info", "proposervm-use-current-height":true }`, GlobalCChainConfig: `{ "warp-api-enabled": true, - "log-level": "debug", - "log-display-level": "debug" + "log-level": "debug" }`, } // If AVALANCHEGO_BUILD_PATH is populated, override location set by GOPATH From b8b5ae85785d8f0f9c2ed9f656493462bb34cd78 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Mon, 22 Jan 2024 21:06:00 +0300 Subject: [PATCH 14/15] Fix bloom reset (#1049) * add UT for eth tx pool subscribe * fix eth tx pool subscribtion * don't use journal * simplify test * increase timeout --- plugin/evm/gossip.go | 2 +- plugin/evm/gossip_test.go | 68 ++++++++++++++++++++++++++++++++++++ plugin/evm/gossipper_test.go | 4 +-- 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/plugin/evm/gossip.go b/plugin/evm/gossip.go index 29f7df317b..c1d1585e2b 100644 --- a/plugin/evm/gossip.go +++ b/plugin/evm/gossip.go @@ -129,7 +129,7 @@ func (g *GossipEthTxPool) Subscribe(ctx context.Context) { log.Debug("resetting bloom filter", "reason", "reached max filled ratio") g.mempool.IteratePending(func(tx *types.Transaction) bool { - g.bloom.Add(&GossipEthTx{Tx: pendingTx}) + g.bloom.Add(&GossipEthTx{Tx: tx}) return true }) } diff --git a/plugin/evm/gossip_test.go b/plugin/evm/gossip_test.go index 153507c19b..dff56c03b1 100644 --- a/plugin/evm/gossip_test.go +++ b/plugin/evm/gossip_test.go @@ -4,9 +4,21 @@ package evm import ( + "context" + "math/big" "testing" + "time" + "github.com/ava-labs/avalanchego/network/p2p/gossip" + "github.com/ava-labs/subnet-evm/consensus/dummy" + "github.com/ava-labs/subnet-evm/core" + "github.com/ava-labs/subnet-evm/core/rawdb" + "github.com/ava-labs/subnet-evm/core/txpool" "github.com/ava-labs/subnet-evm/core/types" + "github.com/ava-labs/subnet-evm/core/vm" + "github.com/ava-labs/subnet-evm/params" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" ) @@ -24,3 +36,59 @@ func TestGossipEthTxMarshaller(t *testing.T) { require.NoError(err) require.Equal(want.GossipID(), got.GossipID()) } + +func TestGossipSubscribe(t *testing.T) { + require := require.New(t) + key, err := crypto.GenerateKey() + require.NoError(err) + addr := crypto.PubkeyToAddress(key.PublicKey) + + require.NoError(err) + txPool := setupPoolWithConfig(t, params.TestChainConfig, addr) + defer txPool.Stop() + txPool.SetGasPrice(common.Big1) + txPool.SetMinFee(common.Big0) + + gossipTxPool, err := NewGossipEthTxPool(txPool) + require.NoError(err) + + // use a custom bloom filter to test the bloom filter reset + gossipTxPool.bloom, err = gossip.NewBloomFilter(1, 0.01, 0.0000000000000001) // maxCount =1 + require.NoError(err) + ctx, cancel := context.WithCancel(context.TODO()) + go func() { + gossipTxPool.Subscribe(ctx) + }() + + // create eth txs + ethTxs := getValidEthTxs(key, 10, big.NewInt(226*params.GWei)) + + // Notify mempool about txs + errs := txPool.AddRemotesSync(ethTxs) + for _, err := range errs { + require.NoError(err, "failed adding subnet-evm tx to remote mempool") + } + time.Sleep(1 * time.Second) + cancel() + for i, tx := range ethTxs { + gossipable := &GossipEthTx{Tx: tx} + require.Truef(gossipTxPool.bloom.Has(gossipable), "expected tx to be in bloom filter: index %d", i) + } +} + +func setupPoolWithConfig(t *testing.T, config *params.ChainConfig, fundedAddress common.Address) *txpool.TxPool { + diskdb := rawdb.NewMemoryDatabase() + engine := dummy.NewETHFaker() + + var gspec = &core.Genesis{ + Config: config, + Alloc: core.GenesisAlloc{fundedAddress: core.GenesisAccount{Balance: big.NewInt(1000000000000000000)}}, + } + chain, err := core.NewBlockChain(diskdb, core.DefaultCacheConfig, gspec, engine, vm.Config{}, common.Hash{}, false) + require.NoError(t, err) + testTxPoolConfig := txpool.DefaultConfig + testTxPoolConfig.Journal = "" + pool := txpool.NewTxPool(testTxPoolConfig, config, chain) + + return pool +} diff --git a/plugin/evm/gossipper_test.go b/plugin/evm/gossipper_test.go index bf7f91a165..68bcbd8c1a 100644 --- a/plugin/evm/gossipper_test.go +++ b/plugin/evm/gossipper_test.go @@ -53,8 +53,8 @@ func getValidEthTxs(key *ecdsa.PrivateKey, count int, gasPrice *big.Int) []*type res := make([]*types.Transaction, count) to := common.Address{} - amount := big.NewInt(10000) - gasLimit := uint64(100000) + amount := big.NewInt(0) + gasLimit := uint64(37000) for i := 0; i < count; i++ { tx, _ := types.SignTx( From 4af6bf78978a8e3a20036aec9a3a2a7f208de406 Mon Sep 17 00:00:00 2001 From: Ceyhun Onur Date: Mon, 22 Jan 2024 21:06:50 +0300 Subject: [PATCH 15/15] Update plugin/evm/tx_gossip_test.go Co-authored-by: Darioush Jalali Signed-off-by: Ceyhun Onur --- plugin/evm/tx_gossip_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/evm/tx_gossip_test.go b/plugin/evm/tx_gossip_test.go index 45bc4a71a6..b0efc23717 100644 --- a/plugin/evm/tx_gossip_test.go +++ b/plugin/evm/tx_gossip_test.go @@ -85,7 +85,6 @@ func TestEthTxGossip(t *testing.T) { emptyBloomFilter, err := gossip.NewBloomFilter(txGossipBloomMinTargetElements, txGossipBloomTargetFalsePositiveRate, txGossipBloomResetFalsePositiveRate) require.NoError(err) emptyBloomFilterBytes, _ := emptyBloomFilter.Marshal() - require.NoError(err) request := &sdk.PullGossipRequest{ Filter: emptyBloomFilterBytes, Salt: agoUtils.RandomBytes(32),