types

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package types contains common types

Index

Constants

View Source
const (
	// BaseMessageTipsOffset is the tips offset.
	BaseMessageTipsOffset = 0
	// BaseMessageSenderOffset is the sender offset.
	BaseMessageSenderOffset = 32
	// BaseMessageRecipientOffset is the recipient offset.
	BaseMessageRecipientOffset = 64
	// BaseMessageRequestOffset is the request offset.
	BaseMessageRequestOffset = BaseMessageRecipientOffset + TipsSize
	// BaseMessageContentOffset is the content offset.
	BaseMessageContentOffset = BaseMessageRequestOffset + RequestSize
)
View Source
const (
	// MessageFlagSize if the size in bytes of a message flag.
	MessageFlagSize = 1
	// MessageHeaderSize is the size in bytes of a message header.
	MessageHeaderSize = 4*4 + MessageFlagSize
)
View Source
const (
	// VersionOffset is the offset of the version.
	VersionOffset = 0
	// GasLimitOffset if the offset of the gas limit.
	GasLimitOffset = 4
	// GasDropOffset is the gas drop offset.
	GasDropOffset = 12
	// RequestSize is the size of the request.
	RequestSize = 24
)
View Source
const (
	// TipsSize is the size of the tips in bytes.
	TipsSize = 8 * 4
	// ShiftSummitTip is the shift for the summit tip.
	ShiftSummitTip = 24 * 8
	// ShiftAttestationTip is the shift for the attestation tip.
	ShiftAttestationTip = 16 * 8
	// ShiftExecutionTip is the shift for the execution tip.
	ShiftExecutionTip = 8 * 8
)
View Source
const AttestationInvalidSalt = "ATTESTATION_INVALID_SALT"

AttestationInvalidSalt is the salt for ATTESTATION_INVALID_SALT.

View Source
const AttestationValidSalt = "ATTESTATION_VALID_SALT"

AttestationValidSalt is the salt for ATTESTATION_VALID_SALT.

View Source
const (
	// MessageBodyOffset is the message body offset.
	MessageBodyOffset = MessageHeaderSize
)
View Source
const ReceiptInvalidSalt = "RECEIPT_INVALID_SALT"

ReceiptInvalidSalt is the salt for RECEIPT_INVALID_SALT.

View Source
const ReceiptValidSalt = "RECEIPT_VALID_SALT"

ReceiptValidSalt is the salt for RECEIPT_VALID_SALT.

View Source
const SignatureLength = int(65)

SignatureLength for ecdsa signature.

View Source
const SnapshotValidSalt = "SNAPSHOT_VALID_SALT"

SnapshotValidSalt is the salt for SNAPSHOT_VALID_SALT.

View Source
const StateInvalidSalt = "STATE_INVALID_SALT"

StateInvalidSalt is the salt for STATE_INVALID_SALT.

Variables

This section is empty.

Functions

func ChainGassesToSnapGas added in v0.0.239

func ChainGassesToSnapGas(chainGasses []ChainGas) (snapGasses []*big.Int, err error)

ChainGassesToSnapGas converts a slice of ChainGas to a slice of big.Int.

func EncodeAgentStatus added in v0.0.171

func EncodeAgentStatus(agentStatus AgentStatus) ([]byte, error)

EncodeAgentStatus encodes a agent status.

func EncodeBaseMessage added in v0.0.171

func EncodeBaseMessage(m BaseMessage) ([]byte, error)

EncodeBaseMessage encodes a base message.

func EncodeChainGas added in v0.0.171

func EncodeChainGas(chainGas ChainGas) ([]byte, error)

EncodeChainGas encodes a chaingas.

func EncodeGasData added in v0.0.171

func EncodeGasData(gasData GasData) ([]byte, error)

EncodeGasData encodes a gasdata.

func EncodeHeader

func EncodeHeader(header Header) ([]byte, error)

EncodeHeader encodes a message header.

func EncodeMessage

func EncodeMessage(m Message) ([]byte, error)

EncodeMessage encodes a message.

func EncodeRequest added in v0.0.171

func EncodeRequest(m Request) ([]byte, error)

EncodeRequest encodes a request.

func EncodeSignature

