Documentation ¶
Index ¶
Constants ¶
const ( // ProfitabilityBase checks matic collateral with min reward ProfitabilityBase = "base" // ProfitabilityAcceptAll validate batch anyway and don't check anything ProfitabilityAcceptAll = "acceptall" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator struct { pb.UnimplementedAggregatorServiceServer State stateInterface EthTxManager ethTxManager Ethman etherman ProfitabilityChecker aggregatorTxProfitabilityChecker TimeSendFinalProof time.Time TimeCleanupLockedProofs types.Duration StateDBMutex *sync.Mutex TimeSendFinalProofMutex *sync.RWMutex // contains filtered or unexported fields }
Aggregator represents an aggregator
func New ¶
func New( cfg Config, stateInterface stateInterface, ethTxManager ethTxManager, etherman etherman, ) (Aggregator, error)
New creates a new aggregator.
func (*Aggregator) Channel ¶
func (a *Aggregator) Channel(stream pb.AggregatorService_ChannelServer) error
Channel implements the bi-directional communication channel between the Prover client and the Aggregator server.
type Config ¶
type Config struct { // Host for the grpc server Host string `mapstructure:"Host"` // Port for the grpc server Port int `mapstructure:"Port"` // RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate // or batches to generate proofs. It is also used in the isSynced loop RetryTime types.Duration `mapstructure:"RetryTime"` // VerifyProofInterval is the interval of time to verify/send an proof in L1 VerifyProofInterval types.Duration `mapstructure:"VerifyProofInterval"` // ProofStatePollingInterval is the interval time to polling the prover about the generation state of a proof ProofStatePollingInterval types.Duration `mapstructure:"ProofStatePollingInterval"` // TxProfitabilityCheckerType type for checking is it profitable for aggregator to validate batch // possible values: base/acceptall TxProfitabilityCheckerType TxProfitabilityCheckerType `mapstructure:"TxProfitabilityCheckerType"` // TxProfitabilityMinReward min reward for base tx profitability checker when aggregator will validate batch // this parameter is used for the base tx profitability checker TxProfitabilityMinReward TokenAmountWithDecimals `mapstructure:"TxProfitabilityMinReward"` // IntervalAfterWhichBatchConsolidateAnyway this is interval for the main sequencer, that will check if there is no transactions IntervalAfterWhichBatchConsolidateAnyway types.Duration `mapstructure:"IntervalAfterWhichBatchConsolidateAnyway"` // ChainID is the L2 ChainID provided by the Network Config ChainID uint64 // ForkID is the L2 ForkID provided by the Network Config ForkId uint64 // SenderAddress defines which private key the eth tx manager needs to use // to sign the L1 txs SenderAddress string `mapstructure:"SenderAddress"` // CleanupLockedProofsInterval is the interval of time to clean up locked proofs. CleanupLockedProofsInterval types.Duration `mapstructure:"CleanupLockedProofsInterval"` // GeneratingProofCleanupThreshold represents the time interval after // which a proof in generating state is considered to be stuck and // allowed to be cleared. GeneratingProofCleanupThreshold string `mapstructure:"GeneratingProofCleanupThreshold"` }
Config represents the configuration of the aggregator
type TokenAmountWithDecimals ¶
TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int
func (*TokenAmountWithDecimals) UnmarshalText ¶
func (t *TokenAmountWithDecimals) UnmarshalText(data []byte) error
UnmarshalText unmarshal token amount from float string to big int
type TxProfitabilityCheckerAcceptAll ¶
type TxProfitabilityCheckerAcceptAll struct { State stateInterface IntervalAfterWhichBatchSentAnyway time.Duration }
TxProfitabilityCheckerAcceptAll validate batch anyway and don't check anything
func NewTxProfitabilityCheckerAcceptAll ¶
func NewTxProfitabilityCheckerAcceptAll(state stateInterface, interval time.Duration) *TxProfitabilityCheckerAcceptAll
NewTxProfitabilityCheckerAcceptAll init tx profitability checker that accept all txs
func (*TxProfitabilityCheckerAcceptAll) IsProfitable ¶
func (pc *TxProfitabilityCheckerAcceptAll) IsProfitable(ctx context.Context, maticCollateral *big.Int) (bool, error)
IsProfitable validate batch anyway and don't check anything
type TxProfitabilityCheckerBase ¶
type TxProfitabilityCheckerBase struct { State stateInterface IntervalAfterWhichBatchSentAnyway time.Duration MinReward *big.Int }
TxProfitabilityCheckerBase checks matic collateral with min reward
func NewTxProfitabilityCheckerBase ¶
func NewTxProfitabilityCheckerBase(state stateInterface, interval time.Duration, minReward *big.Int) *TxProfitabilityCheckerBase
NewTxProfitabilityCheckerBase init base tx profitability checker
func (*TxProfitabilityCheckerBase) IsProfitable ¶
func (pc *TxProfitabilityCheckerBase) IsProfitable(ctx context.Context, maticCollateral *big.Int) (bool, error)
IsProfitable checks matic collateral with min reward
type TxProfitabilityCheckerType ¶
type TxProfitabilityCheckerType string
TxProfitabilityCheckerType checks profitability of batch validation