Documentation
¶
Overview ¶
Package executor is a generated GoMock package.
Index ¶
- Constants
- Variables
- func BlockExecutionRoot(parentExecutionRoot ids.ID, blkTxs []*txs.Tx, postState state.Chain, ...) (ids.ID, error)
- func OwnerRoot(o owners) [32]byte
- type Block
- type Manager
- type MockManager
- func (m *MockManager) EXPECT() *MockManagerMockRecorder
- func (m *MockManager) GetBlock(blkID ids.ID) (chain.Block, error)
- func (m *MockManager) GetState(blkID ids.ID) (state.Chain, bool)
- func (m *MockManager) GetStatelessBlock(blkID ids.ID) (block.Block, error)
- func (m *MockManager) LastAccepted() ids.ID
- func (m *MockManager) NewBlock(arg0 block.Block) chain.Block
- func (m *MockManager) Preferred() ids.ID
- func (m *MockManager) SetPreference(blkID ids.ID)
- func (m *MockManager) VerifyTx(tx *txs.Tx) error
- func (m *MockManager) VerifyUniqueInputs(blkID ids.ID, inputs set.Set[ids.ID]) error
- type MockManagerMockRecorder
- func (mr *MockManagerMockRecorder) GetBlock(blkID any) *gomock.Call
- func (mr *MockManagerMockRecorder) GetState(blkID any) *gomock.Call
- func (mr *MockManagerMockRecorder) GetStatelessBlock(blkID any) *gomock.Call
- func (mr *MockManagerMockRecorder) LastAccepted() *gomock.Call
- func (mr *MockManagerMockRecorder) NewBlock(arg0 any) *gomock.Call
- func (mr *MockManagerMockRecorder) Preferred() *gomock.Call
- func (mr *MockManagerMockRecorder) SetPreference(blkID any) *gomock.Call
- func (mr *MockManagerMockRecorder) VerifyTx(tx any) *gomock.Call
- func (mr *MockManagerMockRecorder) VerifyUniqueInputs(blkID, inputs any) *gomock.Call
Constants ¶
const SyncBound = 10 * time.Second
Variables ¶
var ( ErrUnexpectedMerkleRoot = errors.New("unexpected merkle root") ErrTimestampBeyondSyncBound = errors.New("proposed timestamp is too far in the future relative to local time") ErrEmptyBlock = errors.New("block contains no transactions") ErrChildBlockEarlierThanParent = errors.New("proposed timestamp before current chain time") ErrConflictingBlockTxs = errors.New("block contains conflicting transactions") ErrIncorrectHeight = errors.New("block has incorrect height") ErrBlockNotFound = errors.New("block not found") )
var ( ErrChainNotSynced = errors.New("chain not synced") ErrConflictingParentTxs = errors.New("block contains a transaction that conflicts with a transaction in a parent block") )
Functions ¶
func BlockExecutionRoot ¶ added in v1.30.27
func BlockExecutionRoot( parentExecutionRoot ids.ID, blkTxs []*txs.Tx, postState state.Chain, height uint64, ) (ids.ID, error)
BlockExecutionRoot resolves the canonical leaf projection for a block and returns the execution_root the block must carry at [height]. It is the bridge from a stateless block to the pure xvm root computation: the builder calls it to stamp the root and the executor calls it to verify the stamped root, so the produced root and the verified root are derived by exactly one code path and can never disagree.
[parentExecutionRoot] is the parent block's MerkleRoot (the empty root for a genesis or pre-activation parent). [postState] is the post-block state (the applied state diff) the UTXO/asset families are projected from. The leaf projection is the canonical, deterministic, pure-function-of-the-block image of the post-block state the root commits to. The tx family is fully realized from the block's transactions (TxID = tx.ID(), every tx folded in block order, status = accepted); it is identical on the builder and the verifier because both observe the same ordered tx set. The UTXO family is enumerated from the post-block occupied UTXO set and projected by postBlockUTXOLeaves; the asset family is empty (see postBlockAssetLeaves for why xvm's UTXO-only executor state has no enumerable asset arena to project).
It returns an error if the post-block state cannot be enumerated or an output carries an owner model with no canonical owner_root yet — a wrong root must never be stamped or accepted silently.
func OwnerRoot ¶ added in v1.30.27
func OwnerRoot(o owners) [32]byte
OwnerRoot is the CANONICAL Go definition of the execution_root UTXO leaf's owner_root field. It is the authority the GPU state-snapshot producer MUST match (the GPU/CPU kernels treat owner_root as a host-supplied input — xvm_gpu_layout.hpp documents its intent as "keccak over sorted owner address set + threshold" but does not derive it; this is where that derivation is pinned).
owner_root = keccak256(
threshold_u32_le ‖ key_count_u32_le ‖ key[0] ‖ key[1] ‖ … ‖ key[k-1] )
where:
- threshold is the output's N-of-M spend threshold (binds the M-of-N policy, per the layout's "+ threshold");
- key_count is the number of owner keys, little-endian u32 — a length prefix so two owner sets that differ only by a key-set/threshold framing can never collide (no ambiguous concatenation);
- each key is an owner key in canonical ascending byte order: for an address-keyed output the 20-byte secp256k1 address; for a bls attestation output the committee public key. The order is the same sorted-and-unique order the output's own Verify enforces, so the preimage is deterministic and independent of the order keys happened to be listed in.
The keccak256 is Ethereum Keccak-256 (the same hash xvmroot/the GPU use for every leaf preimage), keeping owner_root in the one hash family the whole execution_root is built from. Integers are little-endian to match the kernel's absorb_u32.
Locktime is NOT folded into owner_root: the UTXOLeaf binds Locktime in its own dedicated field (matching the GPU UTXO struct, which carries locktime and owner_root separately), so binding it here too would be redundant. Threshold is bound in BOTH owner_root and the leaf's Threshold field, exactly as the GPU struct carries threshold both inside the host-computed owner_root and as a standalone field.
Types ¶
type Block ¶
Exported for testing in xvm package.
type Manager ¶
type Manager interface {
state.Versions
// Returns the ID of the most recently accepted block.
LastAccepted() ids.ID
SetPreference(blkID ids.ID)
Preferred() ids.ID
GetBlock(blkID ids.ID) (chain.Block, error)
GetStatelessBlock(blkID ids.ID) (block.Block, error)
NewBlock(block.Block) chain.Block
// VerifyTx verifies that the transaction can be issued based on the currently
// preferred state. This should *not* be used to verify transactions in a block.
VerifyTx(tx *txs.Tx) error
// VerifyUniqueInputs returns nil iff no blocks in the inclusive
// ancestry of [blkID] consume an input in [inputs].
VerifyUniqueInputs(blkID ids.ID, inputs set.Set[ids.ID]) error
}
type MockManager ¶ added in v1.1.11
type MockManager struct {
// contains filtered or unexported fields
}
MockManager is a mock of Manager interface.
func NewMockManager ¶ added in v1.1.11
func NewMockManager(ctrl *gomock.Controller) *MockManager
NewMockManager creates a new mock instance.
func (*MockManager) EXPECT ¶ added in v1.1.11
func (m *MockManager) EXPECT() *MockManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockManager) GetStatelessBlock ¶ added in v1.1.11
GetStatelessBlock mocks base method.
func (*MockManager) LastAccepted ¶ added in v1.1.11
func (m *MockManager) LastAccepted() ids.ID
LastAccepted mocks base method.
func (*MockManager) NewBlock ¶ added in v1.1.11
func (m *MockManager) NewBlock(arg0 block.Block) chain.Block
NewBlock mocks base method.
func (*MockManager) Preferred ¶ added in v1.1.11
func (m *MockManager) Preferred() ids.ID
Preferred mocks base method.
func (*MockManager) SetPreference ¶ added in v1.1.11
func (m *MockManager) SetPreference(blkID ids.ID)
SetPreference mocks base method.
func (*MockManager) VerifyTx ¶ added in v1.1.11
func (m *MockManager) VerifyTx(tx *txs.Tx) error
VerifyTx mocks base method.
func (*MockManager) VerifyUniqueInputs ¶ added in v1.1.11
VerifyUniqueInputs mocks base method.
type MockManagerMockRecorder ¶ added in v1.1.11
type MockManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockManagerMockRecorder is the mock recorder for MockManager.
func (*MockManagerMockRecorder) GetBlock ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) GetBlock(blkID any) *gomock.Call
GetBlock indicates an expected call of GetBlock.
func (*MockManagerMockRecorder) GetState ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) GetState(blkID any) *gomock.Call
GetState indicates an expected call of GetState.
func (*MockManagerMockRecorder) GetStatelessBlock ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) GetStatelessBlock(blkID any) *gomock.Call
GetStatelessBlock indicates an expected call of GetStatelessBlock.
func (*MockManagerMockRecorder) LastAccepted ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) LastAccepted() *gomock.Call
LastAccepted indicates an expected call of LastAccepted.
func (*MockManagerMockRecorder) NewBlock ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) NewBlock(arg0 any) *gomock.Call
NewBlock indicates an expected call of NewBlock.
func (*MockManagerMockRecorder) Preferred ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) Preferred() *gomock.Call
Preferred indicates an expected call of Preferred.
func (*MockManagerMockRecorder) SetPreference ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) SetPreference(blkID any) *gomock.Call
SetPreference indicates an expected call of SetPreference.
func (*MockManagerMockRecorder) VerifyTx ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) VerifyTx(tx any) *gomock.Call
VerifyTx indicates an expected call of VerifyTx.
func (*MockManagerMockRecorder) VerifyUniqueInputs ¶ added in v1.1.11
func (mr *MockManagerMockRecorder) VerifyUniqueInputs(blkID, inputs any) *gomock.Call
VerifyUniqueInputs indicates an expected call of VerifyUniqueInputs.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package executormock is a generated GoMock package.
|
Package executormock is a generated GoMock package. |