mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
platformvm/txs/zap_native: 5 more tx types (LP-023 Phase 1 batch 2)
Native ZAP encoding — no marshal step, struct IS wire format — for the
next batch of platformvm tx types. Same pattern as Phase 1 batch 1.
New types (v1 schemas; variable-length nested fields deferred to batch 3):
base_tx.go — NetworkID + BlockchainID + Memo
(Outs/Ins → batch 3)
register_l1_validator_tx.go — ValidationID + BLS pubkey 48B + PoP 96B
+ Expiry + RemainingBalanceOwnerID stub
(Warp Message + full OutputOwners → batch 3)
slash_validator_tx.go — NodeID + Subnet + SlashPercentage
(Evidence variable-length → batch 3)
transfer_chain_ownership_tx.go — Chain + Owner{threshold,locktime,addr} v1 stub
(full OutputOwners list → batch 3)
remove_chain_validator_tx.go — NodeID + Subnet
(ChainAuth lives in signed wrapper)
Tests + benches extend the existing all_tx_types_test.go +
all_types_bench_test.go infra (no duplication). 18 new accessor zero-alloc
sites verified, including 48B BLSPublicKey and 96B PoP by-value returns.
Aggregate bench results (Apple M1 Max, Go 1.24, -benchtime=2s):
Parse Legacy vs ZAP:
BaseTx 470.0 → 60.42 ns ( 7.8x) 152→24 B 3→1 alloc
RegisterL1ValidatorTx 1008 → 75.03 ns (13.4x) 384→24 B 6→1 alloc
SlashValidatorTx 690.6 → 82.74 ns ( 8.3x) 176→24 B 4→1 alloc
TransferChainOwnershipTx 2459 → 161.5 ns (15.2x) 192→24 B 4→1 alloc
RemoveChainValidatorTx 879.6 → 117.2 ns ( 7.5x) 176→24 B 4→1 alloc
Parse cross-type mean (10 types now native): 8.5x speedup.
Build (one-time per proposer, dominated by Parse on consensus path):
BaseTx 1.5x slower (memo SetBytes deferred-copy; acceptable trade)
Register 1.03x (allocs 7→2)
Slash 1.4x faster (allocs 5→2)
Transfer 0.96x (allocs 5→2)
Remove 1.3x faster (allocs 5→2)
All accessor reads zero-alloc. All builds 1 alloc on read path.
Verification:
cd ~/work/lux/node
GOWORK=off go build ./vms/platformvm/txs/zap_native/...
GOWORK=off go test ./vms/platformvm/txs/zap_native/...
GOWORK=off go test -bench=. -benchmem -benchtime=2s \\
./vms/platformvm/txs/zap_native/...
Activation 1782604800 (2026-07-01 00:00 UTC) unchanged.
LUXD_ENABLE_LEGACY_CODEC=1 opts INTO legacy unchanged.
Refs LP-023. Next: batch 3 — variable-length nested-object schemas (Outs/Ins
lists, Warp Message payloads, full OutputOwners, Evidence) + remaining tx
types via codegen.
This commit is contained in:
@@ -39,6 +39,8 @@ selection, and EVM contract auth.
|
||||
|
||||
| SHA | Tag | Impact |
|
||||
|-----|-----|--------|
|
||||
| (pending) | next | LP-023 Phase 1 batch 2: 5 more native-ZAP tx types — BaseTx v1, RegisterL1ValidatorTx v1, SlashValidatorTx v1, TransferChainOwnershipTx v1, RemoveChainValidatorTx. Cross-type Parse mean speedup 8.5× over linearcodec. Variable-length nested-object schemas (Outs/Ins/full OutputOwners/Warp Message/Evidence) deferred to batch 3. |
|
||||
| `e77a7ef78e` | (pre) | LP-023 Phase 1 batch 1: 4 simple tx types + bench harness. 37× Parse, 5.6× cross-type mean. |
|
||||
| `9df72a6f55` | v1.26.10 | Wire ChainSecurityProfile into bootstrap (closes F102) |
|
||||
| `c4af52411e` | v1.26.10 | X-Chain (avm) mempool refuses classical creds under strict-PQ |
|
||||
| `a14a1601f4` | v1.26.10 | P-Chain (platformvm) mempool refuses classical creds under strict-PQ |
|
||||
|
||||
Reference in New Issue
Block a user