Skip to content

Commit

Permalink
chore: added logs for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed May 3, 2024
1 parent 9b2040c commit 39d2df4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
20 changes: 16 additions & 4 deletions p2p/pkg/contracts/preconf/preconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (p *preconfContract) StoreEncryptedCommitment(
commitmentSignature []byte,
decayDispatchTimestamp uint64,
) (common.Hash, error) {

callData, err := p.preconfABI.Pack(
"storeEncryptedCommitment",
[32]byte(commitmentDigest),
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions p2p/pkg/preconfirmation/preconfirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package preconfirmation
import (
"context"
"errors"
"fmt"
"log/slog"
"math/big"
"sync"
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions p2p/pkg/preconfirmation/tracker/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ func (t *Tracker) handleNewL1Block(
continue
}
startTime := time.Now()

txHash, err := t.preconfContract.OpenCommitment(
ctx,
commitment.EncryptedPreConfirmation.CommitmentIndex,
Expand Down

0 comments on commit 39d2df4

Please sign in to comment.