common

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

README

This package defines the interface between the node host and the node enclave. Any code required for communication between the host and the enclave (e.g. RPC, encoding/decoding, the enclave API) should be placed here.

Documentation

Index

Constants

View Source
const (
	UserIDRequestCQMethod           = "0x0000000000000000000000000000000000000001"
	ListPrivateTransactionsCQMethod = "0x0000000000000000000000000000000000000002"
)

CustomQuery methods

View Source
const (
	L2GenesisHeight = uint64(0)
	L1GenesisHeight = uint64(0)
	L2GenesisSeqNo  = uint64(1)
	// HeightCommittedBlocks is the number of blocks deep a transaction must be to be considered safe from reorganisations.
	HeightCommittedBlocks = 15
)

Variables

View Source
var (
	Wei   = big.NewInt(1)
	GWei  = big.NewInt(1e9)
	Token = big.NewInt(1e18)
)

These are the multipliers for ERC20 and native ETH value denominations Example: To get the wei value of an amount in whole tokens, use

new(big.Int).Mul(value, big.NewInt(common.Token))
View Source
var GethGenesisParentHash = common.Hash{}

Functions

func ExtractPotentialAddress

func ExtractPotentialAddress(hash gethcommon.Hash) *gethcommon.Address

ExtractPotentialAddress - given a 32 byte hash , it checks whether it can be an address and extracts that

func MaxInt

func MaxInt(x, y uint32) uint32

func RandomStr

func RandomStr(n int) string

Generates a random string n characters long.

func ShortAddress

func ShortAddress(address gethcommon.Address) uint64

ShortAddress converts the address to a shorter uint64 for printing.

func ShortHash

func ShortHash(hash gethcommon.Hash) uint64

ShortHash converts the hash to a shorter uint64 for printing.

func ShortNonce

func ShortNonce(nonce types.BlockNonce) uint64

ShortNonce converts the nonce to a shorter uint64 for printing.

func ToCriteria added in v0.24.0

func ToCriteria(jsonCriteria FilterCriteriaJSON) filters.FilterCriteria

func ValueInWei

func ValueInWei(tokenAmount *big.Int) *big.Int

ValueInWei converts a quantity of tokens (e.g. 20.5 HOC) to the integer value in wei (e.g. 2.05 x 10^19 HOC-wei)

Types

type AttestationReport

type AttestationReport struct {
	Report      []byte         // the signed bytes of the report which includes some encrypted identifying data
	PubKey      []byte         // a public key that can be used to send encrypted data back to the TEE securely (should only be used once Report has been verified)
	EnclaveID   common.Address // address identifying the owner of the TEE which signed this report, can also be verified from the encrypted Report data
	HostAddress string         // the IP address on which the host can be contacted by other Obscuro hosts for peer-to-peer communication
}

AttestationReport represents a signed attestation report from a TEE and some metadata about the source of it to verify it

func DecodeAttestation

func DecodeAttestation(encoded EncodedAttestationReport) (*AttestationReport, error)

type BatchHeader

type BatchHeader struct {
	ParentHash       L2BatchHash    `json:"parentHash"`
	Root             StateRoot      `json:"stateRoot"`
	TxHash           common.Hash    `json:"transactionsRoot"`
	ReceiptHash      common.Hash    `json:"receiptsRoot"`
	Number           *big.Int       `json:"number"`           // height of the batch
	SequencerOrderNo *big.Int       `json:"sequencerOrderNo"` // multiple batches can be created with the same height in case of L1 reorgs. The sequencer is responsible for including all of them in the rollups.
	GasLimit         uint64         `json:"gasLimit"`
	GasUsed          uint64         `json:"gasUsed"`
	Time             uint64         `json:"timestamp"`
	Extra            []byte         `json:"extraData"`
	BaseFee          *big.Int       `json:"baseFee"`
	Coinbase         common.Address `json:"coinbase"`

	// The custom Ten fields.
	L1Proof                       L1BlockHash                           `json:"l1Proof"` // the L1 block used by the enclave to generate the current batch
	Signature                     []byte                                `json:"signature"`
	CrossChainMessages            []MessageBus.StructsCrossChainMessage `json:"crossChainMessages"`
	LatestInboundCrossChainHash   common.Hash                           `json:"inboundCrossChainHash"`   // The block hash of the latest block that has been scanned for cross chain messages.
	LatestInboundCrossChainHeight *big.Int                              `json:"inboundCrossChainHeight"` // The block height of the latest block that has been scanned for cross chain messages.
	CrossChainRoot                common.Hash                           `json:"crossChainTreeHash"`      // This is the root hash of a merkle tree, built from all the cross chain messages and transfers that need to go on MainNet.
	CrossChainTree                SerializedCrossChainTree              `json:"crossChainTree"`          // Those are the leafs of the merkle tree hashed for privacy. Necessary for clients to be able to build proofs as they have no access to all transactions in a batch or their receipts.
}