func EncodeSignature(sig Signature) ([]byte, error)

EncodeSignature encodes a signature.

func EncodeTips

func EncodeTips(tips Tips) ([]byte, error)

EncodeTips encodes a list of tips.

func EncodeTipsBigInt added in v0.0.239

func EncodeTipsBigInt(tips Tips) (*big.Int, error)

EncodeTipsBigInt encodes a list of tips into a big int.

func GetAttestationDataHash added in v0.0.239

func GetAttestationDataHash(agentRoot [32]byte, snapGasHash [32]byte) [32]byte

GetAttestationDataHash generates the data hash from the agent root and SnapGasHash.

func HasAttestation added in v0.0.245

func HasAttestation(data StateValidationData) bool

HasAttestation indicates whether the data corresponds to an attestation (or a snapshot, if false).

func HashRawBytes added in v0.0.58

func HashRawBytes(rawBytes []byte) (common.Hash, error)

HashRawBytes takes the raw bytes and produces a hash.

func TotalTips

func TotalTips(tips Tips) *big.Int

TotalTips gets the combined value of the tips.

Types

type AgentFlagType added in v0.0.185

type AgentFlagType uint8

AgentFlagType is the type for the Agent Status Flag.

const (
	// AgentFlagUnknown means agent is not part of agent set.
	AgentFlagUnknown AgentFlagType = iota
	// AgentFlagActive means agent is active.
	AgentFlagActive
	// AgentFlagUnstaking means agent is unstaking.
	AgentFlagUnstaking
	// AgentFlagResting means agent has staked but not currently doing any work.
	AgentFlagResting
	// AgentFlagFraudulent means agent has been accused of fraud and is awaiting fraud resolution.
	AgentFlagFraudulent
	// AgentFlagSlashed means that the agent has been slashed and will not be a part of agent set in the next epoch.
	AgentFlagSlashed
)

func (AgentFlagType) String added in v0.0.185

func (i AgentFlagType) String() string

type AgentStatus added in v0.0.171

type AgentStatus interface {
	// Flag is the current status flag of the agent.
	Flag() AgentFlagType
	// Domain that agent is assigned to.
	Domain() uint32
	// Index of the agent in list of agents.
	Index() uint32
}

AgentStatus is the agent status interface.

func DecodeAgentStatus added in v0.0.171

func DecodeAgentStatus(toDecode []byte) (AgentStatus, error)

DecodeAgentStatus decodes an agent status.

func NewAgentStatus added in v0.0.171

func NewAgentStatus(flag AgentFlagType, domain, index uint32) AgentStatus

NewAgentStatus creates a new agent status.

type AgentStatusRelayedState added in v0.0.239

type AgentStatusRelayedState uint8

AgentStatusRelayedState represents the state of a RelayableAgentStatus model.

const (
	// Queued is when an agent status has been updated on Summit, but has not been relayed to the remote chain.
	Queued AgentStatusRelayedState = iota
	// Relayed is when the agent status has been relayed to the remote chain.
	Relayed
)

type AgentTree added in v0.0.239

type AgentTree struct {
	// AgentRoot is the root of the agent tree.
	AgentRoot string
	// AgentAddress is the address of the agent for the Merkle proof.
	AgentAddress common.Address
	// AgentDomain is the domain of the agent.
	AgentDomain uint32
	// UpdatedAgentFlag is the updated agent flag corresponding to the agent tree.
	UpdatedAgentFlag AgentFlagType
	// BlockNumber is the block number that the agent tree was updated (on summit).
	BlockNumber uint64
	// Proof is the agent tree proof.
	Proof [][32]byte
}

AgentTree is a version of the database AgentTree model with solidity-compatible types.

type Attestation

type Attestation interface {
	Encoder
	// SnapshotRoot is the root of the Snapshot Merkle Tree.
	SnapshotRoot() [32]byte
	// DataHash is the agent root and SnapGasHash combined into a single hash.
	DataHash() [32]byte
	// Nonce is the attestation nonce.
	Nonce() uint32
	// BlockNumber is the block number when the attestation was created in Summit.
	BlockNumber() *big.Int
	// Timestamp is the timestamp when the attestation was created in Summit.
	Timestamp() *big.Int
	// SignAttestation signs the attestation
	SignAttestation(ctx context.Context, signer signer.Signer, valid bool) (signer.Signature, []byte, common.Hash, error)
}

