types

package
v0.0.3-hotfix1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Number         rpc.ArgUint64       `json:"number"`
	GlobalExitRoot common.Hash         `json:"globalExitRoot"`
	Timestamp      rpc.ArgUint64       `json:"timestamp"`
	Coinbase       common.Address      `json:"coinbase"`
	L2Data         rpc.ArgBytes        `json:"batchL2Data"`
	Transactions   []TransactionOrHash `json:"transactions"`
}

Batch represents a batch used for synchronization

func (*Batch) HashToSign

func (b *Batch) HashToSign() []byte

HashToSign returns a hash that uniquely identifies the batch

func (*Batch) Sign

func (b *Batch) Sign(privateKey *ecdsa.PrivateKey) (*SignedBatch, error)

Sign returns a signed batch by the private key

type OffChainData

type OffChainData struct {
	Key   common.Hash
	Value []byte
}

OffChainData represents some data that is not stored on chain and should be preserved

type Sequence

type Sequence struct {
	Batches         []Batch     `json:"batches"`
	OldAccInputHash common.Hash `json:"oldAccInputhash"`
}

Sequence represents the data that the sequencer will send to L1 and other metadata needed to build the accumulated input hash aka accInputHash

func (*Sequence) HashToSign

func (s *Sequence) HashToSign() []byte

HashToSign returns the accumulated input hash of the sequence. Note that this is equivalent to what happens on the smart contract

func (*Sequence) OffChainData

func (s *Sequence) OffChainData() []OffChainData

OffChainData returns the data that needs to be stored off chain from a given sequence

func (*Sequence) Sign

func (s *Sequence) Sign(privateKey *ecdsa.PrivateKey) (*SignedSequence, error)

Sign returns a signed sequence by the private key. Note that what's being signed is the accumulated input hash

type SignedBatch

type SignedBatch struct {
	Batch     Batch        `json:"batch"`
	Signature rpc.ArgBytes `json:"signature"`
}

SignedBatch is a batch but signed

func (*SignedBatch) Signer

func (s *SignedBatch) Signer() (common.Address, error)

Signer returns the address of the signer

type SignedSequence

type SignedSequence struct {
	Sequence  Sequence     `json:"sequence"`
	Signature rpc.ArgBytes `json:"signature"`
}

SignedSequence is a sequence but signed

func (*SignedSequence) Signer

func (s *SignedSequence) Signer() (common.Address, error)

Signer returns the address of the signer

type TransactionOrHash

type TransactionOrHash struct {
	Hash *common.Hash
}

TransactionOrHash for union type of transaction and types.Hash

Jump to

Keyboard shortcuts

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