shutter

package
v1.9.7-0...-38a7985 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: LGPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolVersion     = "/shutter/0.1.0"
	DecryptionKeysTopic = "decryptionKeys"
)

Variables

View Source
var (
	ErrTooManyIdentityPreimages      = errors.New("too many identity preimages")
	ErrIncorrectIdentityPreimageSize = errors.New("incorrect identity preimage size")
)
View Source
var (
	ErrInstanceIdMismatch       = errors.New("instance id mismatch")
	ErrMissingGnosisExtraData   = errors.New("missing gnosis extra data")
	ErrSlotTooLarge             = errors.New("slot too large")
	ErrSlotInThePast            = errors.New("slot in the past")
	ErrSlotInTheFuture          = errors.New("slot in the future")
	ErrTxnPointerTooLarge       = errors.New("txn pointer too large")
	ErrEonTooLarge              = errors.New("eon too large")
	ErrCurrentEonUnavailable    = errors.New("current eon unavailable")
	ErrEonInThePast             = errors.New("eon in the past")
	ErrEonInTheFuture           = errors.New("eon in the future")
	ErrEonNotInRecent           = errors.New("eon not in recent")
	ErrEmptyKeys                = errors.New("empty keys")
	ErrTooManyKeys              = errors.New("too many keys")
	ErrIgnoreMsg                = errors.New("ignoring msg")
	ErrInvalidSignature         = errors.New("invalid signature")
	ErrInvalidKey               = errors.New("invalid key")
	ErrSignersThresholdMismatch = errors.New("signers threshold mismatch")
	ErrDuplicateSigners         = errors.New("duplicate signers")
	ErrUnorderedSigners         = errors.New("unordered signers")
	ErrSignaturesLenMismatch    = errors.New("signatures len mismatch")
)
View Source
var ErrInvalidKeyperIndex = errors.New("invalid keyper index")
View Source
var ErrTimestampBeforeGenesis = errors.New("timestamp before genesis")

Functions

func EncryptedTxnSubmissionLess

func EncryptedTxnSubmissionLess(a, b EncryptedTxnSubmission) bool

func EncryptedTxnSubmissionsAreConsecutive

func EncryptedTxnSubmissionsAreConsecutive(a, b EncryptedTxnSubmission) bool

func EonLess

func EonLess(a, b Eon) bool

func EpochSecretKeyFromBytes

func EpochSecretKeyFromBytes(b []byte) (*crypto.EpochSecretKey, error)

func NewDecryptionKeysExtendedValidator

func NewDecryptionKeysExtendedValidator(logger log.Logger, config Config, sc SlotCalculator, et EonTracker) pubsub.ValidatorEx

Types

type BeaconChainSlotCalculator

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

func NewBeaconChainSlotCalculator

func NewBeaconChainSlotCalculator(genesisTimestamp uint64, secondsPerSlot uint64) BeaconChainSlotCalculator

func (BeaconChainSlotCalculator) CalcCurrentSlot

func (sc BeaconChainSlotCalculator) CalcCurrentSlot() uint64

func (BeaconChainSlotCalculator) CalcSlot

func (sc BeaconChainSlotCalculator) CalcSlot(timestamp uint64) (uint64, error)

func (BeaconChainSlotCalculator) CalcSlotAge

func (sc BeaconChainSlotCalculator) CalcSlotAge(slot uint64) time.Duration

func (BeaconChainSlotCalculator) SecondsPerSlot

func (sc BeaconChainSlotCalculator) SecondsPerSlot() uint64

type BlockEvent

type BlockEvent struct {
	LatestBlockNum  uint64
	LatestBlockTime uint64
	BlocksBatchLen  uint64
	Unwind          bool
}

type BlockListener

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

func NewBlockListener

func NewBlockListener(logger log.Logger, stateChangesClient stateChangesClient) BlockListener

func (BlockListener) RegisterObserver

func (bl BlockListener) RegisterObserver(o event.Observer[BlockEvent]) event.UnregisterFunc

func (BlockListener) Run

func (bl BlockListener) Run(ctx context.Context) error

type BlockTracker

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

func NewBlockTracker

func NewBlockTracker(logger log.Logger, blockListener BlockListener) BlockTracker

func (BlockTracker) Run

func (bt BlockTracker) Run(ctx context.Context) error

func (BlockTracker) Wait

func (bt BlockTracker) Wait(ctx context.Context, blockNum uint64) error

type Config

