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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbError        = errors.New("database error")
	UnmarshalError = errors.New("unmarshal error")
	MarshalError   = errors.New("marshal error")
)

Functions

This section is empty.

Types

type DeployedContract

type DeployedContract struct {
	Address   []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	ClassHash []byte `protobuf:"bytes,2,opt,name=classHash,proto3" json:"classHash,omitempty"`
	// contains filtered or unexported fields
}

func (*DeployedContract) Descriptor deprecated

func (*DeployedContract) Descriptor() ([]byte, []int)

Deprecated: Use DeployedContract.ProtoReflect.Descriptor instead.

func (*DeployedContract) GetAddress

func (x *DeployedContract) GetAddress() []byte

func (*DeployedContract) GetClassHash

func (x *DeployedContract) GetClassHash() []byte

func (*DeployedContract) ProtoMessage

func (*DeployedContract) ProtoMessage()

func (*DeployedContract) ProtoReflect

func (x *DeployedContract) ProtoReflect() protoreflect.Message

func (*DeployedContract) Reset

func (x *DeployedContract) Reset()

func (*DeployedContract) String

func (x *DeployedContract) String() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a Block database manager to save and search the blocks.

func NewManager

func NewManager(database db.Database) *Manager

NewManager returns a new Block manager using the given database.

func (*Manager) Close

func (m *Manager) Close()

Close closes the Manager.

func (*Manager) GetBlockOfProcessedEvent

func (m *Manager) GetBlockOfProcessedEvent(starknetFact int64) int64

GetBlockOfProcessedEvent returns the block of the latest event processed,

func (*Manager) GetLatestBlockSaved

func (m *Manager) GetLatestBlockSaved() int64

GetLatestBlockSaved returns the latest block sync.

func (*Manager) GetLatestBlockSync

func (m *Manager) GetLatestBlockSync() int64

GetLatestBlockSync returns the latest block sync.

func (*Manager) GetLatestStateRoot

func (m *Manager) GetLatestStateRoot() string

GetLatestStateRoot returns the latest state root.

func (*Manager) GetStateUpdate

func (m *Manager) GetStateUpdate(blockHash *felt.Felt) (*types.StateUpdate, error)

func (*Manager) StoreBlockOfProcessedEvent

func (m *Manager) StoreBlockOfProcessedEvent(starknetFact, l1Block int64)

StoreBlockOfProcessedEvent stores the block of the latest event processed,

func (*Manager) StoreLatestBlockSaved

func (m *Manager) StoreLatestBlockSaved(latestBlockSaved int64)

StoreLatestBlockSaved stores the latest block sync.

func (*Manager) StoreLatestBlockSync

func (m *Manager) StoreLatestBlockSync(latestBlockSync int64)

StoreLatestBlockSync stores the latest block sync.

func (*Manager) StoreLatestStateRoot

func (m *Manager) StoreLatestStateRoot(stateRoot string)

StoreLatestStateRoot stores the latest state root.

func (*Manager) StoreStateUpdate

func (m *Manager) StoreStateUpdate(stateDiff *types.StateUpdate, blockHash *felt.Felt) error

StoreStateUpdate stores the state diff for the given block.

type Nonce

type Nonce struct {
	ContractAddress []byte `protobuf:"bytes,1,opt,name=contractAddress,proto3" json:"contractAddress,omitempty"`
	Nonce           []byte `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"`
	// contains filtered or unexported fields
}

func (*Nonce) Descriptor deprecated

func (*Nonce) Descriptor() ([]byte, []int)

Deprecated: Use Nonce.ProtoReflect.Descriptor instead.

func (*Nonce) GetContractAddress

func (x *Nonce) GetContractAddress() []byte

func (*Nonce) GetNonce

func (x *Nonce) GetNonce() []byte

func (*Nonce) ProtoMessage

func (*Nonce) ProtoMessage()

func (*Nonce) ProtoReflect

func (x *Nonce) ProtoReflect() protoreflect.Message

func (*Nonce) Reset

func (x *Nonce) Reset()

func (*Nonce) String

func (x *Nonce) String() string

type StateUpdate