Attestation is the attestation interface.

func DecodeAttestation

func DecodeAttestation(toDecode []byte) (Attestation, error)

DecodeAttestation decodes an attestation.

func NewAttestation

func NewAttestation(snapshotRoot [32]byte, dataHash [32]byte, nonce uint32, blockNumber *big.Int, timestamp *big.Int) Attestation

NewAttestation creates a new attestation.

type AttestationSubmitted

type AttestationSubmitted interface {
	// Notary gets the notary of the attestation.
	Notary() common.Hash
	// Attestation gets the raw bytes of the attestation.
	Attestation() []byte
}

AttestationSubmitted is the type emitted by the AttestationCollector when an attestation is submitted.

func NewAttestationSubmitted

func NewAttestationSubmitted(notary common.Hash, attestation []byte) AttestationSubmitted

NewAttestationSubmitted creates a new attestation submitted type.

type AttestationWithMetadata added in v0.0.245

type AttestationWithMetadata struct {
	// Attestation is the underlying attestation.
	Attestation Attestation
	// contains filtered or unexported fields
}

AttestationWithMetadata is an attestation that was submitted by a Notary and was deemed fraudulent.

func NewAttestationWithMetadata added in v0.0.245

func NewAttestationWithMetadata(attestationPayload []byte, agentDomain uint32, notary common.Address, attSignature []byte) (*AttestationWithMetadata, error)

NewAttestationWithMetadata creates a new AttestationWithMetadata from the attestation payload, domain, notary and attestation signature.

func (*AttestationWithMetadata) Agent added in v0.0.245

Agent returns the agent that submitted the attestation.

func (*AttestationWithMetadata) AgentDomain added in v0.0.245

func (a *AttestationWithMetadata) AgentDomain() uint32

AgentDomain returns the domain of the agent that submitted the attestation.

func (*AttestationWithMetadata) AttestationPayload added in v0.0.245

func (a *AttestationWithMetadata) AttestationPayload() []byte

AttestationPayload returns the attestation payload.

func (*AttestationWithMetadata) AttestationSignature added in v0.0.245

func (a *AttestationWithMetadata) AttestationSignature() []byte

AttestationSignature returns the attestation signature.

func (*AttestationWithMetadata) SetSnapshotPayload added in v0.0.245

func (a *AttestationWithMetadata) SetSnapshotPayload(snapshotPayload []byte)

SetSnapshotPayload sets the snapshot payload.

func (*AttestationWithMetadata) SnapshotPayload added in v0.0.245

func (a *AttestationWithMetadata) SnapshotPayload() []byte

SnapshotPayload returns the snapshot payload.

func (*AttestationWithMetadata) SnapshotSignature added in v0.0.245

func (a *AttestationWithMetadata) SnapshotSignature() []byte

SnapshotSignature returns the nil, since the data corresponds to an attestation.

type BaseMessage added in v0.0.171

type BaseMessage interface {
	// Sender address on origin chain.
	Sender() [32]byte
	// Recipient address on destination chain.
	Recipient() [32]byte
	// Tips paid on the origin chain.
	Tips() Tips
	// Request gets the message request.
	Request() Request
	// Content to be passed to recipient.
	Content() []byte

	// BodyLeaf gets the message body.
	BodyLeaf() ([]byte, error)
	// Leaf gets the message leaf.
	Leaf() ([32]byte, error)
}

BaseMessage is an interface that contains the base message.

func DecodeBaseMessage added in v0.0.171

func DecodeBaseMessage(toDecode []byte) (BaseMessage, error)

DecodeBaseMessage decodes a base message typed mem view.

func NewBaseMessage added in v0.0.171

func NewBaseMessage(sender, recipient [32]byte, tips Tips, request Request, content []byte) BaseMessage

NewBaseMessage creates a new message from fields passed in.

type ChainGas added in v0.0.171

type ChainGas interface {
	// GasData is the gas data for the chain.
	GasData() GasData
	// Domain is domain id of the chain.
	Domain() uint32
}

