devkeys

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const TestMnemonic = "test test test test test test test test test test test junk"

Variables

This section is empty.

Functions

func ChainOperatorKeys

func ChainOperatorKeys(chainID *big.Int) func(ChainOperatorRole) ChainOperatorKey

ChainOperatorKeys is a helper method to not repeat chainID on every operator role

func ChainUserKeys

func ChainUserKeys(chainID *big.Int) func(index uint64) ChainUserKey

ChainUserKeys is a helper method to not repeat chainID for every user key

func SuperchainOperatorKeys

func SuperchainOperatorKeys(chainID *big.Int) func(role SuperchainOperatorRole) SuperchainOperatorKey

SuperchainOperatorKeys is a helper method to not repeat chainID on every operator role

Types

type Addresses

type Addresses interface {
	// Address produces an address for the given key
	Address(key Key) (common.Address, error)
}

Addresses selects an address based on a key. This interface is preferred in tools that do not directly rely on secret-key material.

type ChainOperatorKey

type ChainOperatorKey struct {
	ChainID *big.Int
	Role    ChainOperatorRole
}

ChainOperatorKey is an account specific to an OperationRole of a given OP-Stack chain.

func (ChainOperatorKey) HDPath

func (k ChainOperatorKey) HDPath() string

func (ChainOperatorKey) String

func (k ChainOperatorKey) String() string

type ChainOperatorRole

type ChainOperatorRole uint64

ChainOperatorRole identifies an account for a specific OP-Stack chain operator role.

const (
	// DeployerRole is the deployer of contracts for an OP-Stack chain
	DeployerRole ChainOperatorRole = 0
	// ProposerRole is the key used by op-proposer
	ProposerRole ChainOperatorRole = 1
	// BatcherRole is the key used by op-batcher
	BatcherRole ChainOperatorRole = 2
	// SequencerP2PRole is the key used to publish sequenced L2 blocks
	SequencerP2PRole ChainOperatorRole = 3
	// ChallengerRole is the key used by op-challenger
	ChallengerRole ChainOperatorRole = 4
	// L2ProxyAdminOwnerRole is the key that controls the ProxyAdmin predeploy in L2
	L2ProxyAdminOwnerRole ChainOperatorRole = 5
	// L1ProxyAdminOwnerRole is the key that owns the ProxyAdmin on the L1 side of the deployment.
	// This can be the ProxyAdmin of a L2 chain deployment, or a superchain deployment, depending on the domain.
	L1ProxyAdminOwnerRole ChainOperatorRole = 6
	// BaseFeeVaultRecipientRole is the key that receives from the BaseFeeVault predeploy
	BaseFeeVaultRecipientRole ChainOperatorRole = 7
	// L1FeeVaultRecipientRole is the key that receives from the L1FeeVault predeploy
	L1FeeVaultRecipientRole ChainOperatorRole = 8
	// SequencerFeeVaultRecipientRole is the key that receives form the SequencerFeeVault predeploy
	SequencerFeeVaultRecipientRole ChainOperatorRole = 9
	// SystemConfigOwner is the key that can make SystemConfig changes.
	SystemConfigOwner ChainOperatorRole = 10
)

func (ChainOperatorRole) Key

func (role ChainOperatorRole) Key(chainID *big.Int) Key

func (*ChainOperatorRole) MarshalText added in v1.9.5

func (role *ChainOperatorRole) MarshalText() ([]byte, error)

func (ChainOperatorRole) String

func (role ChainOperatorRole) String() string

func (*ChainOperatorRole) UnmarshalText added in v1.9.5

func (role *ChainOperatorRole) UnmarshalText(data []byte) error

type ChainUserKey

type ChainUserKey struct {
	ChainID *big.Int
	Index   uint64
}

ChainUserKey is a user-key, but purpose-specific to a single chain. ChainID == 0 results in deriving the same key as a regular UserKey for any chain.

func (ChainUserKey) HDPath

func (k ChainUserKey) HDPath() string

func (ChainUserKey) String

func (k ChainUserKey) String() string

type Key

