2023-09-18 17:05:33 +00:00
package heimdall
2023-01-31 08:30:57 +00:00
import (
"context"
"github.com/ledgerwatch/erigon/consensus/bor/clerk"
"github.com/ledgerwatch/erigon/consensus/bor/heimdall/checkpoint"
2023-09-13 10:49:49 +00:00
"github.com/ledgerwatch/erigon/consensus/bor/heimdall/milestone"
2023-01-31 08:30:57 +00:00
"github.com/ledgerwatch/erigon/consensus/bor/heimdall/span"
2023-09-27 12:17:54 +00:00
"github.com/ledgerwatch/erigon/eth/borfinality/generics"
2023-01-31 08:30:57 +00:00
)
2023-09-27 12:17:54 +00:00
func MilestoneRewindPending ( ) bool {
return generics . BorMilestoneRewind . Load ( ) != nil && * generics . BorMilestoneRewind . Load ( ) != 0
}
2023-01-31 08:30:57 +00:00
//go:generate mockgen -destination=../../tests/bor/mocks/IHeimdallClient.go -package=mocks . IHeimdallClient
type IHeimdallClient interface {
StateSyncEvents ( ctx context . Context , fromID uint64 , to int64 ) ( [ ] * clerk . EventRecordWithTime , error )
Span ( ctx context . Context , spanID uint64 ) ( * span . HeimdallSpan , error )
FetchCheckpoint ( ctx context . Context , number int64 ) ( * checkpoint . Checkpoint , error )
FetchCheckpointCount ( ctx context . Context ) ( int64 , error )
2023-09-13 10:49:49 +00:00
FetchMilestone ( ctx context . Context ) ( * milestone . Milestone , error )
FetchMilestoneCount ( ctx context . Context ) ( int64 , error )
FetchNoAckMilestone ( ctx context . Context , milestoneID string ) error //Fetch the bool value whether milestone corresponding to the given id failed in the Heimdall
FetchLastNoAckMilestone ( ctx context . Context ) ( string , error ) //Fetch latest failed milestone id
FetchMilestoneID ( ctx context . Context , milestoneID string ) error //Fetch the bool value whether milestone corresponding to the given id is in process in Heimdall
2023-01-31 08:30:57 +00:00
Close ( )
}
2023-07-28 13:03:32 +00:00
type HeimdallServer interface {
StateSyncEvents ( ctx context . Context , fromID uint64 , to int64 , limit int ) ( uint64 , [ ] * clerk . EventRecordWithTime , error )
Span ( ctx context . Context , spanID uint64 ) ( * span . HeimdallSpan , error )
FetchCheckpoint ( ctx context . Context , number int64 ) ( * checkpoint . Checkpoint , error )
FetchCheckpointCount ( ctx context . Context ) ( int64 , error )
2023-09-13 10:49:49 +00:00
FetchMilestone ( ctx context . Context ) ( * milestone . Milestone , error )
FetchMilestoneCount ( ctx context . Context ) ( int64 , error )
FetchNoAckMilestone ( ctx context . Context , milestoneID string ) error
FetchLastNoAckMilestone ( ctx context . Context ) ( string , error )
FetchMilestoneID ( ctx context . Context , milestoneID string ) error
2023-07-28 13:03:32 +00:00
Close ( )
}