ChainGas is the ChainGas interface.

func DecodeChainGas added in v0.0.171

func DecodeChainGas(toDecode []byte) (ChainGas, error)

DecodeChainGas decodes a chainGas.

func NewChainGas added in v0.0.171

func NewChainGas(gasData GasData, domain uint32) ChainGas

NewChainGas creates a new chaingas.

type ChainType

type ChainType uint8

ChainType is the type of chain being used (e.g. evm).

const (
	// EVM is a chain that conforms to the evm standard.
	EVM ChainType = 0
)

func AllChainTypes

func AllChainTypes() []ChainType

AllChainTypes gets all chain types for the chain.

func (ChainType) String

func (i ChainType) String() string

type CommittedMessage

type CommittedMessage interface {
	// Message is the fully detailed message that was committed
	Message() []byte
	// Leaf gets a leaf
	Leaf() [32]byte
	// Encode encodes a message
	Encode() ([]byte, error)
}

CommittedMessage is the message that got committed.

func DecodeCommittedMessage

func DecodeCommittedMessage(rawMessage []byte) (CommittedMessage, error)

DecodeCommittedMessage decodes a committed message into a struct.

func NewCommittedMessage

func NewCommittedMessage(message []byte) CommittedMessage

NewCommittedMessage creates a new committed message.

type CommittedMessageEncoder

type CommittedMessageEncoder struct {
	CommittedRoot common.Hash
	Message       []byte
}

CommittedMessageEncoder is used to export fields for struct encoding.

type DisputeFlagType added in v0.0.239

type DisputeFlagType uint8

DisputeFlagType is the type for the Dispute Status Flag.

const (
	// DisputeFlagNone means agent is not in dispute.
	DisputeFlagNone DisputeFlagType = iota
	// DisputeFlagPending means agent is in unresolved dispute.
	DisputeFlagPending
	// DisputeFlagSlashed means agent was in dispute that lead to agent being slashed.
	DisputeFlagSlashed
)

func (DisputeFlagType) String added in v0.0.239

func (i DisputeFlagType) String() string

type DisputeProcessedStatus added in v0.0.239

type DisputeProcessedStatus uint8

DisputeProcessedStatus is the status of a dispute on Summit. This enum is used for tracking the status of disputes in the Dispute db model.

const (
	// Opened is when a dispute has been opened but has not been resolved.
	Opened DisputeProcessedStatus = iota
	// Resolved is when a dispute has been resolved on Summit, but agent status has not been updated on the remote chain.
	Resolved
	// Propagated is when a dispute has been resolved on Summit, and agent status has been updated on the remote chain.
	Propagated
)

type DisputeStatus added in v0.0.239

type DisputeStatus interface {
	// Flag is the current status flag of the dispute.
	Flag() DisputeFlagType
	// Rival is the address of the rival.
	Rival() common.Address
	// FraudProver is the address of the fraud prover for this dispute.
	FraudProver() common.Address
	// DisputePtr is the index of the dispute.
	DisputePtr() *big.Int
}

DisputeStatus is the dispute status interface.

func NewDisputeStatus added in v0.0.239

func NewDisputeStatus(flag DisputeFlagType, rival, fraudProver common.Address, disputePtr *big.Int) DisputeStatus

NewDisputeStatus creates a new dispute status.

type Encoder added in v0.0.239

type Encoder interface {
	Encode() ([]byte, error)
}

Encoder encodes a type to bytes.

type GasData added in v0.0.171

type GasData interface {
	// GasPrice is the gas price for the chain (in Wei per gas unit).
	GasPrice() uint16
	// DataPrice is the calldata price (in Wei per byte of content).
	DataPrice() uint16
	// ExecBuffer is the tx fee safety buffer for message execution (in Wei).
	ExecBuffer() uint16
	// AmortAttCost is the amortized cost for attestation submission (in Wei).
	AmortAttCost() uint16
	// EtherPrice is the chain's Ether Price / Mainnet Ether Price (in BWAD).
	EtherPrice() uint16
	// Markup is the markup for the message execution (in BWAD).
	Markup() uint16
}

GasData is the GasData interface.

