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
- func (mr *MockConfigMockRecorder) Equal(arg0 interface{}) *gomock.Call
- func (mr *MockConfigMockRecorder) IsDisabled() *gomock.Call
- func (mr *MockConfigMockRecorder) Key() *gomock.Call
- func (mr *MockConfigMockRecorder) Timestamp() *gomock.Call
- func (mr *MockConfigMockRecorder) Verify(arg0 interface{}) *gomock.Call
- type MockPredicater
- type MockPredicaterMockRecorder
- type PredicateContext
- type Predicater
- type SharedMemoryWriter
- type Upgrade
- type WarpMessageWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptContext ¶
type AcceptContext struct { SnowCtx *snow.Context Warp WarpMessageWriter }
AcceptContext defines the context passed in to a precompileconfig's Accepter
type Accepter ¶
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 coreth 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 coreth.
type ChainConfig ¶
type ChainConfig interface { // 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 ¶
type MockAccepter struct {
// contains filtered or unexported fields
}
MockAccepter is a mock of Accepter interface.
func NewMockAccepter ¶
func NewMockAccepter(ctrl *gomock.Controller) *MockAccepter
NewMockAccepter creates a new mock instance.
func (*MockAccepter) Accept ¶
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 ¶
func (m *MockAccepter) EXPECT() *MockAccepterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAccepterMockRecorder ¶
type MockAccepterMockRecorder struct {
// contains filtered or unexported fields
}
MockAccepterMockRecorder is the mock recorder for MockAccepter.
func (*MockAccepterMockRecorder) Accept ¶
func (mr *MockAccepterMockRecorder) Accept(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call
Accept indicates an expected call of Accept.
type MockChainConfig ¶
type MockChainConfig struct {
// contains filtered or unexported fields
}
MockChainConfig is a mock of ChainConfig interface.
func NewMockChainConfig ¶
func NewMockChainConfig(ctrl *gomock.Controller) *MockChainConfig
NewMockChainConfig creates a new mock instance.
func (*MockChainConfig) EXPECT ¶
func (m *MockChainConfig) EXPECT() *MockChainConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockChainConfig) IsDurango ¶
func (m *MockChainConfig) IsDurango(arg0 uint64) bool
IsDurango mocks base method.
type MockChainConfigMockRecorder ¶
type MockChainConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockChainConfigMockRecorder is the mock recorder for MockChainConfig.
func (*MockChainConfigMockRecorder) IsDurango ¶
func (mr *MockChainConfigMockRecorder) IsDurango(arg0 interface{}) *gomock.Call
IsDUpgrade indicates an expected call of IsDurango.
type MockConfig ¶
type MockConfig struct {
// contains filtered or unexported fields
}
MockConfig is a mock of Config interface.
func NewMockConfig ¶
func NewMockConfig(ctrl *gomock.Controller) *MockConfig
NewMockConfig creates a new mock instance.
func (*MockConfig) EXPECT ¶
func (m *MockConfig) EXPECT() *MockConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConfig) IsDisabled ¶
func (m *MockConfig) IsDisabled() bool
IsDisabled mocks base method.
func (*MockConfig) Timestamp ¶
func (m *MockConfig) Timestamp() *uint64
Timestamp mocks base method.
func (*MockConfig) Verify ¶
func (m *MockConfig) Verify(arg0 ChainConfig) error
Verify mocks base method.
type MockConfigMockRecorder ¶
type MockConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockConfigMockRecorder is the mock recorder for MockConfig.
func (*MockConfigMockRecorder) Equal ¶
func (mr *MockConfigMockRecorder) Equal(arg0 interface{}) *gomock.Call
Equal indicates an expected call of Equal.
func (*MockConfigMockRecorder) IsDisabled ¶
func (mr *MockConfigMockRecorder) IsDisabled() *gomock.Call
IsDisabled indicates an expected call of IsDisabled.
func (*MockConfigMockRecorder) Key ¶
func (mr *MockConfigMockRecorder) Key() *gomock.Call
Key indicates an expected call of Key.
func (*MockConfigMockRecorder) Timestamp ¶
func (mr *MockConfigMockRecorder) Timestamp() *gomock.Call
Timestamp indicates an expected call of Timestamp.
func (*MockConfigMockRecorder) Verify ¶
func (mr *MockConfigMockRecorder) Verify(arg0 interface{}) *gomock.Call
Verify indicates an expected call of Verify.
type MockPredicater ¶
type MockPredicater struct {
// contains filtered or unexported fields
}
MockPredicater is a mock of Predicater interface.
func NewMockPredicater ¶
func NewMockPredicater(ctrl *gomock.Controller) *MockPredicater
NewMockPredicater creates a new mock instance.
func (*MockPredicater) EXPECT ¶
func (m *MockPredicater) EXPECT() *MockPredicaterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPredicater) PredicateGas ¶
func (m *MockPredicater) PredicateGas(arg0 []byte) (uint64, error)
PredicateGas mocks base method.
func (*MockPredicater) VerifyPredicate ¶
func (m *MockPredicater) VerifyPredicate(arg0 *PredicateContext, arg1 []byte) error
VerifyPredicate mocks base method.
type MockPredicaterMockRecorder ¶
type MockPredicaterMockRecorder struct {
// contains filtered or unexported fields
}
MockPredicaterMockRecorder is the mock recorder for MockPredicater.
func (*MockPredicaterMockRecorder) PredicateGas ¶
func (mr *MockPredicaterMockRecorder) PredicateGas(arg0 interface{}) *gomock.Call
PredicateGas indicates an expected call of PredicateGas.
func (*MockPredicaterMockRecorder) VerifyPredicate ¶
func (mr *MockPredicaterMockRecorder) VerifyPredicate(arg0, arg1 interface{}) *gomock.Call
VerifyPredicate indicates an expected call of VerifyPredicate.
type PredicateContext ¶
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 ¶
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 SharedMemoryWriter ¶
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 *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 ¶
type WarpMessageWriter interface {
AddMessage(unsignedMessage *warp.UnsignedMessage) error
}