Skip to content

Log consensus scan URIs, revert BFT logging - #6413

Open
tellary wants to merge 4 commits into
canton-network:mainfrom
obsidiansystems:tellary/5844-log-rewards
Open

Log consensus scan URIs, revert BFT logging#6413
tellary wants to merge 4 commits into
canton-network:mainfrom
obsidiansystems:tellary/5844-log-rewards

Conversation

@tellary

@tellary tellary commented Jul 14, 2026

Copy link
Copy Markdown

Log the scan URIs that formed the BFT consensus for the two reward-accounting reads. Consensus URIs are the f + 1 URIs whose agreement formed the consensus, not every URI that happened to agree with it.

  • Expose consensus scan URIs via getRewardAccountingRootHashWithScanUris and getRewardAccountingActivityTotalsWithScanUris return values, and include them in the log messages of CalculateRewardsTrigger and SummarizingMiningRoundTrigger respectively.
  • Thread the consensus URIs through the BFT machinery: executeCall and the new private bftCallWithScanUris now return (response, List[Uri]); the *WithScanUris methods surface it while bftCall drops it to preserve the existing callers' signatures.
  • Revert the per-call logging customization introduced in SvApp: Do BFT read in CalculateRewardsTrigger, ProcessRewardsTrigger #5768, keeping only the metrics collection and message formatting. All BFT disagreements are now logged uniformly at INFO including those for getRewardAccountingRootHash and getRewardAccountingActivityTotals.
  • Drop ConsensusLogConfig since disagreement logging no longer varies per BFT operation.
  • Update relevant tests.

Tested locally: TrafficBasedRewardsSvAppTimeBasedIntegrationTest and BftScanConnectionTest pass.

Fixes #5844.

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If an upgrade test is required, comment /upgrade_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

@dfordivam dfordivam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this need some adjustments.

And for the logging added in the triggers we should modify the confirmBftRead in
TrafficBasedRewardsSvAppTimeBasedIntegrationTest.scala, to do assertion of log similar to the loggerFactory.assertEventuallyLogsSeq used in it already.
(also make sure the existing entry.warningMessage assertion in the test passes)

}

"logs disagreements at WARN level" in {
"logs disagreements at INFO level" in {

@dfordivam dfordivam Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to revert this to WARN. ie put the disagreementLogLevel back

}

"logs disagreements at WARN level" in {
"logs disagreements at INFO level" in {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to revert this to WARN

@tellary

tellary commented Jul 15, 2026

Copy link
Copy Markdown
Author

we should modify the confirmBftRead

@dfordivam

Ok, I can modify the TrafficBasedRewardsSvAppTimeBasedIntegrationTest to make sure the following logs are emitted:

  • From the CalculateRewardsTrigger:

    "Obtained the root-hash for round $round via BFT read from consensus scans: ${scanUris.mkString(", ")}."
    
  • From the SummarizingMiningRoundTrigger:

    "Obtained the reward accounting totals for round $round via BFT read from consensus scans: ${scanUris.mkString(", ")}.
    

@tellary

tellary commented Jul 15, 2026

Copy link
Copy Markdown
Author

(also make sure the existing entry.warningMessage assertion in the test passes)

@dfordivam

This assertion is still in the TrafficBasedRewardsSvAppTimeBasedIntegrationTest. The test passes, so the asertion passes.

entry.warningMessage should (include(
  "has a mismatch with confirmations" 
) and include(
  cid.contractId
))

logger.info(s"Obtained the root-hash for round $round via BFT read.")
case (RewardAccountingRootHashOk(ok), scanUris) =>
logger.info(
s"Obtained the root-hash for round $round via BFT read from consensus scans: ${scanUris.mkString(", ")}."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "BFT read from scans: ..." is better?

tellary added 4 commits July 23, 2026 01:59
Log the scan URIs that formed the BFT consensus for the two reward-accounting
reads. Consensus URIs are the `f + 1` URIs whose agreement formed the consensus,
not every URI that happened to agree with it.

- Expose consensus scan URIs via `getRewardAccountingRootHashWithScanUris` and
  `getRewardAccountingActivityTotalsWithScanUris` return values, and include
  them in the log messages of `CalculateRewardsTrigger` and
  `SummarizingMiningRoundTrigger` respectively.
- Thread the consensus URIs through the BFT machinery: `executeCall` and the
  new private `bftCallWithScanUris` now return `(response, List[Uri])`; the
  `*WithScanUris` methods surface it while `bftCall` drops it to preserve the
  existing callers' signatures.
- Revert the per-call logging customization introduced in canton-network#5768, keeping
  only the metrics collection and message formatting. All BFT disagreements
  are now logged uniformly at INFO including those for
  `getRewardAccountingRootHash` and `getRewardAccountingActivityTotals`.
- Drop `ConsensusLogConfig` since disagreement logging no longer varies per
  BFT operation.
- Update relevant tests.

Tested locally: `TrafficBasedRewardsSvAppTimeBasedIntegrationTest` and
`BftScanConnectionTest` pass.

Signed-off-by: Ilya Silvestrov <tellary@gmail.com>
- Re-introduce a plain `disagreementLogLevel` parameter in place of the dropped
  `ConsensusLogConfig`, threaded through `bftCallWithScanUris` -> `executeCall`
  -> `logDisagreements`. `getRewardAccountingRootHashWithScanUris` and
  `getRewardAccountingActivityTotalsWithScanUris` log disagreements at WARN.
  All other BFT calls keep the INFO default. Reaching agreement is still
  NOT logged separately exactly as it was before canton-network#5768.
- Assert the consensus scan URI log messages in
  `TrafficBasedRewardsSvAppTimeBasedIntegrationTest`: the new
  `withExpectedRewardTriggersLogging` wrapper around `confirmBftRead`
  captures INFO logs of sv2's `CalculateRewardsTrigger` and
  `SummarizingMiningRoundTrigger` and checks both "... via BFT read from
  consensus scans: <uris>." messages are emitted, with URIs restricted to
  sv1's and sv4's scans (sv3 is stopped and sv2's own scan is not part of
  its peer BFT connection).
- Adjust the `BftScanConnectionTest` disagreement-level tests back to WARN
  for the two reward accounting reads.

Tested locally: `TrafficBasedRewardsSvAppTimeBasedIntegrationTest` and
`BftScanConnectionTest` pass.

Signed-off-by: Ilya Silvestrov <tellary@gmail.com>
Use 'withExpectedRewardTriggersLogging' to check 'CalculateRewardsTrigger' and
'SummarizingMiningRoundTrigger' emit logs about BFT scans inside the
'confirmBftRead' call.

Signed-off-by: Ilya Silvestrov <tellary@gmail.com>
Also, drop 'consensus' from BFT reward-read log messages

Signed-off-by: Ilya Silvestrov <tellary@gmail.com>
@tellary
tellary force-pushed the tellary/5844-log-rewards branch from 5bd35d7 to d13b085 Compare July 23, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve logging of BFT reads in CalculateRewardsTrigger

6 participants