Files
zeekay 445db75699 coreth: complete codec rip Wave 1C — message.Manager replaces codec.Manager
Salvages Wave 1C agent's incomplete work (11 files, 328+ lines) plus
the call-site fixups needed to make sync packages compile.

The new plugin/evm/message/codec.go defines a Manager interface (same
shape as legacy codec.Manager: Marshal/Unmarshal/Size) backed by a
hand-rolled wrappers.Packer with explicit big-endian field encoding.
No reflection registry. Byte-equal to legacy linearcodec output.

Call-site swaps (sync/client/client.go + sync/client/test_client.go):
codec.Manager → message.Manager. Drop the github.com/luxfi/codec
import where it's no longer referenced.

Packages green:
  ok  github.com/luxfi/coreth/plugin/evm/message
  ok  github.com/luxfi/coreth/predicate
  ok  github.com/luxfi/coreth/sync/vm

coreth plugin/evm codec importer count: 21 → 15. Remaining 15 are in
atomic/, predicate/, warp aggregator, tx pool — not in this Wave's
scope.
2026-06-05 13:37:50 -07:00

36 lines
1.1 KiB
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package message
import (
"context"
"fmt"
"github.com/luxfi/ids"
)
// Request represents a Network request type
type Request interface {
// Requests should implement String() for logging.
fmt.Stringer
// Handle allows `Request` to call respective methods on handler to handle
// this particular request type
Handle(ctx context.Context, nodeID ids.NodeID, requestID uint32, handler RequestHandler) ([]byte, error)
}
// RequestMarshaler is the minimal surface RequestToBytes needs from the
// package codec. The concrete *manager satisfies it; callers should pass
// [Codec].
type RequestMarshaler interface {
Marshal(version uint16, source interface{}) ([]byte, error)
}
// RequestToBytes marshals the given request object into bytes. The
// `marshaler` argument exists for symmetry with the legacy codec.Manager
// signature; in-tree callers always pass [Codec].
func RequestToBytes(marshaler RequestMarshaler, request Request) ([]byte, error) {
return marshaler.Marshal(Version, &request)
}