mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
v1.36.8: zap v1.2.4 value ObjectBuilder — faster wire build node-wide
zap v1.2.4 (eager-reserve + value-type ObjectBuilder: zero defer-slice, zero per-StartObject heap alloc) + utxo v0.5.7. Byte-identical wire — 21 platformvm/ xvm/components-lux/da packages green. Node-side setEnvelope/setValidator/setID/ setOwner/setSecurity/writeIDInto helpers take zap.ObjectBuilder by value (its methods mutate through ob.b, so value + pointer are equivalent). Speeds every ZAP object build (P/X txs, blocks, warp, da), not just X-tx. X-tx wire composite 922->655ns / 11->5 allocs. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This commit is contained in:
@@ -143,11 +143,11 @@ require (
|
||||
github.com/luxfi/timer v1.0.2
|
||||
github.com/luxfi/units v1.0.0
|
||||
github.com/luxfi/utils v1.2.0
|
||||
github.com/luxfi/utxo v0.5.6
|
||||
github.com/luxfi/utxo v0.5.7
|
||||
github.com/luxfi/validators v1.2.0
|
||||
github.com/luxfi/vm v1.2.7
|
||||
github.com/luxfi/warp v1.24.0
|
||||
github.com/luxfi/zap v1.2.3
|
||||
github.com/luxfi/zap v1.2.4
|
||||
github.com/luxfi/zwing v0.5.2
|
||||
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354
|
||||
github.com/zap-proto/http v0.0.0-20260506200741-fd6047874433
|
||||
|
||||
@@ -523,6 +523,8 @@ github.com/luxfi/utxo v0.5.5 h1:57iLgiP2nY6d7ljvDpSoQefNbf9+S4Wknj0k99eQ20g=
|
||||
github.com/luxfi/utxo v0.5.5/go.mod h1:Qom/3mk7+9aEziXzdEGvHxTAl7lA2IsSDs+WUkFxjRY=
|
||||
github.com/luxfi/utxo v0.5.6 h1:xdmHmgzhq71rVLd752g4gzl7CFeUsKpxttDdzTQGXKc=
|
||||
github.com/luxfi/utxo v0.5.6/go.mod h1:Qom/3mk7+9aEziXzdEGvHxTAl7lA2IsSDs+WUkFxjRY=
|
||||
github.com/luxfi/utxo v0.5.7 h1:ocmCvtL5/QrxcDBjwISD3gKKyydeNpnlFHZ4E+/YYIM=
|
||||
github.com/luxfi/utxo v0.5.7/go.mod h1:n5Rzk6idEPAdTFLnioVQDhw+ypVtyE2TiJqWaTX7ZIA=
|
||||
github.com/luxfi/validators v1.2.0 h1:VygpiBqBAdGrfkb7xzE2yrVmnXaqE+hm8FLWdGXO7G8=
|
||||
github.com/luxfi/validators v1.2.0/go.mod h1:GYLulrNXAan23ZlX7sgWVbVnLpUexeB/m2qr2ymsXok=
|
||||
github.com/luxfi/version v1.0.1 h1:T/1KYWEMmsrNQk7pN7PFPAwh/7XbeX7cFAKLBqI37Sk=
|
||||
@@ -535,6 +537,8 @@ github.com/luxfi/zap v1.2.2 h1:1WoijKzhx7P//fExdv9P9GNJS1rtpwlBzHLDh5TBc30=
|
||||
github.com/luxfi/zap v1.2.2/go.mod h1:JfqII8VtVQYLLTX6obU1DP9sjGqf9L24vfug5ifh0b8=
|
||||
github.com/luxfi/zap v1.2.3 h1:aLPUgXH5ITqbGRS6tFx1hMZqsB4kL6j39+4s7/JlGgs=
|
||||
github.com/luxfi/zap v1.2.3/go.mod h1:JfqII8VtVQYLLTX6obU1DP9sjGqf9L24vfug5ifh0b8=
|
||||
github.com/luxfi/zap v1.2.4 h1:1hqvo+vKZ+umYYJnxqYvVsZ+D7Os1BDmrLlqISSk/dA=
|
||||
github.com/luxfi/zap v1.2.4/go.mod h1:JfqII8VtVQYLLTX6obU1DP9sjGqf9L24vfug5ifh0b8=
|
||||
github.com/luxfi/zapcodec v1.0.1 h1:pRxLxCOi6uihQMg8A8riDjNjefU2cXZxfRVZ+obeuL8=
|
||||
github.com/luxfi/zapcodec v1.0.1/go.mod h1:txrRt2JK4O76ssTxlXIwoNVsgzyZVL0ES4mlXqGNogs=
|
||||
github.com/luxfi/zapdb v1.10.1 h1:XV3k4UTTKKxUMgbfC7woPXgUEIJd3P5nj2lGTQ88xeE=
|
||||
|
||||
@@ -69,7 +69,8 @@
|
||||
"v1.36.4",
|
||||
"v1.36.5",
|
||||
"v1.36.6",
|
||||
"v1.36.7"
|
||||
"v1.36.7",
|
||||
"v1.36.8"
|
||||
],
|
||||
"41": [
|
||||
"v1.13.2"
|
||||
|
||||
@@ -77,7 +77,7 @@ var (
|
||||
const (
|
||||
defaultMajor = 1
|
||||
defaultMinor = 36
|
||||
defaultPatch = 7
|
||||
defaultPatch = 8
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
+1
-1
@@ -347,7 +347,7 @@ func decodeSignatures(data []byte) ([][]byte, error) {
|
||||
|
||||
// ---------------- Helpers ----------------
|
||||
|
||||
func writeIDInto(ob *zap.ObjectBuilder, off int, id ids.ID) {
|
||||
func writeIDInto(ob zap.ObjectBuilder, off int, id ids.ID) {
|
||||
for i := 0; i < 32; i++ {
|
||||
ob.SetUint8(off+i, id[i])
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ const (
|
||||
|
||||
// setSecurity / readSecurity encode a security.Mode across four fixed object
|
||||
// fields. Shared by CreateNetworkTx and ConvertNetworkTx — one wire encoding.
|
||||
func setSecurity(ob *zap.ObjectBuilder, offRestake, offAdmission, offManager, offThreshold int, m security.Mode) {
|
||||
func setSecurity(ob zap.ObjectBuilder, offRestake, offAdmission, offManager, offThreshold int, m security.Mode) {
|
||||
var restake uint8
|
||||
if m.RestakeParent {
|
||||
restake = 1
|
||||
|
||||
@@ -29,8 +29,8 @@ const (
|
||||
|
||||
// ---- fixed ids ----
|
||||
|
||||
func setID(ob *zap.ObjectBuilder, off int, id ids.ID) { ob.SetBytesFixed(off, id[:]) }
|
||||
func setNodeID(ob *zap.ObjectBuilder, off int, id ids.NodeID) { ob.SetBytesFixed(off, id[:]) }
|
||||
func setID(ob zap.ObjectBuilder, off int, id ids.ID) { ob.SetBytesFixed(off, id[:]) }
|
||||
func setNodeID(ob zap.ObjectBuilder, off int, id ids.NodeID) { ob.SetBytesFixed(off, id[:]) }
|
||||
|
||||
func readNodeID(o zap.Object, off int) ids.NodeID {
|
||||
var id ids.NodeID
|
||||
@@ -80,7 +80,7 @@ func writeOwner(b *zap.Builder, o fx.Owner) (threshold uint32, locktime uint64,
|
||||
return oo.Threshold, oo.Locktime, addrOff, addrCount, nil
|
||||
}
|
||||
|
||||
func setOwner(ob *zap.ObjectBuilder, thresholdOff, locktimeOff, addrPtrOff int, threshold uint32, locktime uint64, addrOff, addrCount int) {
|
||||
func setOwner(ob zap.ObjectBuilder, thresholdOff, locktimeOff, addrPtrOff int, threshold uint32, locktime uint64, addrOff, addrCount int) {
|
||||
ob.SetUint32(thresholdOff, threshold)
|
||||
ob.SetUint64(locktimeOff, locktime)
|
||||
ob.SetList(addrPtrOff, addrOff, addrCount)
|
||||
@@ -145,7 +145,7 @@ func UnmarshalOwner(b []byte) (*secp256k1fx.OutputOwners, error) {
|
||||
|
||||
const validatorSize = 44
|
||||
|
||||
func setValidator(ob *zap.ObjectBuilder, off int, v Validator) {
|
||||
func setValidator(ob zap.ObjectBuilder, off int, v Validator) {
|
||||
setNodeID(ob, off, v.NodeID)
|
||||
ob.SetUint64(off+20, v.Start)
|
||||
ob.SetUint64(off+28, v.End)
|
||||
@@ -165,7 +165,7 @@ func readValidator(obj zap.Object, off int) Validator {
|
||||
|
||||
const signerSize = 1 + blsPubLen + blsSigLen
|
||||
|
||||
func setSigner(ob *zap.ObjectBuilder, off int, s signer.Signer) error {
|
||||
func setSigner(ob zap.ObjectBuilder, off int, s signer.Signer) error {
|
||||
switch sig := s.(type) {
|
||||
case *signer.Empty:
|
||||
ob.SetUint8(off, 0)
|
||||
|
||||
@@ -222,7 +222,7 @@ func writeSpending(b *zap.Builder, base *lux.BaseTx) (spendPtrs, error) {
|
||||
}
|
||||
|
||||
// setEnvelope writes the shared envelope fields into an already-started object.
|
||||
func setEnvelope(ob *zap.ObjectBuilder, k kind, base *lux.BaseTx, p spendPtrs) {
|
||||
func setEnvelope(ob zap.ObjectBuilder, k kind, base *lux.BaseTx, p spendPtrs) {
|
||||
ob.SetUint8(offKind, uint8(k))
|
||||
ob.SetUint32(offNetworkID, base.NetworkID)
|
||||
ob.SetBytesFixed(offBlockchainID, base.BlockchainID[:])
|
||||
|
||||
Reference in New Issue
Block a user