type Config struct {
	P2pConfig
	Enabled                          bool
	InstanceId                       uint64
	ChainId                          *uint256.Int
	BeaconChainGenesisTimestamp      uint64
	SecondsPerSlot                   uint64
	SequencerContractAddress         string
	ValidatorRegistryContractAddress string
	KeyBroadcastContractAddress      string
	KeyperSetManagerContractAddress  string
	MaxNumKeysPerMessage             uint64
	ReorgDepthAwareness              uint64
	MaxPooledEncryptedTxns           int
	EncryptedGasLimit                uint64
	EncryptedTxnsLookBackDistance    uint64
	MaxDecryptionKeysDelay           time.Duration
}

func ConfigByChainName

func ConfigByChainName(chainName string) Config

type DecryptedTxnsPool

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

func NewDecryptedTxnsPool

func NewDecryptedTxnsPool() *DecryptedTxnsPool

func (*DecryptedTxnsPool) AddDecryptedTxns

func (p *DecryptedTxnsPool) AddDecryptedTxns(mark DecryptionMark, txnBatch TxnBatch)

func (*DecryptedTxnsPool) DecryptedTxns

func (p *DecryptedTxnsPool) DecryptedTxns(mark DecryptionMark) (TxnBatch, bool)

func (*DecryptedTxnsPool) DeleteDecryptedTxnsUpToSlot

func (p *DecryptedTxnsPool) DeleteDecryptedTxnsUpToSlot(slot uint64) uint64

func (*DecryptedTxnsPool) Wait

type DecryptionKeysListener

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

func NewDecryptionKeysListener

func NewDecryptionKeysListener(logger log.Logger, config Config, validator pubsub.ValidatorEx) DecryptionKeysListener

func (DecryptionKeysListener) RegisterObserver

func (DecryptionKeysListener) Run

type DecryptionKeysProcessor

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

func NewDecryptionKeysProcessor

func NewDecryptionKeysProcessor(
	logger log.Logger,
	config Config,
	encryptedTxnsPool *EncryptedTxnsPool,
	decryptedTxnsPool *DecryptedTxnsPool,
	blockListener BlockListener,
	slotCalculator SlotCalculator,
) DecryptionKeysProcessor

func (DecryptionKeysProcessor) Enqueue

func (dkp DecryptionKeysProcessor) Enqueue(msg *proto.DecryptionKeys)

func (DecryptionKeysProcessor) Run

type DecryptionKeysSignatureData

type DecryptionKeysSignatureData struct {
	InstanceId        uint64
	Eon               EonIndex
	Slot              uint64
	TxnPointer        uint64
	IdentityPreimages *solid.ListSSZ[*IdentityPreimage]
}

func (DecryptionKeysSignatureData) HashSSZ

func (d DecryptionKeysSignatureData) HashSSZ() ([32]byte, error)

func (DecryptionKeysSignatureData) Sign

func (DecryptionKeysSignatureData) Validate

func (d DecryptionKeysSignatureData) Validate() error

func (DecryptionKeysSignatureData) Verify

func (d DecryptionKeysSignatureData) Verify(signature []byte, address libcommon.Address) (bool, error)

type DecryptionKeysValidator

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

func NewDecryptionKeysValidator

func NewDecryptionKeysValidator(config Config, sc SlotCalculator, et EonTracker) DecryptionKeysValidator

func (DecryptionKeysValidator) Validate

type DecryptionMark

type DecryptionMark struct {
	Slot uint64
	Eon  EonIndex
}

type EncryptedTxnSubmission

type EncryptedTxnSubmission struct {
	EonIndex             EonIndex
	TxnIndex             TxnIndex
	IdentityPrefix       [32]byte
	Sender               libcommon.Address
	EncryptedTransaction []byte
	GasLimit             *big.Int
	BlockNum             uint64
}

EncryptedTxnSubmission mimics contracts.SequencerTransactionSubmitted but without the "Raw" attribute to save memory.

func (EncryptedTxnSubmission) IdentityPreimageBytes

func (ets EncryptedTxnSubmission) IdentityPreimageBytes() []byte

type EncryptedTxnsPool

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

func NewEncryptedTxnsPool

func NewEncryptedTxnsPool(logger log.Logger, config Config, cb bind.ContractBackend, bl BlockListener) *EncryptedTxnsPool

func (*EncryptedTxnsPool) DeleteUpTo

func (etp *EncryptedTxnsPool) DeleteUpTo(eon EonIndex, to TxnIndex)

