Skip to content

Commit 7bede2f

Browse files
Merge branch 'dev' into lint
2 parents e043b6a + bb195ad commit 7bede2f

File tree

21 files changed

+1953
-1059
lines changed

21 files changed

+1953
-1059
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# AvalancheGo
2+
![Avalanche](resources/AvalancheBlack.png?raw=true)
23

34
Official node implementation of the [Avalanche](https://avax.network) network -
45
a blockchains platform with high throughput, and blazing fast transactions.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ require (
3737
golang.org/x/sys v0.0.0-20200824131525-c12d262b63d8 // indirect
3838
google.golang.org/genproto v0.0.0-20200218151345-dad8c97a84f5 // indirect
3939
google.golang.org/grpc v1.29.1
40+
google.golang.org/protobuf v1.23.0
4041
gotest.tools v2.2.0+incompatible
4142
)

main/params.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ func getViper() (*viper.Viper, error) {
262262
// setNodeConfig sets attributes on [Config] based on the values
263263
// defined in the [viper] environment
264264
func setNodeConfig(v *viper.Viper) error {
265+
// Consensus Parameters
266+
Config.ConsensusParams.K = v.GetInt(snowSampleSizeKey)
267+
Config.ConsensusParams.Alpha = v.GetInt(snowQuorumSizeKey)
268+
Config.ConsensusParams.BetaVirtuous = v.GetInt(snowVirtuousCommitThresholdKey)
269+
Config.ConsensusParams.BetaRogue = v.GetInt(snowRogueCommitThresholdKey)
270+
Config.ConsensusParams.Parents = v.GetInt(snowAvalancheNumParentsKey)
271+
Config.ConsensusParams.BatchSize = v.GetInt(snowAvalancheBatchSizeKey)
272+
Config.ConsensusParams.ConcurrentRepolls = v.GetInt(snowConcurrentRepollsKey)
273+
274+
Config.ConsensusGossipFrequency = v.GetDuration(consensusGossipFrequencyKey)
275+
Config.ConsensusShutdownTimeout = v.GetDuration(consensusShutdownTimeoutKey)
276+
265277
// Logging:
266278
loggingConfig, err := logging.DefaultConfig()
267279
if err != nil {
@@ -640,18 +652,6 @@ func setNodeConfig(v *viper.Viper) error {
640652
Config.Params = *genesis.GetParams(networkID)
641653
}
642654

643-
// Consensus Parameters
644-
Config.ConsensusParams.K = v.GetInt(snowSampleSizeKey)
645-
Config.ConsensusParams.Alpha = v.GetInt(snowQuorumSizeKey)
646-
Config.ConsensusParams.BetaVirtuous = v.GetInt(snowVirtuousCommitThresholdKey)
647-
Config.ConsensusParams.BetaRogue = v.GetInt(snowRogueCommitThresholdKey)
648-
Config.ConsensusParams.Parents = v.GetInt(snowAvalancheNumParentsKey)
649-
Config.ConsensusParams.BatchSize = v.GetInt(snowAvalancheBatchSizeKey)
650-
Config.ConsensusParams.ConcurrentRepolls = v.GetInt(snowConcurrentRepollsKey)
651-
652-
Config.ConsensusGossipFrequency = v.GetDuration(consensusGossipFrequencyKey)
653-
Config.ConsensusShutdownTimeout = v.GetDuration(consensusShutdownTimeoutKey)
654-
655655
// Assertions
656656
Config.EnableAssertions = v.GetBool(assertionsEnabledKey)
657657

resources/AvalancheBlack.png

3.6 KB
Loading

scripts/build_coreth.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ BUILD_DIR="$AVALANCHE_PATH/build" # Where binaries go
1313
PLUGIN_DIR="$BUILD_DIR/plugins" # Where plugin binaries (namely coreth) go
1414
BINARY_PATH="$PLUGIN_DIR/evm"
1515

16-
CORETH_VER="v0.3.17"
16+
CORETH_VER="v0.3.18"
1717

1818
CORETH_PATH="$GOPATH/pkg/mod/github.com/ava-labs/coreth@$CORETH_VER"
1919

snow/consensus/snowman/block.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ type Block interface {
3838
// This is used for sending blocks to peers. The bytes should be able to be
3939
// parsed into the same block on another node.
4040
Bytes() []byte
41+
42+
// Height returns the height of this block in the chain.
43+
Height() uint64
4144
}

snow/engine/avalanche/bootstrap/bootstrapper.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,13 @@ func (b *Bootstrapper) process(vtxs ...avalanche.Vertex) error {
159159
}
160160
}
161161

162+
// Cache to ensure that we don't reprocess the same vertex within the loop below
163+
// TODO remove after Apricot release?
164+
dontReprocessCache := &cache.LRU{Size: 1000}
162165
for toProcess.Len() > 0 { // While there are unprocessed vertices
163166
vtx := toProcess.Pop() // Get an unknown vertex or one furthest down the DAG
164167
vtxID := vtx.ID()
168+
dontReprocessCache.Put(vtxID, nil)
165169

166170
switch vtx.Status() {
167171
case choices.Unknown:
@@ -207,8 +211,11 @@ func (b *Bootstrapper) process(vtxs ...avalanche.Vertex) error {
207211
return err
208212
}
209213
for _, parent := range parents { // Process the parents of this vertex (traverse up the DAG)
210-
if _, ok := b.processedCache.Get(parent.ID()); !ok { // But only if we haven't processed the parent
211-
toProcess.Push(parent)
214+
parentID := parent.ID()
215+
if _, ok := b.processedCache.Get(parentID); !ok { // But only if we haven't processed the parent
216+
if _, ok := dontReprocessCache.Get(parentID); !ok {
217+
toProcess.Push(parent)
218+
}
212219
}
213220
}
214221
height, err := vtx.Height()

snow/networking/benchlist/benchlist.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ func (b *queryBenchlist) cleanup() {
239239
updatedWeight := currentWeight
240240
totalWeight := b.vdrs.Weight()
241241
maxBenchlistWeight := uint64(float64(totalWeight) * b.maxPortion)
242-
243242
// Iterate over elements of the benchlist in order of expiration
244243
for b.benchlistOrder.Len() > 0 {
245244
e := b.benchlistOrder.Front()
@@ -273,7 +272,8 @@ func (b *queryBenchlist) cleanup() {
273272
}
274273

275274
updatedBenchLen := b.benchlistSet.Len()
276-
b.ctx.Log.Debug("Benched Weight: (%d/%d) -> (%d/%d). Benched Validators: %d -> %d.",
275+
b.ctx.Log.Debug("Maximum Benchable Weight: %d. Benched Weight: (%d/%d) -> (%d/%d). Benched Validators: %d -> %d.",
276+
maxBenchlistWeight,
277277
currentWeight,
278278
totalWeight,
279279
updatedWeight,

snow/networking/benchlist/benchlist_manager.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ type benchlistManager struct {
5050

5151
// NewManager returns a manager for chain-specific query benchlisting
5252
func NewManager(config *Config) Manager {
53+
// If the maximum portion of validators allowed to be benchlisted
54+
// is 0, return the no-op benchlist
55+
if config.MaxPortion <= 0 {
56+
return NewNoBenchlist()
57+
}
5358
return &benchlistManager{
5459
config: config,
5560
chainBenchlists: make(map[ids.ID]QueryBenchlist),

snow/networking/router/chain_router.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,10 @@ func (sr *ChainRouter) QueryFailed(validatorID ids.ShortID, chainID ids.ID, requ
381381
sr.lock.RLock()
382382
defer sr.lock.RUnlock()
383383

384-
sr.timeouts.Cancel(validatorID, chainID, requestID)
384+
// Registers a failure to the benchlist instead of canceling the timeout.
385+
// This allows the benchlist to register failed queries caused by [validatorID]
386+
// being unreachable.
387+
sr.timeouts.RegisterFailure(validatorID, chainID, requestID)
385388
if chain, exists := sr.chains[chainID]; exists {
386389
chain.QueryFailed(validatorID, requestID)
387390
} else {

0 commit comments

Comments
 (0)