system

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Canonical system contract names registered in Registry.
	AddressBookName = "AddressBook"
	GovParamName    = "GovParam"
	Kip103Name      = "TreasuryRebalance"
	Kip113Name      = "KIP113"

	AllContractNames = []string{
		AddressBookName,
		GovParamName,
		Kip103Name,
		Kip113Name,
	}

	// This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1 used in the
	// EIP-1967 proxy contract. See https://eips.ethereum.org/EIPS/eip-1967#implementation-slot
	ImplementationSlot = common.Hex2Bytes("360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")

	// Some system contracts are allocated at special addresses.
	AddressBookAddr = common.HexToAddress("0x0000000000000000000000000000000000000400") // TODO: replace contracts/reward/contract/utils.go
	RegistryAddr    = common.HexToAddress("0x0000000000000000000000000000000000000401")
	// The following addresses are only used for testing.
	Kip113ProxyAddrMock = common.HexToAddress("0x0000000000000000000000000000000000000402")
	Kip113LogicAddrMock = common.HexToAddress("0x0000000000000000000000000000000000000403")

	// System contract binaries to be injected at hardfork or used in testing.
	RegistryCode     = hexutil.MustDecode("0x" + contracts.RegistryBinRuntime)
	RegistryMockCode = hexutil.MustDecode("0x" + contracts.RegistryMockBinRuntime)
	Kip113Code       = hexutil.MustDecode("0x" + contracts.KIP113BinRuntime)
	Kip113MockCode   = hexutil.MustDecode("0x" + contracts.KIP113MockBinRuntime)

	ERC1967ProxyCode = hexutil.MustDecode("0x" + contracts.ERC1967ProxyBinRuntime)

	// Errors
	ErrRegistryNotInstalled = errors.New("Registry contract not installed")
	ErrKip113BadResult      = errors.New("KIP113 call returned bad data")
	ErrKip113BadPop         = errors.New("KIP113 PoP verification failed")
)

Functions

func AllocKip113Logic

func AllocKip113Logic() map[common.Hash]common.Hash

func AllocKip113Proxy

func AllocKip113Proxy(init AllocKip113Init) map[common.Hash]common.Hash

func AllocProxy

func AllocProxy(impl common.Address) map[common.Hash]common.Hash

func AllocRegistry

func AllocRegistry(init *params.RegistryConfig) map[common.Hash]common.Hash

Create storage state from the given initial values. The storage slots are calculated according to the solidity layout rule. https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html

func InstallRegistry

func InstallRegistry(state *state.StateDB, init *params.RegistryConfig) error

func MergeGenesisAlloc

func MergeGenesisAlloc(aa ...blockchain.GenesisAlloc) blockchain.GenesisAlloc

func MergeStorage

func MergeStorage(ss ...map[common.Hash]common.Hash) map[common.Hash]common.Hash

MergeStorage merges multiple storage maps into one.

func ReadActiveAddressFromRegistry

func ReadActiveAddressFromRegistry(backend bind.ContractCaller, name string, num *big.Int) (common.Address, error)

Types

type AllocKip113Init

type AllocKip113Init struct {
	Infos BlsPublicKeyInfos
	Owner common.Address
}

type BlsPublicKeyInfo

type BlsPublicKeyInfo struct {
	PublicKey []byte
	Pop       []byte
	VerifyErr error // Nil if valid. Must check before use.
}

type BlsPublicKeyInfos

type BlsPublicKeyInfos map[common.Address]BlsPublicKeyInfo

func ReadKip113All

func ReadKip113All(backend bind.ContractCaller, contractAddr common.Address, num *big.Int) (BlsPublicKeyInfos, error)

func (BlsPublicKeyInfos) String

func (infos BlsPublicKeyInfos) String() string

Jump to

Keyboard shortcuts

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