From 39d2df43375fd1c5129785a128014ae5ae3a7553 Mon Sep 17 00:00:00 2001 From: Mikelle Date: Sat, 4 May 2024 00:39:56 +0200 Subject: [PATCH] chore: added logs for debug --- p2p/pkg/contracts/preconf/preconf.go | 20 ++++++++++++++++---- p2p/pkg/preconfirmation/preconfirmation.go | 15 +++++++++++++++ p2p/pkg/preconfirmation/tracker/tracker.go | 1 + 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/p2p/pkg/contracts/preconf/preconf.go b/p2p/pkg/contracts/preconf/preconf.go index e9706fcb6..0e9078a95 100644 --- a/p2p/pkg/contracts/preconf/preconf.go +++ b/p2p/pkg/contracts/preconf/preconf.go @@ -71,7 +71,6 @@ func (p *preconfContract) StoreEncryptedCommitment( commitmentSignature []byte, decayDispatchTimestamp uint64, ) (common.Hash, error) { - callData, err := p.preconfABI.Pack( "storeEncryptedCommitment", [32]byte(commitmentDigest), @@ -115,14 +114,27 @@ func (p *preconfContract) OpenCommitment( var eciBytes [32]byte copy(eciBytes[:], encryptedCommitmentIndex) + p.logger.Info( + "CommitmentDetails", + "CommitmentIndex", fmt.Sprint(eciBytes), + "BidAmount", bidAmt.String(), + "BlockNumber", uint64(blockNumber), + "TxHash", txnHash, + "DecayStartTimestamp", uint64(decayStartTimeStamp), + "DecayEndTimestamp", uint64(decayEndTimeStamp), + "BidSignature", fmt.Sprint(bidSignature), + "PreConfirmationSignature", fmt.Sprint(commitmentSignature), + "SharedSecret", fmt.Sprint(sharedSecretKey), + ) + callData, err := p.preconfABI.Pack( "openCommitment", eciBytes, bidAmt.Uint64(), - big.NewInt(blockNumber).Uint64(), + uint64(blockNumber), txnHash, - big.NewInt(decayStartTimeStamp).Uint64(), - big.NewInt(decayEndTimeStamp).Uint64(), + uint64(decayStartTimeStamp), + uint64(decayEndTimeStamp), bidSignature, commitmentSignature, sharedSecretKey, diff --git a/p2p/pkg/preconfirmation/preconfirmation.go b/p2p/pkg/preconfirmation/preconfirmation.go index aed8329fa..b42c5186d 100644 --- a/p2p/pkg/preconfirmation/preconfirmation.go +++ b/p2p/pkg/preconfirmation/preconfirmation.go @@ -3,6 +3,7 @@ package preconfirmation import ( "context" "errors" + "fmt" "log/slog" "math/big" "sync" @@ -306,6 +307,20 @@ func (p *Preconfirmation) handleBid( if err != nil { return status.Errorf(codes.Internal, "failed to constuct encrypted preconfirmation: %v", err) } + p.logger.Info( + "CommitmentDetails", + "BidAmount", preConfirmation.Bid.BidAmount, + "BlockNumber", uint64(preConfirmation.Bid.BlockNumber), + "TxHash", preConfirmation.Bid.TxHash, + "DecayStartTimestamp", uint64(preConfirmation.Bid.DecayStartTimestamp), + "DecayEndTimestamp", uint64(preConfirmation.Bid.DecayEndTimestamp), + "BidSignature", fmt.Sprint(preConfirmation.Bid.Signature), + "PreConfirmationSignature", fmt.Sprint(preConfirmation.Signature), + "SharedSecret", fmt.Sprint(preConfirmation.SharedSecret), + "EncryptedCommitment", fmt.Sprint([32]byte(encryptedPreConfirmation.Commitment)), + "EncryptedPreConfirmation.Signature", fmt.Sprint(encryptedPreConfirmation.Signature), + ) + p.logger.Info("sending preconfirmation", "preConfirmation", encryptedPreConfirmation) _, err = p.commitmentDA.StoreEncryptedCommitment( ctx, diff --git a/p2p/pkg/preconfirmation/tracker/tracker.go b/p2p/pkg/preconfirmation/tracker/tracker.go index e7304f434..1d575c1ea 100644 --- a/p2p/pkg/preconfirmation/tracker/tracker.go +++ b/p2p/pkg/preconfirmation/tracker/tracker.go @@ -210,6 +210,7 @@ func (t *Tracker) handleNewL1Block( continue } startTime := time.Now() + txHash, err := t.preconfContract.OpenCommitment( ctx, commitment.EncryptedPreConfirmation.CommitmentIndex,