Skip to content

Scan: Use FA weights in app activity computation#6208

Draft
dfordivam wants to merge 3 commits into
dfordivam/cip-104-featured-app-weight-calcs-basefrom
dfordivam/cip-104-featured-app-weight-calcs
Draft

Scan: Use FA weights in app activity computation#6208
dfordivam wants to merge 3 commits into
dfordivam/cip-104-featured-app-weight-calcs-basefrom
dfordivam/cip-104-featured-app-weight-calcs

Conversation

@dfordivam

Copy link
Copy Markdown
Contributor

For preview of the implementation, based on #6178

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 added 3 commits July 2, 2026 06:40
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
Signed-off-by: Divam <dfordivam@gmail.com>
@dfordivam dfordivam requested a review from meiersi-da July 2, 2026 07:00

@meiersi-da meiersi-da 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.

Very nice! Exactly what we were looking for 👏


// Convert the assigned activity back to burn amount using app weight
val reconstructedBurnSum = activity.records.map { r =>
val weight = scaledProvider match {

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.

Suggested change
val weight = scaledProvider match {
val activityWeight = scaledProvider match {


val aggregatedWeights = SortedMap.from(aggregatedBurn.map { case (party, burn) =>
val weight =
featuredAppWeights.getOrElse(party, DbScanRewardsReferenceStore.DefaultAppActivityWeight)

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.

Why do we need the default weight here? The lookup should never fail, or not?

val aggregatedWeights = SortedMap.from(aggregatedBurn.map { case (party, burn) =>
val weight =
featuredAppWeights.getOrElse(party, DbScanRewardsReferenceStore.DefaultAppActivityWeight)
party -> (BigDecimal(burn) * weight).toLong

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.

Oh this is an interesting snag: having to change to do the rounding here. Let's use Daml's Decimal arithmetic as described here: canton-foundation/cips#238 (comment)

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