func DecodeGasData added in v0.0.171

func DecodeGasData(toDecode []byte) (GasData, error)

DecodeGasData decodes a gasData.

func NewGasData added in v0.0.171

func NewGasData(gasPrice, dataPrice, execBuffer, amortAttCost, etherPrice, markup uint16) GasData

NewGasData creates a new gasdata.

type Header interface {
	// Flag is the flag of the message
	Flag() MessageFlag
	// OriginDomain is the origin domain of the message
	OriginDomain() uint32
	// Nonce is the nonce of the message
	Nonce() uint32
	// DestinationDomain is the destination domain of the message
	DestinationDomain() uint32
	// OptimisticSeconds is the optimistic time period of the message in seconds
	OptimisticSeconds() uint32

	// Leaf is the leaf of the header.
	Leaf() ([32]byte, error)
}

Header contains information of a message.

func DecodeHeader

func DecodeHeader(header []byte) (Header, error)

DecodeHeader decodes a header from a byte slice.

func NewHeader

func NewHeader(flag MessageFlag, originDomain uint32, nonce uint32, destinationDomain uint32, optimisticSeconds uint32) Header

NewHeader creates a new header type.

type Message

type Message interface {
	// Header gets the message header
	Header() Header
	// BaseMessage is the base message if the flag indicates the type is a base message
	BaseMessage() BaseMessage
	// Body gets the message body
	Body() []byte

	// OriginDomain returns the Slip-44 ID
	OriginDomain() uint32
	// Nonce is the count of all previous messages to the destination
	Nonce() uint32
	// DestinationDomain is the slip-44 id of the destination
	DestinationDomain() uint32
	// ToLeaf converts a leaf to a keccac256
	ToLeaf() (leaf [32]byte, err error)
	// OptimisticSeconds gets the optimistic seconds count
	OptimisticSeconds() uint32
}

Message is an interface that contains the message.

func DecodeMessage

func DecodeMessage(message []byte) (Message, error)

DecodeMessage decodes a message from a byte slice.

func NewMessage

func NewMessage(header Header, baseMessage BaseMessage, body []byte) Message

NewMessage creates a new message from fields passed in. TODO: Set up different initializers. One for BaseMessage and one for ManagerMessage.

func NewMessageFromBaseMessage added in v0.0.184

func NewMessageFromBaseMessage(header Header, baseMessage BaseMessage) (Message, error)

NewMessageFromBaseMessage creates a generic message given a base message.

func NewMessageFromManagerMessage added in v0.0.184

func NewMessageFromManagerMessage(header Header, payload []byte) (Message, error)

NewMessageFromManagerMessage creates a generic message given a manager message.

type MessageFlag added in v0.0.171

type MessageFlag uint8

MessageFlag indicates if the message is normal "Base" message or "Manager" message.

const (
	// MessageFlagBase is the normal message that has tips.
	MessageFlagBase MessageFlag = iota
	// MessageFlagManager is manager message and will not have tips.
	MessageFlagManager
)

type NotaryAttestation added in v0.0.171

type NotaryAttestation interface {
	// AttPayload is raw bytes of the attestation payload.
	AttPayload() []byte
	// AgentRoot is the agent root.
	AgentRoot() [32]byte
	// SnapGas is the snap gas.
	SnapGas() []*big.Int
	// Attestation is the decoded attestation from the AttPayload
	Attestation() Attestation
}

NotaryAttestation is the notary attestation interface.

func NewNotaryAttestation added in v0.0.171

func NewNotaryAttestation(attPayload []byte, agentRoot [32]byte, snapGas []*big.Int) (NotaryAttestation, error)

NewNotaryAttestation creates a new notary attestation.

type Proof

type Proof interface {
	// Leaf is the leaf in the proof
	Leaf() common.Hash
	// Index is the index in the tree
	Index() uint32
	// Path is the merkle branch
	Path() common.Hash
	// Encode encodes a message
	Encode() ([]byte, error)
}

Proof is a merkle proof object. The leaf it's path to the root and its index in the tree.

func DecodeProof

func DecodeProof(rawProof []byte) (Proof, error)

DecodeProof decodes a proof.

func NewProof

