Documentation
      ¶
    
    
  
    
  
    Index ¶
- type Config
 - type EthClient
 - type EthClientMock
 - func (_m *EthClientMock) EXPECT() *EthClientMock_Expecter
 - func (_m *EthClientMock) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
 - func (_m *EthClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
 - func (_m *EthClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
 
- type EthClientMock_Expecter
 - func (_e *EthClientMock_Expecter) HeaderByHash(ctx interface{}, hash interface{}) *EthClientMock_HeaderByHash_Call
 - func (_e *EthClientMock_Expecter) HeaderByNumber(ctx interface{}, number interface{}) *EthClientMock_HeaderByNumber_Call
 - func (_e *EthClientMock_Expecter) SubscribeNewHead(ctx interface{}, ch interface{}) *EthClientMock_SubscribeNewHead_Call
 
- type EthClientMock_HeaderByHash_Call
 - func (_c *EthClientMock_HeaderByHash_Call) Return(_a0 *types.Header, _a1 error) *EthClientMock_HeaderByHash_Call
 - func (_c *EthClientMock_HeaderByHash_Call) Run(run func(ctx context.Context, hash common.Hash)) *EthClientMock_HeaderByHash_Call
 - func (_c *EthClientMock_HeaderByHash_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Header, error)) *EthClientMock_HeaderByHash_Call
 
- type EthClientMock_HeaderByNumber_Call
 - func (_c *EthClientMock_HeaderByNumber_Call) Return(_a0 *types.Header, _a1 error) *EthClientMock_HeaderByNumber_Call
 - func (_c *EthClientMock_HeaderByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *EthClientMock_HeaderByNumber_Call
 - func (_c *EthClientMock_HeaderByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Header, error)) *EthClientMock_HeaderByNumber_Call
 
- type EthClientMock_SubscribeNewHead_Call
 - func (_c *EthClientMock_SubscribeNewHead_Call) Return(_a0 ethereum.Subscription, _a1 error) *EthClientMock_SubscribeNewHead_Call
 - func (_c *EthClientMock_SubscribeNewHead_Call) Run(run func(ctx context.Context, ch chan<- *types.Header)) *EthClientMock_SubscribeNewHead_Call
 - func (_c *EthClientMock_SubscribeNewHead_Call) RunAndReturn(run func(context.Context, chan<- *types.Header) (ethereum.Subscription, error)) *EthClientMock_SubscribeNewHead_Call
 
- type Network
 - type ReorgDetector
 - func (rd *ReorgDetector) AddBlockToTrack(ctx context.Context, id string, num uint64, hash common.Hash) error
 - func (rd *ReorgDetector) GetFinalizedBlockType() etherman.BlockNumberFinality
 - func (rd *ReorgDetector) GetLastReorgEvent(ctx context.Context) (ReorgEvent, error)
 - func (rd *ReorgDetector) IsDisabled() bool
 - func (rd *ReorgDetector) Start(ctx context.Context) (err error)
 - func (rd *ReorgDetector) String() string
 - func (rd *ReorgDetector) Subscribe(id string) (*Subscription, error)
 
- type ReorgEvent
 - type Subscription
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
	// DBPath is the path to the database
	DBPath string `mapstructure:"DBPath"`
	// CheckReorgsInterval is the interval to check for reorgs in tracked blocks
	CheckReorgsInterval types.Duration `mapstructure:"CheckReorgsInterval"`
	// FinalizedBlockType indicates the status of the blocks that will be queried in order to sync
	// if finalizedBlock == "LatestBlock" then it's disabled and we assume the network has no chances of reorgs
	FinalizedBlock etherman.BlockNumberFinality `` //nolint:lll
	/* 135-byte string literal not displayed */
}
    Config is the configuration for the reorg detector
func (*Config) GetCheckReorgsInterval ¶
GetCheckReorgsInterval returns the interval to check for reorgs in tracked blocks
type EthClientMock ¶
EthClientMock is an autogenerated mock type for the EthClient type
func NewEthClientMock ¶
func NewEthClientMock(t interface {
	mock.TestingT
	Cleanup(func())
}) *EthClientMock
    NewEthClientMock creates a new instance of EthClientMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*EthClientMock) EXPECT ¶
