chain

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2022 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Overview

Package chain is a generated GoMock package.

Index

Constants

View Source
const (
	Set      = "set"
	Transfer = "transfer"
)
View Source
const (
	MinBlockCost          = 0
	DefaultValueUnitSize  = 1 * units.KiB
	DefaultLookbackWindow = 60
)
View Source
const (
	ByteDelimiter byte = '/'
)

Variables

View Source
var (
	// Genesis Correctness
	ErrInvalidMagic     = errors.New("invalid magic")
	ErrInvalidBlockRate = errors.New("invalid block rate")

	// Block Correctness
	ErrTimestampTooEarly      = errors.New("block timestamp too early")
	ErrTimestampTooLate       = errors.New("block timestamp too late")
	ErrNoTxs                  = errors.New("no transactions")
	ErrInvalidCost            = errors.New("invalid block cost")
	ErrInvalidPrice           = errors.New("invalid price")
	ErrInsufficientSurplus    = errors.New("insufficient surplus fee")
	ErrParentBlockNotVerified = errors.New("parent block not verified or accepted")
	ErrInvalidAccessProof     = errors.New("invalid access proof")

	// Tx Correctness
	ErrInvalidBlockID      = errors.New("invalid blockID")
	ErrInvalidSignature    = errors.New("invalid signature")
	ErrDuplicateTx         = errors.New("duplicate transaction")
	ErrInsufficientPrice   = errors.New("insufficient price")
	ErrInvalidType         = errors.New("invalid tx type")
	ErrTypedDataKeyMissing = errors.New("typed data key missing")

	// Execution Correctness
	ErrValueEmpty     = errors.New("value empty")
	ErrValueTooBig    = errors.New("value too big")
	ErrKeyMissing     = errors.New("key missing")
	ErrInvalidKey     = errors.New("key is invalid")
	ErrKeyExists      = errors.New("key already exists")
	ErrUnauthorized   = errors.New("sender is not authorized")
	ErrInvalidBalance = errors.New("invalid balance")
	ErrNonActionable  = errors.New("transaction doesn't do anything")
	ErrBlockTooBig    = errors.New("block too big")
)
View Source
var ErrInvalidKeyFormat = errors.New("invalid key format")

Functions

func BuildBlock

func BuildBlock(vm VM, preferred ids.ID) (snowman.Block, error)

func DeriveSender

func DeriveSender(dh []byte, sig []byte) (*ecdsa.PublicKey, error)

func DigestHash

func DigestHash(utx UnsignedTransaction) ([]byte, error)

func GetBalance

func GetBalance(db database.KeyValueReader, address common.Address) (uint64, error)

func GetLastAccepted

func GetLastAccepted(db database.KeyValueReader) (ids.ID, error)

func GetValue

func GetValue(db database.KeyValueReader, key common.Hash) ([]byte, bool, error)

func HasKey

func HasKey(db database.KeyValueReader, key common.Hash) (bool, error)

DB

func HasLastAccepted

func HasLastAccepted(db database.Database) (bool, error)

func HasTransaction

func HasTransaction(db database.KeyValueReader, txID ids.ID) (bool, error)

func Marshal

func Marshal(source interface{}) ([]byte, error)

func ModifyBalance

func ModifyBalance(db database.KeyValueReaderWriter, address common.Address, add bool, change uint64) (uint64, error)

func PrefixBalanceKey

func PrefixBalanceKey(address common.Address) (k []byte)

[balancePrefix] + [delimiter] + [address]

func PrefixBlockKey

func PrefixBlockKey(blockID ids.ID) (k []byte)

[blockPrefix] + [delimiter] + [blockID]

func PrefixTxKey

func PrefixTxKey(txID ids.ID) (k []byte)

[txPrefix] + [delimiter] + [txID]

func PrefixTxValueKey

func PrefixTxValueKey(txID ids.ID) (k []byte)

[txValuePrefix] + [delimiter] + [txID]

func PutKey

func PutKey(db database.KeyValueWriter, key common.Hash, vmeta *ValueMeta) error

func SelectRandomValue added in v0.0.2

func SelectRandomValue(db database.Database, seed []byte) []byte

func SetBalance

func SetBalance(db database.KeyValueWriter, address common.Address, bal uint64) error

func SetLastAccepted

func SetLastAccepted(db database.KeyValueWriter, block *StatelessBlock) error

func SetTransaction

func SetTransaction(db database.KeyValueWriter, tx *Transaction) error

func Sign

func Sign(dh []byte, priv *ecdsa.PrivateKey) ([]byte, error)