func NewProof(leaf common.Hash, index uint32, path common.Hash) Proof

NewProof creates a new merkle proof.

type ProofEncoder

type ProofEncoder struct {
	Leaf  common.Hash
	Index uint32
	Path  common.Hash
}

ProofEncoder is exported to allow proofs to be encoded/deoded from binary.

type Receipt added in v0.0.239

type Receipt interface {
	Encoder
	// Origin is the origin of the receipt.
	Origin() uint32
	// Destination is the destination of the receipt.
	Destination() uint32
	// MessageHash is the hash of the message.
	MessageHash() [32]byte
	// SnapshotRoot is the root of the Snapshot Merkle Tree.
	SnapshotRoot() [32]byte
	// StateIndex is the state index of the receipt.
	StateIndex() uint8
	// AttestationNotary is the notary of the attestation.
	AttestationNotary() common.Address
	// FirstExecutor is the first executor of the receipt.
	FirstExecutor() common.Address
	// FinalExecutor is the final executor of the receipt.
	FinalExecutor() common.Address
	// SignReceipt returns the signature of the receipt payload signed by the signer.
	SignReceipt(ctx context.Context, signer signer.Signer, valid bool) (signer.Signature, []byte, common.Hash, error)
}

Receipt is the receipt interface.

func DecodeReceipt added in v0.0.239

func DecodeReceipt(toDecode []byte) (Receipt, error)

DecodeReceipt decodes an receipt.

func NewReceipt added in v0.0.239

func NewReceipt(origin uint32, destination uint32, messageHash [32]byte, snapshotRoot [32]byte, stateIndex uint8, attestationNotary common.Address, firstExecutor common.Address, finalExecutor common.Address) Receipt

NewReceipt creates a new receipt.

type Request added in v0.0.171

type Request interface {
	// Version is the base message version to pass to the recipient.
	Version() uint32
	// GasLimit is the minimum amount of gas units to supply for execution.
	GasLimit() uint64
	// GasDrop is the minimum amount of gas token to drop to the recipient.
	GasDrop() *big.Int
}

Request is an interface that contains the request from the base message.

func DecodeRequest added in v0.0.171

func DecodeRequest(toDecode []byte) Request

DecodeRequest decodes a request typed mem view.

func NewRequest added in v0.0.171

func NewRequest(version uint32, gasLimit uint64, gasDrop *big.Int) Request

NewRequest creates a new request from fields passed in.

type Signature

type Signature interface {
	// V gets the v value of the signature
	V() *big.Int
	// R is the r value of the signature
	R() *big.Int
	// S is the s value of the signature
	S() *big.Int
}

Signature creates a new signature.

func DecodeSignature

func DecodeSignature(toDecode []byte) (sig Signature, err error)

DecodeSignature decodes a signature.

func NewSignature

func NewSignature(v, r, s *big.Int) Signature

NewSignature creates a new signature.

type Snapshot added in v0.0.130

type Snapshot interface {
	Encoder
	// States are the states of the snapshot.
	States() []State

	// SnapshotRootAndProofs returns the snapshot root, calculated from the states, as well as each state's proof.
	SnapshotRootAndProofs() ([32]byte, [][][]byte, error)
	// SignSnapshot returns the signature of the snapshot payload signed by the signer
	SignSnapshot(ctx context.Context, signer signer.Signer) (signer.Signature, []byte, common.Hash, error)
}

Snapshot is the snapshot interface.

func DecodeSnapshot added in v0.0.130

func DecodeSnapshot(toDecode []byte) (Snapshot, error)

DecodeSnapshot decodes a snapshot.

func NewSnapshot added in v0.0.130

func NewSnapshot(states []State) Snapshot

NewSnapshot creates a new snapshot.

type SnapshotWithMetadata added in v0.0.245

type SnapshotWithMetadata struct {
	// Snapshot is the underlying snapshot.
	Snapshot Snapshot
	// contains filtered or unexported fields
}

SnapshotWithMetadata is a snapshot type with additional metadata for fraud handling.

func NewSnapshotWithMetadata added in v0.0.245

func NewSnapshotWithMetadata(snapshotPayload []byte, agentDomain uint32, agent common.Address, snapshotSignature []byte) (*SnapshotWithMetadata, error)

