Skip to content

Commit

Permalink
🔧 fix: #265 remove yaml marshalling in endblock logging
Browse files Browse the repository at this point in the history
Logging the entire message in byte code not only take quite a long
time due to marshalling, it's also largely irrelevant, as message
information can easily be obtained from the queue.
  • Loading branch information
byte-bandit committed Jul 4, 2023
1 parent a3c8bf3 commit 2524144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 0 additions & 3 deletions x/consensus/keeper/attest.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package keeper

import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -26,7 +24,6 @@ func (k Keeper) CheckAndProcessAttestedMessages(ctx sdk.Context) error {
"check-and-process-attested-messages-queue",
"id", msg.GetId(),
"nonce", msg.Nonce(),
"string", fmt.Sprintf("+%v", msg),
)
cq, err := k.getConsensusQueue(ctx, opt.QueueTypeName)
if err != nil {
Expand Down
8 changes: 5 additions & 3 deletions x/consensus/types/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/gogoproto/proto"
xchain "github.com/palomachain/paloma/internal/x-chain"
"gopkg.in/yaml.v2"
)

type ConsensusQueueType string
Expand Down Expand Up @@ -63,8 +62,11 @@ type MessageQueuedForBatchingI interface {
var _ MessageQueuedForBatchingI = &BatchOfConsensusMessages{}

func (q *QueuedSignedMessage) String() string {
out, _ := yaml.Marshal(q)
return string(out)
if q == nil {
return ""
}

return fmt.Sprintf("%+v", *q)
}

func (q *QueuedSignedMessage) AddSignData(data *SignData) {
Expand Down

0 comments on commit 2524144

Please sign in to comment.