type Key interface {
	// HDPath produces the hierarchical derivation path to (re)create this key.
	HDPath() string
	// String describes the role of the key
	String() string
}

Key identifies an account, and produces an HD-Path to derive the secret-key from.

We organize the dev keys with a mnemonic key-path structure as following: BIP-44: `m / purpose' / coin_type' / account' / change / address_index` purpose = standard secp256k1 usage (Eth2 BLS keys use different purpose data). coin_type = chain type, set to 60' for ETH. See SLIP-0044. account = for different identities, used here to separate domains:

domain 0: users
domain 1: superchain operations
domain 2: chain operations

change = to separate external and internal addresses.

Used here for chain ID, may be 0 for user accounts (any-chain addresses).

address_index = used here to separate roles. The `'` char signifies BIP-32 hardened derivation.

See: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki https://github.com/satoshilabs/slips/blob/master/slip-0044.md https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

type Keys

type Keys interface {
	Secrets
	Addresses
}

Keys is a joint interface of Secrets and Addresses

type MnemonicDevKeys

type MnemonicDevKeys struct {
	// contains filtered or unexported fields
}

func NewMnemonicDevKeys

func NewMnemonicDevKeys(mnemonic string) (*MnemonicDevKeys, error)

func (*MnemonicDevKeys) Address

func (d *MnemonicDevKeys) Address(key Key) (common.Address, error)

func (*MnemonicDevKeys) Secret

func (d *MnemonicDevKeys) Secret(key Key) (*ecdsa.PrivateKey, error)

type Role added in v1.9.3

type Role interface {
	Key(chainID *big.Int) Key
}

type Secrets

type Secrets interface {
	Secret(key Key) (*ecdsa.PrivateKey, error)
}

Secrets selects a secret-key based on a key. This is meant for dev-purposes only. Secret keys should not directly be exposed to live production services.

type SuperchainOperatorKey

type SuperchainOperatorKey struct {
	ChainID *big.Int
	Role    SuperchainOperatorRole
}

SuperchainOperatorKey is an account specific to an OperationRole of a given OP-Stack chain.

func (SuperchainOperatorKey) HDPath

func (k SuperchainOperatorKey) HDPath() string

func (SuperchainOperatorKey) String

func (k SuperchainOperatorKey) String() string

type SuperchainOperatorRole

type SuperchainOperatorRole uint64

SuperchainOperatorRole identifies an account used in the operations of superchain contracts

const (
	// SuperchainDeployerKey is the deployer of the superchain contracts.
	SuperchainDeployerKey SuperchainOperatorRole = 0
	// SuperchainProxyAdminOwner is the key that owns the superchain ProxyAdmin
	SuperchainProxyAdminOwner SuperchainOperatorRole = 1
	// SuperchainConfigGuardianKey is the Guardian of the SuperchainConfig.
	SuperchainConfigGuardianKey SuperchainOperatorRole = 2
	// SuperchainProtocolVersionsOwner is the key that can make ProtocolVersions changes.
	SuperchainProtocolVersionsOwner SuperchainOperatorRole = 3
	// DependencySetManagerKey is the key used to manage the dependency set of a superchain.
	DependencySetManagerKey SuperchainOperatorRole = 4
)

func (SuperchainOperatorRole) Key added in v1.9.3

func (role SuperchainOperatorRole) Key(chainID *big.Int) Key

func (*SuperchainOperatorRole) MarshalText added in v1.9.5

func (role *SuperchainOperatorRole) MarshalText() ([]byte, error)

func (SuperchainOperatorRole) String

func (role SuperchainOperatorRole) String() string

func (*SuperchainOperatorRole) UnmarshalText added in v1.9.5

func (role *SuperchainOperatorRole) UnmarshalText(data []byte) error

type UserKey

type UserKey uint64

UserKey identifies an account for any user, by index, not specific to any chain.

const (
	DefaultKey UserKey = 0
)

func (UserKey) HDPath

func (k UserKey) HDPath() string

func (UserKey) String

func (k UserKey) String() string

Jump to

Keyboard shortcuts

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