From dce6c71e82823a26790342c2905f2db873ec0701 Mon Sep 17 00:00:00 2001 From: samliok Date: Wed, 20 Aug 2025 20:27:16 -0400 Subject: [PATCH 1/5] rename engine types --- chains/manager.go | 18 +++--- message/messages_test.go | 2 +- proto/p2p/p2p.proto | 4 +- proto/pb/p2p/p2p.pb.go | 20 +++--- .../avalanche/bootstrap/bootstrapper.go | 2 +- .../avalanche/bootstrap/bootstrapper_test.go | 8 +-- snow/engine/snowman/bootstrap/bootstrapper.go | 2 +- .../snowman/bootstrap/bootstrapper_test.go | 26 ++++---- snow/engine/snowman/engine.go | 2 +- snow/engine/snowman/syncer/state_syncer.go | 2 +- snow/networking/handler/engine.go | 12 ++-- snow/networking/handler/engine_test.go | 10 +-- snow/networking/handler/handler.go | 6 +- snow/networking/handler/handler_test.go | 64 +++++++++---------- snow/networking/handler/health_test.go | 4 +- snow/networking/router/chain_router_test.go | 52 +++++++-------- snow/networking/sender/sender_test.go | 30 ++++----- vms/platformvm/vm_test.go | 8 +-- 18 files changed, 136 insertions(+), 136 deletions(-) diff --git a/chains/manager.go b/chains/manager.go index 4ac3764a3087..35eb3cd1fe16 100644 --- a/chains/manager.go +++ b/chains/manager.go @@ -615,7 +615,7 @@ func (m *manager) createAvalancheChain( defer ctx.Lock.Unlock() ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.Initializing, }) @@ -664,7 +664,7 @@ func (m *manager) createAvalancheChain( m.Net, m.ManagerConfig.Router, m.TimeoutManager, - p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + p2ppb.EngineType_ENGINE_TYPE_DAG, sb, avalancheMetrics, ) @@ -683,7 +683,7 @@ func (m *manager) createAvalancheChain( m.Net, m.ManagerConfig.Router, m.TimeoutManager, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, sb, ctx.Registerer, ) @@ -1025,12 +1025,12 @@ func (m *manager) createAvalancheChain( } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: avalancheBootstrapper, Consensus: avalancheEngine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: snowmanBootstrapper, Consensus: snowmanEngine, @@ -1064,7 +1064,7 @@ func (m *manager) createSnowmanChain( defer ctx.Lock.Unlock() ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Initializing, }) @@ -1093,7 +1093,7 @@ func (m *manager) createSnowmanChain( m.Net, m.ManagerConfig.Router, m.TimeoutManager, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, sb, ctx.Registerer, ) @@ -1394,8 +1394,8 @@ func (m *manager) createSnowmanChain( } h.SetEngineManager(&handler.EngineManager{ - Avalanche: nil, - Snowman: &handler.Engine{ + DAG: nil, + Chain: &handler.Engine{ StateSyncer: stateSyncer, Bootstrapper: bootstrapper, Consensus: engine, diff --git a/message/messages_test.go b/message/messages_test.go index 4ea4254b214e..054d00a8b522 100644 --- a/message/messages_test.go +++ b/message/messages_test.go @@ -377,7 +377,7 @@ func TestMessage(t *testing.T) { RequestId: 1, Deadline: 1, ContainerId: testID[:], - EngineType: p2p.EngineType_ENGINE_TYPE_AVALANCHE, + EngineType: p2p.EngineType_ENGINE_TYPE_DAG, }, }, }, diff --git a/proto/p2p/p2p.proto b/proto/p2p/p2p.proto index 047de0e2174a..68431decdbe2 100644 --- a/proto/p2p/p2p.proto +++ b/proto/p2p/p2p.proto @@ -215,8 +215,8 @@ message AcceptedStateSummary { enum EngineType { ENGINE_TYPE_UNSPECIFIED = 0; // Only the X-Chain uses avalanche consensus - ENGINE_TYPE_AVALANCHE = 1; - ENGINE_TYPE_SNOWMAN = 2; + ENGINE_TYPE_DAG = 1; + ENGINE_TYPE_CHAIN = 2; } // GetAcceptedFrontier requests the accepted frontier from a peer. diff --git a/proto/pb/p2p/p2p.pb.go b/proto/pb/p2p/p2p.pb.go index ef2f9b46f82f..bc57e369cbc6 100644 --- a/proto/pb/p2p/p2p.pb.go +++ b/proto/pb/p2p/p2p.pb.go @@ -27,21 +27,21 @@ type EngineType int32 const ( EngineType_ENGINE_TYPE_UNSPECIFIED EngineType = 0 // Only the X-Chain uses avalanche consensus - EngineType_ENGINE_TYPE_AVALANCHE EngineType = 1 - EngineType_ENGINE_TYPE_SNOWMAN EngineType = 2 + EngineType_ENGINE_TYPE_DAG EngineType = 1 + EngineType_ENGINE_TYPE_CHAIN EngineType = 2 ) // Enum value maps for EngineType. var ( EngineType_name = map[int32]string{ 0: "ENGINE_TYPE_UNSPECIFIED", - 1: "ENGINE_TYPE_AVALANCHE", - 2: "ENGINE_TYPE_SNOWMAN", + 1: "ENGINE_TYPE_DAG", + 2: "ENGINE_TYPE_CHAIN", } EngineType_value = map[string]int32{ "ENGINE_TYPE_UNSPECIFIED": 0, - "ENGINE_TYPE_AVALANCHE": 1, - "ENGINE_TYPE_SNOWMAN": 2, + "ENGINE_TYPE_DAG": 1, + "ENGINE_TYPE_CHAIN": 2, } ) @@ -3612,12 +3612,12 @@ const file_p2p_p2p_proto_rawDesc = "" + "\x05block\x18\x01 \x01(\fR\x05block\x12:\n" + "\fnotarization\x18\x02 \x01(\v2\x16.p2p.QuorumCertificateR\fnotarization\x12E\n" + "\x12empty_notarization\x18\x03 \x01(\v2\x16.p2p.EmptyNotarizationR\x11emptyNotarization\x12:\n" + - "\ffinalization\x18\x04 \x01(\v2\x16.p2p.QuorumCertificateR\ffinalization*]\n" + + "\ffinalization\x18\x04 \x01(\v2\x16.p2p.QuorumCertificateR\ffinalization*U\n" + "\n" + "EngineType\x12\x1b\n" + - "\x17ENGINE_TYPE_UNSPECIFIED\x10\x00\x12\x19\n" + - "\x15ENGINE_TYPE_AVALANCHE\x10\x01\x12\x17\n" + - "\x13ENGINE_TYPE_SNOWMAN\x10\x02B.Z,github.com/ava-labs/avalanchego/proto/pb/p2pb\x06proto3" + "\x17ENGINE_TYPE_UNSPECIFIED\x10\x00\x12\x13\n" + + "\x0fENGINE_TYPE_DAG\x10\x01\x12\x15\n" + + "\x11ENGINE_TYPE_CHAIN\x10\x02B.Z,github.com/ava-labs/avalanchego/proto/pb/p2pb\x06proto3" var ( file_p2p_p2p_proto_rawDescOnce sync.Once diff --git a/snow/engine/avalanche/bootstrap/bootstrapper.go b/snow/engine/avalanche/bootstrap/bootstrapper.go index 208d43e77566..1d52f95356c7 100644 --- a/snow/engine/avalanche/bootstrap/bootstrapper.go +++ b/snow/engine/avalanche/bootstrap/bootstrapper.go @@ -320,7 +320,7 @@ func (b *Bootstrapper) Start(ctx context.Context, startReqID uint32) error { b.Ctx.Log.Info("starting bootstrap") b.Ctx.State.Set(snow.EngineState{ - Type: p2p.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2p.EngineType_ENGINE_TYPE_DAG, State: snow.Bootstrapping, }) if err := b.VM.SetState(ctx, snow.Bootstrapping); err != nil { diff --git a/snow/engine/avalanche/bootstrap/bootstrapper_test.go b/snow/engine/avalanche/bootstrap/bootstrapper_test.go index 17aeb026b17a..aebd22b21e42 100644 --- a/snow/engine/avalanche/bootstrap/bootstrapper_test.go +++ b/snow/engine/avalanche/bootstrap/bootstrapper_test.go @@ -169,7 +169,7 @@ func TestBootstrapperSingleFrontier(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.NormalOp, }) return nil @@ -276,7 +276,7 @@ func TestBootstrapperByzantineResponses(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.NormalOp, }) return nil @@ -443,7 +443,7 @@ func TestBootstrapperTxDependencies(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.NormalOp, }) return nil @@ -567,7 +567,7 @@ func TestBootstrapperIncompleteAncestors(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.NormalOp, }) return nil diff --git a/snow/engine/snowman/bootstrap/bootstrapper.go b/snow/engine/snowman/bootstrap/bootstrapper.go index f0a61880aedf..ae3bba5c5707 100644 --- a/snow/engine/snowman/bootstrap/bootstrapper.go +++ b/snow/engine/snowman/bootstrap/bootstrapper.go @@ -166,7 +166,7 @@ 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, + Type: p2p.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, }) if err := b.VM.SetState(ctx, snow.Bootstrapping); err != nil { diff --git a/snow/engine/snowman/bootstrap/bootstrapper_test.go b/snow/engine/snowman/bootstrap/bootstrapper_test.go index 5d3a1ff13d2e..cbe5f2fc2d97 100644 --- a/snow/engine/snowman/bootstrap/bootstrapper_test.go +++ b/snow/engine/snowman/bootstrap/bootstrapper_test.go @@ -169,7 +169,7 @@ func TestBootstrapperStartsOnlyIfEnoughStakeIsConnected(t *testing.T) { // create bootstrapper dummyCallback := func(context.Context, uint32) error { cfg.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -226,7 +226,7 @@ func TestBootstrapperSingleFrontier(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -255,7 +255,7 @@ func TestBootstrapperUnknownByzantineResponse(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -301,7 +301,7 @@ func TestBootstrapperPartialFetch(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -352,7 +352,7 @@ func TestBootstrapperEmptyResponse(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -401,7 +401,7 @@ func TestBootstrapperAncestors(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -447,7 +447,7 @@ func TestBootstrapperFinalized(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -490,7 +490,7 @@ func TestRestartBootstrapping(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -555,7 +555,7 @@ func TestBootstrapOldBlockAfterStateSync(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -596,7 +596,7 @@ func TestBootstrapContinueAfterHalt(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -703,7 +703,7 @@ func TestBootstrapNoParseOnNew(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -724,7 +724,7 @@ func TestBootstrapperReceiveStaleAncestorsMessage(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil @@ -770,7 +770,7 @@ func TestBootstrapperRollbackOnSetState(t *testing.T) { config, func(context.Context, uint32) error { config.Ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) return nil diff --git a/snow/engine/snowman/engine.go b/snow/engine/snowman/engine.go index 16cdc2252873..80559e96ac36 100644 --- a/snow/engine/snowman/engine.go +++ b/snow/engine/snowman/engine.go @@ -515,7 +515,7 @@ func (e *Engine) Start(ctx context.Context, startReqID uint32) error { e.metrics.bootstrapFinished.Set(1) e.Ctx.State.Set(snow.EngineState{ - Type: p2p.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2p.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, }) if err := e.VM.SetState(ctx, snow.NormalOp); err != nil { diff --git a/snow/engine/snowman/syncer/state_syncer.go b/snow/engine/snowman/syncer/state_syncer.go index 7392146d86f9..5c2fea11693a 100644 --- a/snow/engine/snowman/syncer/state_syncer.go +++ b/snow/engine/snowman/syncer/state_syncer.go @@ -113,7 +113,7 @@ func (ss *stateSyncer) Start(ctx context.Context, startReqID uint32) error { ss.Ctx.Log.Info("starting state sync") ss.Ctx.State.Set(snow.EngineState{ - Type: p2p.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2p.EngineType_ENGINE_TYPE_CHAIN, State: snow.StateSyncing, }) if err := ss.VM.SetState(ctx, snow.StateSyncing); err != nil { diff --git a/snow/networking/handler/engine.go b/snow/networking/handler/engine.go index 0e1ee38a0136..d5613cef554f 100644 --- a/snow/networking/handler/engine.go +++ b/snow/networking/handler/engine.go @@ -37,18 +37,18 @@ func (e *Engine) Get(state snow.State) (common.Engine, bool) { // EngineManager resolves the engine that should be used given the current // execution context of the chain. type EngineManager struct { - Avalanche *Engine - Snowman *Engine + DAG *Engine + Chain *Engine } // Get returns the engine corresponding to the provided type if possible. // If an engine type is not specified, the initial engine type is returned. func (e *EngineManager) Get(engineType p2p.EngineType) *Engine { switch engineType { - case p2p.EngineType_ENGINE_TYPE_AVALANCHE: - return e.Avalanche - case p2p.EngineType_ENGINE_TYPE_SNOWMAN: - return e.Snowman + case p2p.EngineType_ENGINE_TYPE_DAG: + return e.DAG + case p2p.EngineType_ENGINE_TYPE_CHAIN: + return e.Chain default: return nil } diff --git a/snow/networking/handler/engine_test.go b/snow/networking/handler/engine_test.go index 88b542685c5d..8462d0f18d2c 100644 --- a/snow/networking/handler/engine_test.go +++ b/snow/networking/handler/engine_test.go @@ -38,9 +38,9 @@ func TestEngineManager_Get(t *testing.T) { }, }, { - name: "request avalanche engine", + name: "request dag engine", args: args{ - engineType: p2p.EngineType_ENGINE_TYPE_AVALANCHE, + engineType: p2p.EngineType_ENGINE_TYPE_DAG, }, expected: expected{ engine: avalanche, @@ -49,7 +49,7 @@ func TestEngineManager_Get(t *testing.T) { { name: "request snowman engine", args: args{ - engineType: p2p.EngineType_ENGINE_TYPE_SNOWMAN, + engineType: p2p.EngineType_ENGINE_TYPE_CHAIN, }, expected: expected{ engine: snowman, @@ -59,8 +59,8 @@ func TestEngineManager_Get(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { e := EngineManager{ - Avalanche: avalanche, - Snowman: snowman, + DAG: avalanche, + Chain: snowman, } require.Equal(t, test.expected.engine, e.Get(test.args.engineType)) diff --git a/snow/networking/handler/handler.go b/snow/networking/handler/handler.go index 17976d461c94..1f9f0d2dcccd 100644 --- a/snow/networking/handler/handler.go +++ b/snow/networking/handler/handler.go @@ -492,8 +492,8 @@ func (h *handler) handleSyncMsg(ctx context.Context, msg Message) error { // We will attempt to pass the message to the requested type for the state // we are currently in. currentState := h.ctx.State.Get() - if msg.EngineType == p2ppb.EngineType_ENGINE_TYPE_SNOWMAN && - currentState.Type == p2ppb.EngineType_ENGINE_TYPE_AVALANCHE { + if msg.EngineType == p2ppb.EngineType_ENGINE_TYPE_CHAIN && + currentState.Type == p2ppb.EngineType_ENGINE_TYPE_DAG { // The peer is requesting an engine type that hasn't been initialized // yet. This means we know that this isn't a response, so we can safely // drop the message. @@ -508,7 +508,7 @@ func (h *handler) handleSyncMsg(ctx context.Context, msg Message) error { var engineType p2ppb.EngineType switch msg.EngineType { - case p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, p2ppb.EngineType_ENGINE_TYPE_SNOWMAN: + case p2ppb.EngineType_ENGINE_TYPE_DAG, p2ppb.EngineType_ENGINE_TYPE_CHAIN: // The peer is requesting an engine type that has been initialized, so // we should attempt to honor the request. engineType = msg.EngineType diff --git a/snow/networking/handler/handler_test.go b/snow/networking/handler/handler_test.go index b376c7a0209e..cc45b364df48 100644 --- a/snow/networking/handler/handler_test.go +++ b/snow/networking/handler/handler_test.go @@ -103,12 +103,12 @@ func TestHandlerDropsTimedOutMessages(t *testing.T) { return nil } handler.SetEngineManager(&EngineManager{ - Snowman: &Engine{ + Chain: &Engine{ Bootstrapper: bootstrapper, }, }) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) @@ -223,7 +223,7 @@ func TestHandlerClosesOnError(t *testing.T) { } handler.SetEngineManager(&EngineManager{ - Snowman: &Engine{ + Chain: &Engine{ Bootstrapper: bootstrapper, Consensus: engine, }, @@ -232,7 +232,7 @@ func TestHandlerClosesOnError(t *testing.T) { // assume bootstrapping is ongoing so that InboundGetAcceptedFrontier // should normally be handled ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, }) @@ -320,12 +320,12 @@ func TestHandlerDropsGossipDuringBootstrapping(t *testing.T) { return nil } handler.SetEngineManager(&EngineManager{ - Snowman: &Engine{ + Chain: &Engine{ Bootstrapper: bootstrapper, }, }) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) @@ -421,14 +421,14 @@ func TestHandlerDispatchInternal(t *testing.T) { } handler.SetEngineManager(&EngineManager{ - Snowman: &Engine{ + Chain: &Engine{ Bootstrapper: bootstrapper, Consensus: engine, }, }) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, // assumed bootstrap is done }) @@ -459,43 +459,43 @@ func TestDynamicEngineTypeDispatch(t *testing.T) { ) }{ { - name: "current - avalanche, requested - unspecified", - currentEngineType: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + name: "current - dag, requested - unspecified", + currentEngineType: p2ppb.EngineType_ENGINE_TYPE_DAG, requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, setup: func(h Handler, b common.BootstrapableEngine, e common.Engine) { h.SetEngineManager(&EngineManager{ - Avalanche: &Engine{ + DAG: &Engine{ StateSyncer: nil, Bootstrapper: b, Consensus: e, }, - Snowman: nil, + Chain: nil, }) }, }, { - name: "current - avalanche, requested - avalanche", - currentEngineType: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, - requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + name: "current - dag, requested - dag", + currentEngineType: p2ppb.EngineType_ENGINE_TYPE_DAG, + requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_DAG, setup: func(h Handler, b common.BootstrapableEngine, e common.Engine) { h.SetEngineManager(&EngineManager{ - Avalanche: &Engine{ + DAG: &Engine{ StateSyncer: nil, Bootstrapper: b, Consensus: e, }, - Snowman: nil, + Chain: nil, }) }, }, { - name: "current - snowman, requested - unspecified", - currentEngineType: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + name: "current - chain, requested - unspecified", + currentEngineType: p2ppb.EngineType_ENGINE_TYPE_CHAIN, requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_UNSPECIFIED, setup: func(h Handler, b common.BootstrapableEngine, e common.Engine) { h.SetEngineManager(&EngineManager{ - Avalanche: nil, - Snowman: &Engine{ + DAG: nil, + Chain: &Engine{ StateSyncer: nil, Bootstrapper: b, Consensus: e, @@ -504,17 +504,17 @@ func TestDynamicEngineTypeDispatch(t *testing.T) { }, }, { - name: "current - snowman, requested - avalanche", - currentEngineType: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, - requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_AVALANCHE, + name: "current - chain, requested - dag", + currentEngineType: p2ppb.EngineType_ENGINE_TYPE_CHAIN, + requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_DAG, setup: func(h Handler, b common.BootstrapableEngine, e common.Engine) { h.SetEngineManager(&EngineManager{ - Avalanche: &Engine{ + DAG: &Engine{ StateSyncer: nil, Bootstrapper: nil, Consensus: e, }, - Snowman: &Engine{ + Chain: &Engine{ StateSyncer: nil, Bootstrapper: b, Consensus: nil, @@ -523,13 +523,13 @@ func TestDynamicEngineTypeDispatch(t *testing.T) { }, }, { - name: "current - snowman, requested - snowman", - currentEngineType: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, - requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + name: "current - chain, requested - chain", + currentEngineType: p2ppb.EngineType_ENGINE_TYPE_CHAIN, + requestedEngineType: p2ppb.EngineType_ENGINE_TYPE_CHAIN, setup: func(h Handler, b common.BootstrapableEngine, e common.Engine) { h.SetEngineManager(&EngineManager{ - Avalanche: nil, - Snowman: &Engine{ + DAG: nil, + Chain: &Engine{ StateSyncer: nil, Bootstrapper: b, Consensus: e, @@ -674,7 +674,7 @@ func TestHandlerStartError(t *testing.T) { // handler to shutdown. handler.SetEngineManager(&EngineManager{}) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Initializing, }) handler.Start(context.Background(), false) diff --git a/snow/networking/handler/health_test.go b/snow/networking/handler/health_test.go index 0f9f3753782b..3f77940db856 100644 --- a/snow/networking/handler/health_test.go +++ b/snow/networking/handler/health_test.go @@ -115,14 +115,14 @@ func TestHealthCheckSubnet(t *testing.T) { } handlerIntf.SetEngineManager(&EngineManager{ - Snowman: &Engine{ + Chain: &Engine{ Bootstrapper: bootstrapper, Consensus: engine, }, }) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, // assumed bootstrap is done }) diff --git a/snow/networking/router/chain_router_test.go b/snow/networking/router/chain_router_test.go index 155337d12462..30e57a572338 100644 --- a/snow/networking/router/chain_router_test.go +++ b/snow/networking/router/chain_router_test.go @@ -41,7 +41,7 @@ import ( ) const ( - engineType = p2ppb.EngineType_ENGINE_TYPE_AVALANCHE + engineType = p2ppb.EngineType_ENGINE_TYPE_DAG testThreadPoolSize = 2 ) @@ -155,12 +155,12 @@ func TestShutdown(t *testing.T) { } engine.HaltF = func(context.Context) {} h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, @@ -273,12 +273,12 @@ func TestConnectedAfterShutdownErrorLogRegression(t *testing.T) { } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: &engine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: &engine, @@ -415,12 +415,12 @@ func TestShutdownTimesOut(t *testing.T) { return nil } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, @@ -609,7 +609,7 @@ func TestRouterTimeout(t *testing.T) { return nil } ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrapping is ongoing }) @@ -619,12 +619,12 @@ func TestRouterTimeout(t *testing.T) { return nil } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, @@ -647,7 +647,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -665,7 +665,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -683,7 +683,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -701,7 +701,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -718,9 +718,9 @@ func TestRouterTimeout(t *testing.T) { nodeID, ctx.ChainID, requestID, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -738,7 +738,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -756,7 +756,7 @@ func TestRouterTimeout(t *testing.T) { ctx.ChainID, requestID, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -776,7 +776,7 @@ func TestRouterTimeout(t *testing.T) { common.ErrTimeout.Code, common.ErrTimeout.Message, ), - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, ) } @@ -1100,7 +1100,7 @@ func TestValidatorOnlyMessageDrops(t *testing.T) { return nil } ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrapping is ongoing }) @@ -1110,12 +1110,12 @@ func TestValidatorOnlyMessageDrops(t *testing.T) { } engine.Default(false) h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, @@ -1277,7 +1277,7 @@ func TestValidatorOnlyAllowedNodeMessageDrops(t *testing.T) { engine.Default(false) h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ Bootstrapper: bootstrapper, Consensus: engine, }, @@ -1521,19 +1521,19 @@ func newChainRouterTest(t *testing.T) (*ChainRouter, *enginetest.Engine) { return ctx } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, }, }) ctx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.NormalOp, // assumed bootstrapping is done }) diff --git a/snow/networking/sender/sender_test.go b/snow/networking/sender/sender_test.go index 0b33c04c5265..299dda032716 100644 --- a/snow/networking/sender/sender_test.go +++ b/snow/networking/sender/sender_test.go @@ -106,7 +106,7 @@ func TestTimeout(t *testing.T) { externalSender, &chainRouter, tm, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnets.New(ctx.NodeID, subnets.Config{}), prometheus.NewRegistry(), ) @@ -160,19 +160,19 @@ func TestTimeout(t *testing.T) { return nil } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, }) ctx2.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_DAG, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) @@ -365,7 +365,7 @@ func TestReliableMessages(t *testing.T) { externalSender, &chainRouter, tm, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnets.New(ctx.NodeID, subnets.Config{}), prometheus.NewRegistry(), ) @@ -429,19 +429,19 @@ func TestReliableMessages(t *testing.T) { } bootstrapper.CantGossip = false h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, }) ctx2.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) @@ -527,7 +527,7 @@ func TestReliableMessagesToMyself(t *testing.T) { externalSender, &chainRouter, tm, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnet, prometheus.NewRegistry(), ) @@ -590,19 +590,19 @@ func TestReliableMessagesToMyself(t *testing.T) { return nil } h.SetEngineManager(&handler.EngineManager{ - Avalanche: &handler.Engine{ + DAG: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, - Snowman: &handler.Engine{ + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: nil, }, }) ctx2.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) @@ -843,7 +843,7 @@ func TestSender_Bootstrap_Requests(t *testing.T) { externalSender, router, timeoutManager, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnets.New(ctx.NodeID, subnets.Config{}), prometheus.NewRegistry(), ) @@ -1050,7 +1050,7 @@ func TestSender_Bootstrap_Responses(t *testing.T) { externalSender, router, timeoutManager, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnets.New(ctx.NodeID, subnets.Config{}), prometheus.NewRegistry(), ) @@ -1089,7 +1089,7 @@ func TestSender_Single_Request(t *testing.T) { deadline = time.Second requestID = uint32(1337) containerID = ids.GenerateTestID() - engineType = p2ppb.EngineType_ENGINE_TYPE_SNOWMAN + engineType = p2ppb.EngineType_ENGINE_TYPE_CHAIN ) snowCtx := snowtest.Context(t, snowtest.PChainID) ctx := snowtest.ConsensusContext(snowCtx) diff --git a/vms/platformvm/vm_test.go b/vms/platformvm/vm_test.go index 211a495eb362..39ba3371687d 100644 --- a/vms/platformvm/vm_test.go +++ b/vms/platformvm/vm_test.go @@ -1232,7 +1232,7 @@ func TestBootstrapPartiallyAccepted(t *testing.T) { externalSender, chainRouter, timeoutManager, - p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + p2ppb.EngineType_ENGINE_TYPE_CHAIN, subnet, prometheus.NewRegistry(), ) @@ -1354,8 +1354,8 @@ func TestBootstrapPartiallyAccepted(t *testing.T) { bootstrapper.TimeoutRegistrar = &enginetest.Timer{} h.SetEngineManager(&handler.EngineManager{ - Avalanche: nil, - Snowman: &handler.Engine{ + DAG: nil, + Chain: &handler.Engine{ StateSyncer: nil, Bootstrapper: bootstrapper, Consensus: engine, @@ -1363,7 +1363,7 @@ func TestBootstrapPartiallyAccepted(t *testing.T) { }) consensusCtx.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_SNOWMAN, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, }) From b476ea7557be2cfe416a4d6bb317337f4978bc76 Mon Sep 17 00:00:00 2001 From: Sam Liokumovich <65994425+samliok@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:46:19 -0400 Subject: [PATCH 2/5] Update snow/networking/sender/sender_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sam Liokumovich <65994425+samliok@users.noreply.github.com> --- snow/networking/sender/sender_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snow/networking/sender/sender_test.go b/snow/networking/sender/sender_test.go index 299dda032716..88573d1ec890 100644 --- a/snow/networking/sender/sender_test.go +++ b/snow/networking/sender/sender_test.go @@ -172,7 +172,7 @@ func TestTimeout(t *testing.T) { }, }) ctx2.State.Set(snow.EngineState{ - Type: p2ppb.EngineType_ENGINE_TYPE_DAG, + Type: p2ppb.EngineType_ENGINE_TYPE_CHAIN, State: snow.Bootstrapping, // assumed bootstrap is ongoing }) From b61dbeab43984be86446a62e5298b9b542342095 Mon Sep 17 00:00:00 2001 From: samliok Date: Thu, 21 Aug 2025 13:27:23 -0400 Subject: [PATCH 3/5] nits --- proto/p2p/p2p.proto | 2 +- snow/networking/handler/engine_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/p2p/p2p.proto b/proto/p2p/p2p.proto index 68431decdbe2..3fa951dee6b3 100644 --- a/proto/p2p/p2p.proto +++ b/proto/p2p/p2p.proto @@ -214,7 +214,7 @@ message AcceptedStateSummary { // The consensus engine that should be used when handling a consensus request. enum EngineType { ENGINE_TYPE_UNSPECIFIED = 0; - // Only the X-Chain uses avalanche consensus + // Only the X-Chain uses DAG consensus ENGINE_TYPE_DAG = 1; ENGINE_TYPE_CHAIN = 2; } diff --git a/snow/networking/handler/engine_test.go b/snow/networking/handler/engine_test.go index 8462d0f18d2c..03b69eec6ece 100644 --- a/snow/networking/handler/engine_test.go +++ b/snow/networking/handler/engine_test.go @@ -47,7 +47,7 @@ func TestEngineManager_Get(t *testing.T) { }, }, { - name: "request snowman engine", + name: "request chain engine", args: args{ engineType: p2p.EngineType_ENGINE_TYPE_CHAIN, }, From e3480fda9d8cbbcccaa859f09f9bbb8bd5bb8c7f Mon Sep 17 00:00:00 2001 From: samliok Date: Thu, 21 Aug 2025 13:45:21 -0400 Subject: [PATCH 4/5] regen protobuf --- proto/pb/p2p/p2p.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/pb/p2p/p2p.pb.go b/proto/pb/p2p/p2p.pb.go index bc57e369cbc6..5fbf5eeff007 100644 --- a/proto/pb/p2p/p2p.pb.go +++ b/proto/pb/p2p/p2p.pb.go @@ -26,7 +26,7 @@ type EngineType int32 const ( EngineType_ENGINE_TYPE_UNSPECIFIED EngineType = 0 - // Only the X-Chain uses avalanche consensus + // Only the X-Chain uses DAG consensus EngineType_ENGINE_TYPE_DAG EngineType = 1 EngineType_ENGINE_TYPE_CHAIN EngineType = 2 ) From 4a2fd48ad15edfffea84696527b048ac03453611 Mon Sep 17 00:00:00 2001 From: samliok Date: Fri, 22 Aug 2025 11:05:24 -0400 Subject: [PATCH 5/5] nits --- snow/networking/handler/engine_test.go | 12 ++++++------ snow/networking/handler/handler.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/snow/networking/handler/engine_test.go b/snow/networking/handler/engine_test.go index 03b69eec6ece..ff53e78da955 100644 --- a/snow/networking/handler/engine_test.go +++ b/snow/networking/handler/engine_test.go @@ -16,8 +16,8 @@ func TestEngineManager_Get(t *testing.T) { engineType p2p.EngineType } - avalanche := &Engine{} - snowman := &Engine{} + dag := &Engine{} + chain := &Engine{} type expected struct { engine *Engine @@ -43,7 +43,7 @@ func TestEngineManager_Get(t *testing.T) { engineType: p2p.EngineType_ENGINE_TYPE_DAG, }, expected: expected{ - engine: avalanche, + engine: dag, }, }, { @@ -52,15 +52,15 @@ func TestEngineManager_Get(t *testing.T) { engineType: p2p.EngineType_ENGINE_TYPE_CHAIN, }, expected: expected{ - engine: snowman, + engine: chain, }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { e := EngineManager{ - DAG: avalanche, - Chain: snowman, + DAG: dag, + Chain: chain, } require.Equal(t, test.expected.engine, e.Get(test.args.engineType)) diff --git a/snow/networking/handler/handler.go b/snow/networking/handler/handler.go index 1f9f0d2dcccd..0723f369acb1 100644 --- a/snow/networking/handler/handler.go +++ b/snow/networking/handler/handler.go @@ -514,7 +514,7 @@ func (h *handler) handleSyncMsg(ctx context.Context, msg Message) error { engineType = msg.EngineType default: // Note: [msg.EngineType] may have been provided by the peer as an - // invalid option. I.E. not one of AVALANCHE, SNOWMAN, or UNSPECIFIED. + // invalid option. I.E. not one of DAG, CHAIN, or UNSPECIFIED. // In this case, we treat the value the same way as UNSPECIFIED. // // If the peer didn't request a specific engine type, we default to the