Documentation ¶
Overview ¶
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
TODO: replace with gomock
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNoopStatefulPrecompileConfig ¶
func NewNoopStatefulPrecompileConfig() *noopStatefulPrecompileConfig
Types ¶
type AcceptContext ¶ added in v0.5.0
type AcceptContext struct { SnowCtx *snow.Context Warp WarpMessageWriter }
AcceptContext defines the context passed in to a precompileconfig's Accepter
type Accepter ¶ added in v0.5.0
type Accepter interface {
Accept(acceptCtx *AcceptContext, txHash common.Hash, logIndex int, topics []common.Hash, logData []byte) error
}
Accepter is an optional interface for StatefulPrecompiledContracts to implement. If implemented, Accept will be called for every log with the address of the precompile when the block is accepted. WARNING: If you are implementing a custom precompile, beware that subnet-evm will not maintain backwards compatibility of this interface and your code should not rely on this. Designed for use only by precompiles that ship with subnet-evm.
type Config ¶
type Config interface { // Key returns the unique key for the stateful precompile. Key() string // Timestamp returns the timestamp at which this stateful precompile should be enabled. // 1) 0 indicates that the precompile should be enabled from genesis. // 2) n indicates that the precompile should be enabled in the first block with timestamp >= [n]. // 3) nil indicates that the precompile is never enabled. Timestamp() *big.Int // IsDisabled returns true if this network upgrade should disable the precompile. IsDisabled() bool // Equal returns true if the provided argument configures the same precompile with the same parameters. Equal(Config) bool // Verify is called on startup and an error is treated as fatal. Configure can assume the Config has passed verification. Verify() error }
StatefulPrecompileConfig defines the interface for a stateful precompile to be enabled via a network upgrade.
type PrecompilePredicateContext ¶ added in v0.5.0
PrecompilePredicateContext is the context passed in to the PrecompilePredicater interface.
type PrecompilePredicater ¶ added in v0.5.0
type PrecompilePredicater interface {
VerifyPredicate(predicateContext *PrecompilePredicateContext, storageSlots []byte) error
}
PrecompilePredicater is an optional interface for StatefulPrecompileContracts to implement. If implemented, the predicate will be enforced on every transaction in a block, prior to the block's execution. If VerifyPredicate returns an error, the block will fail verification with no further processing. WARNING: If you are implementing a custom precompile, beware that subnet-evm will not maintain backwards compatibility of this interface and your code should not rely on this. Designed for use only by precompiles that ship with subnet-evm.
type ProposerPredicateContext ¶ added in v0.5.0
type ProposerPredicateContext struct { PrecompilePredicateContext // ProposerVMBlockCtx defines the ProposerVM context the predicate is verified within ProposerVMBlockCtx *block.Context }
ProposerPredicateContext is the context passed in to the ProposerPredicater interface to verify a precompile predicate within a specific ProposerVM wrapper.
type ProposerPredicater ¶ added in v0.5.0
type ProposerPredicater interface {
VerifyPredicate(proposerPredicateContext *ProposerPredicateContext, storageSlots []byte) error
}
ProposerPredicater is an optional interface for StatefulPrecompiledContracts to implement. If implemented, the predicate will be enforced on every transaction in a block, prior to the block's execution. If VerifyPredicate returns an error, the block will fail verification with no further processing. Note: ProposerVMBlockCtx is guaranteed to be non-nil. Precompiles should use ProposerPredicater instead of PrecompilePredicater iff their execution depends on the ProposerVM Block Context. WARNING: If you are implementing a custom precompile, beware that subnet-evm will not maintain backwards compatibility of this interface and your code should not rely on this. Designed for use only by precompiles that ship with subnet-evm.
type SharedMemoryWriter ¶ added in v0.5.0
type SharedMemoryWriter interface {
}SharedMemoryWriter defines an interface to allow a precompile's Accepter to write operations into shared memory to be committed atomically on block accept.
type Upgrade ¶
type Upgrade struct { BlockTimestamp *big.Int `json:"blockTimestamp"` Disable bool `json:"disable,omitempty"` }
Upgrade contains the timestamp for the upgrade along with a boolean [Disable]. If [Disable] is set, the upgrade deactivates the precompile and clears its storage.
func (*Upgrade) Equal ¶
Equal returns true iff [other] has the same blockTimestamp and has the same on value for the Disable flag.
func (*Upgrade) IsDisabled ¶
IsDisabled returns true if the network upgrade deactivates the precompile.
type WarpMessageWriter ¶ added in v0.5.0
type WarpMessageWriter interface {
AddMessage(unsignedMessage *warp.UnsignedMessage) error
}