mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
Kills pcodecs from 3 complete subsystems (verified go test ./... = 155 ok / 0 FAIL):
- proposervm: block/state/summary struct-is-wire (blockwire.go + statewire.go;
deleted block/state/summary codec.go). blockKind bytes: reserved=0 signed=1
option=2. Epoch inlined in unsigned object. proposer/windower chainSource seed
= binary.LittleEndian (byte-identical to old wrappers.Packer.UnpackLong).
- example/xsvm: tx/block/genesis native Marshal (deleted 3 codec.go); create-chain
example uses genesis.Marshal().
- components: message.Tx native (deleted codec.go); keystore codec shell removed;
index pcodecs.LongLen → local const.
- evm/{predicate,lp176}: off pcodecs.
- platformvm residual: state metadata + genesis + metrics + signer + stakeable
native, vestigial serialize tags removed.
REMAINING (careful solo, agents weekly-capped): warp (reverted — agent left an
ID≠Marshal consensus inconsistency in ChainToL1Conversion; needs proper review,
not a golden-regen) + xvm (reverted — barely started). pcodecs package stays
until those 2 land. /ext/→/v1/ endpoint change also pending.
Co-authored-by: Hanzo Dev <dev@hanzo.ai>
56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package genesis
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/luxfi/formatting"
|
|
)
|
|
|
|
var errUnknownEncoding = errors.New("unknown encoding")
|
|
|
|
func Command() *cobra.Command {
|
|
c := &cobra.Command{
|
|
Use: "genesis",
|
|
Short: "Creates a chain's genesis and prints it to stdout",
|
|
RunE: genesisFunc,
|
|
}
|
|
flags := c.Flags()
|
|
AddFlags(flags)
|
|
return c
|
|
}
|
|
|
|
func genesisFunc(c *cobra.Command, args []string) error {
|
|
flags := c.Flags()
|
|
config, err := ParseFlags(flags, args)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
genesisBytes, err := config.Genesis.Marshal()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
switch config.Encoding {
|
|
case binaryEncoding:
|
|
_, err = os.Stdout.Write(genesisBytes)
|
|
return err
|
|
case hexEncoding:
|
|
encoded, err := formatting.Encode(formatting.Hex, genesisBytes)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
_, err = fmt.Println(encoded)
|
|
return err
|
|
default:
|
|
return fmt.Errorf("%w: %q", errUnknownEncoding, config.Encoding)
|
|
}
|
|
}
|