refactor: migrate UTXO components to standalone github.com/luxfi/utxo

One place, one way to define UTXO primitives. Delete the in-tree duplicate
at node/vms/components/lux/ and import the standalone luxfi/utxo package
with a 'lux' alias so existing call-sites (lux.UTXO, lux.TransferableInput,
etc.) remain unchanged in consumers.

Files changed: 167 imports rewritten, 2 directories deleted.

Build still green on the whole tree except pre-existing examples/multi-network
QChainMainnetID issue (unrelated).

Next: rename luxfi/utxo/luxmock → utxomock for full brand-neutrality; that
is a separate PR since it requires touching all consumer alias names.
This commit is contained in:
Hanzo AI
2026-04-13 06:47:35 -07:00
parent 0866b1a34e
commit 8de1b78ed8
188 changed files with 170 additions and 2007 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/codec/wrappers"
)
-154
View File
@@ -1,154 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"fmt"
"github.com/luxfi/runtime"
"github.com/luxfi/address"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
)
var (
_ AddressManager = (*addressManager)(nil)
ErrMismatchedChainIDs = errors.New("mismatched chainIDs")
)
// BCLookup provides blockchain alias lookup
type BCLookup interface {
Lookup(string) (ids.ID, error)
PrimaryAlias(ids.ID) (string, error)
}
type AddressManager interface {
// ParseLocalAddress takes in an address for this chain and produces the ID
ParseLocalAddress(addrStr string) (ids.ShortID, error)
// ParseAddress takes in an address and produces the ID of the chain it's
// for and the ID of the address
ParseAddress(addrStr string) (ids.ID, ids.ShortID, error)
// FormatLocalAddress takes in a raw address and produces the formatted
// address for this chain
FormatLocalAddress(addr ids.ShortID) (string, error)
// FormatAddress takes in a chainID and a raw address and produces the
// formatted address for that chain
FormatAddress(chainID ids.ID, addr ids.ShortID) (string, error)
}
type addressManager struct {
rt *runtime.Runtime
}
func NewAddressManager(rt *runtime.Runtime) AddressManager {
return &addressManager{
rt: rt,
}
}
func (a *addressManager) ParseLocalAddress(addrStr string) (ids.ShortID, error) {
chainID, addr, err := a.ParseAddress(addrStr)
if err != nil {
return ids.ShortID{}, err
}
expectedChainID := a.rt.ChainID
if chainID != expectedChainID {
return ids.ShortID{}, fmt.Errorf(
"%w: expected %q but got %q",
ErrMismatchedChainIDs,
expectedChainID,
chainID,
)
}
return addr, nil
}
func (a *addressManager) ParseAddress(addrStr string) (ids.ID, ids.ShortID, error) {
chainIDAlias, hrp, addrBytes, err := address.Parse(addrStr)
if err != nil {
return ids.Empty, ids.ShortID{}, err
}
// Try to parse chainIDAlias as an ID directly since Runtime doesn't have BCLookup
chainID, err := ids.FromString(chainIDAlias)
if err != nil {
return ids.ID{}, ids.ShortID{}, fmt.Errorf("failed to parse chain ID %q: %w", chainIDAlias, err)
}
networkID := a.rt.NetworkID
expectedHRP := constants.GetHRP(networkID)
if hrp != expectedHRP {
return ids.Empty, ids.ShortID{}, fmt.Errorf(
"expected hrp %q but got %q",
expectedHRP,
hrp,
)
}
addr, err := ids.ToShortID(addrBytes)
if err != nil {
return ids.Empty, ids.ShortID{}, err
}
return chainID, addr, nil
}
func (a *addressManager) FormatLocalAddress(addr ids.ShortID) (string, error) {
chainID := a.rt.ChainID
return a.FormatAddress(chainID, addr)
}
func (a *addressManager) FormatAddress(chainID ids.ID, addr ids.ShortID) (string, error) {
// Use ChainID directly - Runtime doesn't have BCLookup
chainIDAlias := chainID.String()
hrp := constants.GetHRP(a.rt.NetworkID)
return address.Format(chainIDAlias, hrp, addr.Bytes())
}
func ParseLocalAddresses(a AddressManager, addrStrs []string) (set.Set[ids.ShortID], error) {
addrs := make(set.Set[ids.ShortID], len(addrStrs))
for _, addrStr := range addrStrs {
addr, err := a.ParseLocalAddress(addrStr)
if err != nil {
return nil, fmt.Errorf("couldn't parse address %q: %w", addrStr, err)
}
addrs.Add(addr)
}
return addrs, nil
}
// ParseServiceAddress get address ID from address string, being it either localized (using address manager,
// doing also components validations), or not localized.
// If both attempts fail, reports error from localized address parsing
func ParseServiceAddress(a AddressManager, addrStr string) (ids.ShortID, error) {
addr, err := ids.ShortFromString(addrStr)
if err == nil {
return addr, nil
}
addr, err = a.ParseLocalAddress(addrStr)
if err != nil {
return addr, fmt.Errorf("couldn't parse address %q: %w", addrStr, err)
}
return addr, nil
}
// ParseServiceAddress get addresses IDs from addresses strings, being them either localized or not
func ParseServiceAddresses(a AddressManager, addrStrs []string) (set.Set[ids.ShortID], error) {
addrs := set.NewSet[ids.ShortID](len(addrStrs))
for _, addrStr := range addrStrs {
addr, err := ParseServiceAddress(a, addrStr)
if err != nil {
return nil, err
}
addrs.Add(addr)
}
return addrs, nil
}
-38
View File
@@ -1,38 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/verify"
)
var (
errNilAssetID = errors.New("nil asset ID is not valid")
errEmptyAssetID = errors.New("empty asset ID is not valid")
_ verify.Verifiable = (*Asset)(nil)
)
type Asset struct {
ID ids.ID `serialize:"true" json:"assetID"`
}
// AssetID returns the ID of the contained asset
func (asset *Asset) AssetID() ids.ID {
return asset.ID
}
func (asset *Asset) Verify() error {
switch {
case asset == nil:
return errNilAssetID
case asset.ID == ids.Empty:
return errEmptyAssetID
default:
return nil
}
}
-21
View File
@@ -1,21 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
)
// AtomicUTXOManager defines the interface for managing atomic UTXOs
type AtomicUTXOManager interface {
// GetAtomicUTXOs returns the UTXOs controlled by [addrs] from the given [chainID]
GetAtomicUTXOs(
chainID ids.ID,
addrs set.Set[ids.ShortID],
startAddr ids.ShortID,
startUTXOID ids.ID,
limit int,
) ([]*UTXO, ids.ShortID, ids.ID, error)
}
-96
View File
@@ -1,96 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"fmt"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/vm/chains/atomic"
"github.com/luxfi/codec"
)
var _ AtomicUTXOManager = (*atomicUTXOManager)(nil)
type atomicUTXOManager struct {
sm atomic.SharedMemory
codec codec.Manager
}
func NewAtomicUTXOManager(sm atomic.SharedMemory, codec codec.Manager) AtomicUTXOManager {
return &atomicUTXOManager{
sm: sm,
codec: codec,
}
}
func (a *atomicUTXOManager) GetAtomicUTXOs(
chainID ids.ID,
addrs set.Set[ids.ShortID],
startAddr ids.ShortID,
startUTXOID ids.ID,
limit int,
) ([]*UTXO, ids.ShortID, ids.ID, error) {
addrsList := make([][]byte, addrs.Len())
i := 0
for addr := range addrs {
copied := addr
addrsList[i] = copied[:]
i++
}
allUTXOBytes, lastAddr, lastUTXO, err := a.sm.Indexed(
chainID,
addrsList,
startAddr.Bytes(),
startUTXOID[:],
limit,
)
if err != nil {
return nil, ids.ShortID{}, ids.Empty, fmt.Errorf("error fetching atomic UTXOs: %w", err)
}
lastAddrID, err := ids.ToShortID(lastAddr)
if err != nil {
lastAddrID = ids.ShortEmpty
}
lastUTXOID, err := ids.ToID(lastUTXO)
if err != nil {
lastUTXOID = ids.Empty
}
utxos := make([]*UTXO, len(allUTXOBytes))
for i, utxoBytes := range allUTXOBytes {
utxo := &UTXO{}
if _, err := a.codec.Unmarshal(utxoBytes, utxo); err != nil {
return nil, ids.ShortID{}, ids.Empty, fmt.Errorf("error parsing UTXO: %w", err)
}
utxos[i] = utxo
}
return utxos, lastAddrID, lastUTXOID, nil
}
// GetAtomicUTXOs returns exported UTXOs such that at least one of the
// addresses in [addrs] is referenced.
//
// Returns at most [limit] UTXOs.
//
// Returns:
// * The fetched UTXOs
// * The address associated with the last UTXO fetched
// * The ID of the last UTXO fetched
// * Any error that may have occurred upstream.
func GetAtomicUTXOs(
sharedMemory atomic.SharedMemory,
codec codec.Manager,
chainID ids.ID,
addrs set.Set[ids.ShortID],
startAddr ids.ShortID,
startUTXOID ids.ID,
limit int,
) ([]*UTXO, ids.ShortID, ids.ID, error) {
manager := NewAtomicUTXOManager(sharedMemory, codec)
return manager.GetAtomicUTXOs(chainID, addrs, startAddr, startUTXOID, limit)
}
-87
View File
@@ -1,87 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"fmt"
"github.com/luxfi/runtime"
"github.com/luxfi/ids"
"github.com/luxfi/vm/types"
)
// MaxMemoSize is the maximum number of bytes in the memo field
const MaxMemoSize = 256
var (
ErrNilTx = errors.New("nil tx is not valid")
ErrWrongNetworkID = errors.New("tx has wrong network ID")
ErrWrongChainID = errors.New("tx has wrong chain ID")
ErrMemoTooLarge = errors.New("memo exceeds maximum length")
)
// BaseTx is the basis of all standard transactions.
type BaseTx struct {
NetworkID uint32 `serialize:"true" json:"networkID"` // ID of the network this chain lives on
BlockchainID ids.ID `serialize:"true" json:"blockchainID"` // ID of the chain on which this transaction exists (prevents replay attacks)
Outs []*TransferableOutput `serialize:"true" json:"outputs"` // The outputs of this transaction
Ins []*TransferableInput `serialize:"true" json:"inputs"` // The inputs to this transaction
Memo types.JSONByteSlice `serialize:"true" json:"memo"` // Memo field contains arbitrary bytes, up to maxMemoSize
}
// InputUTXOs track which UTXOs this transaction is consuming.
func (t *BaseTx) InputUTXOs() []*UTXOID {
utxos := make([]*UTXOID, len(t.Ins))
for i, in := range t.Ins {
utxos[i] = &in.UTXOID
}
return utxos
}
// NumCredentials returns the number of expected credentials
func (t *BaseTx) NumCredentials() int {
return len(t.Ins)
}
// Verify ensures that transaction metadata is valid
func (t *BaseTx) Verify(rt *runtime.Runtime) error {
switch {
case t == nil:
return ErrNilTx
case t.NetworkID != rt.NetworkID:
return ErrWrongNetworkID
case t.BlockchainID != rt.ChainID:
return ErrWrongChainID
case len(t.Memo) > MaxMemoSize:
return fmt.Errorf(
"%w: %d > %d",
ErrMemoTooLarge,
len(t.Memo),
MaxMemoSize,
)
default:
return nil
}
}
// VerifyMemoFieldLength validates memo field length based on Durango activation status
func VerifyMemoFieldLength(memo types.JSONByteSlice, isDurangoActive bool) error {
if !isDurangoActive {
// SyntacticVerify validates this field pre-Durango
return nil
}
if len(memo) != 0 {
return fmt.Errorf(
"%w: %d > %d",
ErrMemoTooLarge,
len(memo),
0,
)
}
return nil
}
-11
View File
@@ -1,11 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import "context"
// RuntimeInitializable can be initialized with a context
type RuntimeInitializable interface {
InitRuntime(context.Context)
}
-53
View File
@@ -1,53 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"github.com/luxfi/ids"
"github.com/luxfi/math"
"github.com/luxfi/codec/wrappers"
)
var ErrInsufficientFunds = errors.New("insufficient funds")
type FlowChecker struct {
consumed, produced map[ids.ID]uint64
errs wrappers.Errs
}
func NewFlowChecker() *FlowChecker {
return &FlowChecker{
consumed: make(map[ids.ID]uint64),
produced: make(map[ids.ID]uint64),
}
}
func (fc *FlowChecker) Consume(assetID ids.ID, amount uint64) {
fc.add(fc.consumed, assetID, amount)
}
func (fc *FlowChecker) Produce(assetID ids.ID, amount uint64) {
fc.add(fc.produced, assetID, amount)
}
func (fc *FlowChecker) add(value map[ids.ID]uint64, assetID ids.ID, amount uint64) {
var err error
value[assetID], err = math.Add64(value[assetID], amount)
fc.errs.Add(err)
}
func (fc *FlowChecker) Verify() error {
if !fc.errs.Errored() {
for assetID, producedAssetAmount := range fc.produced {
consumedAssetAmount := fc.consumed[assetID]
if producedAssetAmount > consumedAssetAmount {
fc.errs.Add(ErrInsufficientFunds)
break
}
}
}
return fc.errs.Err
}
-10
View File
@@ -1,10 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
// This file is kept minimal as types are defined in their respective files:
// - UTXO is defined in utxo.go
// - UTXOID is defined in utxo_id.go
// - Asset is defined in asset.go
// - TransferableInput and TransferableOutput are defined in transferables.go
@@ -1,114 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/luxfi/node/vms/components/lux (interfaces: TransferableIn)
//
// Generated by this command:
//
// mockgen -package=lux -destination=vms/components/lux/mock_transferable_in.go github.com/luxfi/node/vms/components/lux TransferableIn
//
// Package luxmock is a generated GoMock package.
package luxmock
import (
"context"
"github.com/luxfi/runtime"
reflect "reflect"
gomock "go.uber.org/mock/gomock"
)
// MockTransferableIn is a mock of TransferableIn interface.
type MockTransferableIn struct {
ctrl *gomock.Controller
recorder *MockTransferableInMockRecorder
}
// MockTransferableInMockRecorder is the mock recorder for MockTransferableIn.
type MockTransferableInMockRecorder struct {
mock *MockTransferableIn
}
// NewMockTransferableIn creates a new mock instance.
func NewMockTransferableIn(ctrl *gomock.Controller) *MockTransferableIn {
mock := &MockTransferableIn{ctrl: ctrl}
mock.recorder = &MockTransferableInMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockTransferableIn) EXPECT() *MockTransferableInMockRecorder {
return m.recorder
}
// Amount mocks base method.
func (m *MockTransferableIn) Amount() uint64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Amount")
ret0, _ := ret[0].(uint64)
return ret0
}
// Amount indicates an expected call of Amount.
func (mr *MockTransferableInMockRecorder) Amount() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Amount", reflect.TypeOf((*MockTransferableIn)(nil).Amount))
}
// Cost mocks base method.
func (m *MockTransferableIn) Cost() (uint64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Cost")
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Cost indicates an expected call of Cost.
func (mr *MockTransferableInMockRecorder) Cost() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cost", reflect.TypeOf((*MockTransferableIn)(nil).Cost))
}
// InitRuntime mocks base method.
func (m *MockTransferableIn) InitRuntime(arg0 *runtime.Runtime) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "InitRuntime", arg0)
}
// InitRuntime indicates an expected call of InitRuntime.
func (mr *MockTransferableInMockRecorder) InitRuntime(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitRuntime", reflect.TypeOf((*MockTransferableIn)(nil).InitRuntime), arg0)
}
// Verify mocks base method.
func (m *MockTransferableIn) Verify() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Verify")
ret0, _ := ret[0].(error)
return ret0
}
// Verify indicates an expected call of Verify.
func (mr *MockTransferableInMockRecorder) Verify() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*MockTransferableIn)(nil).Verify))
}
// InitializeWithRuntime mocks base method.
func (m *MockTransferableIn) InitializeWithRuntime(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitializeWithRuntime", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// InitializeWithRuntime indicates an expected call of InitializeWithRuntime.
func (mr *MockTransferableInMockRecorder) InitializeWithRuntime(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeWithRuntime", reflect.TypeOf((*MockTransferableIn)(nil).InitializeWithRuntime), ctx)
}
@@ -1,113 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/luxfi/node/vms/components/lux (interfaces: TransferableOut)
//
// Generated by this command:
//
// mockgen -package=lux -destination=vms/components/lux/mock_transferable_out.go github.com/luxfi/node/vms/components/lux TransferableOut
//
// Package luxmock is a generated GoMock package.
package luxmock
import (
"context"
"reflect"
"github.com/luxfi/runtime"
verify "github.com/luxfi/node/vms/components/verify"
gomock "go.uber.org/mock/gomock"
)
// MockTransferableOut is a mock of TransferableOut interface.
type MockTransferableOut struct {
verify.IsState
ctrl *gomock.Controller
recorder *MockTransferableOutMockRecorder
}
// MockTransferableOutMockRecorder is the mock recorder for MockTransferableOut.
type MockTransferableOutMockRecorder struct {
mock *MockTransferableOut
}
// NewMockTransferableOut creates a new mock instance.
func NewMockTransferableOut(ctrl *gomock.Controller) *MockTransferableOut {
mock := &MockTransferableOut{ctrl: ctrl}
mock.recorder = &MockTransferableOutMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockTransferableOut) EXPECT() *MockTransferableOutMockRecorder {
return m.recorder
}
// Amount mocks base method.
func (m *MockTransferableOut) Amount() uint64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Amount")
ret0, _ := ret[0].(uint64)
return ret0
}
// Amount indicates an expected call of Amount.
func (mr *MockTransferableOutMockRecorder) Amount() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Amount", reflect.TypeOf((*MockTransferableOut)(nil).Amount))
}
// InitRuntime mocks base method.
func (m *MockTransferableOut) InitRuntime(arg0 *runtime.Runtime) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "InitRuntime", arg0)
}
// InitRuntime indicates an expected call of InitRuntime.
func (mr *MockTransferableOutMockRecorder) InitRuntime(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitRuntime", reflect.TypeOf((*MockTransferableOut)(nil).InitRuntime), arg0)
}
// Verify mocks base method.
func (m *MockTransferableOut) Verify() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Verify")
ret0, _ := ret[0].(error)
return ret0
}
// Verify indicates an expected call of Verify.
func (mr *MockTransferableOutMockRecorder) Verify() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*MockTransferableOut)(nil).Verify))
}
// isState mocks base method.
func (m *MockTransferableOut) isState() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isState")
}
// isState indicates an expected call of isState.
func (mr *MockTransferableOutMockRecorder) isState() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isState", reflect.TypeOf((*MockTransferableOut)(nil).isState))
}
// InitializeWithRuntime mocks base method.
func (m *MockTransferableOut) InitializeWithRuntime(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitializeWithRuntime", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// InitializeWithRuntime indicates an expected call of InitializeWithRuntime.
func (mr *MockTransferableOutMockRecorder) InitializeWithRuntime(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeWithRuntime", reflect.TypeOf((*MockTransferableOut)(nil).InitializeWithRuntime), ctx)
}
-58
View File
@@ -1,58 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/crypto/hash"
)
var (
errNilMetadata = errors.New("nil metadata is not valid")
errMetadataNotInitialize = errors.New("metadata was never initialized and is not valid")
_ verify.Verifiable = (*Metadata)(nil)
)
type Metadata struct {
id ids.ID // The ID of this data
unsignedBytes []byte // Unsigned byte representation of this data
bytes []byte // Byte representation of this data
}
// Initialize set the bytes and ID
func (md *Metadata) Initialize(unsignedBytes, bytes []byte) {
md.id = hash.ComputeHash256Array(bytes)
md.unsignedBytes = unsignedBytes
md.bytes = bytes
}
// ID returns the unique ID of this data
func (md *Metadata) ID() ids.ID {
return md.id
}
// UnsignedBytes returns the unsigned binary representation of this data
func (md *Metadata) Bytes() []byte {
return md.unsignedBytes
}
// Bytes returns the binary representation of this data
func (md *Metadata) SignedBytes() []byte {
return md.bytes
}
func (md *Metadata) Verify() error {
switch {
case md == nil:
return errNilMetadata
case md.id == ids.Empty:
return errMetadataNotInitialize
default:
return nil
}
}
-14
View File
@@ -1,14 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
const (
codecVersion = 0
)
// Addressable is the interface a feature extension must provide to be able to
// be tracked as a part of the utxo set for a set of addresses
type Addressable interface {
Addresses() [][]byte
}
-53
View File
@@ -1,53 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"github.com/luxfi/runtime"
"github.com/luxfi/node/vms/components/verify"
)
var (
_ verify.State = (*TestState)(nil)
_ TransferableOut = (*TestTransferable)(nil)
_ Addressable = (*TestAddressable)(nil)
)
type TestState struct {
verify.IsState `json:"-"`
Err error
}
func (*TestState) InitRuntime(*runtime.Runtime) {}
func (v *TestState) Verify() error {
return v.Err
}
type TestTransferable struct {
TestState
Val uint64 `serialize:"true"`
}
func (*TestTransferable) InitRuntime(*runtime.Runtime) {}
func (t *TestTransferable) Amount() uint64 {
return t.Val
}
func (*TestTransferable) Cost() (uint64, error) {
return 0, nil
}
type TestAddressable struct {
TestTransferable `serialize:"true"`
Addrs [][]byte `serialize:"true"`
}
func (a *TestAddressable) Addresses() [][]byte {
return a.Addrs
}
-247
View File
@@ -1,247 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"bytes"
"errors"
"sort"
"github.com/luxfi/codec"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/runtime"
"github.com/luxfi/utils"
)
var (
ErrNilTransferableOutput = errors.New("nil transferable output is not valid")
ErrNilTransferableFxOutput = errors.New("nil transferable feature extension output is not valid")
ErrOutputsNotSorted = errors.New("outputs not sorted")
ErrNilTransferableInput = errors.New("nil transferable input is not valid")
ErrNilTransferableFxInput = errors.New("nil transferable feature extension input is not valid")
ErrInputsNotSortedUnique = errors.New("inputs not sorted and unique")
_ verify.Verifiable = (*TransferableOutput)(nil)
_ verify.Verifiable = (*TransferableInput)(nil)
_ utils.Sortable[*TransferableInput] = (*TransferableInput)(nil)
)
// Amounter is a data structure that has an amount of something associated with it
type Amounter interface {
// Amount returns how much value this element represents of the asset in its
// transaction.
Amount() uint64
}
// Coster is a data structure that has a cost associated with it
type Coster interface {
// Cost returns how much this element costs to be included in its
// transaction.
Cost() (uint64, error)
}
// TransferableIn is the interface a feature extension must provide to transfer
// value between features extensions.
type TransferableIn interface {
verify.Verifiable
Amounter
Coster
}
// TransferableOut is the interface a feature extension must provide to transfer
// value between features extensions.
type TransferableOut interface {
verify.State
Amounter
InitRuntime(*runtime.Runtime)
}
type TransferableOutput struct {
Asset `serialize:"true"`
// FxID has serialize false because we don't want this to be encoded in bytes
FxID ids.ID `serialize:"false" json:"fxID"`
Out TransferableOut `serialize:"true" json:"output"`
}
func (out *TransferableOutput) InitRuntime(rt *runtime.Runtime) {
out.Out.InitRuntime(rt)
}
// Output returns the feature extension output that this Output is using.
func (out *TransferableOutput) Output() TransferableOut {
return out.Out
}
func (out *TransferableOutput) Verify() error {
switch {
case out == nil:
return ErrNilTransferableOutput
case out.Out == nil:
return ErrNilTransferableFxOutput
default:
return verify.All(&out.Asset, out.Out)
}
}
type innerSortTransferableOutputs struct {
outs []*TransferableOutput
codec codec.Manager
}
func (outs *innerSortTransferableOutputs) Less(i, j int) bool {
iOut := outs.outs[i]
jOut := outs.outs[j]
iAssetID := iOut.AssetID()
jAssetID := jOut.AssetID()
switch bytes.Compare(iAssetID[:], jAssetID[:]) {
case -1:
return true
case 1:
return false
}
iBytes, err := outs.codec.Marshal(codecVersion, &iOut.Out)
if err != nil {
return false
}
jBytes, err := outs.codec.Marshal(codecVersion, &jOut.Out)
if err != nil {
return false
}
return bytes.Compare(iBytes, jBytes) == -1
}
func (outs *innerSortTransferableOutputs) Len() int {
return len(outs.outs)
}
func (outs *innerSortTransferableOutputs) Swap(i, j int) {
o := outs.outs
o[j], o[i] = o[i], o[j]
}
// SortTransferableOutputs sorts output objects
func SortTransferableOutputs(outs []*TransferableOutput, c codec.Manager) {
sort.Sort(&innerSortTransferableOutputs{outs: outs, codec: c})
}
// IsSortedTransferableOutputs returns true if output objects are sorted
func IsSortedTransferableOutputs(outs []*TransferableOutput, c codec.Manager) bool {
return sort.IsSorted(&innerSortTransferableOutputs{outs: outs, codec: c})
}
type TransferableInput struct {
UTXOID `serialize:"true"`
Asset `serialize:"true"`
// FxID has serialize false because we don't want this to be encoded in bytes
FxID ids.ID `serialize:"false" json:"fxID"`
In TransferableIn `serialize:"true" json:"input"`
}
// Input returns the feature extension input that this Input is using.
func (in *TransferableInput) Input() TransferableIn {
return in.In
}
func (in *TransferableInput) Verify() error {
switch {
case in == nil:
return ErrNilTransferableInput
case in.In == nil:
return ErrNilTransferableFxInput
default:
return verify.All(&in.UTXOID, &in.Asset, in.In)
}
}
func (in *TransferableInput) InitRuntime(rt *runtime.Runtime) {
if contextInput, ok := in.In.(interface{ InitRuntime(*runtime.Runtime) }); ok {
contextInput.InitRuntime(rt)
}
}
func (in *TransferableInput) Compare(other *TransferableInput) int {
return in.UTXOID.Compare(&other.UTXOID)
}
type innerSortTransferableInputsWithSigners struct {
ins []*TransferableInput
signers [][]*secp256k1.PrivateKey
}
func (ins *innerSortTransferableInputsWithSigners) Less(i, j int) bool {
iID, iIndex := ins.ins[i].InputSource()
jID, jIndex := ins.ins[j].InputSource()
switch bytes.Compare(iID[:], jID[:]) {
case -1:
return true
case 0:
return iIndex < jIndex
default:
return false
}
}
func (ins *innerSortTransferableInputsWithSigners) Len() int {
return len(ins.ins)
}
func (ins *innerSortTransferableInputsWithSigners) Swap(i, j int) {
ins.ins[j], ins.ins[i] = ins.ins[i], ins.ins[j]
ins.signers[j], ins.signers[i] = ins.signers[i], ins.signers[j]
}
// SortTransferableInputsWithSigners sorts the inputs and signers based on the
// input's utxo ID
func SortTransferableInputsWithSigners(ins []*TransferableInput, signers [][]*secp256k1.PrivateKey) {
sort.Sort(&innerSortTransferableInputsWithSigners{ins: ins, signers: signers})
}
// VerifyTx verifies that the inputs and outputs flowcheck, including a fee.
// Additionally, this verifies that the inputs and outputs are sorted.
func VerifyTx(
feeAmount uint64,
feeAssetID ids.ID,
allIns [][]*TransferableInput,
allOuts [][]*TransferableOutput,
c codec.Manager,
) error {
fc := NewFlowChecker()
fc.Produce(feeAssetID, feeAmount) // The txFee must be burned
// Add all the outputs to the flow checker and make sure they are sorted
for _, outs := range allOuts {
for _, out := range outs {
if err := out.Verify(); err != nil {
return err
}
fc.Produce(out.AssetID(), out.Output().Amount())
}
if !IsSortedTransferableOutputs(outs, c) {
return ErrOutputsNotSorted
}
}
// Add all the inputs to the flow checker and make sure they are sorted
for _, ins := range allIns {
for _, in := range ins {
if err := in.Verify(); err != nil {
return err
}
fc.Consume(in.AssetID(), in.Input().Amount())
}
if !utils.IsSortedAndUnique(ins) {
return ErrInputsNotSortedUnique
}
}
return fc.Verify()
}
-35
View File
@@ -1,35 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"github.com/luxfi/node/vms/components/verify"
)
var (
errNilUTXO = errors.New("nil utxo is not valid")
errEmptyUTXO = errors.New("empty utxo is not valid")
_ verify.Verifiable = (*UTXO)(nil)
)
type UTXO struct {
UTXOID `serialize:"true"`
Asset `serialize:"true"`
Out verify.State `serialize:"true" json:"output"`
}
func (utxo *UTXO) Verify() error {
switch {
case utxo == nil:
return errNilUTXO
case utxo.Out == nil:
return errEmptyUTXO
default:
return verify.All(&utxo.UTXOID, &utxo.Asset, utxo.Out)
}
}
-110
View File
@@ -1,110 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"bytes"
"fmt"
"math"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/utils"
safemath "github.com/luxfi/math"
)
// GetBalance returns the current balance of [addrs]
func GetBalance(db UTXOReader, addrs set.Set[ids.ShortID]) (uint64, error) {
utxos, err := GetAllUTXOs(db, addrs)
if err != nil {
return 0, fmt.Errorf("couldn't get UTXOs: %w", err)
}
balance := uint64(0)
for _, utxo := range utxos {
if out, ok := utxo.Out.(Amounter); ok {
balance, err = safemath.Add64(out.Amount(), balance)
if err != nil {
return 0, err
}
}
}
return balance, nil
}
func GetAllUTXOs(db UTXOReader, addrs set.Set[ids.ShortID]) ([]*UTXO, error) {
utxos, _, _, err := GetPaginatedUTXOs(
db,
addrs,
ids.ShortEmpty,
ids.Empty,
math.MaxInt,
)
return utxos, err
}
// GetPaginatedUTXOs returns UTXOs such that at least one of the addresses in
// [addrs] is referenced.
//
// Returns at most [limit] UTXOs.
//
// Only returns UTXOs associated with addresses >= [startAddr].
//
// For address [startAddr], only returns UTXOs whose IDs are greater than
// [startUTXOID].
//
// Returns:
// * The fetched UTXOs
// * The address associated with the last UTXO fetched
// * The ID of the last UTXO fetched
func GetPaginatedUTXOs(
db UTXOReader,
addrs set.Set[ids.ShortID],
lastAddr ids.ShortID,
lastUTXOID ids.ID,
limit int,
) ([]*UTXO, ids.ShortID, ids.ID, error) {
var (
utxos []*UTXO
seen = set.NewSet[ids.ID](limit) // IDs of UTXOs already in the list
searchSize = limit // the limit diminishes which can impact the expected return
addrsList = addrs.List()
)
utils.Sort(addrsList) // enforces the same ordering for pagination
for _, addr := range addrsList {
start := ids.Empty
if comp := bytes.Compare(addr.Bytes(), lastAddr.Bytes()); comp == -1 { // Skip addresses before [startAddr]
continue
} else if comp == 0 {
start = lastUTXOID
}
lastAddr = addr // The last address searched
utxoIDs, err := db.UTXOIDs(addr.Bytes(), start, searchSize) // Get UTXOs associated with [addr]
if err != nil {
return nil, ids.ShortID{}, ids.Empty, fmt.Errorf("couldn't get UTXOs for address %s: %w", addr, err)
}
for _, utxoID := range utxoIDs {
lastUTXOID = utxoID // The last searched UTXO - not the last found
if seen.Contains(utxoID) { // Already have this UTXO in the list
continue
}
utxo, err := db.GetUTXO(utxoID)
if err != nil {
return nil, ids.ShortID{}, ids.Empty, fmt.Errorf("couldn't get UTXO %s: %w", utxoID, err)
}
utxos = append(utxos, utxo)
seen.Add(utxoID)
limit--
if limit <= 0 {
return utxos, lastAddr, lastUTXOID, nil // Found [limit] utxos; stop.
}
}
}
return utxos, lastAddr, lastUTXOID, nil // Didn't reach the [limit] utxos; no more were found
}
-32
View File
@@ -1,32 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import "github.com/luxfi/ids"
// Removes the UTXOs consumed by [ins] from the UTXO set
func Consume(utxoDB UTXODeleter, ins []*TransferableInput) {
for _, input := range ins {
utxoDB.DeleteUTXO(input.InputID())
}
}
// Adds the UTXOs created by [outs] to the UTXO set.
// [txID] is the ID of the tx that created [outs].
func Produce(
utxoDB UTXOAdder,
txID ids.ID,
outs []*TransferableOutput,
) {
for index, out := range outs {
utxoDB.AddUTXO(&UTXO{
UTXOID: UTXOID{
TxID: txID,
OutputIndex: uint32(index),
},
Asset: out.Asset,
Out: out.Output(),
})
}
}
-101
View File
@@ -1,101 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"bytes"
"cmp"
"errors"
"fmt"
"strconv"
"strings"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/utils"
)
var (
errNilUTXOID = errors.New("nil utxo ID is not valid")
errMalformedUTXOIDString = errors.New("unexpected number of tokens in string")
errFailedDecodingUTXOIDTxID = errors.New("failed decoding UTXOID TxID")
errFailedDecodingUTXOIDIndex = errors.New("failed decoding UTXOID index")
_ verify.Verifiable = (*UTXOID)(nil)
_ utils.Sortable[*UTXOID] = (*UTXOID)(nil)
)
type UTXOID struct {
// Serialized:
TxID ids.ID `serialize:"true" json:"txID"`
OutputIndex uint32 `serialize:"true" json:"outputIndex"`
// Symbol is false if the UTXO should be part of the DB
Symbol bool `json:"-"`
// id is the unique ID of a UTXO, it is calculated from TxID and OutputIndex
id ids.ID
}
// InputSource returns the source of the UTXO that this input is spending
func (utxo *UTXOID) InputSource() (ids.ID, uint32) {
return utxo.TxID, utxo.OutputIndex
}
// InputID returns a unique ID of the UTXO that this input is spending
func (utxo *UTXOID) InputID() ids.ID {
if utxo.id == ids.Empty {
utxo.id = utxo.TxID.Prefix(uint64(utxo.OutputIndex))
}
return utxo.id
}
// Symbolic returns if this is the ID of a UTXO in the DB, or if it is a
// symbolic input
func (utxo *UTXOID) Symbolic() bool {
return utxo.Symbol
}
func (utxo *UTXOID) String() string {
return fmt.Sprintf("%s:%d", utxo.TxID, utxo.OutputIndex)
}
// UTXOIDFromString attempts to parse a string into a UTXOID
func UTXOIDFromString(s string) (*UTXOID, error) {
ss := strings.Split(s, ":")
if len(ss) != 2 {
return nil, errMalformedUTXOIDString
}
txID, err := ids.FromString(ss[0])
if err != nil {
return nil, fmt.Errorf("%w: %w", errFailedDecodingUTXOIDTxID, err)
}
idx, err := strconv.ParseUint(ss[1], 10, 32)
if err != nil {
return nil, fmt.Errorf("%w: %w", errFailedDecodingUTXOIDIndex, err)
}
return &UTXOID{
TxID: txID,
OutputIndex: uint32(idx),
}, nil
}
func (utxo *UTXOID) Verify() error {
if utxo == nil {
return errNilUTXOID
}
return nil
}
func (utxo *UTXOID) Compare(other *UTXOID) int {
utxoID, utxoIndex := utxo.InputSource()
otherID, otherIndex := other.InputSource()
if txIDComp := bytes.Compare(utxoID[:], otherID[:]); txIDComp != 0 {
return txIDComp
}
return cmp.Compare(utxoIndex, otherIndex)
}
-299
View File
@@ -1,299 +0,0 @@
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package lux
import (
"errors"
"github.com/luxfi/database"
"github.com/luxfi/database/linkeddb"
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/ids"
"github.com/luxfi/metric"
"github.com/luxfi/node/cache"
"github.com/luxfi/node/cache/metercacher"
"github.com/luxfi/codec"
)
const (
utxoCacheSize = 8192
indexCacheSize = 64
)
var (
utxoPrefix = []byte("utxo")
indexPrefix = []byte("index")
)
// UTXOState is a thin wrapper around a database to provide, caching,
// serialization, and de-serialization for UTXOs.
type UTXOState interface {
UTXOReader
UTXOWriter
// Checksum returns the current UTXOChecksum.
Checksum() ids.ID
}
// UTXOReader is a thin wrapper around a database to provide fetching of UTXOs.
type UTXOReader interface {
UTXOGetter
// UTXOIDs returns the slice of IDs associated with [addr], starting after
// [previous].
// If [previous] is not in the list, starts at beginning.
// Returns at most [limit] IDs.
UTXOIDs(addr []byte, previous ids.ID, limit int) ([]ids.ID, error)
}
// UTXOGetter is a thin wrapper around a database to provide fetching of a UTXO.
type UTXOGetter interface {
// GetUTXO attempts to load a utxo.
GetUTXO(utxoID ids.ID) (*UTXO, error)
}
type UTXOAdder interface {
AddUTXO(utxo *UTXO)
}
type UTXODeleter interface {
DeleteUTXO(utxoID ids.ID)
}
// UTXOWriter is a thin wrapper around a database to provide storage and
// deletion of UTXOs.
type UTXOWriter interface {
// PutUTXO saves the provided utxo to storage.
PutUTXO(utxo *UTXO) error
// DeleteUTXO deletes the provided utxo.
DeleteUTXO(utxoID ids.ID) error
}
type utxoState struct {
codec codec.Manager
// UTXO ID -> *UTXO. If the *UTXO is nil the UTXO doesn't exist
utxoCache cache.Cacher[ids.ID, *UTXO]
utxoDB database.Database
indexDB database.Database
indexCache cache.Cacher[string, linkeddb.LinkedDB]
trackChecksum bool
checksum ids.ID
}
func NewUTXOState(
db database.Database,
codec codec.Manager,
trackChecksum bool,
) (UTXOState, error) {
s := &utxoState{
codec: codec,
utxoCache: &cache.LRU[ids.ID, *UTXO]{Size: utxoCacheSize},
utxoDB: prefixdb.New(utxoPrefix, db),
indexDB: prefixdb.New(indexPrefix, db),
indexCache: &cache.LRU[string, linkeddb.LinkedDB]{Size: indexCacheSize},
trackChecksum: trackChecksum,
}
return s, s.initChecksum()
}
func NewMeteredUTXOState(
db database.Database,
codec codec.Manager,
metrics metric.Registerer,
trackChecksum bool,
) (UTXOState, error) {
registry, ok := metrics.(metric.Registry)
if !ok {
return nil, errors.New("metrics must be a Registry")
}
utxoCache, err := metercacher.New[ids.ID, *UTXO](
"utxo_cache",
registry,
&cache.LRU[ids.ID, *UTXO]{Size: utxoCacheSize},
)
if err != nil {
return nil, err
}
indexCache, err := metercacher.New[string, linkeddb.LinkedDB](
"index_cache",
registry,
&cache.LRU[string, linkeddb.LinkedDB]{
Size: indexCacheSize,
},
)
if err != nil {
return nil, err
}
s := &utxoState{
codec: codec,
utxoCache: utxoCache,
utxoDB: prefixdb.New(utxoPrefix, db),
indexDB: prefixdb.New(indexPrefix, db),
indexCache: indexCache,
trackChecksum: trackChecksum,
}
return s, s.initChecksum()
}
func (s *utxoState) GetUTXO(utxoID ids.ID) (*UTXO, error) {
if utxo, found := s.utxoCache.Get(utxoID); found {
if utxo == nil {
return nil, database.ErrNotFound
}
return utxo, nil
}
bytes, err := s.utxoDB.Get(utxoID[:])
if err == database.ErrNotFound {
s.utxoCache.Put(utxoID, nil)
return nil, database.ErrNotFound
}
if err != nil {
return nil, err
}
// The key was in the database
utxo := &UTXO{}
if _, err := s.codec.Unmarshal(bytes, utxo); err != nil {
return nil, err
}
s.utxoCache.Put(utxoID, utxo)
return utxo, nil
}
func (s *utxoState) PutUTXO(utxo *UTXO) error {
utxoBytes, err := s.codec.Marshal(codecVersion, utxo)
if err != nil {
return err
}
utxoID := utxo.InputID()
s.updateChecksum(utxoID)
s.utxoCache.Put(utxoID, utxo)
if err := s.utxoDB.Put(utxoID[:], utxoBytes); err != nil {
return err
}
addressable, ok := utxo.Out.(Addressable)
if !ok {
return nil
}
addresses := addressable.Addresses()
for _, addr := range addresses {
indexList := s.getIndexDB(addr)
if err := indexList.Put(utxoID[:], nil); err != nil {
return err
}
}
return nil
}
func (s *utxoState) DeleteUTXO(utxoID ids.ID) error {
utxo, err := s.GetUTXO(utxoID)
if err == database.ErrNotFound {
return nil
}
if err != nil {
return err
}
s.updateChecksum(utxoID)
s.utxoCache.Put(utxoID, nil)
if err := s.utxoDB.Delete(utxoID[:]); err != nil {
return err
}
addressable, ok := utxo.Out.(Addressable)
if !ok {
return nil
}
addresses := addressable.Addresses()
for _, addr := range addresses {
indexList := s.getIndexDB(addr)
if err := indexList.Delete(utxoID[:]); err != nil {
return err
}
}
return nil
}
func (s *utxoState) UTXOIDs(addr []byte, start ids.ID, limit int) ([]ids.ID, error) {
indexList := s.getIndexDB(addr)
iter := indexList.NewIteratorWithStart(start[:])
defer iter.Release()
utxoIDs := []ids.ID(nil)
for len(utxoIDs) < limit && iter.Next() {
utxoID, err := ids.ToID(iter.Key())
if err != nil {
return nil, err
}
if utxoID == start {
continue
}
start = ids.Empty
utxoIDs = append(utxoIDs, utxoID)
}
return utxoIDs, iter.Error()
}
func (s *utxoState) Checksum() ids.ID {
return s.checksum
}
func (s *utxoState) getIndexDB(addr []byte) linkeddb.LinkedDB {
addrStr := string(addr)
if indexList, exists := s.indexCache.Get(addrStr); exists {
return indexList
}
indexDB := prefixdb.NewNested(addr, s.indexDB)
indexList := linkeddb.NewDefault(indexDB)
s.indexCache.Put(addrStr, indexList)
return indexList
}
func (s *utxoState) initChecksum() error {
if !s.trackChecksum {
return nil
}
it := s.utxoDB.NewIterator()
defer it.Release()
for it.Next() {
utxoID, err := ids.ToID(it.Key())
if err != nil {
return err
}
s.updateChecksum(utxoID)
}
return it.Error()
}
func (s *utxoState) updateChecksum(modifiedID ids.ID) {
if !s.trackChecksum {
return
}
s.checksum = s.checksum.XOR(modifiedID)
}
-96
View File
@@ -1,96 +0,0 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/luxfi/node/vms/components/lux (interfaces: TransferableIn)
//
// Generated by this command:
//
// mockgen -package=luxmock -destination=luxmock/transferable_in.go -mock_names=TransferableIn=TransferableIn . TransferableIn
//
// Package luxmock is a generated GoMock package.
package luxmock
import (
"context"
reflect "reflect"
gomock "github.com/luxfi/mock/gomock"
)
// TransferableIn is a mock of TransferableIn interface.
type TransferableIn struct {
ctrl *gomock.Controller
recorder *TransferableInMockRecorder
isgomock struct{}
}
// TransferableInMockRecorder is the mock recorder for TransferableIn.
type TransferableInMockRecorder struct {
mock *TransferableIn
}
// NewTransferableIn creates a new mock instance.
func NewTransferableIn(ctrl *gomock.Controller) *TransferableIn {
mock := &TransferableIn{ctrl: ctrl}
mock.recorder = &TransferableInMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *TransferableIn) EXPECT() *TransferableInMockRecorder {
return m.recorder
}
// Amount mocks base method.
func (m *TransferableIn) Amount() uint64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Amount")
ret0, _ := ret[0].(uint64)
return ret0
}
// Amount indicates an expected call of Amount.
func (mr *TransferableInMockRecorder) Amount() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Amount", reflect.TypeOf((*TransferableIn)(nil).Amount))
}
// Cost mocks base method.
func (m *TransferableIn) Cost() (uint64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Cost")
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Cost indicates an expected call of Cost.
func (mr *TransferableInMockRecorder) Cost() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cost", reflect.TypeOf((*TransferableIn)(nil).Cost))
}
// InitRuntime mocks base method.
func (m *TransferableIn) InitRuntime(ctx context.Context) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "InitRuntime", ctx)
}
// InitRuntime indicates an expected call of InitRuntime.
func (mr *TransferableInMockRecorder) InitRuntime(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitRuntime", reflect.TypeOf((*TransferableIn)(nil).InitRuntime), ctx)
}
// Verify mocks base method.
func (m *TransferableIn) Verify() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Verify")
ret0, _ := ret[0].(error)
return ret0
}
// Verify indicates an expected call of Verify.
func (mr *TransferableInMockRecorder) Verify() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*TransferableIn)(nil).Verify))
}
@@ -1,95 +0,0 @@
// Code generated by MockGen and manually edited.
// Source: github.com/luxfi/node/vms/components/lux (interfaces: TransferableOut)
//
// Generated by this command:
//
// mockgen -package=luxmock -destination=vms/components/lux/luxmock/transferable_out.go -mock_names=TransferableOut=TransferableOut github.com/luxfi/node/vms/components/lux TransferableOut
//
// Package luxmock is a generated GoMock package.
package luxmock
import (
"context"
reflect "reflect"
gomock "github.com/luxfi/mock/gomock"
verify "github.com/luxfi/node/vms/components/verify"
)
// TransferableOut is a mock of TransferableOut interface.
type TransferableOut struct {
verify.IsState
ctrl *gomock.Controller
recorder *TransferableOutMockRecorder
}
// TransferableOutMockRecorder is the mock recorder for TransferableOut.
type TransferableOutMockRecorder struct {
mock *TransferableOut
}
// NewTransferableOut creates a new mock instance.
func NewTransferableOut(ctrl *gomock.Controller) *TransferableOut {
mock := &TransferableOut{ctrl: ctrl}
mock.recorder = &TransferableOutMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *TransferableOut) EXPECT() *TransferableOutMockRecorder {
return m.recorder
}
// Amount mocks base method.
func (m *TransferableOut) Amount() uint64 {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Amount")
ret0, _ := ret[0].(uint64)
return ret0
}
// Amount indicates an expected call of Amount.
func (mr *TransferableOutMockRecorder) Amount() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Amount", reflect.TypeOf((*TransferableOut)(nil).Amount))
}
// InitRuntime mocks base method.
func (m *TransferableOut) InitRuntime(arg0 context.Context) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "InitRuntime", arg0)
}
// InitRuntime indicates an expected call of InitRuntime.
func (mr *TransferableOutMockRecorder) InitRuntime(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitRuntime", reflect.TypeOf((*TransferableOut)(nil).InitRuntime), arg0)
}
// Verify mocks base method.
func (m *TransferableOut) Verify() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Verify")
ret0, _ := ret[0].(error)
return ret0
}
// Verify indicates an expected call of Verify.
func (mr *TransferableOutMockRecorder) Verify() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Verify", reflect.TypeOf((*TransferableOut)(nil).Verify))
}
// isState mocks base method.
func (m *TransferableOut) isState() {
m.ctrl.T.Helper()
m.ctrl.Call(m, "isState")
}
// isState indicates an expected call of isState.
func (mr *TransferableOutMockRecorder) isState() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isState", reflect.TypeOf((*TransferableOut)(nil).isState))
}
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/formatting"
"github.com/luxfi/ids"
"github.com/luxfi/math"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/genesis"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/txs"
)
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/vm/chains/atomic"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
"github.com/luxfi/node/vms/platformvm/status"
"github.com/luxfi/node/vms/platformvm/txs"
@@ -22,7 +22,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
"github.com/luxfi/node/vms/platformvm/reward"
@@ -18,7 +18,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
"github.com/luxfi/node/vms/platformvm/state"
@@ -28,7 +28,7 @@ import (
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/config"
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/codec"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utxo/secp256k1fx"
)
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/txs"
)
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/address"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/platformvm/txs/txheap"
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/txs/mempool"
+1 -1
View File
@@ -26,7 +26,7 @@ import (
apitypes "github.com/luxfi/api/types"
"github.com/luxfi/node/cache/lru"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/state"
+1 -1
View File
@@ -40,7 +40,7 @@ import (
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/version"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/block/executor/executormock"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
+1 -1
View File
@@ -6,7 +6,7 @@ package stakeable
import (
"errors"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/runtime"
)
@@ -10,8 +10,8 @@ import (
"github.com/luxfi/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/luxfi/node/vms/components/lux"
"github.com/luxfi/node/vms/components/lux/luxmock"
lux "github.com/luxfi/utxo"
luxmock "github.com/luxfi/utxo/luxmock"
)
var errTest = errors.New("hi mom")
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/status"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/container/iterator"
+1 -1
View File
@@ -17,7 +17,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/status"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/utils"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
ids "github.com/luxfi/ids"
gas "github.com/luxfi/node/vms/components/gas"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
status "github.com/luxfi/node/vms/platformvm/status"
txs "github.com/luxfi/node/vms/platformvm/txs"
iterator "github.com/luxfi/container/iterator"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
ids "github.com/luxfi/ids"
gas "github.com/luxfi/node/vms/components/gas"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
status "github.com/luxfi/node/vms/platformvm/status"
txs "github.com/luxfi/node/vms/platformvm/txs"
iterator "github.com/luxfi/container/iterator"
+1 -1
View File
@@ -20,7 +20,7 @@ import (
ids "github.com/luxfi/ids"
"github.com/luxfi/log"
gas "github.com/luxfi/node/vms/components/gas"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
block "github.com/luxfi/node/vms/platformvm/block"
status "github.com/luxfi/node/vms/platformvm/status"
txs "github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -30,7 +30,7 @@ import (
"github.com/luxfi/node/cache/metercacher"
"github.com/luxfi/node/upgrade"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/fx"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/genesis"
"github.com/luxfi/node/vms/platformvm/status"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/state/statetest"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -38,7 +38,7 @@ import (
"github.com/luxfi/codec/wrappers"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/config"
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/database/linkeddb"
"github.com/luxfi/database/prefixdb"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/status"
"github.com/luxfi/node/vms/platformvm/txs"
)
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
)
func (s *state) GetUTXO(utxoID ids.ID) (*lux.UTXO, error) {
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/timer/mockable"
"github.com/luxfi/utxo/secp256k1fx"
)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/timer/mockable"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
safemath "github.com/luxfi/math"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/fx"
"github.com/luxfi/utxo/secp256k1fx"
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
safemath "github.com/luxfi/math"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/fx"
"github.com/luxfi/utxo/secp256k1fx"
@@ -15,8 +15,8 @@ import (
"github.com/luxfi/runtime"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
"github.com/luxfi/node/vms/components/lux/luxmock"
lux "github.com/luxfi/utxo"
luxmock "github.com/luxfi/utxo/luxmock"
"github.com/luxfi/node/vms/platformvm/fx/fxmock"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utils"
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
safemath "github.com/luxfi/math"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/fx"
"github.com/luxfi/node/vms/platformvm/reward"
@@ -15,8 +15,8 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/bls/signer/localsigner"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
"github.com/luxfi/node/vms/components/lux/luxmock"
lux "github.com/luxfi/utxo"
luxmock "github.com/luxfi/utxo/luxmock"
"github.com/luxfi/node/vms/platformvm/fx/fxmock"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/signer"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/timer/mockable"
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
safemath "github.com/luxfi/math"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/fx"
"github.com/luxfi/node/vms/platformvm/reward"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
)
var _ UnsignedTx = (*AdvanceTimeTx)(nil)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/runtime"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/utils"
"github.com/luxfi/utxo/secp256k1fx"
)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utils"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/runtime"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/txs"
@@ -20,7 +20,7 @@ import (
"github.com/luxfi/utils"
hash "github.com/luxfi/crypto/hash"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/warp/message"
"github.com/luxfi/node/vms/platformvm/signer"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/utxo/secp256k1fx"
)
@@ -14,7 +14,7 @@ import (
consensustest "github.com/luxfi/consensus/test/helpers"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/vm/chains/atomic"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/wallet/chain/p/builder"
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/state"
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/state"
@@ -9,7 +9,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/txs"
)
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/database"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/platformvm/txs/fee"
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/mock/gomock"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/state"
@@ -19,7 +19,7 @@ import (
"github.com/luxfi/vm/chains/atomic"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/node/vms/platformvm/txs/fee"
@@ -27,7 +27,7 @@ import (
"github.com/luxfi/math/set"
"github.com/luxfi/node/genesis/builder"
"github.com/luxfi/node/upgrade/upgradetest"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/genesis/genesistest"
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"fmt"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utxo/secp256k1fx"
)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/gas"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/utils"
"github.com/luxfi/utxo/secp256k1fx"
)
@@ -14,7 +14,7 @@ import (
consensustest "github.com/luxfi/consensus/test/helpers"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utxo/secp256k1fx"
"github.com/luxfi/vm/types"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/txs"
@@ -16,7 +16,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/crypto/bls/signer/localsigner"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utils"
"github.com/luxfi/node/vms/platformvm/signer"
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify/verifymock"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utils"
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
)
var _ UnsignedTx = (*RewardValidatorTx)(nil)
@@ -14,7 +14,7 @@ import (
consensustest "github.com/luxfi/consensus/test/helpers"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/utxo/secp256k1fx"
"github.com/luxfi/vm/types"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
)
var (
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"github.com/luxfi/crypto/bls"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/fx"
)
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify/verifymock"
"github.com/luxfi/node/vms/platformvm/fx/fxmock"
"github.com/luxfi/node/vms/platformvm/stakeable"
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify/verifymock"
"github.com/luxfi/node/vms/platformvm/reward"
"github.com/luxfi/node/vms/platformvm/stakeable"
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/p2p/gossip"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/codec/linearcodec"
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/codec/wrappers"
"github.com/luxfi/utxo/secp256k1fx"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"github.com/luxfi/runtime"
ids "github.com/luxfi/ids"
set "github.com/luxfi/math/set"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
txs "github.com/luxfi/node/vms/platformvm/txs"
gomock "go.uber.org/mock/gomock"
)
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/wallet/chain/p/builder"
"github.com/luxfi/node/wallet/chain/p/signer"
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"github.com/luxfi/runtime"
"github.com/luxfi/constants"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/state"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"github.com/luxfi/runtime"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/utxo/secp256k1fx"
)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/math/set"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/state"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
gomock "go.uber.org/mock/gomock"
ids "github.com/luxfi/ids"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
verify "github.com/luxfi/node/vms/components/verify"
txs "github.com/luxfi/node/vms/platformvm/txs"
)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
reflect "reflect"
ids "github.com/luxfi/ids"
lux "github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
verify "github.com/luxfi/node/vms/components/verify"
txs "github.com/luxfi/node/vms/platformvm/txs"
gomock "go.uber.org/mock/gomock"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"fmt"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"github.com/luxfi/crypto/secp256k1"
"github.com/luxfi/ids"
"github.com/luxfi/log"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/components/verify"
"github.com/luxfi/node/vms/platformvm/stakeable"
"github.com/luxfi/node/vms/platformvm/txs"
+1 -1
View File
@@ -28,7 +28,7 @@ import (
"github.com/luxfi/node/cache/lru"
"github.com/luxfi/node/utils/json"
"github.com/luxfi/node/version"
"github.com/luxfi/node/vms/components/lux"
lux "github.com/luxfi/utxo"
"github.com/luxfi/node/vms/platformvm/block"
"github.com/luxfi/node/vms/platformvm/config"
"github.com/luxfi/node/vms/platformvm/fx"

Some files were not shown because too many files have changed in this diff Show More