Consumer flip: fee + wallet field->method accessors + codec-free signing

fee/complexity + static_calculator + wallet/chain/p signer/backend visitors
moved off removed struct fields onto method accessors (tx.Ins->tx.Inputs()
etc). sign() rewritten to the codec-free unsigned‖creds model (tx.Unsigned.
Bytes() + tx.Initialize()). txs/fee + wallet/chain/p/signer build clean.
This commit is contained in:
zeekay
2026-07-10 11:11:42 -07:00
parent bbba24bad6
commit e869b7bcd1
6 changed files with 184 additions and 182 deletions
+63 -53
View File
@@ -540,11 +540,11 @@ func (*complexityVisitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
// Removed in regenesis
// func (c *complexityVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
// baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
// baseTxComplexity, err := baseTxComplexity(tx)
// if err != nil {
// return err
// }
// authComplexity, err := AuthComplexity(tx.ChainAuth)
// authComplexity, err := AuthComplexity(tx.ChainAuth())
// if err != nil {
// return err
// }
@@ -556,15 +556,15 @@ func (*complexityVisitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
// }
func (c *complexityVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
bandwidth, err := math.Mul(uint64(len(tx.FxIDs)), ids.IDLen)
bandwidth, err := math.Mul(uint64(len(tx.FxIDs())), ids.IDLen)
if err != nil {
return err
}
bandwidth, err = math.Add(bandwidth, uint64(len(tx.BlockchainName)))
bandwidth, err = math.Add(bandwidth, uint64(len(tx.BlockchainName())))
if err != nil {
return err
}
bandwidth, err = math.Add(bandwidth, uint64(len(tx.GenesisData)))
bandwidth, err = math.Add(bandwidth, uint64(len(tx.GenesisData())))
if err != nil {
return err
}
@@ -572,11 +572,11 @@ func (c *complexityVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
gas.Bandwidth: bandwidth,
}
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.ChainAuth)
authComplexity, err := AuthComplexity(tx.ChainAuth())
if err != nil {
return err
}
@@ -590,11 +590,11 @@ func (c *complexityVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
// Removed in regenesis
// func (c *complexityVisitor) CreateNetTx(tx *txs.CreateNetTx) error {
// baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
// baseTxComplexity, err := baseTxComplexity(tx)
// if err != nil {
// return err
// }
// ownerComplexity, err := OwnerComplexity(tx.Owner)
// ownerComplexity, err := OwnerComplexity(tx.Owner())
// if err != nil {
// return err
// }
@@ -606,11 +606,11 @@ func (c *complexityVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
// }
func (c *complexityVisitor) ImportTx(tx *txs.ImportTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
inputsComplexity, err := InputComplexity(tx.ImportedInputs...)
inputsComplexity, err := InputComplexity(tx.ImportedInputs()...)
if err != nil {
return err
}
@@ -622,11 +622,11 @@ func (c *complexityVisitor) ImportTx(tx *txs.ImportTx) error {
}
func (c *complexityVisitor) ExportTx(tx *txs.ExportTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
outputsComplexity, err := OutputComplexity(tx.ExportedOutputs...)
outputsComplexity, err := OutputComplexity(tx.ExportedOutputs()...)
if err != nil {
return err
}
@@ -639,11 +639,11 @@ func (c *complexityVisitor) ExportTx(tx *txs.ExportTx) error {
// Removed in regenesis
// func (c *complexityVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
// baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
// baseTxComplexity, err := baseTxComplexity(tx)
// if err != nil {
// return err
// }
// authComplexity, err := AuthComplexity(tx.ChainAuth)
// authComplexity, err := AuthComplexity(tx.ChainAuth())
// if err != nil {
// return err
// }
@@ -655,23 +655,23 @@ func (c *complexityVisitor) ExportTx(tx *txs.ExportTx) error {
// }
func (c *complexityVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
signerComplexity, err := SignerComplexity(tx.Signer)
signerComplexity, err := SignerComplexity(tx.Signer())
if err != nil {
return err
}
outputsComplexity, err := OutputComplexity(tx.StakeOuts...)
outputsComplexity, err := OutputComplexity(tx.StakeOuts()...)
if err != nil {
return err
}
validatorOwnerComplexity, err := OwnerComplexity(tx.ValidatorRewardsOwner)
validatorOwnerComplexity, err := OwnerComplexity(tx.ValidatorRewardsOwner())
if err != nil {
return err
}
delegatorOwnerComplexity, err := OwnerComplexity(tx.DelegatorRewardsOwner)
delegatorOwnerComplexity, err := OwnerComplexity(tx.DelegatorRewardsOwner())
if err != nil {
return err
}
@@ -686,15 +686,15 @@ func (c *complexityVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionle
}
func (c *complexityVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
ownerComplexity, err := OwnerComplexity(tx.DelegationRewardsOwner)
ownerComplexity, err := OwnerComplexity(tx.DelegationRewardsOwner())
if err != nil {
return err
}
outputsComplexity, err := OutputComplexity(tx.StakeOuts...)
outputsComplexity, err := OutputComplexity(tx.StakeOuts()...)
if err != nil {
return err
}
@@ -708,15 +708,15 @@ func (c *complexityVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionle
// Removed in regenesis
// func (c *complexityVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
// baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
// baseTxComplexity, err := baseTxComplexity(tx)
// if err != nil {
// return err
// }
// authComplexity, err := AuthComplexity(tx.ChainAuth)
// authComplexity, err := AuthComplexity(tx.ChainAuth())
// if err != nil {
// return err
// }
// ownerComplexity, err := OwnerComplexity(tx.Owner)
// ownerComplexity, err := OwnerComplexity(tx.Owner())
// if err != nil {
// return err
// }
@@ -738,15 +738,15 @@ func (c *complexityVisitor) BaseTx(tx *txs.BaseTx) error {
}
func (c *complexityVisitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
validatorComplexity, err := ConvertNetworkToL1ValidatorComplexity(tx.Validators...)
validatorComplexity, err := ConvertNetworkToL1ValidatorComplexity(tx.Validators()...)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.ChainAuth)
authComplexity, err := AuthComplexity(tx.ChainAuth())
if err != nil {
return err
}
@@ -755,7 +755,7 @@ func (c *complexityVisitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) e
&validatorComplexity,
&authComplexity,
&gas.Dimensions{
gas.Bandwidth: uint64(len(tx.Address)),
gas.Bandwidth: uint64(len(tx.Address())),
},
)
return err
@@ -765,11 +765,11 @@ func (c *complexityVisitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) err
// Sovereign L1 = network + N validators + K chains. Fee complexity
// is approximately the sum: baseTx + ConvertNetworkToL1 (validators)
// + sum(CreateChain) (chains). Charge as composite.
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
validatorComplexity, err := ConvertNetworkToL1ValidatorComplexity(tx.Validators...)
validatorComplexity, err := ConvertNetworkToL1ValidatorComplexity(tx.Validators()...)
if err != nil {
return err
}
@@ -778,7 +778,7 @@ func (c *complexityVisitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) err
return err
}
// Per-chain genesis adds to the bandwidth dimension.
for _, ch := range tx.Chains {
for _, ch := range tx.Chains() {
chainBytes := gas.Dimensions{
gas.Bandwidth: uint64(len(ch.GenesisData)) + uint64(len(ch.BlockchainName)),
}
@@ -791,11 +791,11 @@ func (c *complexityVisitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) err
}
func (c *complexityVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
warpComplexity, err := WarpComplexity(tx.Message)
warpComplexity, err := WarpComplexity(tx.Message())
if err != nil {
return err
}
@@ -807,11 +807,11 @@ func (c *complexityVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx)
}
func (c *complexityVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
warpComplexity, err := WarpComplexity(tx.Message)
warpComplexity, err := WarpComplexity(tx.Message())
if err != nil {
return err
}
@@ -823,7 +823,7 @@ func (c *complexityVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightT
}
func (c *complexityVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanceTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
@@ -834,11 +834,11 @@ func (c *complexityVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1Valid
}
func (c *complexityVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.DisableAuth)
authComplexity, err := AuthComplexity(tx.DisableAuth())
if err != nil {
return err
}
@@ -849,12 +849,22 @@ func (c *complexityVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) e
return err
}
func baseTxComplexity(tx *txs.BaseTx) (gas.Dimensions, error) {
outputsComplexity, err := OutputComplexity(tx.Outs...)
// baseTxEnvelope is the spending-envelope accessor surface shared by every
// spending tx type (BaseTx and all delta-carrying txs embed spendingTx, which
// serves Outputs/Inputs/Memo). baseTxComplexity reads it directly rather than
// reaching for a struct field that no longer exists.
type baseTxEnvelope interface {
Outputs() []*lux.TransferableOutput
Inputs() []*lux.TransferableInput
Memo() []byte
}
func baseTxComplexity(tx baseTxEnvelope) (gas.Dimensions, error) {
outputsComplexity, err := OutputComplexity(tx.Outputs()...)
if err != nil {
return gas.Dimensions{}, err
}
inputsComplexity, err := InputComplexity(tx.Ins...)
inputsComplexity, err := InputComplexity(tx.Inputs()...)
if err != nil {
return gas.Dimensions{}, err
}
@@ -864,17 +874,17 @@ func baseTxComplexity(tx *txs.BaseTx) (gas.Dimensions, error) {
}
complexity[gas.Bandwidth], err = math.Add(
complexity[gas.Bandwidth],
uint64(len(tx.Memo)),
uint64(len(tx.Memo())),
)
return complexity, err
}
func (c *complexityVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.ChainAuth)
authComplexity, err := AuthComplexity(tx.ChainAuth())
if err != nil {
return err
}
@@ -886,11 +896,11 @@ func (c *complexityVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) err
}
func (c *complexityVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
ownerComplexity, err := OwnerComplexity(tx.Owner)
ownerComplexity, err := OwnerComplexity(tx.Owner())
if err != nil {
return err
}
@@ -902,11 +912,11 @@ func (c *complexityVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
}
func (c *complexityVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.ChainAuth)
authComplexity, err := AuthComplexity(tx.ChainAuth())
if err != nil {
return err
}
@@ -922,15 +932,15 @@ func (*complexityVisitor) TransformChainTx(*txs.TransformChainTx) error {
}
func (c *complexityVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
baseTxComplexity, err := baseTxComplexity(&tx.BaseTx)
baseTxComplexity, err := baseTxComplexity(tx)
if err != nil {
return err
}
authComplexity, err := AuthComplexity(tx.ChainAuth)
authComplexity, err := AuthComplexity(tx.ChainAuth())
if err != nil {
return err
}
ownerComplexity, err := OwnerComplexity(tx.Owner)
ownerComplexity, err := OwnerComplexity(tx.Owner())
if err != nil {
return err
}
+2 -2
View File
@@ -93,7 +93,7 @@ func (c *staticVisitor) CreateChainTx(*txs.CreateChainTx) error {
// }
func (c *staticVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
if tx.Chain != constants.PrimaryNetworkID {
if tx.Chain() != constants.PrimaryNetworkID {
c.fee = c.config.TxFee // Use TxFee since AddChainValidatorFee was removed in regenesis
} else {
c.fee = c.config.AddNetworkValidatorFee
@@ -102,7 +102,7 @@ func (c *staticVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessVa
}
func (c *staticVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
if tx.Chain != constants.PrimaryNetworkID {
if tx.Chain() != constants.PrimaryNetworkID {
c.fee = c.config.TxFee // Use TxFee since AddChainDelegatorFee was removed in regenesis
} else {
c.fee = c.config.AddNetworkDelegatorFee
+24 -24
View File
@@ -45,14 +45,14 @@ func NewBackend(context *builder.Context, utxos common.ChainUTXOs, chainTxs map[
if !ok {
continue
}
chainOwner[txID] = createNetworkTx.Owner
chainOwner[txID] = createNetworkTx.Owner()
}
for _, tx := range chainTxs { // then check for TransferChainOwnershipTx
transferChainOwnershipTx, ok := tx.Unsigned.(*txs.TransferChainOwnershipTx)
if !ok {
continue
}
chainOwner[transferChainOwnershipTx.Chain] = transferChainOwnershipTx.Owner
chainOwner[transferChainOwnershipTx.Chain()] = transferChainOwnershipTx.Owner()
}
return &backend{
ChainUTXOs: utxos,
@@ -93,43 +93,43 @@ func (v *backendVisitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
}
func (v *backendVisitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
v.b.setChainOwner(v.txID, tx.Owner)
return v.baseTx(&tx.BaseTx)
v.b.setChainOwner(v.txID, tx.Owner())
return v.baseTx(tx)
}
func (v *backendVisitor) ImportTx(tx *txs.ImportTx) error {
err := v.b.removeUTXOs(v.ctx, tx.SourceChain, tx.InputUTXOs())
err := v.b.removeUTXOs(v.ctx, tx.SourceChain(), tx.InputUTXOs())
if err != nil {
return err
}
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) ExportTx(tx *txs.ExportTx) error {
for i, out := range tx.ExportedOutputs {
for i, out := range tx.ExportedOutputs() {
err := v.b.AddUTXO(
v.ctx,
tx.DestinationChain,
tx.DestinationChain(),
&lux.UTXO{
UTXOID: lux.UTXOID{
TxID: v.txID,
OutputIndex: uint32(len(tx.Outs) + i),
OutputIndex: uint32(len(tx.Outputs()) + i),
},
Asset: lux.Asset{ID: out.AssetID()},
Out: out.Out,
@@ -139,28 +139,28 @@ func (v *backendVisitor) ExportTx(tx *txs.ExportTx) error {
return err
}
}
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) TransformChainTx(tx *txs.TransformChainTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
v.b.setChainOwner(tx.Chain, tx.Owner)
return v.baseTx(&tx.BaseTx)
v.b.setChainOwner(tx.Chain(), tx.Owner())
return v.baseTx(tx)
}
func (v *backendVisitor) BaseTx(tx *txs.BaseTx) error {
@@ -180,18 +180,18 @@ func (v *backendVisitor) RegisterL1ValidatorTx(*txs.RegisterL1ValidatorTx) error
}
func (v *backendVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanceTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error {
return v.baseTx(&tx.BaseTx)
return v.baseTx(tx)
}
func (v *backendVisitor) baseTx(tx *txs.BaseTx) error {
func (v *backendVisitor) baseTx(tx txs.UnsignedTx) error {
return v.b.removeUTXOs(v.ctx, constants.PlatformChainID, tx.InputIDs())
}
+33 -37
View File
@@ -52,7 +52,7 @@ func (*visitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
}
func (s *visitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -60,11 +60,11 @@ func (s *visitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
}
func (s *visitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getAuthSigners(tx.ChainValidator.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getAuthSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -73,7 +73,7 @@ func (s *visitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
}
func (s *visitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -81,11 +81,11 @@ func (s *visitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
}
func (s *visitor) CreateChainTx(tx *txs.CreateChainTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
netAuthSigners, err := s.getAuthSigners(tx.ChainID, tx.ChainAuth)
netAuthSigners, err := s.getAuthSigners(tx.ChainID(), tx.ChainAuth())
if err != nil {
return err
}
@@ -94,7 +94,7 @@ func (s *visitor) CreateChainTx(tx *txs.CreateChainTx) error {
}
func (s *visitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -102,11 +102,11 @@ func (s *visitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
}
func (s *visitor) ImportTx(tx *txs.ImportTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
txImportSigners, err := s.getSigners(tx.SourceChain, tx.ImportedInputs)
txImportSigners, err := s.getSigners(tx.SourceChain(), tx.ImportedInputs())
if err != nil {
return err
}
@@ -115,7 +115,7 @@ func (s *visitor) ImportTx(tx *txs.ImportTx) error {
}
func (s *visitor) ExportTx(tx *txs.ExportTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -124,11 +124,11 @@ func (s *visitor) ExportTx(tx *txs.ExportTx) error {
// Removed in regenesis
func (s *visitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getAuthSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getAuthSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -137,11 +137,11 @@ func (s *visitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
}
func (s *visitor) TransformChainTx(tx *txs.TransformChainTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getAuthSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getAuthSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -150,7 +150,7 @@ func (s *visitor) TransformChainTx(tx *txs.TransformChainTx) error {
}
func (s *visitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -158,7 +158,7 @@ func (s *visitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidato
}
func (s *visitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -166,11 +166,11 @@ func (s *visitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegato
}
func (s *visitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getAuthSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getAuthSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -179,7 +179,7 @@ func (s *visitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) err
}
func (s *visitor) BaseTx(tx *txs.BaseTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -187,11 +187,11 @@ func (s *visitor) BaseTx(tx *txs.BaseTx) error {
}
func (s *visitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getAuthSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getAuthSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -200,7 +200,7 @@ func (s *visitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error {
}
func (s *visitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -208,7 +208,7 @@ func (s *visitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) error {
}
func (s *visitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -216,7 +216,7 @@ func (s *visitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) error {
}
func (s *visitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -224,7 +224,7 @@ func (s *visitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
}
func (s *visitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanceTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -232,11 +232,11 @@ func (s *visitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanc
}
func (s *visitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
disableAuthSigners, err := s.getAuthSigners(tx.ValidationID, tx.DisableAuth)
disableAuthSigners, err := s.getAuthSigners(tx.ValidationID(), tx.DisableAuth())
if err != nil {
return err
}
@@ -337,11 +337,10 @@ func (s *visitor) getAuthSigners(ownerID ids.ID, auth verify.Verifiable) ([]keyc
}
func sign(tx *txs.Tx, signHash bool, txSigners [][]keychain.Signer) error {
unsignedBytes, err := txs.Codec.Marshal(txs.CodecVersion, &tx.Unsigned)
if err != nil {
return fmt.Errorf("couldn't marshal unsigned tx: %w", err)
}
// The unsigned tx is already a zap buffer — its bytes are the wire form.
unsignedBytes := tx.Unsigned.Bytes()
unsignedHash := hash.ComputeHash256(unsignedBytes)
var err error
if expectedLen := len(txSigners); expectedLen != len(tx.Creds) {
tx.Creds = make([]verify.Verifiable, expectedLen)
@@ -398,10 +397,7 @@ func sign(tx *txs.Tx, signHash bool, txSigners [][]keychain.Signer) error {
}
}
signedBytes, err := txs.Codec.Marshal(txs.CodecVersion, tx)
if err != nil {
return fmt.Errorf("couldn't marshal tx: %w", err)
}
tx.SetBytes(unsignedBytes, signedBytes)
return nil
// Signed bytes are unsigned ‖ creds; Initialize encodes the credential
// buffer, concatenates, and binds bytes + TxID. There is no codec.
return tx.Initialize()
}
+33 -37
View File
@@ -52,7 +52,7 @@ func (*signerVisitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
}
func (s *signerVisitor) BaseTx(tx *txs.BaseTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -60,7 +60,7 @@ func (s *signerVisitor) BaseTx(tx *txs.BaseTx) error {
}
func (s *signerVisitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -68,11 +68,11 @@ func (s *signerVisitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
}
func (s *signerVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.ChainValidator.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -81,7 +81,7 @@ func (s *signerVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
}
func (s *signerVisitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -89,11 +89,11 @@ func (s *signerVisitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
}
func (s *signerVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.ChainID, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.ChainID(), tx.ChainAuth())
if err != nil {
return err
}
@@ -102,7 +102,7 @@ func (s *signerVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
}
func (s *signerVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -110,11 +110,11 @@ func (s *signerVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
}
func (s *signerVisitor) ImportTx(tx *txs.ImportTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
txImportSigners, err := s.getSigners(tx.SourceChain, tx.ImportedInputs)
txImportSigners, err := s.getSigners(tx.SourceChain(), tx.ImportedInputs())
if err != nil {
return err
}
@@ -123,7 +123,7 @@ func (s *signerVisitor) ImportTx(tx *txs.ImportTx) error {
}
func (s *signerVisitor) ExportTx(tx *txs.ExportTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -131,11 +131,11 @@ func (s *signerVisitor) ExportTx(tx *txs.ExportTx) error {
}
func (s *signerVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -144,11 +144,11 @@ func (s *signerVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) e
}
func (s *signerVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -157,11 +157,11 @@ func (s *signerVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipT
}
func (s *signerVisitor) TransformChainTx(tx *txs.TransformChainTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -170,7 +170,7 @@ func (s *signerVisitor) TransformChainTx(tx *txs.TransformChainTx) error {
}
func (s *signerVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -178,7 +178,7 @@ func (s *signerVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessVa
}
func (s *signerVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Ins)
txSigners, err := s.getSigners(constants.PlatformChainID, tx.Inputs())
if err != nil {
return err
}
@@ -259,7 +259,7 @@ func (s *signerVisitor) getChainSigners(netID ids.ID, chainAuth verify.Verifiabl
return nil, errWrongTxType
}
owner, ok := network.Owner.(*secp256k1fx.OutputOwners)
owner, ok := network.Owner().(*secp256k1fx.OutputOwners)
if !ok {
return nil, errUnknownOwnerType
}
@@ -283,11 +283,10 @@ func (s *signerVisitor) getChainSigners(netID ids.ID, chainAuth verify.Verifiabl
}
func sign(tx *txs.Tx, signHash bool, txSigners [][]keychain.Signer) error {
unsignedBytes, err := txs.Codec.Marshal(txs.Version, &tx.Unsigned)
if err != nil {
return fmt.Errorf("couldn't marshal unsigned tx: %w", err)
}
// The unsigned tx is already a zap buffer — its bytes are the wire form.
unsignedBytes := tx.Unsigned.Bytes()
unsignedHash := hash.ComputeHash256(unsignedBytes)
var err error
if expectedLen := len(txSigners); expectedLen != len(tx.Creds) {
tx.Creds = make([]verify.Verifiable, expectedLen)
@@ -344,17 +343,14 @@ func sign(tx *txs.Tx, signHash bool, txSigners [][]keychain.Signer) error {
}
}
signedBytes, err := txs.Codec.Marshal(txs.Version, tx)
if err != nil {
return fmt.Errorf("couldn't marshal tx: %w", err)
}
tx.SetBytes(unsignedBytes, signedBytes)
return nil
// Signed bytes are unsigned ‖ creds; Initialize encodes the credential
// buffer, concatenates, and binds bytes + TxID. There is no codec.
return tx.Initialize()
}
// DisableL1ValidatorTx signs a DisableL1ValidatorTx
func (s *signerVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
@@ -363,7 +359,7 @@ func (s *signerVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error
// IncreaseL1ValidatorBalanceTx signs an IncreaseL1ValidatorBalanceTx
func (s *signerVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanceTx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
@@ -372,7 +368,7 @@ func (s *signerVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1Validator
// RegisterL1ValidatorTx signs a RegisterL1ValidatorTx
func (s *signerVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
@@ -381,7 +377,7 @@ func (s *signerVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) err
// SetL1ValidatorWeightTx signs a SetL1ValidatorWeightTx
func (s *signerVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
@@ -390,11 +386,11 @@ func (s *signerVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) e
// ConvertNetworkToL1Tx signs a ConvertNetworkToL1Tx
func (s *signerVisitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
chainAuthSigners, err := s.getChainSigners(tx.Chain, tx.ChainAuth)
chainAuthSigners, err := s.getChainSigners(tx.Chain(), tx.ChainAuth())
if err != nil {
return err
}
@@ -403,7 +399,7 @@ func (s *signerVisitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error
}
func (s *signerVisitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) error {
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Ins)
txSigners, err := s.getSigners(constants.PrimaryNetworkID, tx.Inputs())
if err != nil {
return err
}
+29 -29
View File
@@ -39,50 +39,50 @@ func (*backendVisitor) RewardValidatorTx(*txs.RewardValidatorTx) error {
}
func (b *backendVisitor) AddValidatorTx(tx *txs.AddValidatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) AddChainValidatorTx(tx *txs.AddChainValidatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) AddDelegatorTx(tx *txs.AddDelegatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) CreateChainTx(tx *txs.CreateChainTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) CreateNetworkTx(tx *txs.CreateNetworkTx) error {
b.b.setOwner(
b.txID,
tx.Owner,
tx.Owner(),
)
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) ImportTx(tx *txs.ImportTx) error {
err := b.b.removeUTXOs(
b.ctx,
tx.SourceChain,
tx.SourceChain(),
tx.InputUTXOs(),
)
if err != nil {
return err
}
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) ExportTx(tx *txs.ExportTx) error {
for i, out := range tx.ExportedOutputs {
for i, out := range tx.ExportedOutputs() {
err := b.b.AddUTXO(
b.ctx,
tx.DestinationChain,
tx.DestinationChain(),
&lux.UTXO{
UTXOID: lux.UTXOID{
TxID: b.txID,
OutputIndex: uint32(len(tx.Outs) + i),
OutputIndex: uint32(len(tx.Outputs()) + i),
},
Asset: lux.Asset{ID: out.AssetID()},
Out: out.Out,
@@ -92,31 +92,31 @@ func (b *backendVisitor) ExportTx(tx *txs.ExportTx) error {
return err
}
}
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) RemoveChainValidatorTx(tx *txs.RemoveChainValidatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) TransformChainTx(tx *txs.TransformChainTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) AddPermissionlessValidatorTx(tx *txs.AddPermissionlessValidatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) AddPermissionlessDelegatorTx(tx *txs.AddPermissionlessDelegatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) TransferChainOwnershipTx(tx *txs.TransferChainOwnershipTx) error {
b.b.setOwner(
tx.Chain,
tx.Owner,
tx.Chain(),
tx.Owner(),
)
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) BaseTx(tx *txs.BaseTx) error {
@@ -124,27 +124,27 @@ func (b *backendVisitor) BaseTx(tx *txs.BaseTx) error {
}
func (b *backendVisitor) ConvertNetworkToL1Tx(tx *txs.ConvertNetworkToL1Tx) error {
for i, vdr := range tx.Validators {
for i, vdr := range tx.Validators() {
b.b.setOwner(
tx.Chain.Append(uint32(i)),
tx.Chain().Append(uint32(i)),
&secp256k1fx.OutputOwners{
Threshold: vdr.DeactivationOwner.Threshold,
Addrs: vdr.DeactivationOwner.Addresses,
},
)
}
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) CreateSovereignL1Tx(tx *txs.CreateSovereignL1Tx) error {
// Sovereign L1 launch: the new network ID is derived from the tx
// hash at commit time. The wallet backend does not need to
// preregister owners — that happens P-chain-side during execution.
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) error {
warpMessage, err := warp.ParseMessage(tx.Message)
warpMessage, err := warp.ParseMessage(tx.Message())
if err != nil {
return err
}
@@ -164,22 +164,22 @@ func (b *backendVisitor) RegisterL1ValidatorTx(tx *txs.RegisterL1ValidatorTx) er
Addrs: registerL1ValidatorMessage.DisableOwner.Addresses,
},
)
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) SetL1ValidatorWeightTx(tx *txs.SetL1ValidatorWeightTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) IncreaseL1ValidatorBalanceTx(tx *txs.IncreaseL1ValidatorBalanceTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) DisableL1ValidatorTx(tx *txs.DisableL1ValidatorTx) error {
return b.baseTx(&tx.BaseTx)
return b.baseTx(tx)
}
func (b *backendVisitor) baseTx(tx *txs.BaseTx) error {
func (b *backendVisitor) baseTx(tx txs.UnsignedTx) error {
return b.b.removeUTXOs(
b.ctx,
constants.PlatformChainID,