Skip to content

Commit

Permalink
Merge branch 'master' into p-chain_introducing-fees-calculators
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed May 21, 2024
2 parents e2f8809 + 551f8d3 commit 0fe0367
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 23 deletions.
4 changes: 2 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,7 @@ This version is backwards compatible to [v1.7.0](https://github.com/ava-labs/ava

### Networking

- Reduced default peerlist and accepted frontier gossipping
- Reduced default peerlist and accepted frontier gossiping
- Increased the default at-large outbound buffer size to 32 MiB

### Metrics
Expand Down Expand Up @@ -3100,7 +3100,7 @@ This version is backwards compatible to [v1.7.0](https://github.com/ava-labs/ava
- Added `--snow-mixed-query-num-push-vdr` and `--snow-mixed-query-num-push-non-vdr` to allow parameterization of sending push queries
- By default, non-validators now send only pull queries, not push queries.
- By default, validators now send both pull queries and push queries upon inserting a container into consensus. Previously, nodes sent only push queries.
- Added metrics to track the amount of over gossipping of `peerlist` messages
- Added metrics to track the amount of over gossiping of `peerlist` messages
- Added custom message queueing support to outbound `Peer` messages
- Reused `Ping` messages to avoid needless memory allocations

Expand Down
2 changes: 1 addition & 1 deletion api/admin/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Now, calls to the X-Chain can be made to either `/ext/bc/X` or, equivalently, to

Give a blockchain an alias, a different name that can be used any place the blockchain’s ID is used.

:::note Aliasing a chain can also be done via the [Node API](https://docs.avax.network/nodes/configure/avalanchego-config-flags.md#--chain-aliases-file-string).
:::note Aliasing a chain can also be done via the [Node API](/nodes/configure/avalanchego-config-flags.md#--chain-aliases-file-string).
Note that the alias is set for each chain on each node individually. In a multi-node Subnet, the
same alias should be configured on each node to use an alias across a Subnet successfully. Setting
an alias for a chain on one node does not register that alias with other nodes automatically.
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (n *Node) initNetworking() error {
}
}
if unknownACPs.Len() > 0 {
n.Log.Warn("gossipping unknown ACPs",
n.Log.Warn("gossiping unknown ACPs",
zap.Reflect("acps", unknownACPs),
)
}
Expand Down
6 changes: 0 additions & 6 deletions scripts/build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ source "$AVALANCHE_PATH"/scripts/constants.sh

EXCLUDED_TARGETS="| grep -v /mocks | grep -v proto | grep -v tests/e2e | grep -v tests/upgrade"

GOOS=$(go env GOOS)
if [[ "$GOOS" == "windows" ]]; then
# tmpnet and antithesis tests (which depend on tmpnet) are not compatible with windows
EXCLUDED_TARGETS="${EXCLUDED_TARGETS} | grep -v tests/fixture | grep -v tests/antithesis"
fi

TEST_TARGETS="$(eval "go list ./... ${EXCLUDED_TARGETS}")"

# shellcheck disable=SC2086
Expand Down
2 changes: 1 addition & 1 deletion snow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Currently, Avalanchego implements its own message serialization to communicate.

### [Network](https://github.com/ava-labs/avalanchego/blob/master/network/network.go)

The networking interface is shared across all chains. It implements functions from the `ExternalSender` interface. The two functions it implements are `Send` and `Gossip`. `Send` sends a message of type `OutboundMessage` to a specific set of nodes (specified by an array of `NodeIDs`). `Gossip` sends a message of type `OutboundMessage` to a random group of nodes in a subnet (can be a validator or a non-validator). Gossipping is used to push transactions across the network. The networking protocol uses TLS to pass messages between peers.
The networking interface is shared across all chains. It implements functions from the `ExternalSender` interface. The two functions it implements are `Send` and `Gossip`. `Send` sends a message of type `OutboundMessage` to a specific set of nodes (specified by an array of `NodeIDs`). `Gossip` sends a message of type `OutboundMessage` to a random group of nodes in a subnet (can be a validator or a non-validator). gossiping is used to push transactions across the network. The networking protocol uses TLS to pass messages between peers.

Along with sending and gossiping, the networking library is also responsible for making connections and maintaining connections. Any node whether they are a validator or non-validator will attempt to connect to the primary network.

Expand Down
16 changes: 8 additions & 8 deletions snow/engine/snowman/bootstrap/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ func (b *Bootstrapper) Clear(context.Context) error {
}

func (b *Bootstrapper) Start(ctx context.Context, startReqID uint32) error {
b.Ctx.State.Set(snow.EngineState{
Type: p2p.EngineType_ENGINE_TYPE_SNOWMAN,
State: snow.Bootstrapping,
})
if err := b.VM.SetState(ctx, snow.Bootstrapping); err != nil {
return fmt.Errorf("failed to notify VM that bootstrapping has started: %w", err)
}

lastAccepted, err := b.getLastAccepted(ctx)
if err != nil {
return err
Expand All @@ -161,14 +169,6 @@ func (b *Bootstrapper) Start(ctx context.Context, startReqID uint32) error {
zap.Uint64("lastAcceptedHeight", lastAcceptedHeight),
)

b.Ctx.State.Set(snow.EngineState{
Type: p2p.EngineType_ENGINE_TYPE_SNOWMAN,
State: snow.Bootstrapping,
})
if err := b.VM.SetState(ctx, snow.Bootstrapping); err != nil {
return fmt.Errorf("failed to notify VM that bootstrapping has started: %w", err)
}

// Set the starting height
b.startingHeight = lastAcceptedHeight
b.requestID = startReqID
Expand Down
31 changes: 31 additions & 0 deletions snow/engine/snowman/bootstrap/bootstrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,37 @@ func TestBootstrapperReceiveStaleAncestorsMessage(t *testing.T) {
require.Equal(snow.Bootstrapping, config.Ctx.State.Get().State)
}

func TestBootstrapperRollbackOnSetState(t *testing.T) {
require := require.New(t)

config, _, _, vm := newConfig(t)

blks := snowmantest.BuildChain(2)
initializeVMWithBlockchain(vm, blks)

blks[1].StatusV = choices.Accepted

bs, err := New(
config,
func(context.Context, uint32) error {
config.Ctx.State.Set(snow.EngineState{
Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN,
State: snow.NormalOp,
})
return nil
},
)
require.NoError(err)

vm.SetStateF = func(context.Context, snow.State) error {
blks[1].StatusV = choices.Processing
return nil
}

require.NoError(bs.Start(context.Background(), 0))
require.Equal(blks[0].HeightV, bs.startingHeight)
}

func initializeVMWithBlockchain(vm *block.TestVM, blocks []*snowmantest.Block) {
vm.CantSetState = false
vm.LastAcceptedF = func(context.Context) (ids.ID, error) {
Expand Down
17 changes: 17 additions & 0 deletions tests/fixture/tmpnet/detached_process_default.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build linux || darwin

package tmpnet

import (
"os/exec"
"syscall"
)

func configureDetachedProcess(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}
}
12 changes: 12 additions & 0 deletions tests/fixture/tmpnet/detached_process_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:build windows

package tmpnet

import "os/exec"

func configureDetachedProcess(*exec.Cmd) {
panic("tmpnet deployment to windows is not supported")
}
5 changes: 1 addition & 4 deletions tests/fixture/tmpnet/node_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,8 @@ func (p *NodeProcess) Start(w io.Writer) error {

// All arguments are provided in the flags file
cmd := exec.Command(p.node.RuntimeConfig.AvalancheGoPath, "--config-file", p.node.getFlagsPath()) // #nosec G204

// Ensure process is detached from the parent process so that an error in the parent will not affect the child
cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}
configureDetachedProcess(cmd)

if err := cmd.Start(); err != nil {
return err
Expand Down

0 comments on commit 0fe0367

Please sign in to comment.