sync

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorMemoryPageNotFound = errors.New("memory page not found")
	ErrorFactAlreadySaved   = errors.New("fact already saved")
)

Functions

func NewApiCollector

func NewApiCollector(manager *sync.Manager, feeder *feeder.Client) *apiCollector

NewApiCollector create a new api Collector notest

func NewL1Collector

func NewL1Collector(manager *sync.Manager, feeder *feeder.Client, l1client L1Client, chainID int) *l1Collector

NewL1Collector creates a new Ethereum Collector. notest

Types

type CollectorDiff

type CollectorDiff struct {
	Code map[string]*starknetTypes.Contract
	// contains filtered or unexported fields
}

type L1Client

type L1Client interface {
	ChainID(ctx context.Context) (*big.Int, error)
	BlockNumber(ctx context.Context) (uint64, error)
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethtypes.Log, error)
	SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethtypes.Log) (ethereum.Subscription, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *ethtypes.Transaction, isPending bool, err error)
}

type StateDiffCollector

type StateDiffCollector interface {
	// Run starts the collection of StateDiff.
	Run()
	// GetChannel returns the channel that will be used to collect the StateDiff.
	GetChannel() chan *CollectorDiff
	// Close closes the collection of StateDiff.
	Close()
	// LatestBlock returns the last block of StarkNet
	LatestBlock() *feeder.StarknetBlock
	// PendingBlock returns the pending block of StarkNet
	PendingBlock() *feeder.StarknetBlock
}

StateDiffCollector is a collection of StateDiff provided from the feeder gateway that can be iterated over.

type Synchronizer

type Synchronizer struct {

	// Running is true when the service is active and running
	Running bool
	// contains filtered or unexported fields
}

func NewSynchronizer

func NewSynchronizer(n utils.Network, ethNode string, feederClient *feeder.Client,
	syncManager *sync.Manager, stateManager state.StateManager, blockManager *blockDB.Manager,
	transactionManager *transaction.Manager,
) *Synchronizer

NewSynchronizer creates a new Synchronizer. notest

func (*Synchronizer) ChainID

func (s *Synchronizer) ChainID() *big.Int

func (*Synchronizer) Close

func (s *Synchronizer) Close()

Close closes the service.

func (*Synchronizer) GetLatestBlockOnChain

func (s *Synchronizer) GetLatestBlockOnChain() int64

func (*Synchronizer) GetPendingBlock

func (s *Synchronizer) GetPendingBlock() *feeder.StarknetBlock

func (*Synchronizer) GetStateDiff

func (s *Synchronizer) GetStateDiff(blockHash *felt.Felt) (*types.StateUpdate, error)

func (*Synchronizer) LatestBlockSynced

func (s *Synchronizer) LatestBlockSynced() (blockNumber int64, blockHash *felt.Felt)

func (*Synchronizer) Run

func (s *Synchronizer) Run()

Run starts the service.

func (*Synchronizer) SetCode

func (s *Synchronizer) SetCode(collectedDiff *CollectorDiff, deployedContract *types.DeployedContract) error

func (*Synchronizer) Status

func (s *Synchronizer) Status() *types.SyncStatus

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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