type StateUpdate struct {
	BlockHash []byte `protobuf:"bytes,1,opt,name=blockHash,proto3" json:"blockHash,omitempty"`
	NewRoot   []byte `protobuf:"bytes,2,opt,name=newRoot,proto3" json:"newRoot,omitempty"`
	OldRoot   []byte `protobuf:"bytes,3,opt,name=oldRoot,proto3" json:"oldRoot,omitempty"`
	// NOTE: map <contractAddressHex, diffs>
	StorageDiffs      map[string]*StorageDiffs `` /* 165-byte string literal not displayed */
	DeclaredContracts [][]byte                 `protobuf:"bytes,5,rep,name=declaredContracts,proto3" json:"declaredContracts,omitempty"`
	DeployedContracts []*DeployedContract      `protobuf:"bytes,6,rep,name=deployedContracts,proto3" json:"deployedContracts,omitempty"`
	Nonces            []*Nonce                 `protobuf:"bytes,7,rep,name=nonces,proto3" json:"nonces,omitempty"`
	// contains filtered or unexported fields
}

func (*StateUpdate) Descriptor deprecated

func (*StateUpdate) Descriptor() ([]byte, []int)

Deprecated: Use StateUpdate.ProtoReflect.Descriptor instead.

func (*StateUpdate) GetBlockHash

func (x *StateUpdate) GetBlockHash() []byte

func (*StateUpdate) GetDeclaredContracts

func (x *StateUpdate) GetDeclaredContracts() [][]byte

func (*StateUpdate) GetDeployedContracts

func (x *StateUpdate) GetDeployedContracts() []*DeployedContract

func (*StateUpdate) GetNewRoot

func (x *StateUpdate) GetNewRoot() []byte

func (*StateUpdate) GetNonces

func (x *StateUpdate) GetNonces() []*Nonce

func (*StateUpdate) GetOldRoot

func (x *StateUpdate) GetOldRoot() []byte

func (*StateUpdate) GetStorageDiffs

func (x *StateUpdate) GetStorageDiffs() map[string]*StorageDiffs

func (*StateUpdate) ProtoMessage

func (*StateUpdate) ProtoMessage()

func (*StateUpdate) ProtoReflect

func (x *StateUpdate) ProtoReflect() protoreflect.Message

func (*StateUpdate) Reset

func (x *StateUpdate) Reset()

func (*StateUpdate) String

func (x *StateUpdate) String() string

type StorageDiff

type StorageDiff struct {
	Key   []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*StorageDiff) Descriptor deprecated

func (*StorageDiff) Descriptor() ([]byte, []int)

Deprecated: Use StorageDiff.ProtoReflect.Descriptor instead.

func (*StorageDiff) GetKey

func (x *StorageDiff) GetKey() []byte

func (*StorageDiff) GetValue

func (x *StorageDiff) GetValue() []byte

func (*StorageDiff) ProtoMessage

func (*StorageDiff) ProtoMessage()

func (*StorageDiff) ProtoReflect

func (x *StorageDiff) ProtoReflect() protoreflect.Message

func (*StorageDiff) Reset

func (x *StorageDiff) Reset()

func (*StorageDiff) String

func (x *StorageDiff) String() string

type StorageDiffs

type StorageDiffs struct {
	Diffs []*StorageDiff `protobuf:"bytes,1,rep,name=diffs,proto3" json:"diffs,omitempty"`
	// contains filtered or unexported fields
}

func (*StorageDiffs) Descriptor deprecated

func (*StorageDiffs) Descriptor() ([]byte, []int)

Deprecated: Use StorageDiffs.ProtoReflect.Descriptor instead.

func (*StorageDiffs) GetDiffs

func (x *StorageDiffs) GetDiffs() []*StorageDiff

func (*StorageDiffs) ProtoMessage

func (*StorageDiffs) ProtoMessage()

func (*StorageDiffs) ProtoReflect

func (x *StorageDiffs) ProtoReflect() protoreflect.Message

func (*StorageDiffs) Reset

func (x *StorageDiffs) Reset()

func (*StorageDiffs) String

func (x *StorageDiffs) String() string

Jump to

Keyboard shortcuts

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