l2chain

package
v0.23.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

README

This is where the bulk of the Ten specific logic is. The entry point is the L2Chain.

Ethereum Blocks and Rollups produced by peers are fed into this datastructure, and it decides which is the canonical chain, it produces rollups, and is able provide information when requested via RPC.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewL1Blockchain

func NewL1Blockchain(genesisJSON []byte, logger gethlog.Logger) *core.BlockChain

NewL1Blockchain creates a Geth BlockChain object. `genesisJSON` is the Genesis block config in JSON format. A Geth node can be made to output this using the `dumpgenesis` startup command.

Types

type BlockIngestionType

type BlockIngestionType struct {
	// IsLatest is true if this block was the canonical head of the L1 chain at the time it was submitted to enclave
	// (if false then we are behind and catching up, expect to be fed another block immediately afterwards)
	IsLatest bool

	// Fork is true if the ingested block is on a different branch to previously known head
	// (resulting in rewinding of one or more blocks that we had previously considered canonical)
	Fork bool

	// PreGenesis is true if there is no stored L1 head block.
	// (L1 head is only stored when there is an L2 state to associate it with. Soon we will start consuming from the
	// genesis block and then, we should only see one block ingested in a 'PreGenesis' state)
	PreGenesis bool
}

type ObscuroChain

type ObscuroChain interface {
	// AccountOwner - returns the account that owns the address.
	// For EOA - the actual address.
	// For Contracts - the address of the deployer.
	// Note - this might be subject to change if we implement a more flexible mechanism
	AccountOwner(address gethcommon.Address, blockNumber *gethrpc.BlockNumber) (*gethcommon.Address, error)

	// GetBalanceAtBlock - will return the balance of a specific address at the specific given block number (batch number).
	GetBalanceAtBlock(accountAddr gethcommon.Address, blockNumber *gethrpc.BlockNumber) (*hexutil.Big, error)

	// ObsCall - The interface for executing eth_call RPC commands against obscuro.
	ObsCall(apiArgs *gethapi.TransactionArgs, blockNumber *gethrpc.BlockNumber) (*gethcore.ExecutionResult, error)

	// ObsCallAtBlock - Execute eth_call RPC against obscuro for a specific block (batch) number.
	ObsCallAtBlock(apiArgs *gethapi.TransactionArgs, blockNumber *gethrpc.BlockNumber) (*gethcore.ExecutionResult, error)

	// GetChainStateAtTransaction - returns the stateDB after applying all the transactions in the batch leading to the desired transaction.
	GetChainStateAtTransaction(batch *core.Batch, txIndex int, reexec uint64) (*gethcore.Message, vm.BlockContext, *state.StateDB, error)
}

ObscuroChain - the interface that provides the data access layer to the obscuro l2. Operations here should be read only.

func NewChain

func NewChain(
	storage storage.Storage,
	gethEncodingService gethencoding.EncodingService,
	chainConfig *params.ChainConfig,
	genesis *genesis.Genesis,
	logger gethlog.Logger,
	registry components.BatchRegistry,
	gasEstimationCap uint64,
) ObscuroChain

Jump to

Keyboard shortcuts

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