func Unmarshal

func Unmarshal(source []byte, destination interface{}) (uint16, error)

func ValueHash

func ValueHash(v []byte) common.Hash

func ValueHashString

func ValueHashString(v []byte) string

func ValueKey

func ValueKey(key common.Hash) (k []byte)

Assumes [key] does not contain delimiter [keyPrefix] + [delimiter] + [key]

Types

type Activity

type Activity struct {
	Tmstmp int64  `serialize:"true" json:"timestamp"`
	TxID   ids.ID `serialize:"true" json:"txId"`
	Typ    string `serialize:"true" json:"type"`
	Sender string `serialize:"true" json:"sender,omitempty"`
	Key    string `serialize:"true" json:"key,omitempty"`
	To     string `serialize:"true" json:"to,omitempty"` // common.Address will be 0x000 when not populated
	Units  uint64 `serialize:"true" json:"units,omitempty"`
}

type Airdrop

type Airdrop struct {
	// Address strings are hex-formatted common.Address
	Address common.Address `serialize:"true" json:"address"`
}

type BaseTx

type BaseTx struct {
	// BlkID is the ID of a block in the [lookbackWindow].
	BlockID ids.ID `serialize:"true" json:"blockId"`

	// Magic is a value defined in genesis to protect against replay attacks on
	// different VMs.
	Magic uint64 `serialize:"true" json:"magic"`

	// Price is the value per unit to spend on this transaction.
	Price uint64 `serialize:"true" json:"price"`
}

func (*BaseTx) Copy

func (b *BaseTx) Copy() *BaseTx

func (*BaseTx) ExecuteBase

func (b *BaseTx) ExecuteBase(g *Genesis) error

func (*BaseTx) FeeUnits

func (b *BaseTx) FeeUnits(g *Genesis) uint64

func (*BaseTx) GetBlockID

func (b *BaseTx) GetBlockID() ids.ID

func (*BaseTx) GetMagic

func (b *BaseTx) GetMagic() uint64

func (*BaseTx) GetPrice

func (b *BaseTx) GetPrice() uint64

func (*BaseTx) LoadUnits

func (b *BaseTx) LoadUnits(g *Genesis) uint64

func (*BaseTx) SetBlockID

func (b *BaseTx) SetBlockID(bid ids.ID)

func (*BaseTx) SetMagic

func (b *BaseTx) SetMagic(magic uint64)

func (*BaseTx) SetPrice

func (b *BaseTx) SetPrice(price uint64)

type Context

type Context struct {
	RecentBlockIDs  ids.Set
	RecentTxIDs     ids.Set
	RecentLoadUnits uint64

	Prices []uint64
	Costs  []uint64

	NextCost  uint64
	NextPrice uint64
}

type CustomAllocation

type CustomAllocation struct {
	// Address strings are hex-formatted common.Address
	Address common.Address `serialize:"true" json:"address"`
	Balance uint64         `serialize:"true" json:"balance"`
}

type Genesis

type Genesis struct {
	Magic uint64 `serialize:"true" json:"magic"`

	// Tx params
	BaseTxUnits uint64 `serialize:"true" json:"baseTxUnits"`

	// SetTx params
	ValueUnitSize uint64 `serialize:"true" json:"valueUnitSize"`
	MaxValueSize  uint64 `serialize:"true" json:"maxValueSize"`

	// Fee Mechanism Params
	MinPrice         uint64 `serialize:"true" json:"minPrice"`
	LookbackWindow   int64  `serialize:"true" json:"lookbackWindow"`
	TargetBlockRate  int64  `serialize:"true" json:"targetBlockRate"` // seconds
	TargetBlockSize  uint64 `serialize:"true" json:"targetBlockSize"` // units
	MaxBlockSize     uint64 `serialize:"true" json:"maxBlockSize"`    // units
	BlockCostEnabled bool   `serialize:"true" json:"blockCostEnabled"`

	// Allocations
	CustomAllocation []*CustomAllocation `serialize:"true" json:"customAllocation"`
	AirdropHash      string              `serialize:"true" json:"airdropHash"`
	AirdropUnits     uint64              `serialize:"true" json:"airdropUnits"`
}

func DefaultGenesis

func DefaultGenesis() *Genesis

func (*Genesis) Load

func (g *Genesis) Load(db database.Database, airdropData []byte) error

func (*Genesis) StatefulBlock

func (g *Genesis) StatefulBlock() *StatefulBlock

func (*Genesis) Verify