func (_m *EthClientMock) EXPECT() *EthClientMock_Expecter
func (*EthClientMock) HeaderByHash ¶
HeaderByHash provides a mock function with given fields: ctx, hash
func (*EthClientMock) HeaderByNumber ¶
func (_m *EthClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
HeaderByNumber provides a mock function with given fields: ctx, number
func (*EthClientMock) SubscribeNewHead ¶
func (_m *EthClientMock) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
SubscribeNewHead provides a mock function with given fields: ctx, ch
type EthClientMock_Expecter ¶
type EthClientMock_Expecter struct {
	// contains filtered or unexported fields
}
    func (*EthClientMock_Expecter) HeaderByHash ¶
func (_e *EthClientMock_Expecter) HeaderByHash(ctx interface{}, hash interface{}) *EthClientMock_HeaderByHash_Call
HeaderByHash is a helper method to define mock.On call
- ctx context.Context
 - hash common.Hash
 
func (*EthClientMock_Expecter) HeaderByNumber ¶
func (_e *EthClientMock_Expecter) HeaderByNumber(ctx interface{}, number interface{}) *EthClientMock_HeaderByNumber_Call
HeaderByNumber is a helper method to define mock.On call
- ctx context.Context
 - number *big.Int
 
func (*EthClientMock_Expecter) SubscribeNewHead ¶
func (_e *EthClientMock_Expecter) SubscribeNewHead(ctx interface{}, ch interface{}) *EthClientMock_SubscribeNewHead_Call
SubscribeNewHead is a helper method to define mock.On call
- ctx context.Context
 - ch chan<- *types.Header
 
type EthClientMock_HeaderByHash_Call ¶
EthClientMock_HeaderByHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByHash'
func (*EthClientMock_HeaderByHash_Call) Return ¶
func (_c *EthClientMock_HeaderByHash_Call) Return(_a0 *types.Header, _a1 error) *EthClientMock_HeaderByHash_Call
func (*EthClientMock_HeaderByHash_Call) Run ¶
func (_c *EthClientMock_HeaderByHash_Call) Run(run func(ctx context.Context, hash common.Hash)) *EthClientMock_HeaderByHash_Call
func (*EthClientMock_HeaderByHash_Call) RunAndReturn ¶
func (_c *EthClientMock_HeaderByHash_Call) RunAndReturn(run func(context.Context, common.Hash) (*types.Header, error)) *EthClientMock_HeaderByHash_Call
type EthClientMock_HeaderByNumber_Call ¶
EthClientMock_HeaderByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeaderByNumber'
func (*EthClientMock_HeaderByNumber_Call) Return ¶
func (_c *EthClientMock_HeaderByNumber_Call) Return(_a0 *types.Header, _a1 error) *EthClientMock_HeaderByNumber_Call
func (*EthClientMock_HeaderByNumber_Call) Run ¶
func (_c *EthClientMock_HeaderByNumber_Call) Run(run func(ctx context.Context, number *big.Int)) *EthClientMock_HeaderByNumber_Call
func (*EthClientMock_HeaderByNumber_Call) RunAndReturn ¶
func (_c *EthClientMock_HeaderByNumber_Call) RunAndReturn(run func(context.Context, *big.Int) (*types.Header, error)) *EthClientMock_HeaderByNumber_Call
type EthClientMock_SubscribeNewHead_Call ¶
EthClientMock_SubscribeNewHead_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeNewHead'
func (*EthClientMock_SubscribeNewHead_Call) Return ¶
func (_c *EthClientMock_SubscribeNewHead_Call) Return(_a0 ethereum.Subscription, _a1 error) *EthClientMock_SubscribeNewHead_Call
func (*EthClientMock_SubscribeNewHead_Call) Run ¶
func (_c *EthClientMock_SubscribeNewHead_Call) Run(run func(ctx context.Context, ch chan<- *types.Header)) *EthClientMock_SubscribeNewHead_Call
func (*EthClientMock_SubscribeNewHead_Call) RunAndReturn ¶
func (_c *EthClientMock_SubscribeNewHead_Call) RunAndReturn(run func(context.Context, chan<- *types.Header) (ethereum.Subscription, error)) *EthClientMock_SubscribeNewHead_Call
type ReorgDetector ¶
type ReorgDetector struct {
	// contains filtered or unexported fields
}
    func (*ReorgDetector) AddBlockToTrack ¶
func (rd *ReorgDetector) AddBlockToTrack(ctx context.Context, id string, num uint64, hash common.Hash) error
AddBlockToTrack adds a block to the tracked list for a subscriber
func (*ReorgDetector) GetFinalizedBlockType ¶ added in v0.0.2
func (rd *ReorgDetector) GetFinalizedBlockType() etherman.BlockNumberFinality
GetFinalizedBlockType returns the finalized block name
func (*ReorgDetector) GetLastReorgEvent ¶ added in v0.5.1
func (rd *ReorgDetector) GetLastReorgEvent(ctx context.Context) (ReorgEvent, error)
GetLastReorgEvent returns the the last ReorgEvent stored in reorg_event table
func (*ReorgDetector) IsDisabled ¶ added in v0.0.2
func (rd *ReorgDetector) IsDisabled() bool
func (*ReorgDetector) Start ¶
func (rd *ReorgDetector) Start(ctx context.Context) (err error)
Start starts the reorg detector
func (*ReorgDetector) String ¶ added in v0.0.2
func (rd *ReorgDetector) String() string
func (*ReorgDetector) Subscribe ¶
func (rd *ReorgDetector) Subscribe(id string) (*Subscription, error)
Subscribe subscribes to reorg events
type ReorgEvent ¶ added in v0.1.0
type ReorgEvent struct {
	DetectedAt   int64       `meddler:"detected_at"`
	FromBlock    uint64      `meddler:"from_block"`
	ToBlock      uint64      `meddler:"to_block"`
	SubscriberID string      `meddler:"subscriber_id"`
	TrackedHash  common.Hash `meddler:"tracked_hash,hash"`
	CurrentHash  common.Hash `meddler:"current_hash,hash"`
	Version      string      `meddler:"version"`
}
    type Subscription ¶
Subscription is a subscription to reorg events