Skip to content

Scan: Reward accounting root-hash and activity-totals return three values#5576

Merged
dfordivam merged 8 commits into
mainfrom
dfordivam/scan-get-root-hash-api-change
May 18, 2026
Merged

Scan: Reward accounting root-hash and activity-totals return three values#5576
dfordivam merged 8 commits into
mainfrom
dfordivam/scan-get-root-hash-api-change

Conversation

@dfordivam
Copy link
Copy Markdown
Contributor

@dfordivam dfordivam commented May 18, 2026

Modified the following endpoints to return "undetermined" and "cannot-compute" values, in addition to the result.

  • /v0/reward-accounting-process/rounds/{round_number}/activity-totals
  • /v0/reward-accounting-process/rounds/{round_number}/root-hash

As discussed last week with Simon and Robert; these are the criterion for the return value selection.

  • undetermined
    returned if scan does not see any CalculateRewardsContract with a round number <= the queried round
    or if the root hash (and associated data) is not found in the store
  • cannot-compute
    if scan does not have a complete set of activity records for the round

But in the code the "undetermined" is actually a catch-all case, because even if the CalculateRewardsV2 exist for this round, and the scan is yet to compute the totals, "undetermined" would still work since the sv-app would retry.

As these are internal endpoints, marked as "subject to change", the existing /v0 endpoints have been modified, and PR has no release-notes mention. (original addition of these endpoints also did not have release-notes entry)

  /v0/reward-accounting-process/rounds/{round_number}/root-hash:
    get:
      tags: [internal, scan]
      x-jvm-package: scan
      operationId: "getRewardAccountingRootHash"
      description: |
        SV node internal API (CIP-0104, subject to change).
        Returns the root hash computed for the specified round.

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 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 added 4 commits May 18, 2026 06:29
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
@dfordivam dfordivam added this to the Traffic-Based App Rewards milestone May 18, 2026
@dfordivam dfordivam marked this pull request as ready for review May 18, 2026 07:34
@dfordivam
Copy link
Copy Markdown
Contributor Author

@meiersi-da This is a small change we discussed last week. I have originally done this as part of my integ test PR, but took this out in this separate PR on main.

The change was in fact necessary to get the CI green by avoiding unnecessary error logging from the CalculateRewardsTrigger when it just needed to retry the fetch.

@dfordivam dfordivam requested a review from meiersi-da May 18, 2026 07:41
@dfordivam dfordivam self-assigned this May 18, 2026
@dfordivam dfordivam requested a review from adetokunbo May 18, 2026 07:41
Copy link
Copy Markdown
Contributor

@meiersi-da meiersi-da left a comment

Choose a reason for hiding this comment

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

Thanks a lot.

Comment thread apps/scan/src/main/openapi/scan.yaml Outdated
ec: ExecutionContext,
tc: TraceContext,
): Future[Option[GetRewardAccountingBatchResponse]] =
bftCall(_.getRewardAccountingBatch(roundNumber, batchHash))
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.

need to check whether doing BFT calls for this endpoint using the standard code path works as expected, as deviations in the responses are expected. I suspect we might be logging mismatches too aggressively.

Nothing to do right now, but something to be aware of.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, at the moment this is just to compile the code. When the triggers actually use BFT client, we will have to circle back to these concerns.

dfordivam added 2 commits May 18, 2026 08:21
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
@dfordivam dfordivam force-pushed the dfordivam/scan-get-root-hash-api-change branch from 335f110 to 5252d35 Compare May 18, 2026 08:21
dfordivam added 2 commits May 18, 2026 08:40
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
@dfordivam dfordivam merged commit 6ac735a into main May 18, 2026
65 checks passed
@dfordivam dfordivam deleted the dfordivam/scan-get-root-hash-api-change branch May 18, 2026 09:20
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.

2 participants