func (g *Genesis) Verify() error

type Input

type Input struct {
	Typ   string         `json:"type"`
	Key   string         `json:"key"`
	Value []byte         `json:"value"`
	To    common.Address `json:"to"`
	Units uint64         `json:"units"`
}

func (*Input) Decode

func (i *Input) Decode() (UnsignedTransaction, error)

type KeyValueMeta

type KeyValueMeta struct {
	Key       string     `serialize:"true" json:"key"`
	ValueMeta *ValueMeta `serialize:"true" json:"valueMeta"`
}

type Mempool

type Mempool interface {
	Len() int
	Prune(ids.Set)
	PopMax() (*Transaction, uint64)
	Add(*Transaction) bool
	NewTxs(uint64) []*Transaction
}

type MockMempool

type MockMempool struct {
	// contains filtered or unexported fields
}

MockMempool is a mock of Mempool interface.

func NewMockMempool

func NewMockMempool(ctrl *gomock.Controller) *MockMempool

NewMockMempool creates a new mock instance.

func (*MockMempool) Add

func (m *MockMempool) Add(arg0 *Transaction) bool

Add mocks base method.

func (*MockMempool) EXPECT

func (m *MockMempool) EXPECT() *MockMempoolMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMempool) Len

func (m *MockMempool) Len() int

Len mocks base method.

func (*MockMempool) NewTxs

func (m *MockMempool) NewTxs(arg0 uint64) []*Transaction

NewTxs mocks base method.

func (*MockMempool) PopMax

func (m *MockMempool) PopMax() (*Transaction, uint64)

PopMax mocks base method.

func (*MockMempool) Prune

func (m *MockMempool) Prune(arg0 ids.Set)

Prune mocks base method.

type MockMempoolMockRecorder

type MockMempoolMockRecorder struct {
	// contains filtered or unexported fields
}

MockMempoolMockRecorder is the mock recorder for MockMempool.

func (*MockMempoolMockRecorder) Add

func (mr *MockMempoolMockRecorder) Add(arg0 interface{}) *gomock.Call

Add indicates an expected call of Add.

func (*MockMempoolMockRecorder) Len

func (mr *MockMempoolMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len.

func (*MockMempoolMockRecorder) NewTxs

func (mr *MockMempoolMockRecorder) NewTxs(arg0 interface{}) *gomock.Call

NewTxs indicates an expected call of NewTxs.

func (*MockMempoolMockRecorder) PopMax

func (mr *MockMempoolMockRecorder) PopMax() *gomock.Call

PopMax indicates an expected call of PopMax.

func (*MockMempoolMockRecorder) Prune

func (mr *MockMempoolMockRecorder) Prune(arg0 interface{}) *gomock.Call

Prune indicates an expected call of Prune.

type MockUnsignedTransaction

type MockUnsignedTransaction struct {
	// contains filtered or unexported fields
}

MockUnsignedTransaction is a mock of UnsignedTransaction interface.

func NewMockUnsignedTransaction

func NewMockUnsignedTransaction(ctrl *gomock.Controller) *MockUnsignedTransaction

NewMockUnsignedTransaction creates a new mock instance.

func (*MockUnsignedTransaction) Activity

func (m *MockUnsignedTransaction) Activity() *Activity

Activity mocks base method.

func (*MockUnsignedTransaction) Copy

Copy mocks base method.

func (*MockUnsignedTransaction) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockUnsignedTransaction) Execute

Execute mocks base method.

func (*MockUnsignedTransaction) ExecuteBase

func (m *MockUnsignedTransaction) ExecuteBase(arg0 *Genesis) error

ExecuteBase mocks base method.

func (*MockUnsignedTransaction) FeeUnits

func (m *MockUnsignedTransaction) FeeUnits(arg0 *Genesis) uint64

FeeUnits mocks base method.

func (*MockUnsignedTransaction) GetBlockID

func (m *MockUnsignedTransaction) GetBlockID() ids.ID

GetBlockID mocks base method.

func (*MockUnsignedTransaction) GetMagic

func (m *MockUnsignedTransaction) GetMagic() uint64

GetMagic mocks base method.

func (*MockUnsignedTransaction) GetPrice

func (m *MockUnsignedTransaction) GetPrice() uint64

GetPrice mocks base method.

func (*MockUnsignedTransaction) LoadUnits

func (m *MockUnsignedTransaction) LoadUnits(arg0 *Genesis) uint64

LoadUnits mocks base method.

func (*MockUnsignedTransaction) SetBlockID

