Documentation
¶
Index ¶
- Variables
- func LogToMessagePayload(l *ethTypes.Log) []byte
- func PayloadHashToLogHash(payloadHash common.Hash, addr common.Address) common.Hash
- type BlockReplacement
- type BlockSeal
- type ChainIndex
- type ContainsQuery
- type DerivedBlockRefPair
- type DerivedBlockSealPair
- type DerivedIDPair
- type ExecutingMessage
- type Identifier
- type ManagedEvent
- type Message
- type ReferenceView
- type SafetyLevel
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOutOfOrder happens when you try to add data to the DB, // but it does not actually fit onto the latest data (by being too old or new). ErrOutOfOrder = errors.New("data out of order") // ErrDataCorruption happens when the underlying DB has some I/O issue ErrDataCorruption = errors.New("data corruption") // ErrSkipped happens when we try to retrieve data that is not available (pruned) // It may also happen if we erroneously skip data, that was not considered a conflict, if the DB is corrupted. ErrSkipped = errors.New("skipped data") // ErrFuture happens when data is just not yet available ErrFuture = errors.New("future data") // ErrIneffective happens when data is accepted as compatible, but did not change anything. // This happens when a node is deriving an L2 block we already know of being derived from the given source, // but without path to skip forward to newer source blocks without doing the known derivation work first. ErrIneffective = errors.New("ineffective data") // ErrConflict happens when we know for sure that there is different canonical data ErrConflict = errors.New("conflicting data") // ErrAwaitReplacementBlock happens when we know for sure that a replacement block is needed before progress can be made. ErrAwaitReplacementBlock = errors.New("awaiting replacement block") // ErrStop can be used in iterators to indicate iteration has to stop ErrStop = errors.New("iter stop") // ErrOutOfScope is when data is accessed, but access is not allowed, because of a limited scope. // E.g. when limiting scope to L2 blocks derived from a specific subset of the L1 chain. ErrOutOfScope = errors.New("out of scope") // ErrPreviousToFirst is when you try to get the previous block of the first block // E.g. when calling PreviousDerivedFrom on the first L1 block in the DB. ErrPreviousToFirst = errors.New("cannot get parent of first block in the database") // ErrUnknownChain is when a chain is unknown, not in the dependency set. ErrUnknownChain = errors.New("unknown chain") // ErrNoRPCSource happens when a sub-service needs an RPC data source, but is not configured with one. ErrNoRPCSource = errors.New("no RPC client configured") )
Functions ¶
func LogToMessagePayload ¶ added in v1.9.5
LogToMessagePayload is the data that is hashed to get the payloadHash it is the concatenation of the log's topics and data the implementation is based on the interop messaging spec
func PayloadHashToLogHash ¶ added in v1.9.5
PayloadHashToLogHash converts the payload hash to the log hash it is the concatenation of the log's address and the hash of the log's payload, which is then hashed again. This is the hash that is stored in the log storage. The logHash can then be used to traverse from the executing message to the log the referenced initiating message.
Types ¶
type BlockReplacement ¶ added in v1.11.0
type BlockSeal ¶ added in v1.9.5
func BlockSealFromRef ¶ added in v1.9.5
func (BlockSeal) ForceWithParent ¶ added in v1.9.5
func (BlockSeal) MustWithParent ¶ added in v1.9.5
type ChainIndex ¶ added in v1.9.5
type ChainIndex uint32
ChainIndex represents the lifetime of a chain in a dependency set.
func (ChainIndex) MarshalText ¶ added in v1.9.5
func (ci ChainIndex) MarshalText() ([]byte, error)
func (ChainIndex) String ¶ added in v1.9.5
func (ci ChainIndex) String() string
func (*ChainIndex) UnmarshalText ¶ added in v1.9.5
func (ci *ChainIndex) UnmarshalText(data []byte) error
type ContainsQuery ¶ added in v1.11.0
type ContainsQuery struct {
Timestamp uint64
BlockNum uint64
LogIdx uint32
LogHash common.Hash // LogHash commits to the origin-address and the message payload-hash
}
ContainsQuery contains all the information needed to check a message against a chain's database, to determine if it is valid (ie all invariants hold).
type DerivedBlockRefPair ¶ added in v1.11.0
type DerivedBlockRefPair struct {
Source eth.BlockRef `json:"source"`
Derived eth.BlockRef `json:"derived"`
}
DerivedBlockRefPair is a pair of block refs, where Derived (L2) is derived from Source (L1).
func (*DerivedBlockRefPair) IDs ¶ added in v1.11.0
func (refs *DerivedBlockRefPair) IDs() DerivedIDPair
func (*DerivedBlockRefPair) Seals ¶ added in v1.11.0
func (refs *DerivedBlockRefPair) Seals() DerivedBlockSealPair
type DerivedBlockSealPair ¶ added in v1.11.0
type DerivedBlockSealPair struct {
Source BlockSeal `json:"source"`
Derived BlockSeal `json:"derived"`
}
DerivedBlockSealPair is a pair of block seals, where Derived (L2) is derived from Source (L1).
func (*DerivedBlockSealPair) IDs ¶ added in v1.11.0
func (seals *DerivedBlockSealPair) IDs() DerivedIDPair
type DerivedIDPair ¶ added in v1.11.0
type DerivedIDPair struct {
Source eth.BlockID `json:"source"`
Derived eth.BlockID `json:"derived"`
}
DerivedIDPair is a pair of block IDs, where Derived (L2) is derived from Source (L1).
type ExecutingMessage ¶ added in v1.9.3
type ExecutingMessage struct {
Chain ChainIndex // same as ChainID for now, but will be indirect, i.e. translated to full ID, later
BlockNum uint64
LogIdx uint32
Timestamp uint64
Hash common.Hash
}
func (*ExecutingMessage) String ¶ added in v1.9.5
func (s *ExecutingMessage) String() string
type Identifier ¶
type Identifier struct {
Origin common.Address
BlockNumber uint64
LogIndex uint32
Timestamp uint64
ChainID eth.ChainID // flat, not a pointer, to make Identifier safe as map key
}
func (Identifier) MarshalJSON ¶
func (id Identifier) MarshalJSON() ([]byte, error)
func (*Identifier) UnmarshalJSON ¶
func (id *Identifier) UnmarshalJSON(input []byte) error
type ManagedEvent ¶ added in v1.11.0
type ManagedEvent struct {
Reset *string `json:"reset,omitempty"`
UnsafeBlock *eth.BlockRef `json:"unsafeBlock,omitempty"`
DerivationUpdate *DerivedBlockRefPair `json:"derivationUpdate,omitempty"`
ExhaustL1 *DerivedBlockRefPair `json:"exhaustL1,omitempty"`
ReplaceBlock *BlockReplacement `json:"replaceBlock,omitempty"`
DerivationOriginUpdate *eth.BlockRef `json:"derivationOriginUpdate,omitempty"`
}
ManagedEvent is an event sent by the managed node to the supervisor, to share an update. One of the fields will be non-null; different kinds of updates may be sent.
type Message ¶ added in v1.9.1
type Message struct {
Identifier Identifier `json:"identifier"`
PayloadHash common.Hash `json:"payloadHash"`
}
type ReferenceView ¶ added in v1.9.5
func (ReferenceView) String ¶ added in v1.9.5
func (v ReferenceView) String() string
type SafetyLevel ¶
type SafetyLevel string
const ( // Finalized is CrossSafe, with the additional constraint that every // dependency is derived only from finalized L1 input data. // This matches RPC label "finalized". Finalized SafetyLevel = "finalized" // CrossSafe is as safe as LocalSafe, with all its dependencies // also fully verified to be reproducible from L1. // This matches RPC label "safe". CrossSafe SafetyLevel = "safe" // LocalSafe is verified to be reproducible from L1, // without any verified cross-L2 dependencies. // This does not have an RPC label. LocalSafe SafetyLevel = "local-safe" // CrossUnsafe is as safe as LocalUnsafe, // but with verified cross-L2 dependencies that are at least CrossUnsafe. // This does not have an RPC label. CrossUnsafe SafetyLevel = "cross-unsafe" // LocalUnsafe is the safety of the tip of the chain. This matches RPC label "unsafe". LocalUnsafe SafetyLevel = "unsafe" // Invalid is the safety of when the message or block is not matching the expected data. Invalid SafetyLevel = "invalid" )
func (*SafetyLevel) AtLeastAsSafe ¶ added in v1.9.1
func (lvl *SafetyLevel) AtLeastAsSafe(min SafetyLevel) bool
AtLeastAsSafe returns true if the receiver is at least as safe as the other SafetyLevel. Safety levels are assumed to graduate from LocalUnsafe to LocalSafe to CrossUnsafe to CrossSafe, with Finalized as the strongest.
func (SafetyLevel) MarshalText ¶
func (lvl SafetyLevel) MarshalText() ([]byte, error)
func (SafetyLevel) String ¶
func (lvl SafetyLevel) String() string
func (*SafetyLevel) UnmarshalText ¶
func (lvl *SafetyLevel) UnmarshalText(text []byte) error
func (SafetyLevel) Validate ¶ added in v1.11.0
func (lvl SafetyLevel) Validate() bool
Validate returns true if the SafetyLevel is one of the recognized levels