mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
node: ZAP-native everywhere — kill every //go:build grpc path
The companion commit `7496606282` retired the gRPC fallback inside
vms/rpcchainvm/. This commit closes the loop by deleting every
remaining `//go:build grpc` file under node/, removing the dual-build
plumbing entirely. ZAP is the only wire protocol; there is no
`-tags=grpc` opt-in.
Per the "one and only one way to do everything" mandate, the
backwards-compat scaffolding (gRPC adapters, protoc stubs, connect-go
example handlers, OTLP gRPC exporter, x/sync gRPC sync engine,
keystore-over-gRPC client/server, rpcwarp gRPC signer, gRPC alias
reader) is removed forward-only — no aliases, no deprecation period.
Deletions (84 files):
- proto/pb/{aliasreader,http,io,keystore,message,messenger,net,p2p,
platformvm,rpcdb,sdk,sender,sharedmemory,signer,sync,
validatorstate,vm,warp}/ — protoc stubs (entire tree)
- proto/{p2p,platformvm,sync,vm}/*_grpc.go — gRPC type re-exports
- db/rpcdb/{grpc_server,grpc_client,grpc_test}.go — rpcdb gRPC adapter
- service/keystore/rpckeystore/ — keystore-over-gRPC (dead consumer)
- x/sync/ — entire merkledb sync engine (100% gRPC-tagged)
- internal/ids/rpcaliasreader/ — gRPC alias reader (dead consumer)
- connectproto/ — connect-go XSVM ping handler scaffolding
- vms/platformvm/warp/rpcwarp/{client,server}.go — gRPC warp signer
- vms/platformvm/network/warp.go — protobuf-based warp justification
handler (warp_zap.go retains the no-op verifier consumers expect)
- vms/components/message/message_grpc.go + message_test.go
- vms/example/xsvm/api/ping.go + vm_http_grpc.go + cmd/{run,xsvm}/
- wallet/network/primary/examples/sign-l1-validator-* (5 dead
example main packages)
- trace/{exporter_grpc,exporter_type,exporter_type_test,noop,tracer}.go
(OTLP gRPC exporter + duplicate Tracer types — trace_zap.go has
the canonical Tracer interface + no-op tracer)
- message/bft_grpc.go (Simplex BFT wrapper)
Edits (9 files): every surviving `_zap.go` drops its `//go:build !grpc`
constraint (the files are unconditional now) and drops stale
"ZAP version" / "ZAP mode" inline comments.
Doc updates:
- LLM.md ZAP Transport section: remove the `-tags=grpc` opt-in
language. Replace with "ZAP is the only wire protocol... there is
one and only one way". Update Latest Tag to v1.26.31. Update the
rpcdb topology section to reflect single-adapter state.
go.mod: connectrpc.com/connect, connectrpc.com/grpcreflect,
otlptracegrpc moved out of direct deps. google.golang.org/grpc +
protobuf demoted to indirect (still pulled transitively via luxfi/dex).
Verified:
- `go build ./...` (default, no tags) clean
- `go test ./db/rpcdb/... ./trace/... ./message/... ./vms/rpcchainvm/...
./vms/components/message/... ./vms/platformvm/network/...
./vms/example/xsvm/... ./service/keystore/... ./proto/...` clean
- `grep -rln '//go:build grpc' --include='*.go' node/` returns zero
- `grep -rln '//go:build !grpc' --include='*.go' node/` returns zero
- `grep -rln 'google.golang.org/grpc' --include='*.go' node/` returns
zero (only transitive deps remain in go.sum)
Pre-existing TestGraniteNetworkIDConfiguration failure in tests/ is
unrelated — fails on the parent commit too (verified via stash).
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
//go:build grpc
|
||||
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpcaliasreader
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
|
||||
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
|
||||
)
|
||||
|
||||
var _ ids.AliaserReader = (*Client)(nil)
|
||||
|
||||
// Client implements alias lookups that talk over RPC.
|
||||
type Client struct {
|
||||
client aliasreaderpb.AliasReaderClient
|
||||
}
|
||||
|
||||
// NewClient returns an alias lookup instance connected to a remote alias lookup
|
||||
// instance
|
||||
func NewClient(client aliasreaderpb.AliasReaderClient) *Client {
|
||||
return &Client{client: client}
|
||||
}
|
||||
|
||||
func (c *Client) Lookup(alias string) (ids.ID, error) {
|
||||
resp, err := c.client.Lookup(context.Background(), &aliasreaderpb.Alias{
|
||||
Alias: alias,
|
||||
})
|
||||
if err != nil {
|
||||
return ids.Empty, err
|
||||
}
|
||||
return ids.ToID(resp.Id)
|
||||
}
|
||||
|
||||
func (c *Client) PrimaryAlias(id ids.ID) (string, error) {
|
||||
resp, err := c.client.PrimaryAlias(context.Background(), &aliasreaderpb.ID{
|
||||
Id: id[:],
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.Alias, nil
|
||||
}
|
||||
|
||||
func (c *Client) Aliases(id ids.ID) ([]string, error) {
|
||||
resp, err := c.client.Aliases(context.Background(), &aliasreaderpb.ID{
|
||||
Id: id[:],
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.Aliases, nil
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
//go:build grpc
|
||||
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpcaliasreader
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
|
||||
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
|
||||
)
|
||||
|
||||
var _ aliasreaderpb.AliasReaderServer = (*Server)(nil)
|
||||
|
||||
// Server enables alias lookups over RPC.
|
||||
type Server struct {
|
||||
aliasreaderpb.UnsafeAliasReaderServer
|
||||
aliaser ids.AliaserReader
|
||||
}
|
||||
|
||||
// NewServer returns an alias lookup connected to a remote alias lookup
|
||||
func NewServer(aliaser ids.AliaserReader) *Server {
|
||||
return &Server{aliaser: aliaser}
|
||||
}
|
||||
|
||||
func (s *Server) Lookup(
|
||||
_ context.Context,
|
||||
req *aliasreaderpb.Alias,
|
||||
) (*aliasreaderpb.ID, error) {
|
||||
id, err := s.aliaser.Lookup(req.Alias)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &aliasreaderpb.ID{
|
||||
Id: id[:],
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) PrimaryAlias(
|
||||
_ context.Context,
|
||||
req *aliasreaderpb.ID,
|
||||
) (*aliasreaderpb.Alias, error) {
|
||||
if s.aliaser == nil {
|
||||
return nil, fmt.Errorf("aliaser is nil - BCLookup not configured for this chain")
|
||||
}
|
||||
|
||||
id, err := ids.ToID(req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
alias, err := s.aliaser.PrimaryAlias(id)
|
||||
|
||||
return &aliasreaderpb.Alias{
|
||||
Alias: alias,
|
||||
}, err
|
||||
}
|
||||
|
||||
func (s *Server) Aliases(
|
||||
_ context.Context,
|
||||
req *aliasreaderpb.ID,
|
||||
) (*aliasreaderpb.AliasList, error) {
|
||||
id, err := ids.ToID(req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
aliases, err := s.aliaser.Aliases(id)
|
||||
return &aliasreaderpb.AliasList{
|
||||
Aliases: aliases,
|
||||
}, err
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
//go:build grpc
|
||||
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpcaliasreader
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/luxfi/ids"
|
||||
"github.com/luxfi/ids/idstest"
|
||||
"github.com/luxfi/vm/rpc/grpcutils"
|
||||
|
||||
aliasreaderpb "github.com/luxfi/node/proto/pb/aliasreader"
|
||||
)
|
||||
|
||||
func TestInterface(t *testing.T) {
|
||||
for _, test := range idstest.AliasTests {
|
||||
t.Run(test.Name, func(t *testing.T) {
|
||||
require := require.New(t)
|
||||
|
||||
listener, err := grpcutils.NewListener()
|
||||
require.NoError(err)
|
||||
defer listener.Close()
|
||||
serverCloser := grpcutils.ServerCloser{}
|
||||
defer serverCloser.Stop()
|
||||
w := ids.NewAliaser()
|
||||
|
||||
server := grpcutils.NewServer()
|
||||
aliasreaderpb.RegisterAliasReaderServer(server, NewServer(w))
|
||||
serverCloser.Add(server)
|
||||
|
||||
go grpcutils.Serve(listener, server)
|
||||
|
||||
conn, err := grpcutils.Dial(listener.Addr().String())
|
||||
require.NoError(err)
|
||||
defer conn.Close()
|
||||
|
||||
r := NewClient(aliasreaderpb.NewAliasReaderClient(conn))
|
||||
test.Test(t, r, w)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user