BatchHeader is a public / plaintext struct that holds common properties of batches. Making changes to this struct will require GRPC + GRPC Converters regen

func (*BatchHeader) Hash

func (b *BatchHeader) Hash() L2BatchHash

Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding excluding the signature.

func (*BatchHeader) IsGenesis added in v0.25.0

func (b *BatchHeader) IsGenesis() bool

IsGenesis indicates whether the batch is the genesis batch. todo (#718) - Change this to a check against a hardcoded genesis hash.

func (*BatchHeader) MarshalJSON

func (b *BatchHeader) MarshalJSON() ([]byte, error)

MarshalJSON custom marshals the BatchHeader into a json

func (*BatchHeader) UnmarshalJSON

func (b *BatchHeader) UnmarshalJSON(data []byte) error

type BatchListingResponse

type BatchListingResponse struct {
	BatchesData []PublicBatch
	Total       uint64
}

type BatchListingResponseDeprecated added in v0.24.0

type BatchListingResponseDeprecated struct {
	BatchesData []PublicBatchDeprecated
	Total       uint64
}

type BatchRequest

type BatchRequest struct {
	Requester string   // The address of the requester, used to direct the response
	FromSeqNo *big.Int // The requester's view of the current head seq no, or nil if they haven't stored any batches.
}

BatchRequest is used when requesting a range of batches from a peer.

type BlockAndReceipts

type BlockAndReceipts struct {
	Block       *L1Block
	ReceiptsMap map[int]*types.Receipt // sparse map with obscuro-relevant receipts in it
	Receipts    *types.Receipts
	// contains filtered or unexported fields
}

BlockAndReceipts - a structure that contains a fuller view of a block. It allows iterating over the successful transactions, using the receipts. The receipts are bundled in the host node and thus verification is performed over their correctness. To work properly, all of the receipts are required, due to rlp encoding pruning some of the information. The receipts must also be in the correct order.

func ParseBlockAndReceipts

func ParseBlockAndReceipts(block *L1Block, receipts *L1Receipts) (*BlockAndReceipts, error)

ParseBlockAndReceipts - will create a container struct that has preprocessed the receipts and verified if they indeed match the receipt root hash in the block.

func (*BlockAndReceipts) SuccessfulTransactions

func (br *BlockAndReceipts) SuccessfulTransactions() *types.Transactions

SuccessfulTransactions - returns slice containing only the transactions that have receipts with successful status.

type BlockListingResponse

type BlockListingResponse struct {
	BlocksData []PublicBlock
	Total      uint64
}

type BlockSubmissionResponse

type BlockSubmissionResponse struct {
	ProducedSecretResponses []*ProducedSecretResponse // The responses to any secret requests in the ingested L1 block.
	RejectError             *errutil.BlockRejectError // If block was rejected, contains information about what block to submit next.
}

BlockSubmissionResponse is the response sent from the enclave back to the node after ingesting a block

type CalldataRollupHeader

type CalldataRollupHeader struct {
	FirstBatchSequence    *big.Int
	FirstCanonBatchHeight *big.Int
	FirstCanonParentHash  L2BatchHash

	Coinbase common.Address
	BaseFee  *big.Int
	GasLimit uint64

	StartTime       uint64
	BatchTimeDeltas [][]byte // todo - minimize assuming a default of 1 sec and then store only exceptions

	L1HeightDeltas [][]byte // delta of the block height. Stored as a byte array because rlp can't encode negative numbers

	ReOrgs [][]byte `rlp:"optional"` // sparse list of reorged headers - non null only for reorgs.
}

CalldataRollupHeader contains all information necessary to reconstruct the batches included in the rollup. This data structure is serialised, compressed, and encrypted, before being serialised again in the rollup.

type ChainFork

type ChainFork struct {
	NewCanonical *types.Block
	OldCanonical *types.Block

	CommonAncestor   *types.Block
	CanonicalPath    []L1BlockHash
	NonCanonicalPath []L1BlockHash
}

ChainFork - represents the result of walking the chain when processing a fork

func (*ChainFork) IsFork

func (cf *ChainFork) IsFork() bool

func (*ChainFork) String

func (cf *ChainFork) String() string

type CrossChainMessages

type CrossChainMessages = []CrossChainMessage

type Enclave

type Enclave interface {
	EnclaveScan

	// Status checks whether the enclave is ready to process requests - only implemented by the RPC layer
	Status(context.Context) (Status, SystemError)

	// Attestation - Produces an attestation report which will be used to request the shared secret from another enclave.
	Attestation(context.Context) (*AttestationReport, SystemError)

	// GenerateSecret - the genesis enclave is responsible with generating the secret entropy
	GenerateSecret(context.Context) (EncryptedSharedEnclaveSecret, SystemError)

	// InitEnclave - initialise an enclave with a seed received by another enclave
	InitEnclave(ctx context.Context, secret EncryptedSharedEnclaveSecret) SystemError

	// EnclaveID - returns the enclave's ID
	EnclaveID(context.Context) (EnclaveID, SystemError)

	// SubmitL1Block - Used for the host to submit L1 blocks to the enclave, these may be:
	//  a. historic block - if the enclave is behind and in the process of catching up with the L1 state
	//  b. the latest block published by the L1, to which the enclave should respond with a rollup
	// It is the responsibility of the host to gossip the returned rollup
	// For good functioning the caller should always submit blocks ordered by height
	// submitting a block before receiving ancestors of it, will result in it being ignored
	SubmitL1Block(ctx context.Context, block *L1Block, receipts L1Receipts, isLatest bool) (*BlockSubmissionResponse, SystemError)

	// SubmitTx - user transactions
	SubmitTx(ctx context.Context, tx EncryptedTx) (*responses.RawTx, SystemError)

	// SubmitBatch submits a batch received from the sequencer for processing.
	SubmitBatch(ctx context.Context, batch *ExtBatch) SystemError

	// ObsCall - Execute a smart contract to retrieve data. The equivalent of "Eth_call"
	// Todo - return the result with a block delay. To prevent frontrunning.
	ObsCall(ctx context.Context, encryptedParams EncryptedParamsCall) (*responses.Call, SystemError)

	// GetTransactionCount returns the nonce of the wallet with the given address (encrypted with the acc viewing key)
	GetTransactionCount(ctx context.Context, encryptedParams EncryptedParamsGetTxCount) (*responses.TxCount, SystemError)

	// Stop gracefully stops the enclave
	Stop() SystemError

	// GetTransaction returns a transaction in JSON format, encrypted with the viewing key for the transaction's `from` field.
	GetTransaction(ctx context.Context, encryptedParams EncryptedParamsGetTxByHash) (*responses.TxByHash, SystemError)

	// GetTransactionReceipt returns a transaction receipt given its signed hash, or nil if the transaction is unknown
	GetTransactionReceipt(ctx context.Context, encryptedParams EncryptedParamsGetTxReceipt) (*responses.TxReceipt, SystemError)

	// GetBalance returns the balance of the address on the Obscuro network, encrypted with the viewing key for the
	// address.
	GetBalance(ctx context.Context, encryptedParams EncryptedParamsGetBalance) (*responses.Balance, SystemError)

	// GetCode returns the code stored at the given address in the state for the given rollup hash.
	GetCode(ctx context.Context, address gethcommon.Address, rollupHash *gethcommon.Hash) ([]byte, SystemError)

	GetStorageSlot(ctx context.Context, encryptedParams EncryptedParamsGetStorageSlot) (*responses.EnclaveResponse, SystemError)

	// Subscribe adds a log subscription to the enclave under the given ID, provided the request is authenticated
	// correctly. The events will be populated in the BlockSubmissionResponse. If there is an existing subscription
	// with the given ID, it is overwritten.
	Subscribe(ctx context.Context, id rpc.ID, encryptedParams EncryptedParamsLogSubscription) SystemError

	// Unsubscribe removes the log subscription with the given ID from the enclave. If there is no subscription with
	// the given ID, nothing is deleted.
	Unsubscribe(id rpc.ID) SystemError

	// StopClient stops the enclave client if one exists - only implemented by the RPC layer
	StopClient() SystemError

	// EstimateGas tries to estimate the gas needed to execute a specific transaction based on the pending state.
	EstimateGas(ctx context.Context, encryptedParams EncryptedParamsEstimateGas) (*responses.Gas, SystemError)

	// GetLogs returns all the logs matching the filter.
	GetLogs(ctx context.Context, encryptedParams EncryptedParamsGetLogs) (*responses.Logs, SystemError)

	// HealthCheck returns whether the enclave is in a healthy state
	HealthCheck(context.Context) (bool, SystemError)

	// GetBatch - retrieve a batch if existing within the enclave db.
	GetBatch(ctx context.Context, hash L2BatchHash) (*ExtBatch, SystemError)

	// GetBatchBySeqNo - retrieve batch by sequencer number if it's in the db.
	GetBatchBySeqNo(ctx context.Context, seqNo uint64) (*ExtBatch, SystemError)

	// GetRollupData - retrieve the first batch sequence and start time for a given rollup.
	GetRollupData(ctx context.Context, hash L2RollupHash) (*PublicRollupMetadata, SystemError)

	// CreateBatch - creates a new head batch extending the previous one for the latest known L1 head if the node is
	// a sequencer. Will panic otherwise.
	CreateBatch(ctx context.Context, skipIfEmpty bool) SystemError

	// CreateRollup - will create a new rollup by going through the sequencer if the node is a sequencer
	// or panic otherwise.
	CreateRollup(ctx context.Context, fromSeqNo uint64) (*ExtRollup, SystemError)

	// DebugTraceTransaction returns the trace of a transaction
	DebugTraceTransaction(ctx context.Context, hash gethcommon.Hash, config *tracers.TraceConfig) (json.RawMessage, SystemError)

	// StreamL2Updates - will stream any new batches as they are created/detected
	// All will be queued in the channel that has been returned.
	StreamL2Updates() (chan StreamL2UpdatesResponse, func())
	// DebugEventLogRelevancy returns the logs of a transaction
	DebugEventLogRelevancy(ctx context.Context, hash gethcommon.Hash) (json.RawMessage, SystemError)

	ExportCrossChainData(context.Context, uint64, uint64) (*ExtCrossChainBundle, SystemError)
}

Enclave represents the API of the service that runs inside the TEE.

type EnclaveID added in v0.21.0

type EnclaveID = common.Address

type EnclavePublicConfig

type EnclavePublicConfig struct {
	L2MessageBusAddress gethcommon.Address
}

type EnclaveScan

type EnclaveScan interface {
	// GetTotalContractCount returns the total number of contracts that have been deployed
	GetTotalContractCount(context.Context) (*big.Int, SystemError)

	// GetPersonalTransactions returns the user's recent transactions according to specified pagination
	GetPersonalTransactions(ctx context.Context, encryptedParams EncryptedParamsGetPersonalTransactions) (*responses.PersonalTransactionsResponse, SystemError)

	// EnclavePublicConfig returns network data that is known to the enclave but can be shared publicly
	EnclavePublicConfig(context.Context) (*EnclavePublicConfig, SystemError)
}

EnclaveScan represents the methods that are used for data scanning in the enclave

type EncodedAttestationReport

type EncodedAttestationReport []byte

type EncodedBatchMsg

type EncodedBatchMsg []byte

type EncodedBatchRequest

type EncodedBatchRequest []byte

type EncodedL1Block

type EncodedL1Block []byte

EncodedL1Block the encoded version of an L1 block.

func EncodeBlock

func EncodeBlock(b *types.Block) (EncodedL1Block, error)

func (EncodedL1Block) DecodeBlock

func (eb EncodedL1Block) DecodeBlock() (*types.Block, error)

type EncodedRollup

type EncodedRollup []byte

func EncodeRollup

func EncodeRollup(r *ExtRollup) (EncodedRollup, error)

type EncryptedParamsCall

type EncryptedParamsCall []byte // As above, but for an RPC call request.

type EncryptedParamsEstimateGas

type EncryptedParamsEstimateGas []byte // As above, but for an RPC estimateGas request.

type EncryptedParamsGetBalance

type EncryptedParamsGetBalance []byte // The params for an RPC getBalance request, as a JSON object encrypted with the public key of the enclave.

type EncryptedParamsGetLogs

type EncryptedParamsGetLogs []byte // As above, but for an RPC getLogs request.

type EncryptedParamsGetPersonalTransactions added in v0.26.0

type EncryptedParamsGetPersonalTransactions []byte

type EncryptedParamsGetStorageSlot added in v0.26.0

type EncryptedParamsGetStorageSlot []byte

type EncryptedParamsGetTxByHash

type EncryptedParamsGetTxByHash []byte // As above, but for an RPC getTransactionByHash request.

type EncryptedParamsGetTxCount

type EncryptedParamsGetTxCount []byte // As above, but for an RPC getTransactionCount request.

type EncryptedParamsGetTxReceipt

type EncryptedParamsGetTxReceipt []byte // As above, but for an RPC getTransactionReceipt request.

type EncryptedParamsLogSubscription

type EncryptedParamsLogSubscription []byte // As above, but for an RPC logs subscription request.

type EncryptedParamsSendRawTx

type EncryptedParamsSendRawTx []byte // As above, but for an RPC sendRawTransaction request.

type EncryptedSharedEnclaveSecret

type EncryptedSharedEnclaveSecret []byte

type EncryptedSubscriptionLogs

type EncryptedSubscriptionLogs = map[rpc.ID][]byte

EncryptedSubscriptionLogs - Alias for the event subscription updates going out of the enclave.

type EncryptedTransactions

type EncryptedTransactions []byte // A blob of encrypted transactions, as they're stored in the rollup, with the nonce prepended.

type EncryptedTx

type EncryptedTx []byte // A single transaction, encoded as a JSON list of transaction binary hexes and encrypted using the enclave's public key

type ExtBatch

type ExtBatch struct {
	Header *BatchHeader
	// todo - remove and replace with enclave API
	TxHashes        []TxHash // The hashes of the transactions included in the batch.
	EncryptedTxBlob EncryptedTransactions
	// contains filtered or unexported fields
}

ExtBatch is an encrypted form of batch used when passing the batch around outside of an enclave. todo (#718) - expand this structure to contain the required fields.

func DecodeExtBatch

func DecodeExtBatch(encoded []byte) (*ExtBatch, error)

func (*ExtBatch) Encoded

func (b *ExtBatch) Encoded() ([]byte, error)

func (*ExtBatch) Hash

func (b *ExtBatch) Hash() L2BatchHash

Hash returns the keccak256 hash of the batch's header. The hash is computed on the first call and cached thereafter.

func (*ExtBatch) SDump

func (b *ExtBatch) SDump() string

func (*ExtBatch) SeqNo added in v0.24.0

func (b *ExtBatch) SeqNo() *big.Int

type ExtCrossChainBundle added in v0.24.1

type ExtCrossChainBundle struct {
	LastBatchHash        gethcommon.Hash
	Signature            []byte
	L1BlockHash          gethcommon.Hash // The block hash that's expected to be canonical on signature submission
	L1BlockNum           *big.Int        // The number of the block that has the block hash. This is used to verify the block hash.
	CrossChainRootHashes [][]byte        // The CrossChainRoots of the batches that are being submitted
}

func (ExtCrossChainBundle) HashPacked added in v0.24.1

func (bundle ExtCrossChainBundle) HashPacked() common.Hash

type ExtRollup

type ExtRollup struct {
	Header               *RollupHeader // the fields required by the management contract
	CalldataRollupHeader []byte        // encrypted header useful for recreating the batches
	BatchPayloads        []byte        // The transactions included in the rollup, in external/encrypted form.
	// contains filtered or unexported fields
}

ExtRollup is an encrypted form of rollup used when passing the rollup around outside an enclave.

func DecodeRollup

func DecodeRollup(encoded EncodedRollup) (*ExtRollup, error)

func (*ExtRollup) Hash

func (r *ExtRollup) Hash() L2RollupHash

Hash returns the keccak256 hash of the rollup's header. The hash is computed on the first call and cached thereafter.

type FilterCriteria added in v0.24.0

type FilterCriteria ethereum.FilterQuery

FilterCriteria represents a request to create a new filter. Same as ethereum.FilterQuery but with UnmarshalJSON() method. duplicated from geth to tweak the unmarshalling

func (*FilterCriteria) UnmarshalJSON added in v0.24.0

func (args *FilterCriteria) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *args fields with given data.

type FilterCriteriaJSON

type FilterCriteriaJSON struct {
	BlockHash *common.Hash     `json:"blockHash"`
	FromBlock *rpc.BlockNumber `json:"fromBlock"`
	ToBlock   *rpc.BlockNumber `json:"toBlock"`
	Addresses []common.Address `json:"addresses"`
	Topics    [][]common.Hash  `json:"topics"`
}

FilterCriteriaJSON is a structure that JSON-serialises to a format that can be successfully deserialised into a filters.FilterCriteria object (round-tripping a filters.FilterCriteria to JSON and back doesn't work, due to a custom serialiser implemented by filters.FilterCriteria).

func SerializableFilterCriteria added in v0.25.0

func SerializableFilterCriteria(crit FilterCriteria) FilterCriteriaJSON

type FinalityType

type FinalityType string
const (
	MempoolPending FinalityType = "Pending"
	BatchFinal     FinalityType = "Final"
)

type L1Address

type L1Address = common.Address

MainNet aliases

type L1Block

type L1Block = types.Block

type L1BlockHash

type L1BlockHash = common.Hash

type L1Receipt

type L1Receipt = types.Receipt

type L1Receipts

type L1Receipts = types.Receipts

type L1Transaction

type L1Transaction = types.Transaction

type L2Address

type L2Address = common.Address

type L2BatchHash

type L2BatchHash = common.Hash

Local Obscuro aliases

type L2PricedTransaction added in v0.21.0

type L2PricedTransaction struct {
	Tx             *L2Tx
	PublishingCost *big.Int
}

type L2PricedTransactions added in v0.21.0

type L2PricedTransactions []L2PricedTransaction

func (L2PricedTransactions) ToTransactions added in v0.21.0

func (txs L2PricedTransactions) ToTransactions() types.Transactions

type L2Receipt

type L2Receipt = types.Receipt

type L2Receipts

type L2Receipts = types.Receipts

type L2RollupHash

type L2RollupHash = common.Hash

type L2Transactions

type L2Transactions = types.Transactions

type L2Tx

type L2Tx = types.Transaction

type L2TxHash

type L2TxHash = common.Hash

type Latency

type Latency func() time.Duration

type ListPrivateTransactionsQueryParams added in v0.25.0

type ListPrivateTransactionsQueryParams struct {
	Address    common.Address  `json:"address"`
	Pagination QueryPagination `json:"pagination"`
}

type LogSubscription

type LogSubscription struct {
	// ViewingKey - links this subscription request to an externally owed account
	ViewingKey *viewingkey.RPCSignedViewingKey

	// A subscriber-defined filter to apply to the stream of logs.
	Filter *FilterCriteriaJSON
}

LogSubscription is an authenticated subscription to logs.

func CreateAuthenticatedLogSubscriptionPayload added in v0.24.1

func CreateAuthenticatedLogSubscriptionPayload(args []interface{}, vk *viewingkey.ViewingKey) (*LogSubscription, error)

type NodeType

type NodeType int

NodeType represents the type of the node.

const (
	Sequencer NodeType = iota
	Validator
	Unknown
)

func ToNodeType

func ToNodeType(s string) (NodeType, error)

func (NodeType) String

func (n NodeType) String() string

type Nonce

type Nonce = uint64

type ObscuroNetworkInfo

type ObscuroNetworkInfo struct {
	ManagementContractAddress common.Address
	L1StartHash               common.Hash
	MessageBusAddress         common.Address
	L2MessageBusAddress       common.Address
	ImportantContracts        map[string]common.Address // map of contract name to address
}

type PrivateTransactionsQueryResponse added in v0.25.0

type PrivateTransactionsQueryResponse struct {
	Receipts types.Receipts
	Total    uint64
}

type ProducedSecretResponse

type ProducedSecretResponse struct {
	Secret      []byte
	RequesterID gethcommon.Address // enclaveID of the enclave that requested the secret
	AttesterID  gethcommon.Address // enclaveID of the enclave that produced the secret
	HostAddress string
}

ProducedSecretResponse contains the data to publish to L1 in response to a secret request discovered while processing an L1 block

type PublicBatch

type PublicBatch struct {
	SequencerOrderNo *big.Int              `json:"sequence"`
	FullHash         common.Hash           `json:"fullHash"`
	Height           *big.Int              `json:"height"`
	TxCount          *big.Int              `json:"txCount"`
	Header           *BatchHeader          `json:"header"`
	EncryptedTxBlob  EncryptedTransactions `json:"encryptedTxBlob"`
}

type PublicBatchDeprecated added in v0.24.0

type PublicBatchDeprecated struct {
	BatchHeader
	TxHashes []TxHash `json:"txHashes"`
}

TODO (@will) remove when tenscan UI has been updated

type PublicBlock

type PublicBlock struct {
	BlockHeader types.Header `json:"blockHeader"`
	RollupHash  common.Hash  `json:"rollupHash"`
}

type PublicRollup added in v0.24.0

type PublicRollup struct {
	ID        *big.Int
	Hash      string
	FirstSeq  *big.Int
	LastSeq   *big.Int
	Timestamp uint64
	Header    *RollupHeader
	L1Hash    string
}

type PublicRollupMetadata added in v0.24.0

type PublicRollupMetadata struct {
	FirstBatchSequence *big.Int
	StartTime          uint64
}

PublicRollupMetadata contains internal rollup data that can be requested from the enclave.

type PublicTransaction

type PublicTransaction struct {
	TransactionHash TxHash
	BatchHeight     *big.Int
	BatchTimestamp  uint64
	Finality        FinalityType
}

type QueryPagination

type QueryPagination struct {
	Offset uint64
	Size   uint
}

func (*QueryPagination) UnmarshalJSON

func (p *QueryPagination) UnmarshalJSON(data []byte) error

type RollupHeader

type RollupHeader struct {
	CompressionL1Head L1BlockHash // the l1 block that the sequencer considers canonical at the time when this rollup is created

	CrossChainMessages []MessageBus.StructsCrossChainMessage `json:"crossChainMessages"`

	PayloadHash common.Hash // The hash of the compressed batches. TODO
	Signature   []byte      // The signature of the sequencer enclave on the payload hash

	LastBatchSeqNo uint64
}

RollupHeader is a public / plaintext struct that holds common properties of rollups. All these fields are processed by the Management contract

func (*RollupHeader) Hash

func (r *RollupHeader) Hash() L2RollupHash

Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding excluding the signature.

func (*RollupHeader) MarshalJSON

func (r *RollupHeader) MarshalJSON() ([]byte, error)

MarshalJSON custom marshals the RollupHeader into a json

type RollupListingResponse added in v0.24.0

type RollupListingResponse struct {
	RollupsData []PublicRollup
	Total       uint64
}

type SerializedCrossChainTree added in v0.24.1

type SerializedCrossChainTree = []byte

type StateRoot

type StateRoot = common.Hash

type Status

type Status struct {
	StatusCode StatusCode
	L1Head     gethcommon.Hash
	L2Head     *big.Int
}

Status represents the enclave's current state - whether the enclave is healthy and ready to process requests, as well as its latest known heads for the L1 and L2 chains

type StatusCode

type StatusCode int
const (
	Running        StatusCode = iota // the enclave is running, accepting L1 blocks
	AwaitingSecret                   // the enclave has not received the network secret and cannot process L1 blocks
	Unavailable                      // the enclave is unavailable (no guarantee it will self-recover)
)

type StreamL2UpdatesResponse

type StreamL2UpdatesResponse struct {
	Batch *ExtBatch
	Logs  EncryptedSubscriptionLogs
}

StreamL2UpdatesResponse - the struct encoded for each response message when streaming batches out of the enclave. The properties inside need to be encrypted according to the privacy rules.

type SystemError

type SystemError interface {
	Error() string
}

SystemError is the interface for the internal errors generated in the Enclave and consumed by the Host

type TransactionListingResponse

type TransactionListingResponse struct {
	TransactionsData []PublicTransaction
	Total            uint64
}

type TxHash

type TxHash = common.Hash

type ValueTransferEvent

type ValueTransferEvent struct {
	Sender   common.Address
	Receiver common.Address
	Amount   *big.Int
	Sequence uint64
}

type ValueTransferEvents

type ValueTransferEvents = []ValueTransferEvent

Directories

Path Synopsis
rpc
nolint
nolint
native
// Package native: This file was copied/adapted from geth - go-ethereum/eth/tracers // // // Copyright 2021 The go-ethereum Authors // This file is part of the go-ethereum library.
// Package native: This file was copied/adapted from geth - go-ethereum/eth/tracers // // // Copyright 2021 The go-ethereum Authors // This file is part of the go-ethereum library.

Jump to

Keyboard shortcuts

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