Skip to content

Commit a8a0e0f

Browse files
bump avago v1.11.3 (#1130)
* bump avago v1.11.3 * fix tests * use test validator state in test context * fix tmpnet path * Integrate stake weighted gossip selection (#511) * Integrate stake weighted gossip selection * nit * merged * add validity check * remove redeclaration * use compressed bytes --------- Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
1 parent e929e8b commit a8a0e0f

18 files changed

+65
-50
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
env:
12-
tmpnet_data_path: ~/.tmpnet/networks/1000
12+
tmpnet_data_path: ~/.tmpnet/networks
1313
min_go_version: '~1.21.7'
1414

1515
jobs:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The Subnet EVM runs in a separate process from the main AvalancheGo process and
5959
[v0.6.0] AvalancheGo@v1.11.0-v1.11.1 (Protocol Version: 33)
6060
[v0.6.1] AvalancheGo@v1.11.0-v1.11.1 (Protocol Version: 33)
6161
[v0.6.2] AvalancheGo@v1.11.2 (Protocol Version: 34)
62-
[v0.6.3] AvalancheGo@v1.11.2 (Protocol Version: 34)
62+
[v0.6.3] AvalancheGo@v1.11.3 (Protocol Version: 35)
6363
```
6464

6565
## API

compatibility.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"rpcChainVMProtocolVersion": {
3-
"v0.6.3": 34,
3+
"v0.6.3": 35,
44
"v0.6.2": 34,
55
"v0.6.1": 33,
66
"v0.6.0": 33,

go.mod

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.21
44

55
require (
66
github.com/VictoriaMetrics/fastcache v1.10.0
7-
github.com/ava-labs/avalanchego v1.11.2
7+
github.com/ava-labs/avalanchego v1.11.3
88
github.com/cespare/cp v0.1.0
99
github.com/davecgh/go-spew v1.1.1
1010
github.com/deckarep/golang-set/v2 v2.1.0
@@ -47,15 +47,14 @@ require (
4747
golang.org/x/sys v0.16.0
4848
golang.org/x/text v0.14.0
4949
golang.org/x/time v0.3.0
50-
google.golang.org/protobuf v1.32.0
50+
google.golang.org/protobuf v1.33.0
5151
gopkg.in/natefinch/lumberjack.v2 v2.0.0
5252
)
5353

5454
require (
55-
github.com/BurntSushi/toml v1.3.2 // indirect
5655
github.com/DataDog/zstd v1.5.2 // indirect
5756
github.com/NYTimes/gziphandler v1.1.1 // indirect
58-
github.com/ava-labs/coreth v0.13.2-0.20240304213436-8afbf2d68461 // indirect
57+
github.com/ava-labs/coreth v0.13.2-rc.2 // indirect
5958
github.com/beorn7/perks v1.0.1 // indirect
6059
github.com/bits-and-blooms/bitset v1.7.0 // indirect
6160
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY
5656
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
5757
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
5858
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
59-
github.com/ava-labs/avalanchego v1.11.2 h1:8iodZ+RjqpRwHdiXPPtvaNt72qravge7voGzw3yPRzg=
60-
github.com/ava-labs/avalanchego v1.11.2/go.mod h1:oTVnF9idL57J4LM/6RByTmKhI4QvV6OCnF99ysyBljE=
61-
github.com/ava-labs/coreth v0.13.2-0.20240304213436-8afbf2d68461 h1:SIwGF3eVEwmexLm7is/MvG7W5sbmpGXaUT6RfUPP3jw=
62-
github.com/ava-labs/coreth v0.13.2-0.20240304213436-8afbf2d68461/go.mod h1:v24MTMbxFSvyM7YeQFyWiXjIzVo2+UVs7tgH7xrByew=
59+
github.com/ava-labs/avalanchego v1.11.3 h1:Fgf2R46SFsbe3dbaCu0vFPaA8F1zMqdf6Y/NYjG/wcA=
60+
github.com/ava-labs/avalanchego v1.11.3/go.mod h1:ruzSPKSH8GBFegvNsnKerD8+8oVnkJ5ejRAOUQ4pAZU=
61+
github.com/ava-labs/coreth v0.13.2-rc.2 h1:GmXSyDykDUuDyW7933T8lK7Fp6/4k/IcHhLJjkvjUYI=
62+
github.com/ava-labs/coreth v0.13.2-rc.2/go.mod h1:jOapwtgvroqZ2U8PJpoaq1PHrUFOrlgshUWQfM3nba0=
6363
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
6464
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
6565
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
@@ -989,8 +989,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
989989
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
990990
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
991991
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
992-
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
993-
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
992+
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
993+
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
994994
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
995995
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
996996
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

peer/network_test.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ func TestNetworkRouting(t *testing.T) {
844844

845845
func buildCodec(t *testing.T, types ...interface{}) codec.Manager {
846846
codecManager := codec.NewDefaultManager()
847-
c := linearcodec.NewDefault(time.Time{})
847+
c := linearcodec.NewDefault()
848848
for _, typ := range types {
849849
assert.NoError(t, c.RegisterType(typ))
850850
}
@@ -871,7 +871,7 @@ type testAppSender struct {
871871
sendCrossChainAppResponseFn func(ids.ID, uint32, []byte) error
872872
sendAppRequestFn func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
873873
sendAppResponseFn func(ids.NodeID, uint32, []byte) error
874-
sendAppGossipFn func([]byte, int, int, int) error
874+
sendAppGossipFn func(common.SendConfig, []byte) error
875875
}
876876

877877
func (t testAppSender) SendCrossChainAppRequest(_ context.Context, chainID ids.ID, requestID uint32, appRequestBytes []byte) error {
@@ -882,10 +882,6 @@ func (t testAppSender) SendCrossChainAppResponse(_ context.Context, chainID ids.
882882
return t.sendCrossChainAppResponseFn(chainID, requestID, appResponseBytes)
883883
}
884884

885-
func (t testAppSender) SendAppGossipSpecific(context.Context, set.Set[ids.NodeID], []byte) error {
886-
panic("not implemented")
887-
}
888-
889885
func (t testAppSender) SendAppRequest(ctx context.Context, nodeIDs set.Set[ids.NodeID], requestID uint32, message []byte) error {
890886
return t.sendAppRequestFn(ctx, nodeIDs, requestID, message)
891887
}
@@ -894,8 +890,8 @@ func (t testAppSender) SendAppResponse(_ context.Context, nodeID ids.NodeID, req
894890
return t.sendAppResponseFn(nodeID, requestID, message)
895891
}
896892

897-
func (t testAppSender) SendAppGossip(_ context.Context, message []byte, numValidators int, numNonValidators int, numPeers int) error {
898-
return t.sendAppGossipFn(message, numValidators, numNonValidators, numPeers)
893+
func (t testAppSender) SendAppGossip(_ context.Context, config common.SendConfig, message []byte) error {
894+
return t.sendAppGossipFn(config, message)
899895
}
900896

901897
func (t testAppSender) SendAppError(ctx context.Context, nodeID ids.NodeID, requestID uint32, errorCode int32, errorMessage string) error {

plugin/evm/config.go

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const (
3535
defaultMaxBlocksPerRequest = 0 // Default to no maximum on the number of blocks per getLogs request
3636
defaultContinuousProfilerFrequency = 15 * time.Minute
3737
defaultContinuousProfilerMaxFiles = 5
38+
defaultPushGossipPercentStake = .9
3839
defaultPushGossipNumValidators = 100
3940
defaultPushGossipNumPeers = 0
4041
defaultPushRegossipNumValidators = 10
@@ -154,6 +155,7 @@ type Config struct {
154155
KeystoreInsecureUnlockAllowed bool `json:"keystore-insecure-unlock-allowed"`
155156

156157
// Gossip Settings
158+
PushGossipPercentStake float64 `json:"push-gossip-percent-stake"`
157159
PushGossipNumValidators int `json:"push-gossip-num-validators"`
158160
PushGossipNumPeers int `json:"push-gossip-num-peers"`
159161
PushRegossipNumValidators int `json:"push-regossip-num-validators"`
@@ -260,6 +262,7 @@ func (c *Config) SetDefaults() {
260262
c.AcceptorQueueLimit = defaultAcceptorQueueLimit
261263
c.CommitInterval = defaultCommitInterval
262264
c.SnapshotWait = defaultSnapshotWait
265+
c.PushGossipPercentStake = defaultPushGossipPercentStake
263266
c.PushGossipNumValidators = defaultPushGossipNumValidators
264267
c.PushGossipNumPeers = defaultPushGossipNumPeers
265268
c.PushRegossipNumValidators = defaultPushRegossipNumValidators
@@ -317,5 +320,8 @@ func (c *Config) Validate() error {
317320
return fmt.Errorf("cannot use commit interval of 0 with pruning enabled")
318321
}
319322

323+
if c.PushGossipPercentStake < 0 || c.PushGossipPercentStake > 1 {
324+
return fmt.Errorf("push-gossip-percent-stake is %f but must be in the range [0, 1]", c.PushGossipPercentStake)
325+
}
320326
return nil
321327
}

plugin/evm/gossiper_eth_gossiping_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import (
1717
"github.com/ava-labs/avalanchego/ids"
1818
"github.com/ava-labs/avalanchego/utils/set"
1919

20+
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
21+
2022
"github.com/ethereum/go-ethereum/common"
2123
"github.com/ethereum/go-ethereum/crypto"
2224
"github.com/ethereum/go-ethereum/rlp"
@@ -105,7 +107,7 @@ func TestMempoolEthTxsAppGossipHandling(t *testing.T) {
105107
return nil
106108
}
107109
wg.Add(1)
108-
sender.SendAppGossipF = func(context.Context, []byte, int, int, int) error {
110+
sender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error {
109111
wg.Done()
110112
return nil
111113
}

plugin/evm/message/codec.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
package message
55

66
import (
7-
"time"
8-
97
"github.com/ava-labs/avalanchego/codec"
108
"github.com/ava-labs/avalanchego/codec/linearcodec"
119
"github.com/ava-labs/avalanchego/utils/units"
@@ -24,7 +22,7 @@ var (
2422

2523
func init() {
2624
Codec = codec.NewManager(maxMessageSize)
27-
c := linearcodec.NewDefault(time.Time{})
25+
c := linearcodec.NewDefault()
2826

2927
errs := wrappers.Errs{}
3028
errs.Add(
@@ -55,7 +53,7 @@ func init() {
5553
}
5654

5755
CrossChainCodec = codec.NewManager(maxMessageSize)
58-
ccc := linearcodec.NewDefault(time.Time{})
56+
ccc := linearcodec.NewDefault()
5957

6058
errs = wrappers.Errs{}
6159
errs.Add(

plugin/evm/syncervm_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func TestStateSyncToggleEnabledToDisabled(t *testing.T) {
113113

114114
syncDisabledVM := &VM{}
115115
appSender := &commonEng.SenderTest{T: t}
116-
appSender.SendAppGossipF = func(context.Context, []byte, int, int, int) error { return nil }
116+
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
117117
appSender.SendAppRequestF = func(ctx context.Context, nodeSet set.Set[ids.NodeID], requestID uint32, request []byte) error {
118118
nodeID, hasItem := nodeSet.Pop()
119119
if !hasItem {

plugin/evm/tx_gossip_test.go

+16-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ func TestEthTxGossip(t *testing.T) {
7979
return 0, nil
8080
}
8181
validatorState.GetValidatorSetF = func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
82-
return map[ids.NodeID]*validators.GetValidatorOutput{requestingNodeID: nil}, nil
82+
return map[ids.NodeID]*validators.GetValidatorOutput{
83+
requestingNodeID: {
84+
NodeID: requestingNodeID,
85+
Weight: 1,
86+
},
87+
}, nil
8388
}
8489

8590
// Ask the VM for any new transactions. We should get nothing at first.
@@ -149,12 +154,19 @@ func TestEthTxPushGossipOutbound(t *testing.T) {
149154
require := require.New(t)
150155
ctx := context.Background()
151156
snowCtx := utils.TestSnowContext()
157+
snowCtx.ValidatorState = &validators.TestState{
158+
GetCurrentHeightF: func(context.Context) (uint64, error) {
159+
return 0, nil
160+
},
161+
GetValidatorSetF: func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
162+
return nil, nil
163+
},
164+
}
152165
sender := &common.FakeSender{
153166
SentAppGossip: make(chan []byte, 1),
154167
}
155168

156169
vm := &VM{
157-
p2pSender: sender,
158170
ethTxPullGossiper: gossip.NoOpGossiper{},
159171
}
160172

@@ -167,7 +179,7 @@ func TestEthTxPushGossipOutbound(t *testing.T) {
167179
nil,
168180
make(chan common.Message),
169181
nil,
170-
&common.FakeSender{},
182+
sender,
171183
))
172184
require.NoError(vm.SetState(ctx, snow.NormalOp))
173185

@@ -208,7 +220,6 @@ func TestEthTxPushGossipInbound(t *testing.T) {
208220

209221
sender := &common.SenderTest{}
210222
vm := &VM{
211-
p2pSender: sender,
212223
ethTxPullGossiper: gossip.NoOpGossiper{},
213224
}
214225

@@ -221,7 +232,7 @@ func TestEthTxPushGossipInbound(t *testing.T) {
221232
nil,
222233
make(chan common.Message),
223234
nil,
224-
&common.FakeSender{},
235+
sender,
225236
))
226237
require.NoError(vm.SetState(ctx, snow.NormalOp))
227238

plugin/evm/vm.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,9 @@ func (vm *VM) initBlockBuilding() error {
688688
}()
689689

690690
pushGossipParams := gossip.BranchingFactor{
691-
Validators: vm.config.PushGossipNumValidators,
692-
Peers: vm.config.PushGossipNumPeers,
691+
StakePercentage: vm.config.PushGossipPercentStake,
692+
Validators: vm.config.PushGossipNumValidators,
693+
Peers: vm.config.PushGossipNumPeers,
693694
}
694695
pushRegossipParams := gossip.BranchingFactor{
695696
Validators: vm.config.PushRegossipNumValidators,
@@ -701,6 +702,7 @@ func (vm *VM) initBlockBuilding() error {
701702
ethTxPushGossiper, err = gossip.NewPushGossiper[*GossipEthTx](
702703
ethTxGossipMarshaller,
703704
ethTxPool,
705+
vm.validators,
704706
ethTxGossipClient,
705707
ethTxGossipMetrics,
706708
pushGossipParams,

plugin/evm/vm_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func GenesisVM(t *testing.T,
208208
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, genesisJSON)
209209
appSender := &commonEng.SenderTest{T: t}
210210
appSender.CantSendAppGossip = true
211-
appSender.SendAppGossipF = func(context.Context, []byte, int, int, int) error { return nil }
211+
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
212212
err := vm.Initialize(
213213
context.Background(),
214214
ctx,
@@ -1994,7 +1994,7 @@ func TestConfigureLogLevel(t *testing.T) {
19941994
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, test.genesisJSON)
19951995
appSender := &commonEng.SenderTest{T: t}
19961996
appSender.CantSendAppGossip = true
1997-
appSender.SendAppGossipF = func(context.Context, []byte, int, int, int) error { return nil }
1997+
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
19981998
err := vm.Initialize(
19991999
context.Background(),
20002000
ctx,

plugin/evm/vm_upgrade_bytes_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func TestNetworkUpgradesOverriden(t *testing.T) {
179179
ctx, dbManager, genesisBytes, issuer, _ := setupGenesis(t, string(genesisBytes))
180180
appSender := &commonEng.SenderTest{T: t}
181181
appSender.CantSendAppGossip = true
182-
appSender.SendAppGossipF = func(context.Context, []byte, int, int, int) error { return nil }
182+
appSender.SendAppGossipF = func(context.Context, commonEng.SendConfig, []byte) error { return nil }
183183
err = vm.Initialize(
184184
context.Background(),
185185
ctx,

predicate/predicate_results.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package predicate
66
import (
77
"fmt"
88
"strings"
9-
"time"
109

1110
"github.com/ava-labs/avalanchego/codec"
1211
"github.com/ava-labs/avalanchego/codec/linearcodec"
@@ -25,7 +24,7 @@ var Codec codec.Manager
2524
func init() {
2625
Codec = codec.NewManager(MaxResultsSize)
2726

28-
c := linearcodec.NewDefault(time.Time{})
27+
c := linearcodec.NewDefault()
2928
errs := wrappers.Errs{}
3029
errs.Add(
3130
c.RegisterType(Results{}),

scripts/versions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# shellcheck disable=SC2034
55

66
# Don't export them as they're used in the context of other calls
7-
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.2'}
7+
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.3'}
88
GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}
99

1010
# This won't be used, but it's here to make code syncs easier

utils/snow.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/ava-labs/avalanchego/api/metrics"
88
"github.com/ava-labs/avalanchego/ids"
99
"github.com/ava-labs/avalanchego/snow"
10+
"github.com/ava-labs/avalanchego/snow/validators"
1011
"github.com/ava-labs/avalanchego/utils/crypto/bls"
1112
"github.com/ava-labs/avalanchego/utils/logging"
1213
)
@@ -18,14 +19,15 @@ func TestSnowContext() *snow.Context {
1819
}
1920
pk := bls.PublicFromSecretKey(sk)
2021
return &snow.Context{
21-
NetworkID: 0,
22-
SubnetID: ids.Empty,
23-
ChainID: ids.Empty,
24-
NodeID: ids.EmptyNodeID,
25-
PublicKey: pk,
26-
Log: logging.NoLog{},
27-
BCLookup: ids.NewAliaser(),
28-
Metrics: metrics.NewOptionalGatherer(),
29-
ChainDataDir: "",
22+
NetworkID: 0,
23+
SubnetID: ids.Empty,
24+
ChainID: ids.Empty,
25+
NodeID: ids.EmptyNodeID,
26+
PublicKey: pk,
27+
Log: logging.NoLog{},
28+
BCLookup: ids.NewAliaser(),
29+
Metrics: metrics.NewOptionalGatherer(),
30+
ChainDataDir: "",
31+
ValidatorState: &validators.TestState{},
3032
}
3133
}

warp/aggregator/aggregator_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func newValidator(t testing.TB, weight uint64) (*bls.SecretKey, *avalancheWarp.V
2323
pk := bls.PublicFromSecretKey(sk)
2424
return sk, &avalancheWarp.Validator{
2525
PublicKey: pk,
26-
PublicKeyBytes: bls.PublicKeyToBytes(pk),
26+
PublicKeyBytes: bls.PublicKeyToCompressedBytes(pk),
2727
Weight: weight,
2828
NodeIDs: []ids.NodeID{ids.GenerateTestNodeID()},
2929
}

0 commit comments

Comments
 (0)