From 6d0a7248d78fcd0a73e53a89a21adbeff7f3b61b Mon Sep 17 00:00:00 2001 From: David Date: Tue, 6 Jun 2023 19:10:33 +0800 Subject: [PATCH] feat(all): improve proposer && prover logs (#264) --- driver/chain_syncer/calldata/syncer.go | 1 + driver/state/state.go | 2 +- prover/proof_submitter/util.go | 9 ++++++++- prover/proof_submitter/valid_proof_submitter.go | 7 ------- prover/prover.go | 16 ++++++++++++++-- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/driver/chain_syncer/calldata/syncer.go b/driver/chain_syncer/calldata/syncer.go index 04bd8184a..ffb8a0ddd 100644 --- a/driver/chain_syncer/calldata/syncer.go +++ b/driver/chain_syncer/calldata/syncer.go @@ -153,6 +153,7 @@ func (s *Syncer) onBlockProposed( "L1Height", event.Raw.BlockNumber, "L1Hash", event.Raw.BlockHash, "BlockID", event.Id, + "BlockFee", event.BlockFee, "Removed", event.Raw.Removed, ) diff --git a/driver/state/state.go b/driver/state/state.go index d6deea238..81fd67f75 100644 --- a/driver/state/state.go +++ b/driver/state/state.go @@ -172,7 +172,7 @@ func (s *State) startSubscriptions(ctx context.Context) { log.Info("✅ Block proven", "blockID", e.Id, "hash", common.Hash(e.BlockHash), "prover", e.Prover) } case e := <-s.blockVerifiedCh: - log.Info("📈 Block verified", "blockID", e.Id, "hash", common.Hash(e.BlockHash)) + log.Info("📈 Block verified", "blockID", e.Id, "hash", common.Hash(e.BlockHash), "reward", e.Reward) case e := <-s.crossChainSynced: // Verify the protocol synced block, check if it exists in // L2 execution engine. diff --git a/prover/proof_submitter/util.go b/prover/proof_submitter/util.go index d3a26ae86..77a898476 100644 --- a/prover/proof_submitter/util.go +++ b/prover/proof_submitter/util.go @@ -112,7 +112,8 @@ func sendTxWithBackoff( if err != nil { log.Warn( "Failed to check if the generated proof is needed", - "blockID", blockID, "error", err, + "blockID", blockID, + "error", err, ) return err } @@ -171,6 +172,12 @@ func sendTxWithBackoff( return err } + log.Info( + "💰 Your block proof was accepted", + "blockID", blockID, + "proposedAt", proposedAt, + ) + return nil }, backoff.NewConstantBackOff(12*time.Second)); err != nil { return fmt.Errorf("failed to send TaikoL1.proveBlock transaction: %w", err) diff --git a/prover/proof_submitter/valid_proof_submitter.go b/prover/proof_submitter/valid_proof_submitter.go index 6148cf895..f2f38d78d 100644 --- a/prover/proof_submitter/valid_proof_submitter.go +++ b/prover/proof_submitter/valid_proof_submitter.go @@ -270,13 +270,6 @@ func (s *ValidProofSubmitter) SubmitProof( return err } - log.Info( - "💰 Your block proof was accepted", - "blockID", proofWithHeader.BlockID, - "hash", block.Hash(), "height", block.Number(), - "transactions", block.Transactions().Len(), - ) - metrics.ProverSentProofCounter.Inc(1) metrics.ProverSentValidProofCounter.Inc(1) metrics.ProverLatestProvenBlockIDGauge.Update(proofWithHeader.BlockID.Int64()) diff --git a/prover/prover.go b/prover/prover.go index bedcd78e5..360216ee9 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -343,7 +343,14 @@ func (p *Prover) onBlockProposed( if event.Id.Uint64() <= p.lastHandledBlockID { return nil } - log.Info("Proposed block", "blockID", event.Id) + log.Info( + "Proposed block", + "L1Height", event.Raw.BlockNumber, + "L1Hash", event.Raw.BlockHash, + "BlockID", event.Id, + "BlockFee", event.BlockFee, + "Removed", event.Raw.Removed, + ) metrics.ProverReceivedProposedBlockGauge.Update(event.Id.Int64()) handleBlockProposedEvent := func() error { @@ -442,7 +449,12 @@ func (p *Prover) onBlockVerified(ctx context.Context, event *bindings.TaikoL1Cli return nil } - log.Info("New verified valid block", "blockID", event.Id, "hash", common.BytesToHash(event.BlockHash[:])) + log.Info( + "New verified valid block", + "blockID", event.Id, + "hash", common.BytesToHash(event.BlockHash[:]), + "reward", event.Reward, + ) // cancel any proofs being generated for this block p.cancelProof(ctx, event.Id.Uint64())