Files
zeekay f480e48e39 run on the native fleet
Adds .hanzo/workflows/cicd.yml calling the canonical pipeline and drops the
GitHub-hosted workflows it replaces. Lands here because this is where the repo
is written — git.hanzo.ai is upstream and github.com is its push mirror, so the
same change made on github.com never reaches the runner fleet.
2026-08-20 20:20:25 -07:00

60 lines
1.4 KiB
Go

// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"github.com/luxfi/log"
"github.com/luxfi/proto/x/fxs"
"github.com/luxfi/proto/x/txs"
"github.com/luxfi/timer/mockable"
)
var _ Parser = (*parser)(nil)
// Parser parses both X-chain txs and blocks. It embeds the codec-free
// txs.Parser (for ParseTx / ParseGenesisTx) and adds native-ZAP block parsing.
type Parser interface {
txs.Parser
ParseBlock(bytes []byte) (Block, error)
ParseGenesisBlock(bytes []byte) (Block, error)
}
type parser struct {
txs.Parser
}
func NewParser(fxs []fxs.Fx) (Parser, error) {
p, err := txs.NewParser(fxs)
if err != nil {
return nil, err
}
return &parser{Parser: p}, nil
}
func NewCustomParser(
fxIndex *txs.FxIndex,
clock *mockable.Clock,
log log.Logger,
fxs []fxs.Fx,
) (Parser, error) {
p, err := txs.NewCustomParser(fxIndex, clock, log, fxs)
if err != nil {
return nil, err
}
return &parser{Parser: p}, nil
}
// ParseBlock decodes a native-ZAP X-chain block (byte-preserving).
func (*parser) ParseBlock(bytes []byte) (Block, error) {
return parseStandardBlock(bytes)
}
// ParseGenesisBlock decodes the genesis block. Same wire as any other block —
// the genesis/standard distinction was a codec-version artifact that no longer
// exists.
func (*parser) ParseGenesisBlock(bytes []byte) (Block, error) {
return parseStandardBlock(bytes)
}