NewSnapshotWithMetadata returns a new SnapshotWithMetadata from a Snapshot payload and other metadata.

func (*SnapshotWithMetadata) Agent added in v0.0.245

func (s *SnapshotWithMetadata) Agent() common.Address

Agent returns the agent that submitted the snapshot.

func (*SnapshotWithMetadata) AgentDomain added in v0.0.245

func (s *SnapshotWithMetadata) AgentDomain() uint32

AgentDomain returns the domain of the agent that submitted the snapshot.

func (*SnapshotWithMetadata) AttestationPayload added in v0.0.245

func (s *SnapshotWithMetadata) AttestationPayload() []byte

AttestationPayload returns nil, since the data corresponds to a snapshot.

func (*SnapshotWithMetadata) AttestationSignature added in v0.0.245

func (s *SnapshotWithMetadata) AttestationSignature() []byte

AttestationSignature returns nil, since the data corresponds to a snapshot.

func (*SnapshotWithMetadata) SnapshotPayload added in v0.0.245

func (s *SnapshotWithMetadata) SnapshotPayload() []byte

SnapshotPayload returns the snapshot payload.

func (*SnapshotWithMetadata) SnapshotSignature added in v0.0.245

func (s *SnapshotWithMetadata) SnapshotSignature() []byte

SnapshotSignature returns the snapshot signature.

type State added in v0.0.130

type State interface {
	Encoder
	// Root is the root of the Origin Merkle Tree.
	Root() [32]byte
	// Origin is the domain where Origin is located.
	Origin() uint32
	// Nonce is the amount of sent messages.
	Nonce() uint32
	// BlockNumber is the block of the last sent message.
	BlockNumber() *big.Int
	// Timestamp is the unix time of the last sent message.
	Timestamp() *big.Int
	// GasData is the gas data from the chain's gas oracle.
	GasData() GasData

	// Hash returns the hash of the state.
	Hash() ([32]byte, error)
	// SubLeaves returns the left and right sub-leaves of the state.
	SubLeaves() (leftLeaf, rightLeaf [32]byte, err error)
	// SignState returns the signature of the state payload signed by the signer.
	SignState(ctx context.Context, signer signer.Signer) (signer.Signature, []byte, common.Hash, error)
}

State is the state interface.

func DecodeState added in v0.0.130

func DecodeState(toDecode []byte) (State, error)

DecodeState decodes a state.

func NewState added in v0.0.130

func NewState(root [32]byte, origin uint32, nonce uint32, blockNumber *big.Int, timestamp *big.Int, gasData GasData) State

NewState creates a new state.

type StateValidationData added in v0.0.245

type StateValidationData interface {
	// Agent returns the agent that submitted the snapshot or attestation.
	Agent() common.Address
	// AgentDomain returns the domain of the agent that submitted the snapshot or attestation.
	AgentDomain() uint32
	// SnapshotPayload returns the snapshot payload.
	SnapshotPayload() []byte
	// SnapshotSignature returns the snapshot signature, if it exists.
	SnapshotSignature() []byte
	// AttestationPayload returns the attestation payload, if it exists.
	AttestationPayload() []byte
	// AttestationSignature returns the attestation signature, if it exists.
	AttestationSignature() []byte
}

StateValidationData provides data necessary for processing states in a snapshot, i.e. verifyState() and submitStateReport() contract calls.

type Tips

type Tips interface {
	// SummitTip gets the tips for the agent work on summit
	SummitTip() *big.Int
	// AttestationTip gets the tips for the doing the attestation
	AttestationTip() *big.Int
	// ExecutionTip gets the tips for executing the message
	ExecutionTip() *big.Int
	// DeliveryTip gets the tips for delivering the message receipt to summit
	DeliveryTip() *big.Int
}

Tips contain tips used for scientizing different agents.

func DecodeTips

func DecodeTips(toDecode []byte) (Tips, error)

DecodeTips decodes a tips typed mem view.

func NewTips

func NewTips(summitTip, attestationTip, executionTip, deliveryTip *big.Int) Tips

NewTips creates a new tips type.

Jump to

Keyboard shortcuts

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