func (m *MockUnsignedTransaction) SetBlockID(arg0 ids.ID)

SetBlockID mocks base method.

func (*MockUnsignedTransaction) SetMagic

func (m *MockUnsignedTransaction) SetMagic(arg0 uint64)

SetMagic mocks base method.

func (*MockUnsignedTransaction) SetPrice

func (m *MockUnsignedTransaction) SetPrice(arg0 uint64)

SetPrice mocks base method.

func (*MockUnsignedTransaction) TypedData

func (m *MockUnsignedTransaction) TypedData() *tdata.TypedData

TypedData mocks base method.

type MockUnsignedTransactionMockRecorder

type MockUnsignedTransactionMockRecorder struct {
	// contains filtered or unexported fields
}

MockUnsignedTransactionMockRecorder is the mock recorder for MockUnsignedTransaction.

func (*MockUnsignedTransactionMockRecorder) Activity

Activity indicates an expected call of Activity.

func (*MockUnsignedTransactionMockRecorder) Copy

Copy indicates an expected call of Copy.

func (*MockUnsignedTransactionMockRecorder) Execute

func (mr *MockUnsignedTransactionMockRecorder) Execute(arg0 interface{}) *gomock.Call

Execute indicates an expected call of Execute.

func (*MockUnsignedTransactionMockRecorder) ExecuteBase

func (mr *MockUnsignedTransactionMockRecorder) ExecuteBase(arg0 interface{}) *gomock.Call

ExecuteBase indicates an expected call of ExecuteBase.

func (*MockUnsignedTransactionMockRecorder) FeeUnits

func (mr *MockUnsignedTransactionMockRecorder) FeeUnits(arg0 interface{}) *gomock.Call

FeeUnits indicates an expected call of FeeUnits.

func (*MockUnsignedTransactionMockRecorder) GetBlockID

GetBlockID indicates an expected call of GetBlockID.

func (*MockUnsignedTransactionMockRecorder) GetMagic

GetMagic indicates an expected call of GetMagic.

func (*MockUnsignedTransactionMockRecorder) GetPrice

GetPrice indicates an expected call of GetPrice.

func (*MockUnsignedTransactionMockRecorder) LoadUnits

func (mr *MockUnsignedTransactionMockRecorder) LoadUnits(arg0 interface{}) *gomock.Call

LoadUnits indicates an expected call of LoadUnits.

func (*MockUnsignedTransactionMockRecorder) SetBlockID

func (mr *MockUnsignedTransactionMockRecorder) SetBlockID(arg0 interface{}) *gomock.Call

SetBlockID indicates an expected call of SetBlockID.

func (*MockUnsignedTransactionMockRecorder) SetMagic

func (mr *MockUnsignedTransactionMockRecorder) SetMagic(arg0 interface{}) *gomock.Call

SetMagic indicates an expected call of SetMagic.

func (*MockUnsignedTransactionMockRecorder) SetPrice

func (mr *MockUnsignedTransactionMockRecorder) SetPrice(arg0 interface{}) *gomock.Call

SetPrice indicates an expected call of SetPrice.

func (*MockUnsignedTransactionMockRecorder) TypedData

TypedData indicates an expected call of TypedData.

type MockVM

type MockVM struct {
	// contains filtered or unexported fields
}

MockVM is a mock of VM interface.

func NewMockVM

func NewMockVM(ctrl *gomock.Controller) *MockVM

NewMockVM creates a new mock instance.

func (*MockVM) Accepted

func (m *MockVM) Accepted(arg0 *StatelessBlock)

Accepted mocks base method.

func (*MockVM) EXPECT

func (m *MockVM) EXPECT() *MockVMMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVM) ExecutionContext

func (m *MockVM) ExecutionContext(currentTime int64, parent *StatelessBlock) (*Context, error)

ExecutionContext mocks base method.

func (*MockVM) Genesis

func (m *MockVM) Genesis() *Genesis

Genesis mocks base method.

func (*MockVM) GetStatelessBlock

func (m *MockVM) GetStatelessBlock(arg0 ids.ID) (*StatelessBlock, error)

GetStatelessBlock mocks base method.

func (*MockVM) IsBootstrapped

func (m *MockVM) IsBootstrapped() bool

IsBootstrapped mocks base method.

func (*MockVM) Mempool

func (m *MockVM) Mempool() Mempool

Mempool mocks base method.

func (*MockVM) Rejected

func (m *MockVM) Rejected(arg0 *StatelessBlock)

Rejected mocks base method.

func (*MockVM) State

