Documentation ¶
Overview ¶
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
Package precompileconfig is a generated GoMock package.
Index ¶
- type AcceptContext
- type Accepter
- type ChainConfig
- type Config
- type MockAccepter
- type MockAccepterMockRecorder
- type MockChainConfig
- type MockChainConfigMockRecorder
- type MockConfig
- type MockConfigMockRecorder
- type MockPredicater
- type MockPredicaterMockRecorder
- type PredicateContext
- type Predicater
- type Upgrade
- type WarpMessageWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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, blockHash common.Hash, blockNumber uint64, 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 ChainConfig ¶ added in v0.5.4
type ChainConfig interface { // GetFeeConfig returns the original FeeConfig that was set in the genesis. GetFeeConfig() commontype.FeeConfig // AllowedFeeRecipients returns true if fee recipients are allowed in the genesis. AllowedFeeRecipients() bool // IsDurango returns true if the time is after Durango. IsDurango(time uint64) bool }
ChainContext defines an interface that provides information to a stateful precompile about the chain configuration. The precompile can access this information to initialize its state.
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() *uint64 // 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(ChainConfig) error }
StatefulPrecompileConfig defines the interface for a stateful precompile to be enabled via a network upgrade.
type MockAccepter ¶ added in v0.5.3
type MockAccepter struct {
// contains filtered or unexported fields
}
MockAccepter is a mock of Accepter interface.
func NewMockAccepter ¶ added in v0.5.3
func NewMockAccepter(ctrl *gomock.Controller) *MockAccepter
NewMockAccepter creates a new mock instance.
func (*MockAccepter) Accept ¶ added in v0.5.3
func (m *MockAccepter) Accept(arg0 *AcceptContext, arg1 common.Hash, arg2 uint64, arg3 common.Hash, arg4 int, arg5 []common.Hash, arg6 []byte) error
Accept mocks base method.
func (*MockAccepter) EXPECT ¶ added in v0.5.3
func (m *MockAccepter) EXPECT() *MockAccepterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAccepterMockRecorder ¶ added in v0.5.3
type MockAccepterMockRecorder struct {
// contains filtered or unexported fields
}
MockAccepterMockRecorder is the mock recorder for MockAccepter.
type MockChainConfig ¶ added in v0.5.4
type MockChainConfig struct {
// contains filtered or unexported fields
}
MockChainConfig is a mock of ChainConfig interface.
func NewMockChainConfig ¶ added in v0.5.4
func NewMockChainConfig(ctrl *gomock.Controller) *MockChainConfig
NewMockChainConfig creates a new mock instance.
func (*MockChainConfig) AllowedFeeRecipients ¶ added in v0.5.4
func (m *MockChainConfig) AllowedFeeRecipients() bool
AllowedFeeRecipients mocks base method.
func (*MockChainConfig) EXPECT ¶ added in v0.5.4
func (m *MockChainConfig) EXPECT() *MockChainConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockChainConfig) GetFeeConfig ¶ added in v0.5.4
func (m *MockChainConfig) GetFeeConfig() commontype.FeeConfig
GetFeeConfig mocks base method.
func (*MockChainConfig) IsDurango ¶ added in v0.5.11
func (m *MockChainConfig) IsDurango(arg0 uint64) bool
IsDurango mocks base method.
type MockChainConfigMockRecorder ¶ added in v0.5.4
type MockChainConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockChainConfigMockRecorder is the mock recorder for MockChainConfig.
func (*MockChainConfigMockRecorder) AllowedFeeRecipients ¶ added in v0.5.4
func (mr *MockChainConfigMockRecorder) AllowedFeeRecipients() *gomock.Call
AllowedFeeRecipients indicates an expected call of AllowedFeeRecipients.
func (*MockChainConfigMockRecorder) GetFeeConfig ¶ added in v0.5.4
func (mr *MockChainConfigMockRecorder) GetFeeConfig() *gomock.Call
GetFeeConfig indicates an expected call of GetFeeConfig.
type MockConfig ¶ added in v0.5.4
type MockConfig struct {
// contains filtered or unexported fields
}
MockConfig is a mock of Config interface.
func NewMockConfig ¶ added in v0.5.4
func NewMockConfig(ctrl *gomock.Controller) *MockConfig
NewMockConfig creates a new mock instance.
func (*MockConfig) EXPECT ¶ added in v0.5.4
func (m *MockConfig) EXPECT() *MockConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConfig) Equal ¶ added in v0.5.4
func (m *MockConfig) Equal(arg0 Config) bool
Equal mocks base method.
func (*MockConfig) IsDisabled ¶ added in v0.5.4
func (m *MockConfig) IsDisabled() bool
IsDisabled mocks base method.
func (*MockConfig) Timestamp ¶ added in v0.5.4
func (m *MockConfig) Timestamp() *uint64
Timestamp mocks base method.
func (*MockConfig) Verify ¶ added in v0.5.4
func (m *MockConfig) Verify(arg0 ChainConfig) error
Verify mocks base method.
type MockConfigMockRecorder ¶ added in v0.5.4
type MockConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockConfigMockRecorder is the mock recorder for MockConfig.
func (*MockConfigMockRecorder) Equal ¶ added in v0.5.4
func (mr *MockConfigMockRecorder) Equal(arg0 any) *gomock.Call
Equal indicates an expected call of Equal.
func (*MockConfigMockRecorder) IsDisabled ¶ added in v0.5.4
func (mr *MockConfigMockRecorder) IsDisabled() *gomock.Call
IsDisabled indicates an expected call of IsDisabled.
func (*MockConfigMockRecorder) Key ¶ added in v0.5.4
func (mr *MockConfigMockRecorder) Key() *gomock.Call
Key indicates an expected call of Key.
func (*MockConfigMockRecorder) Timestamp ¶ added in v0.5.4
func (mr *MockConfigMockRecorder) Timestamp() *gomock.Call
Timestamp indicates an expected call of Timestamp.
type MockPredicater ¶ added in v0.5.6
type MockPredicater struct {
// contains filtered or unexported fields
}
MockPredicater is a mock of Predicater interface.
func NewMockPredicater ¶ added in v0.5.6
func NewMockPredicater(ctrl *gomock.Controller) *MockPredicater
NewMockPredicater creates a new mock instance.
func (*MockPredicater) EXPECT ¶ added in v0.5.6
func (m *MockPredicater) EXPECT() *MockPredicaterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPredicater) PredicateGas ¶ added in v0.5.6
func (m *MockPredicater) PredicateGas(arg0 []byte) (uint64, error)
PredicateGas mocks base method.
func (*MockPredicater) VerifyPredicate ¶ added in v0.5.6
func (m *MockPredicater) VerifyPredicate(arg0 *PredicateContext, arg1 []byte) error
VerifyPredicate mocks base method.
type MockPredicaterMockRecorder ¶ added in v0.5.6
type MockPredicaterMockRecorder struct {
// contains filtered or unexported fields
}
MockPredicaterMockRecorder is the mock recorder for MockPredicater.
func (*MockPredicaterMockRecorder) PredicateGas ¶ added in v0.5.6
func (mr *MockPredicaterMockRecorder) PredicateGas(arg0 any) *gomock.Call
PredicateGas indicates an expected call of PredicateGas.
func (*MockPredicaterMockRecorder) VerifyPredicate ¶ added in v0.5.6
func (mr *MockPredicaterMockRecorder) VerifyPredicate(arg0, arg1 any) *gomock.Call
VerifyPredicate indicates an expected call of VerifyPredicate.
type PredicateContext ¶ added in v0.5.4
type PredicateContext struct { SnowCtx *snow.Context // ProposerVMBlockCtx defines the ProposerVM context the predicate is verified within ProposerVMBlockCtx *block.Context }
PredicateContext is the context passed in to the Predicater interface to verify a precompile predicate within a specific ProposerVM wrapper.
type Predicater ¶ added in v0.5.4
type Predicater interface { PredicateGas(predicateBytes []byte) (uint64, error) VerifyPredicate(predicateContext *PredicateContext, predicateBytes []byte) error }
Predicater is an optional interface for StatefulPrecompileContracts to implement. If implemented, the predicate will be called for each predicate included in the access list of a transaction. PredicateGas will be called while calculating the IntrinsicGas of a transaction causing it to be dropped if the total gas goes above the tx gas limit. VerifyPredicate is used to populate a bit set of predicates verified prior to block execution, which can be accessed via the StateDB during execution. The bitset is stored in the block, so that historical blocks can be re-verified without calling VerifyPredicate.
type Upgrade ¶
type Upgrade struct { BlockTimestamp *uint64 `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
}