Documentation ¶
Index ¶
- func CalculateEpochIndex(epochLength uint64, blockNumber uint64) uint64
- type ApplicationContract
- type ApplicationContractAdapter
- type ConsensusContract
- type ConsensusContractAdapter
- type ContractFactory
- type EthClient
- type EthWsClient
- type EvmReader
- func (r *EvmReader) AddAppEpochLengthIntoCache(app application) error
- func (r *EvmReader) CheckForClaimStatus(ctx context.Context, apps []application, mostRecentBlockNumber uint64)
- func (r *EvmReader) CheckForOutputExecution(ctx context.Context, apps []application, mostRecentBlockNumber uint64)
- func (r *EvmReader) GetAppContracts(app Application) (ApplicationContract, ConsensusContract, error)
- func (r *EvmReader) GetEpochLengthCache(a Address) uint64
- func (r *EvmReader) GetEthClient() *EthClient
- func (r *EvmReader) ReadAndStoreInputs(ctx context.Context, startBlock uint64, endBlock uint64, ...) error
- func (r *EvmReader) Run(ctx context.Context, ready chan<- struct{}) error
- func (r *EvmReader) String() string
- type EvmReaderRepository
- type InputSource
- type InputSourceAdapter
- type SubscriptionError
- type TypeExportApplication
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateEpochIndex ¶
CalculateEpochIndex calculates the epoch index given the input block number and epoch length
Types ¶
type ApplicationContract ¶
type ApplicationContract interface { GetConsensus(opts *bind.CallOpts) (Address, error) RetrieveOutputExecutionEvents( opts *bind.FilterOpts, ) ([]*appcontract.IApplicationOutputExecuted, error) }
type ApplicationContractAdapter ¶
type ApplicationContractAdapter struct {
// contains filtered or unexported fields
}
IConsensus Wrapper
func (*ApplicationContractAdapter) GetConsensus ¶
func (*ApplicationContractAdapter) RetrieveOutputExecutionEvents ¶
func (a *ApplicationContractAdapter) RetrieveOutputExecutionEvents( opts *bind.FilterOpts, ) ([]*appcontract.IApplicationOutputExecuted, error)
type ConsensusContract ¶
type ConsensusContract interface { GetEpochLength(opts *bind.CallOpts) (*big.Int, error) RetrieveClaimAcceptanceEvents( opts *bind.FilterOpts, appAddresses []Address, ) ([]*iconsensus.IConsensusClaimAcceptance, error) }
type ConsensusContractAdapter ¶
type ConsensusContractAdapter struct {
// contains filtered or unexported fields
}
IConsensus Wrapper
func (*ConsensusContractAdapter) GetEpochLength ¶
func (*ConsensusContractAdapter) RetrieveClaimAcceptanceEvents ¶
func (c *ConsensusContractAdapter) RetrieveClaimAcceptanceEvents( opts *bind.FilterOpts, appAddresses []common.Address, ) ([]*iconsensus.IConsensusClaimAcceptance, error)
type ContractFactory ¶
type ContractFactory interface { NewApplication(address Address) (ApplicationContract, error) NewIConsensus(address Address) (ConsensusContract, error) }
type EthClient ¶
type EthClient interface {
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
}
EthClient mimics part of ethclient.Client functions to narrow down the interface needed by the EvmReader. It must be bound to an HTTP endpoint
type EthWsClient ¶
type EthWsClient interface {
SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
}
EthWsClient mimics part of ethclient.Client functions to narrow down the interface needed by the EvmReader. It must be bound to a WS endpoint
type EvmReader ¶
EvmReader reads Input Added, Claim Submitted and Output Executed events from the blockchain
func NewEvmReader ¶
func NewEvmReader( client EthClient, wsClient EthWsClient, inputSource InputSource, repository EvmReaderRepository, inputBoxDeploymentBlock uint64, defaultBlock DefaultBlock, contractFactory ContractFactory, shouldModifyIndex bool, ) EvmReader
Creates a new EvmReader
func (*EvmReader) AddAppEpochLengthIntoCache ¶
AddAppEpochLengthIntoCache checks the epoch length cache and read epoch length from IConsensus contract and add it to the cache if needed
func (*EvmReader) CheckForClaimStatus ¶
func (*EvmReader) CheckForOutputExecution ¶
func (*EvmReader) GetAppContracts ¶
func (r *EvmReader) GetAppContracts(app Application, ) (ApplicationContract, ConsensusContract, error)
GetAppContracts retrieves the ApplicationContract and ConsensusContract for a given Application. Also validates if IConsensus configuration matches the blockchain registered one
func (*EvmReader) GetEpochLengthCache ¶
func (*EvmReader) GetEthClient ¶
func (*EvmReader) ReadAndStoreInputs ¶
func (r *EvmReader) ReadAndStoreInputs( ctx context.Context, startBlock uint64, endBlock uint64, apps []TypeExportApplication, ) error
ReadAndStoreInputs reads, inputs from the InputSource given specific filter options, indexes them into epochs and store the indexed inputs and epochs
type EvmReaderRepository ¶
type EvmReaderRepository interface { StoreEpochAndInputsTransaction( ctx context.Context, epochInputMap map[*Epoch][]Input, blockNumber uint64, appAddress Address, ) (epochIndexIdMap map[uint64]uint64, epochIndexInputIdsMap map[uint64][]uint64, err error) GetAllRunningApplications(ctx context.Context) ([]Application, error) GetNodeConfig(ctx context.Context) (*NodePersistentConfig, error) GetEpoch(ctx context.Context, indexKey uint64, appAddressKey Address) (*Epoch, error) GetPreviousEpochsWithOpenClaims( ctx context.Context, app Address, lastBlock uint64, ) ([]*Epoch, error) UpdateEpochs(ctx context.Context, app Address, claims []*Epoch, mostRecentBlockNumber uint64, ) error GetOutput( ctx context.Context, appAddressKey Address, indexKey uint64, ) (*Output, error) UpdateOutputExecutionTransaction( ctx context.Context, app Address, executedOutputs []*Output, blockNumber uint64, ) error GetInputIndex( ctx context.Context, applicationAddress Address, ) (uint64, error) UpdateInputIndex( ctx context.Context, applicationAddress Address, ) error }
Interface for the node repository
type InputSource ¶
type InputSource interface { // Wrapper for FilterInputAdded(), which is automatically generated // by go-ethereum and cannot be used for testing RetrieveInputs(opts *bind.FilterOpts, appAddresses []Address, index []*big.Int, ) ([]iinputbox.IInputBoxInputAdded, error) }
Interface for Input reading
type InputSourceAdapter ¶
type InputSourceAdapter struct {
// contains filtered or unexported fields
}
InputBox Wrapper
func NewInputSourceAdapter ¶
func (*InputSourceAdapter) RetrieveInputs ¶
func (i *InputSourceAdapter) RetrieveInputs( opts *bind.FilterOpts, appContract []common.Address, index []*big.Int, ) ([]iinputbox.IInputBoxInputAdded, error)
type SubscriptionError ¶
type SubscriptionError struct {
Cause error
}
func (*SubscriptionError) Error ¶
func (e *SubscriptionError) Error() string
type TypeExportApplication ¶
type TypeExportApplication = application
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
(c) Cartesi and individual authors (see AUTHORS) SPDX-License-Identifier: Apache-2.0 (see LICENSE)
|
(c) Cartesi and individual authors (see AUTHORS) SPDX-License-Identifier: Apache-2.0 (see LICENSE) |