func (*EncryptedTxnsPool) Run

func (etp *EncryptedTxnsPool) Run(ctx context.Context) error

func (*EncryptedTxnsPool) Txns

func (etp *EncryptedTxnsPool) Txns(eon EonIndex, from, to TxnIndex, gasLimit uint64) ([]EncryptedTxnSubmission, error)

type Eon

type Eon struct {
	Index           EonIndex
	ActivationBlock uint64
	Key             []byte
	Threshold       uint64
	Members         []libcommon.Address
}

func (Eon) KeyperAt

func (e Eon) KeyperAt(index uint64) (libcommon.Address, error)

func (Eon) PublicKey

func (e Eon) PublicKey() (*crypto.EonPublicKey, error)

type EonIndex

type EonIndex uint64

type EonTracker

type EonTracker interface {
	Run(ctx context.Context) error
	CurrentEon() (Eon, bool)
	RecentEon(index EonIndex) (Eon, bool)
	EonByBlockNum(blockNum uint64) (Eon, bool)
}

type IdentityPreimage

type IdentityPreimage [identityPreimageSize]byte

func IdentityPreimageFromBytes

func IdentityPreimageFromBytes(b []byte) (*IdentityPreimage, error)

func (*IdentityPreimage) Clone

func (ip *IdentityPreimage) Clone() clonable.Clonable

func (*IdentityPreimage) DecodeSSZ

func (ip *IdentityPreimage) DecodeSSZ(buf []byte, _ int) error

func (*IdentityPreimage) EncodeSSZ

func (ip *IdentityPreimage) EncodeSSZ(dst []byte) ([]byte, error)

func (*IdentityPreimage) EncodingSizeSSZ

func (ip *IdentityPreimage) EncodingSizeSSZ() int

func (*IdentityPreimage) HashSSZ

func (ip *IdentityPreimage) HashSSZ() ([32]byte, error)

func (*IdentityPreimage) String

func (ip *IdentityPreimage) String() string

type IdentityPreimages

type IdentityPreimages []*IdentityPreimage

func (IdentityPreimages) ToListSSZ

func (ips IdentityPreimages) ToListSSZ() *solid.ListSSZ[*IdentityPreimage]

type KsmEonTracker

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

func NewKsmEonTracker

func NewKsmEonTracker(logger log.Logger, config Config, bl BlockListener, cb bind.ContractBackend) *KsmEonTracker

func (*KsmEonTracker) CurrentEon

func (et *KsmEonTracker) CurrentEon() (Eon, bool)

func (*KsmEonTracker) EonByBlockNum

func (et *KsmEonTracker) EonByBlockNum(blockNum uint64) (Eon, bool)

func (*KsmEonTracker) RecentEon

func (et *KsmEonTracker) RecentEon(index EonIndex) (Eon, bool)

func (*KsmEonTracker) Run

func (et *KsmEonTracker) Run(ctx context.Context) error

type P2pConfig

type P2pConfig struct {
	PrivateKey     *ecdsa.PrivateKey
	ListenPort     uint64
	BootstrapNodes []string
}

func (P2pConfig) BootstrapNodesAddrInfo

func (c P2pConfig) BootstrapNodesAddrInfo() ([]peer.AddrInfo, error)

type Pool

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

func NewPool

func NewPool(
	logger log.Logger,
	config Config,
	secondaryTxnProvider txnprovider.TxnProvider,
	contractBackend bind.ContractBackend,
	stateChangesClient stateChangesClient,
) *Pool

func (Pool) ProvideTxns

func (p Pool) ProvideTxns(ctx context.Context, opts ...txnprovider.ProvideOption) ([]types.Transaction, error)

func (Pool) Run

func (p Pool) Run(ctx context.Context) error

type ProcessedMark

type ProcessedMark struct {
	Slot uint64
	Eon  EonIndex
	From TxnIndex
	To   TxnIndex
}

type SlotCalculator

type SlotCalculator interface {
	CalcSlot(timestamp uint64) (uint64, error)
	CalcSlotAge(slot uint64) time.Duration
	CalcCurrentSlot() uint64
	SecondsPerSlot() uint64
}

type TxnBatch

type TxnBatch struct {
	Transactions  []types.Transaction
	TotalGasLimit uint64
}

type TxnIndex

type TxnIndex uint64

Directories

Path Synopsis
internal
testhelpers
Package testhelpers is a generated GoMock package.
Package testhelpers is a generated GoMock package.

Jump to

Keyboard shortcuts

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