func (m *MockVM) State() database.Database

State mocks base method.

func (*MockVM) Verified

func (m *MockVM) Verified(arg0 *StatelessBlock)

Verified mocks base method.

type MockVMMockRecorder

type MockVMMockRecorder struct {
	// contains filtered or unexported fields
}

MockVMMockRecorder is the mock recorder for MockVM.

func (*MockVMMockRecorder) Accepted

func (mr *MockVMMockRecorder) Accepted(arg0 interface{}) *gomock.Call

Accepted indicates an expected call of Accepted.

func (*MockVMMockRecorder) ExecutionContext

func (mr *MockVMMockRecorder) ExecutionContext(currentTime, parent interface{}) *gomock.Call

ExecutionContext indicates an expected call of ExecutionContext.

func (*MockVMMockRecorder) Genesis

func (mr *MockVMMockRecorder) Genesis() *gomock.Call

Genesis indicates an expected call of Genesis.

func (*MockVMMockRecorder) GetStatelessBlock

func (mr *MockVMMockRecorder) GetStatelessBlock(arg0 interface{}) *gomock.Call

GetStatelessBlock indicates an expected call of GetStatelessBlock.

func (*MockVMMockRecorder) IsBootstrapped

func (mr *MockVMMockRecorder) IsBootstrapped() *gomock.Call

IsBootstrapped indicates an expected call of IsBootstrapped.

func (*MockVMMockRecorder) Mempool

func (mr *MockVMMockRecorder) Mempool() *gomock.Call

Mempool indicates an expected call of Mempool.

func (*MockVMMockRecorder) Rejected

func (mr *MockVMMockRecorder) Rejected(arg0 interface{}) *gomock.Call

Rejected indicates an expected call of Rejected.

func (*MockVMMockRecorder) State

func (mr *MockVMMockRecorder) State() *gomock.Call

State indicates an expected call of State.

func (*MockVMMockRecorder) Verified

func (mr *MockVMMockRecorder) Verified(arg0 interface{}) *gomock.Call

Verified indicates an expected call of Verified.

type SetTx

type SetTx struct {
	*BaseTx `serialize:"true" json:"baseTx"`

	Value []byte `serialize:"true" json:"value"`
}

func (*SetTx) Activity

func (s *SetTx) Activity() *Activity

func (*SetTx) Copy

func (s *SetTx) Copy() UnsignedTransaction

func (*SetTx) Execute

func (s *SetTx) Execute(t *TransactionContext) error

func (*SetTx) FeeUnits

func (s *SetTx) FeeUnits(g *Genesis) uint64

func (*SetTx) LoadUnits

func (s *SetTx) LoadUnits(g *Genesis) uint64

func (*SetTx) TypedData

func (s *SetTx) TypedData() *tdata.TypedData

type StatefulBlock

type StatefulBlock struct {
	Prnt        ids.ID         `serialize:"true" json:"parent"`
	Tmstmp      int64          `serialize:"true" json:"timestamp"`
	Hght        uint64         `serialize:"true" json:"height"`
	Price       uint64         `serialize:"true" json:"price"`
	Cost        uint64         `serialize:"true" json:"cost"`
	AccessProof common.Hash    `serialize:"true" json:"accessProof"`
	Txs         []*Transaction `serialize:"true" json:"txs"`
}

func GetBlock

func GetBlock(db database.KeyValueReader, bid ids.ID) (*StatefulBlock, error)

func (*StatefulBlock) Dummy

func (b *StatefulBlock) Dummy() bool

type StatelessBlock

type StatelessBlock struct {
	*StatefulBlock `serialize:"true" json:"block"`
	// contains filtered or unexported fields
}

Stateless is defined separately from "Block" in case external packages needs use the stateful block without mocking VM or parent block

func DummyBlock

func DummyBlock(tmstp int64, tx *Transaction) *StatelessBlock

DummyBlock is used for validating new txs and some tests

func NewBlock

func NewBlock(vm VM, parent snowman.Block, tmstp int64, context *Context) *StatelessBlock

func ParseBlock

func ParseBlock(
	source []byte,
	status choices.Status,
	vm VM,
) (*StatelessBlock, error)

func ParseStatefulBlock

func ParseStatefulBlock(
	blk *StatefulBlock,
	source []byte,
	status choices.Status,
	vm VM,
) (*StatelessBlock, error)

func (*StatelessBlock) Accept

func (b *StatelessBlock) Accept(ctx context.Context) error

implements "snowman.Block.choices.Decidable"

func (*StatelessBlock) Bytes

