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,65 +0,0 @@
|
||||
//go:build grpc
|
||||
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// Package rpckeystore is the keystore-over-RPC client and server. The
|
||||
// transport is selected by build tag: `grpc` selects the legacy gRPC
|
||||
// codepath in this file; the default build (no tag) will eventually
|
||||
// select a ZAP-based codepath (task #57). Mirrors the rpcdb naming
|
||||
// pattern — `rpc` is the value (remote procedure call), the substrate
|
||||
// is per-tag.
|
||||
package rpckeystore
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/luxfi/database"
|
||||
"github.com/luxfi/database/encdb"
|
||||
"github.com/luxfi/node/db/rpcdb"
|
||||
"github.com/luxfi/node/service/keystore"
|
||||
"github.com/luxfi/vm/rpc/grpcutils"
|
||||
|
||||
keystorepb "github.com/luxfi/node/proto/pb/keystore"
|
||||
rpcdbpb "github.com/luxfi/node/proto/pb/rpcdb"
|
||||
)
|
||||
|
||||
var _ keystore.BlockchainKeystore = (*Client)(nil)
|
||||
|
||||
// Client is a consensus.Keystore that talks over RPC.
|
||||
type Client struct {
|
||||
client keystorepb.KeystoreClient
|
||||
}
|
||||
|
||||
// NewClient returns a keystore instance connected to a remote keystore instance
|
||||
func NewClient(client keystorepb.KeystoreClient) *Client {
|
||||
return &Client{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) GetDatabase(username, password string) (*encdb.Database, error) {
|
||||
bcDB, err := c.GetRawDatabase(username, password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return encdb.New([]byte(password), bcDB)
|
||||
}
|
||||
|
||||
func (c *Client) GetRawDatabase(username, password string) (database.Database, error) {
|
||||
resp, err := c.client.GetDatabase(context.Background(), &keystorepb.GetDatabaseRequest{
|
||||
Username: username,
|
||||
Password: password,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
clientConn, err := grpcutils.Dial(resp.ServerAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dbClient := rpcdb.NewGRPCClient(rpcdbpb.NewDatabaseClient(clientConn))
|
||||
return dbClient, nil
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
//go:build grpc
|
||||
|
||||
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
package rpckeystore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/luxfi/database"
|
||||
|
||||
"github.com/luxfi/node/service/keystore"
|
||||
"github.com/luxfi/vm/rpc/grpcutils"
|
||||
|
||||
keystorepb "github.com/luxfi/node/proto/pb/keystore"
|
||||
)
|
||||
|
||||
var _ keystorepb.KeystoreServer = (*Server)(nil)
|
||||
|
||||
// Server is a consensus.Keystore that is managed over RPC.
|
||||
type Server struct {
|
||||
keystorepb.UnsafeKeystoreServer
|
||||
ks keystore.BlockchainKeystore
|
||||
}
|
||||
|
||||
// NewServer returns a keystore connected to a remote keystore
|
||||
func NewServer(ks keystore.BlockchainKeystore) *Server {
|
||||
return &Server{
|
||||
ks: ks,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) GetDatabase(
|
||||
_ context.Context,
|
||||
req *keystorepb.GetDatabaseRequest,
|
||||
) (*keystorepb.GetDatabaseResponse, error) {
|
||||
db, err := s.ks.GetRawDatabase(req.Username, req.Password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
closer := dbCloser{Database: db}
|
||||
|
||||
serverListener, err := grpcutils.NewListener()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
server := grpcutils.NewServer()
|
||||
closer.closer.Add(server)
|
||||
|
||||
// start the db server
|
||||
go grpcutils.Serve(serverListener, server)
|
||||
|
||||
return &keystorepb.GetDatabaseResponse{ServerAddr: serverListener.Addr().String()}, nil
|
||||
}
|
||||
|
||||
type dbCloser struct {
|
||||
database.Database
|
||||
closer grpcutils.ServerCloser
|
||||
}
|
||||
|
||||
func (db *dbCloser) Close() error {
|
||||
err := db.Database.Close()
|
||||
db.closer.Stop()
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user