Documentation
¶
Overview ¶
Package bench holds the linearcodec-vs-native-ZAP benchmark harness for the platformvm txs.
FIXTURE PHILOSOPHY: every tx the harness measures is built with field counts representative of mainnet — a typical AddPermissionlessValidator in production carries 2 inputs + 2 outputs + 1 stake-out + signer.PoP (the most common case as of 2026-06). Empty BaseTx{} fixtures are excluded from the headline numbers; they appear only as a "minimal payload" floor in the report to bound how much of the speedup is fixed-cost.
Index ¶
- Variables
- func FixtureMap() map[string]txs.UnsignedTx
- func MustMarshal(unsigned txs.UnsignedTx) []byte
- func MustMarshalSignedTx(unsigned txs.UnsignedTx) []byte
- func NewAddDelegatorTxFixture() *txs.AddDelegatorTx
- func NewAddPermissionlessDelegatorTxFixture() *txs.AddPermissionlessDelegatorTx
- func NewAddPermissionlessValidatorTxFixture() *txs.AddPermissionlessValidatorTx
- func NewAddValidatorTxFixture() *txs.AddValidatorTx
- func NewAdvanceTimeTxFixture() *txs.AdvanceTimeTx
- func NewBaseTxFixture() *txs.BaseTx
- func NewBaseTxWithStakeableFixture() *txs.BaseTx
- func NewCreateChainTxFixture() *txs.CreateChainTx
- func NewCreateNetworkTxFixture() *txs.CreateNetworkTx
- func NewExportTxFixture() *txs.ExportTx
- func NewImportTxFixture() *txs.ImportTx
- func NewRewardValidatorTxFixture() *txs.RewardValidatorTx
Constants ¶
This section is empty.
Variables ¶
var MainnetAssetID = ids.ID{
0x51, 0xc2, 0x4f, 0xe7, 0xee, 0x02, 0x01, 0xff,
0x0f, 0x33, 0x5f, 0x51, 0x99, 0x28, 0xdb, 0x6e,
0xef, 0x62, 0x24, 0x25, 0x45, 0x52, 0xc9, 0x6b,
0x6b, 0x42, 0x5f, 0xbc, 0x18, 0xfa, 0x24, 0x3b,
}
MainnetAssetID is the canonical LUX asset ID on the mainnet P-Chain, used in every fixture so that benchmark inputs match production tx payloads byte-for-byte in the "asset ID" 32-byte slot.
Functions ¶
func FixtureMap ¶
func FixtureMap() map[string]txs.UnsignedTx
FixtureMap returns the named fixtures the bench harness iterates over. Add new tx types here as Blue lands accessors for them; the per-type bench is reflective over this map.
Insertion order matters for table output: this is the order the columns appear in RESULTS.md.
func MustMarshal ¶
func MustMarshal(unsigned txs.UnsignedTx) []byte
MustMarshal panics on error; intended for fixture pre-encoding.
func MustMarshalSignedTx ¶
func MustMarshalSignedTx(unsigned txs.UnsignedTx) []byte
MustMarshalSignedTx wraps an unsigned in a *txs.Tx with empty creds and returns the canonical signed-byte form. This matches the mempool/block path: txs on the wire are *txs.Tx, not bare unsigned.
func NewAddDelegatorTxFixture ¶
func NewAddDelegatorTxFixture() *txs.AddDelegatorTx
NewAddDelegatorTxFixture is the delegator counterpart — same shape, no DelegationShares (delegators don't carry that field).
func NewAddPermissionlessDelegatorTxFixture ¶
func NewAddPermissionlessDelegatorTxFixture() *txs.AddPermissionlessDelegatorTx
NewAddPermissionlessDelegatorTxFixture is the delegator companion to AddPermissionlessValidator. No Signer; no RewardsOwner split; just the single DelegationRewardsOwner. Smaller wire footprint than the validator fixture by ~200B (no PoP).
func NewAddPermissionlessValidatorTxFixture ¶
func NewAddPermissionlessValidatorTxFixture() *txs.AddPermissionlessValidatorTx
NewAddPermissionlessValidatorTxFixture is the Banff-era primary-net validator with a full ProofOfPossession (a real mainnet validator tx has this signer). Field count: BaseTx(2/2) + Validator + ChainID + Signer(PoP) + StakeOuts(1) + ValidatorRewardsOwner + DelegatorRewardsOwner + DelegationShares = 8 top-level fields.
func NewAddValidatorTxFixture ¶
func NewAddValidatorTxFixture() *txs.AddValidatorTx
NewAddValidatorTxFixture returns a legacy primary-network AddValidator with a realistic 2-in / 2-out base, 1 stake-out, and a rewards owner of size 1.
func NewAdvanceTimeTxFixture ¶
func NewAdvanceTimeTxFixture() *txs.AdvanceTimeTx
NewAdvanceTimeTxFixture is the minimal scheduled-time-advance tx. 4 fields in the wire layout: codec version, type ID, then a single uint64. Smallest of the smalls.
func NewBaseTxFixture ¶
NewBaseTxFixture returns the canonical "1 input / 1 output" BaseTx the way it appears in real mainnet bytes — the smallest non-trivial payload and the unit by which all other fixtures are bounded from below.
func NewBaseTxWithStakeableFixture ¶
NewBaseTxWithStakeableFixture stresses the stakeable.LockOut path (slot 22). Real validator deposit txs use this; ignoring it would understate the codec cost.
func NewCreateChainTxFixture ¶
func NewCreateChainTxFixture() *txs.CreateChainTx
NewCreateChainTxFixture is the legacy create-blockchain tx.
func NewCreateNetworkTxFixture ¶
func NewCreateNetworkTxFixture() *txs.CreateNetworkTx
NewCreateNetworkTxFixture is the legacy create-network tx.
func NewExportTxFixture ¶
NewExportTxFixture covers the P→X (or P→C) export.
func NewImportTxFixture ¶
NewImportTxFixture covers the cross-chain import path; the ImportedInputs slice is what real X→P moves carry. Two imported inputs is the modal case (one for amount, one for fee).
func NewRewardValidatorTxFixture ¶
func NewRewardValidatorTxFixture() *txs.RewardValidatorTx
NewRewardValidatorTxFixture is the "reward this validator" tx. Carries a single ids.ID. Tiny.
Types ¶
This section is empty.