Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions agglayer/grpc/agglayer_grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import (
)

var (
errUndefinedAggchainData = errors.New("undefined aggchain data parameter")
errUnknownAggchainData = errors.New("unknown aggchain data type")
errNilCertificate = errors.New("nil certificate provided for conversion to proto")
errUnknownAggchainData = errors.New("unknown aggchain data type")
errNilCertificate = errors.New("nil certificate provided for conversion to proto")
)

type AgglayerGRPCClient struct {
Expand Down Expand Up @@ -272,7 +271,7 @@ func ConvertCertToProtoCertificate(
// convertAggchainData converts the aggchain data to a proto aggchain data
func convertAggchainData(aggchainData types.AggchainData) (*v1types.AggchainData, error) {
if aggchainData == nil {
return nil, errUndefinedAggchainData
return nil, nil
}

switch ad := aggchainData.(type) {
Expand Down
5 changes: 0 additions & 5 deletions agglayer/grpc/agglayer_grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,6 @@ func TestSendCertificate(t *testing.T) {
expectedCertID common.Hash
expectedError string
}{
{
name: "returns error when AggchainData not defined",
certificate: &types.Certificate{},
expectedError: "undefined aggchain data",
},
{
name: "returns error from submission service",
certificate: &types.Certificate{
Expand Down
2 changes: 1 addition & 1 deletion aggsender/aggsender.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func (a *AggSender) sendCertificate(ctx context.Context) (*agglayertypes.Certifi
}

if _, err := a.localValidator.ValidateAndSignCertificate(ctx, certificate, certificateParams.ToBlock); err != nil {
return nil, fmt.Errorf("error validating certificate locally: %w", err)
a.log.Errorf("error validating certificate locally: %w", err)
}

multisig, err := a.validatorPoller.PollValidators(ctx, &types.ValidationRequest{
Expand Down
4 changes: 2 additions & 2 deletions aggsender/block_notifier_polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (b *BlockNotifierPolling) step(ctx context.Context,
}
if previousState.lastBlockSeen > currentBlock {
b.logger.Warnf("Block number decreased [finality:%s]: %d -> %d",
b.config.BlockFinalityType, previousState.lastBlockSeen, currentBlock)
b.config.BlockFinalityType.String(), previousState.lastBlockSeen, currentBlock)
// It start from scratch because something fails in calculation of block period
newState := previousState.initialBlock(currentBlock)
return b.nextBlockRequestDelay(nil, nil), newState, eventToEmit
Expand All @@ -161,7 +161,7 @@ func (b *BlockNotifierPolling) step(ctx context.Context,
if currentBlock-previousState.lastBlockSeen != 1 {
if !b.config.BlockFinalityType.IsSafe() && !b.config.BlockFinalityType.IsFinalized() {
b.logger.Warnf("Missed block(s) [finality:%s]: %d -> %d",
b.config.BlockFinalityType, previousState.lastBlockSeen, currentBlock)
b.config.BlockFinalityType.String(), previousState.lastBlockSeen, currentBlock)
}

// It start from scratch because something fails in calculation of block period
Expand Down
2 changes: 1 addition & 1 deletion aggsender/block_notifier_polling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestBlockNotifierPollingStep(t *testing.T) {
},
mockLoggerFn: func() aggkitcommon.Logger {
mockLogger := mocks.NewLogger(t)
mockLogger.EXPECT().Warnf("Missed block(s) [finality:%s]: %d -> %d", aggkittypes.LatestBlock, uint64(100), uint64(105)).Once()
mockLogger.EXPECT().Warnf("Missed block(s) [finality:%s]: %d -> %d", aggkittypes.LatestBlock.String(), uint64(100), uint64(105)).Once()
return mockLogger
},
headerByNumberError: false,
Expand Down
2 changes: 1 addition & 1 deletion aggsender/epoch_notifier_per_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (e *EpochNotifierPerBlock) step(status internalStatus,
logFunc = e.logger.Infof
}
logFunc("New block seen [finality:%s]: %d. blockRate:%s Epoch:%d Percent:%.2f%% notify:%v config:%s",
newBlock.BlockFinalityType, newBlock.BlockNumber, newBlock.BlockRate, closingEpoch,
newBlock.BlockFinalityType.String(), newBlock.BlockNumber, newBlock.BlockRate, closingEpoch,
percentEpoch*maxPercent, needNotify, e.Config.String())
if needNotify {
// Notify the epoch has started
Expand Down
2 changes: 1 addition & 1 deletion test/config/fep-config.toml.template
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ AggSenderPrivateKey = {Path = "{{.zkevm_l2_sequencer_keystore_file_path}}", Pass
# LatestBlock, SafeBlock, PendingBlock, FinalizedBlock, EarliestBlock
# Default value is "LatestBlock"
# ------------------------------------------------------------------------------
BlockFinality = "LatestBlock"
#BlockFinality = "LatestBlock"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side note, maybe we can remove this, AFAIK there is no BlockFinality in the AggSender config (anymore)?

Suggested change
#BlockFinality = "LatestBlock"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, in the next PR I'll remove definitely


Mode = "AggchainProof"
CheckStatusCertificateInterval = "1s"
Expand Down
Loading