From d5f686d10eb6ac699289c960fa4037884ab10bdd Mon Sep 17 00:00:00 2001 From: Stefan Iliev <46542846+StefanIliev545@users.noreply.github.com> Date: Fri, 24 May 2024 11:07:11 +0300 Subject: [PATCH] Fixing log spam. (#1931) (#1933) Co-authored-by: StefanIliev545 --- go/common/errutil/errors_util.go | 3 ++- go/enclave/nodetype/common.go | 4 ++-- go/host/enclave/guardian.go | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/go/common/errutil/errors_util.go b/go/common/errutil/errors_util.go index 62823f6f46..2e72aeb154 100644 --- a/go/common/errutil/errors_util.go +++ b/go/common/errutil/errors_util.go @@ -23,7 +23,8 @@ var ( ErrBlockAncestorNotFound = errors.New("block ancestor not found") ErrBlockForBatchNotFound = errors.New("block for batch not found") ErrAncestorBatchNotFound = errors.New("parent for batch not found") - ErrCrossChainBundleRepublished = errors.New("Root already added to the message bus") + ErrCrossChainBundleRepublished = errors.New("root already added to the message bus") + ErrCrossChainBundleNoBatches = errors.New("no batches for cross chain bundle") ) // BlockRejectError is used as a standard format for error response from enclave for block submission errors diff --git a/go/enclave/nodetype/common.go b/go/enclave/nodetype/common.go index c9a28978b4..197fef08d1 100644 --- a/go/enclave/nodetype/common.go +++ b/go/enclave/nodetype/common.go @@ -2,11 +2,11 @@ package nodetype import ( "context" - "fmt" "math/big" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ten-protocol/go-ten/go/common" + "github.com/ten-protocol/go-ten/go/common/errutil" "github.com/ten-protocol/go-ten/go/enclave/storage" ) @@ -17,7 +17,7 @@ func ExportCrossChainData(ctx context.Context, storage storage.Storage, fromSeqN } if len(canonicalBatches) == 0 { - return nil, fmt.Errorf("no batches found for export of cross chain data") + return nil, errutil.ErrCrossChainBundleNoBatches } blockHash := canonicalBatches[len(canonicalBatches)-1].Header.L1Proof diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index 7c472e2d94..2c6d6a6a36 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -651,7 +651,9 @@ func (g *Guardian) periodicBundleSubmission() { bundle, err := g.enclaveClient.ExportCrossChainData(context.Background(), fromSequenceNumber, to.Uint64()) if err != nil { - g.logger.Error("Unable to export cross chain bundle from enclave", log.ErrKey, err) + if !errors.Is(err, errutil.ErrCrossChainBundleNoBatches) { + g.logger.Error("Unable to export cross chain bundle from enclave", log.ErrKey, err) + } continue }