types

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNonCanonicalSignature is returned when the signature is not canonical.
	ErrNonCanonicalSignature = errors.New("received non-canonical signature")
)

Functions

func HexEncodeBig added in v0.0.4

func HexEncodeBig(bigint *big.Int) string

HexEncodeBig encodes bigint as a hex string with 0x prefix. The sign of the integer is ignored.

func IsHexValid added in v0.0.4

func IsHexValid(s string) bool

IsHexValid checks if the provided string is a valid hexadecimal value

func Sign added in v0.0.8

func Sign(privateKey *ecdsa.PrivateKey, hashToSign []byte) ([]byte, error)

Sign the hashToSIgn with the given privateKey.

Types

type ArgBig added in v0.0.4

type ArgBig big.Int

ArgBig helps to marshal big number values provided in the RPC requests

func (ArgBig) Hex added in v0.0.4

func (a ArgBig) Hex() string

Hex returns a hexadecimal representation

func (ArgBig) MarshalText added in v0.0.4

func (a ArgBig) MarshalText() ([]byte, error)

MarshalText marshals an array of bytes into an instance of ArgBig

func (*ArgBig) UnmarshalText added in v0.0.4

func (a *ArgBig) UnmarshalText(input []byte) error

UnmarshalText unmarshals an instance of ArgBig into an array of bytes

type ArgBytes added in v0.0.4

type ArgBytes []byte

ArgBytes helps to marshal byte array values provided in the RPC requests

func ArgBytesPtr added in v0.0.4

func ArgBytesPtr(b []byte) *ArgBytes

ArgBytesPtr helps to marshal byte array values provided in the RPC requests

func (ArgBytes) Hex added in v0.0.4

func (b ArgBytes) Hex() string

Hex returns a hexadecimal representation

func (ArgBytes) MarshalText added in v0.0.4

func (b ArgBytes) MarshalText() ([]byte, error)

MarshalText marshals into text

func (*ArgBytes) UnmarshalText added in v0.0.4

func (b *ArgBytes) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type ArgHash added in v0.0.4

type ArgHash common.Hash

ArgHash represents a common.Hash that accepts strings shorter than 64 bytes, like 0x00

func (*ArgHash) Hash added in v0.0.4

func (arg *ArgHash) Hash() common.Hash

Hash returns an instance of common.Hash

func (*ArgHash) UnmarshalText added in v0.0.4

func (arg *ArgHash) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type ArgUint64 added in v0.0.4

type ArgUint64 uint64

ArgUint64 helps to marshal uint64 values provided in the RPC requests

func (ArgUint64) Hex added in v0.0.4

func (b ArgUint64) Hex() string

Hex returns a hexadecimal representation

func (ArgUint64) MarshalText added in v0.0.4

func (b ArgUint64) MarshalText() ([]byte, error)

MarshalText marshals into text

func (*ArgUint64) UnmarshalText added in v0.0.4

func (b *ArgUint64) UnmarshalText(input []byte) error

UnmarshalText unmarshals from text

type Batch

type Batch struct {
	L2Data            ArgBytes       `json:"L2Data"`
	ForcedGER         common.Hash    `json:"forcedGlobalExitRoot"`
	ForcedTimestamp   ArgUint64      `json:"forcedTimestamp"`
	Coinbase          common.Address `json:"coinbase"`
	ForcedBlockHashL1 common.Hash    `json:"forcedBlockHashL1"`
}

Batch represents the batch data that the sequencer will send to L1

type BatchKey added in v0.0.6

type BatchKey struct {
	Number uint64
	Hash   common.Hash
}

BatchKey is the pairing of batch number and data hash of a batch

type DACStatus added in v0.0.8

type DACStatus struct {
	Uptime                string `json:"uptime"`
	Version               string `json:"version"`
	KeyCount              uint64 `json:"key_count"`
	BackfillProgress      uint64 `json:"backfill_progress"`
	OffchainDataGapsExist bool   `json:"offchain_data_gaps_exist"`
}

DACStatus contains DAC status info

type OffChainData

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

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

func RemoveDuplicateOffChainData added in v0.0.9

func RemoveDuplicateOffChainData(ods []OffChainData) []OffChainData

RemoveDuplicateOffChainData removes duplicate off chain data

type Sequence

type Sequence []ArgBytes

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) ([]byte, error)

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

type SequenceBanana added in v0.0.8

type SequenceBanana struct {
	Batches              []Batch     `json:"batches"`
	OldAccInputHash      common.Hash `json:"oldAccInputhash"`
	L1InfoRoot           common.Hash `json:"l1InfoRoot"`
	MaxSequenceTimestamp ArgUint64   `json:"maxSequenceTimestamp"`
}

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

func (*SequenceBanana) HashToSign added in v0.0.8

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

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

func (*SequenceBanana) OffChainData added in v0.0.8

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

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

func (*SequenceBanana) Sign added in v0.0.8

func (s *SequenceBanana) Sign(privateKey *ecdsa.PrivateKey) ([]byte, error)

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

type SignedSequence

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

SignedSequence is a sequence but signed

func (*SignedSequence) GetSignature added in v0.0.8

func (s *SignedSequence) GetSignature() []byte

GetSignature returns signature

func (*SignedSequence) OffChainData added in v0.0.8

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

OffChainData returns the data to be stored of the sequence

func (*SignedSequence) SetSignature added in v0.0.8

func (s *SignedSequence) SetSignature(sign []byte)

SetSignature set signature

func (*SignedSequence) Sign added in v0.0.8

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

Sign signs the sequence using the privateKey

func (*SignedSequence) Signer

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

Signer returns the address of the signer

type SignedSequenceBanana added in v0.0.8

type SignedSequenceBanana struct {
	Sequence  SequenceBanana `json:"sequence"`
	Signature ArgBytes       `json:"signature"`
}

SignedSequenceBanana is a sequence but signed

func (*SignedSequenceBanana) GetSignature added in v0.0.8

func (s *SignedSequenceBanana) GetSignature() []byte

GetSignature returns signature

func (*SignedSequenceBanana) OffChainData added in v0.0.8

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

OffChainData returns the data to be stored of the sequence

func (*SignedSequenceBanana) SetSignature added in v0.0.8

func (s *SignedSequenceBanana) SetSignature(sign []byte)

SetSignature set signature

func (*SignedSequenceBanana) Sign added in v0.0.8

func (s *SignedSequenceBanana) Sign(privateKey *ecdsa.PrivateKey) (ArgBytes, error)

Sign signs the sequence using the privateKey

func (*SignedSequenceBanana) Signer added in v0.0.8

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

Signer returns the address of the signer

type SignedSequenceInterface added in v0.0.8

type SignedSequenceInterface interface {
	Signer() (common.Address, error)
	OffChainData() []OffChainData
	Sign(privateKey *ecdsa.PrivateKey) (ArgBytes, error)
	SetSignature([]byte)
	GetSignature() []byte
}

SignedSequenceInterface is the interface that defines the methods that a signed sequence must implement

Jump to

Keyboard shortcuts

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