Documentation ¶
Index ¶
- Constants
- func InitFromConfig(ctx context.Context, d *Driver, cfg *Config) (err error)
- type AnchorConstructor
- type BeaconSyncProgressTracker
- func (s *BeaconSyncProgressTracker) ClearMeta()
- func (s *BeaconSyncProgressTracker) HeadChanged(newID *big.Int) bool
- func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockHash() common.Hash
- func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockHeight() *big.Int
- func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockID() *big.Int
- func (s *BeaconSyncProgressTracker) OutOfSync() bool
- func (s *BeaconSyncProgressTracker) Track(ctx context.Context)
- func (s *BeaconSyncProgressTracker) Triggered() bool
- func (s *BeaconSyncProgressTracker) UpdateMeta(id, height *big.Int, blockHash common.Hash)
- type Config
- type Driver
- type HeightOrID
- type L2ChainSyncer
- type State
- type VerifiedHeaderInfo
Constants ¶
const ( // Time to wait before the next try, when receiving subscription errors. RetryDelay = 10 * time.Second MaxReorgDepth = 500 ReorgRollbackDepth = 20 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnchorConstructor ¶ added in v0.1.6
type AnchorConstructor struct {
// contains filtered or unexported fields
}
AnchorConstructor is responsible for assembling the anchor transaction (TaikoL2.anchor) in each L2 block, which is always the first transaction.
func NewAnchorConstructor ¶ added in v0.1.6
func NewAnchorConstructor( rpc *rpc.Client, gasLimit uint64, goldenTouchAddress common.Address, goldenTouchPrivKey string, ) (*AnchorConstructor, error)
NewAnchorConstructor creates a new AnchorConstructor instance.
func (*AnchorConstructor) AssembleAnchorTx ¶ added in v0.1.6
func (c *AnchorConstructor) AssembleAnchorTx( ctx context.Context, l1Height *big.Int, l1Hash common.Hash, l2Height *big.Int, ) (*types.Transaction, error)
AssembleAnchorTx assembles a signed TaikoL2.anchor transaction.
type BeaconSyncProgressTracker ¶ added in v0.1.9
type BeaconSyncProgressTracker struct {
// contains filtered or unexported fields
}
BeaconSyncProgressTracker is responsible for tracking the L2 execution engine's sync progress, after a beacon sync is triggered in it, and check whether the L2 execution is not able to sync through P2P (due to no connected peer or some other reasons).
func NewBeaconSyncProgressTracker ¶ added in v0.1.9
func NewBeaconSyncProgressTracker(c *ethclient.Client, timeout time.Duration) *BeaconSyncProgressTracker
NewBeaconSyncProgressTracker creates a new BeaconSyncProgressTracker instance.
func (*BeaconSyncProgressTracker) ClearMeta ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) ClearMeta()
ClearMeta cleans the inner beacon sync meta data.
func (*BeaconSyncProgressTracker) HeadChanged ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) HeadChanged(newID *big.Int) bool
HeadChanged checks if a new beacon sync request will be needed.
func (*BeaconSyncProgressTracker) LastSyncedVerifiedBlockHash ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockHash() common.Hash
LastSyncedVerifiedBlockHash returns tracker.lastSyncedVerifiedBlockHash.
func (*BeaconSyncProgressTracker) LastSyncedVerifiedBlockHeight ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockHeight() *big.Int
LastSyncedVerifiedBlockHeight returns tracker.lastSyncedVerifiedBlockHeight.
func (*BeaconSyncProgressTracker) LastSyncedVerifiedBlockID ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) LastSyncedVerifiedBlockID() *big.Int
LastSyncedVerifiedBlockID returns tracker.lastSyncedVerifiedBlockID.
func (*BeaconSyncProgressTracker) OutOfSync ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) OutOfSync() bool
OutOfSync tells whether the L2 execution engine is marked as out of sync.
func (*BeaconSyncProgressTracker) Track ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) Track(ctx context.Context)
Track starts the inner event loop, to monitor the sync progress.
func (*BeaconSyncProgressTracker) Triggered ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) Triggered() bool
Triggered returns tracker.triggered.
func (*BeaconSyncProgressTracker) UpdateMeta ¶ added in v0.1.9
func (s *BeaconSyncProgressTracker) UpdateMeta(id, height *big.Int, blockHash common.Hash)
UpdateMeta updates the inner beacon sync meta data.
type Config ¶
type Config struct { L1Endpoint string L2Endpoint string L2EngineEndpoint string TaikoL1Address common.Address TaikoL2Address common.Address ThrowawayBlocksBuilderPrivKey *ecdsa.PrivateKey JwtSecret string P2PSyncVerifiedBlocks bool P2PSyncTimeout time.Duration }
Config contains the configurations to initialize a Taiko driver.
func NewConfigFromCliContext ¶
NewConfigFromCliContext creates a new config instance from the command line inputs.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver keeps the L2 execution engine's local block chain in sync with the TaikoL1 contract.
func (*Driver) ChainSyncer ¶ added in v0.1.5
func (d *Driver) ChainSyncer() *L2ChainSyncer
ChainSyncer returns the driver's chain syncer.
func (*Driver) InitFromCli ¶
New initializes the given driver instance based on the command line flags.
type HeightOrID ¶ added in v0.1.9
HeightOrID contains a block height or a block ID.
func (*HeightOrID) NotEmpty ¶ added in v0.1.9
func (h *HeightOrID) NotEmpty() bool
NotEmpty checks whether this is an empty struct.
type L2ChainSyncer ¶ added in v0.1.5
type L2ChainSyncer struct {
// contains filtered or unexported fields
}
L2ChainSyncer is responsible for keeping the L2 execution engine's local chain in sync with the one in TaikoL1 contract.
func NewL2ChainSyncer ¶ added in v0.1.5
func NewL2ChainSyncer( ctx context.Context, rpc *rpc.Client, state *State, throwawayBlocksBuilderPrivKey *ecdsa.PrivateKey, p2pSyncVerifiedBlocks bool, p2pSyncTimeout time.Duration, ) (*L2ChainSyncer, error)
NewL2ChainSyncer creates a new chain syncer instance.
func (*L2ChainSyncer) AheadOfProtocolVerifiedHead ¶ added in v0.1.5
func (s *L2ChainSyncer) AheadOfProtocolVerifiedHead() bool
AheadOfProtocolVerifiedHead checks whether the L2 chain is ahead of verified head in protocol.
func (*L2ChainSyncer) ProcessL1Blocks ¶ added in v0.1.5
ProcessL1Blocks fetches all `TaikoL1.BlockProposed` events between given L1 block heights, and then tries inserting them into L2 execution engine's block chain.
func (*L2ChainSyncer) Sync ¶ added in v0.1.5
func (s *L2ChainSyncer) Sync(l1End *types.Header) error
Sync performs a sync operation to L2 execution engine's local chain.
func (*L2ChainSyncer) TriggerBeaconSync ¶ added in v0.1.5
func (s *L2ChainSyncer) TriggerBeaconSync() error
TriggerBeaconSync triggers the L2 execution engine to start performing a beacon sync.
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) SubL1HeadsFeed ¶
func (s *State) SubL1HeadsFeed(ch chan *types.Header) event.Subscription
SubL1HeadsFeed registers a subscription of new L1 heads.