Documentation ¶
Index ¶
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 Config ¶
type Config struct { L1Endpoint string L2Endpoint string L2EngineEndpoint string TaikoL1Address common.Address TaikoL2Address common.Address ThrowawayBlocksBuilderPrivKey *ecdsa.PrivateKey JwtSecret string P2PSyncVerifiedBlocks bool }
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 node'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 L2ChainSyncer ¶ added in v0.1.5
type L2ChainSyncer struct {
// contains filtered or unexported fields
}
func NewL2ChainSyncer ¶ added in v0.1.5
func NewL2ChainSyncer( ctx context.Context, rpc *rpc.Client, state *State, throwawayBlocksBuilderPrivKey *ecdsa.PrivateKey, p2pSyncVerifiedBlocks bool, ) (*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 node'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 node's local chain.
func (*L2ChainSyncer) TriggerBeaconSync ¶ added in v0.1.5
func (s *L2ChainSyncer) TriggerBeaconSync() error
TriggerBeaconSync triggers the L2 node 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.