mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
The module already called itself github.com/luxfi/node while containing no node in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and the Go column of the matrix measured a VM plugin. A repo that fetches the thing it claims to be has not replaced it, so the Go sources move in — 1515 files, the daemon and everything under it — and the build reaches outside this module for nothing. Rust and C++ sit beside it unchanged and are still measured against it by the differential. That is the point of one repo: the reference implementation and the two ports are the same checkout, so parity is a thing you can run rather than a thing you assert. Verified: builds, and the closure carries no lux-private — checked at build time rather than believed. The daemon starts twelve chains on a local network (P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
78 lines
2.3 KiB
Go
78 lines
2.3 KiB
Go
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package txs
|
|
|
|
import (
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/node/vms/components/verify"
|
|
"github.com/luxfi/runtime"
|
|
lux "github.com/luxfi/utxo"
|
|
"github.com/luxfi/zap"
|
|
)
|
|
|
|
var _ UnsignedTx = (*DisableL1ValidatorTx)(nil)
|
|
|
|
// DisableL1ValidatorTx disables an L1 validator, proving authorization with a
|
|
// credential. The struct IS the wire: it embeds spendingTx (the envelope) and
|
|
// adds the validation id plus an auth sig-index list.
|
|
//
|
|
// Wire: zap header + object{ [email protected], ValidationID:32B@77,
|
|
// DisableAuth:listptr@109 } (kind=kindDisableL1Validator).
|
|
type DisableL1ValidatorTx struct {
|
|
spendingTx
|
|
}
|
|
|
|
const (
|
|
offDisableValidationID = spendSize // 32B
|
|
offDisableAuth = 109 // list ptr (8B)
|
|
sizeDisable = 117
|
|
)
|
|
|
|
// NewDisableL1ValidatorTx builds the tx into a fresh zap buffer.
|
|
func NewDisableL1ValidatorTx(base *lux.BaseTx, validationID ids.ID, disableAuth verify.Verifiable) (*DisableL1ValidatorTx, error) {
|
|
b := zap.NewBuilder(zap.HeaderSize + 256 + sizeDisable)
|
|
p, err := writeSpending(b, base)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
authOff, authCount, err := writeAuth(b, disableAuth)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
ob := b.StartObject(sizeDisable)
|
|
setEnvelope(ob, kindDisableL1Validator, base, p)
|
|
setID(ob, offDisableValidationID, validationID)
|
|
ob.SetList(offDisableAuth, authOff, authCount)
|
|
ob.FinishAsRoot()
|
|
msg, err := zap.Parse(b.Finish())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &DisableL1ValidatorTx{spendingTx{msg}}, nil
|
|
}
|
|
|
|
// ValidationID is the id of the validator being disabled (offset read).
|
|
func (tx *DisableL1ValidatorTx) ValidationID() ids.ID {
|
|
return readID(tx.root(), offDisableValidationID)
|
|
}
|
|
|
|
// DisableAuth authorizes this validator to be disabled (offset read).
|
|
func (tx *DisableL1ValidatorTx) DisableAuth() verify.Verifiable {
|
|
return readAuth(tx.root(), offDisableAuth)
|
|
}
|
|
|
|
func (tx *DisableL1ValidatorTx) SyntacticVerify(rt *runtime.Runtime) error {
|
|
if tx == nil {
|
|
return ErrNilTx
|
|
}
|
|
if err := verifyBaseTx(tx.baseTx(), rt); err != nil {
|
|
return err
|
|
}
|
|
return tx.DisableAuth().Verify()
|
|
}
|
|
|
|
func (tx *DisableL1ValidatorTx) Visit(visitor Visitor) error {
|
|
return visitor.DisableL1ValidatorTx(tx)
|
|
}
|