precompileconfig

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0, LGPL-3.0 Imports: 3 Imported by: 3

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 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 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

func (u *Upgrade) Equal(other *Upgrade) bool

Equal returns true iff [other] has the same blockTimestamp and has the same on value for the Disable flag.

func (*Upgrade) IsDisabled

func (u *Upgrade) IsDisabled() bool

IsDisabled returns true if the network upgrade deactivates the precompile.

func (*Upgrade) Timestamp

func (u *Upgrade) Timestamp() *big.Int

Timestamp returns the timestamp this network upgrade goes into effect.

Jump to

Keyboard shortcuts

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