func (b *StatelessBlock) Bytes() []byte

implements "snowman.Block"

func (*StatelessBlock) Height

func (b *StatelessBlock) Height() uint64

implements "snowman.Block"

func (*StatelessBlock) ID

func (b *StatelessBlock) ID() ids.ID

implements "snowman.Block.choices.Decidable"

func (*StatelessBlock) Parent

func (b *StatelessBlock) Parent() ids.ID

implements "snowman.Block"

func (*StatelessBlock) Reject

func (b *StatelessBlock) Reject(ctx context.Context) error

implements "snowman.Block.choices.Decidable"

func (*StatelessBlock) SetChildrenDB

func (b *StatelessBlock) SetChildrenDB(db database.Database) error

func (*StatelessBlock) Status

func (b *StatelessBlock) Status() choices.Status

implements "snowman.Block.choices.Decidable"

func (*StatelessBlock) Timestamp

func (b *StatelessBlock) Timestamp() time.Time

implements "snowman.Block"

func (*StatelessBlock) Verify

func (b *StatelessBlock) Verify(ctx context.Context) error

implements "snowman.Block"

type Transaction

type Transaction struct {
	UnsignedTransaction `serialize:"true" json:"unsignedTransaction"`
	Signature           []byte `serialize:"true" json:"signature"`
	// contains filtered or unexported fields
}

func NewTx

func NewTx(utx UnsignedTransaction, sig []byte) *Transaction

func (*Transaction) Activity

func (t *Transaction) Activity() *Activity

func (*Transaction) Bytes

func (t *Transaction) Bytes() []byte

func (*Transaction) Copy

func (t *Transaction) Copy() *Transaction

func (*Transaction) DigestHash

func (t *Transaction) DigestHash() []byte

func (*Transaction) Execute

func (t *Transaction) Execute(g *Genesis, db database.Database, blk *StatelessBlock, context *Context) error

func (*Transaction) ID

func (t *Transaction) ID() ids.ID

func (*Transaction) Init

func (t *Transaction) Init(g *Genesis) error

func (*Transaction) Sender

func (t *Transaction) Sender() common.Address

func (*Transaction) Size

func (t *Transaction) Size() uint64

type TransactionContext

type TransactionContext struct {
	Genesis   *Genesis
	Database  database.Database
	BlockTime uint64
	TxID      ids.ID
	Sender    common.Address
}

type TransferTx

type TransferTx struct {
	*BaseTx `serialize:"true" json:"baseTx"`

	// To is the recipient of the [Units].
	To common.Address `serialize:"true" json:"to"`

	// Units are transferred to [To].
	Units uint64 `serialize:"true" json:"units"`
}

func (*TransferTx) Activity

func (t *TransferTx) Activity() *Activity

func (*TransferTx) Copy

func (t *TransferTx) Copy() UnsignedTransaction

func (*TransferTx) Execute

func (t *TransferTx) Execute(c *TransactionContext) error

func (*TransferTx) TypedData

func (t *TransferTx) TypedData() *tdata.TypedData

type UnsignedTransaction

type UnsignedTransaction interface {
	Copy() UnsignedTransaction
	GetBlockID() ids.ID
	GetMagic() uint64
	GetPrice() uint64
	SetBlockID(ids.ID)
	SetMagic(uint64)
	SetPrice(uint64)
	FeeUnits(*Genesis) uint64  // number of units to mine tx
	LoadUnits(*Genesis) uint64 // units that should impact fee rate

	ExecuteBase(*Genesis) error
	Execute(*TransactionContext) error
	TypedData() *tdata.TypedData
	Activity() *Activity
}

func ParseTypedData

func ParseTypedData(td *tdata.TypedData) (UnsignedTransaction, error)

type VM

type VM interface {
	Genesis() *Genesis
	IsBootstrapped() bool
	State() database.Database
	Mempool() Mempool
	GetStatelessBlock(ids.ID) (*StatelessBlock, error)
	ExecutionContext(currentTime int64, parent *StatelessBlock) (*Context, error)
	Verified(*StatelessBlock)
	Rejected(*StatelessBlock)
	Accepted(*StatelessBlock)
}

type ValueMeta

type ValueMeta struct {
	Size    uint64 `serialize:"true" json:"size"`
	TxID    ids.ID `serialize:"true" json:"txId"`
	Created uint64 `serialize:"true" json:"created"`
}

func GetValueMeta

func GetValueMeta(db database.KeyValueReader, key common.Hash) (*ValueMeta, bool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL