Skip to content

Conversation

@ray-roestenburg-da
Copy link
Contributor

@ray-roestenburg-da ray-roestenburg-da commented Nov 14, 2025

Fixes https://github.com/DACH-NY/canton-network-internal/issues/2493 (all SVs will agree on zero values)
API's that depend on the balance values have already been deprecated and replaced by instrument total supply and holdings summary.

balance values are:

changeToInitialAmountAsOfRoundZero
changeToHoldingFeesRate
cumulativeChangeToInitialAmountAsOfRoundZero
cumulativeChangeToHoldingFeesRate
totalAmuletBalance

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.

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).

…they always agree.

Signed-off-by: Raymond Roestenburg <[email protected]>
@martinflorian-da
Copy link
Contributor

Fixes https://github.com/DACH-NY/canton-network-internal/issues/2493

Can we test this somehow?

Should we also mention this in the release notes?

@ray-roestenburg-da
Copy link
Contributor Author

ray-roestenburg-da commented Nov 14, 2025

@martinflorian-da the existing tests for scan aggregation should suffice but will have another look.
I'll also add release notes

@martinflorian-da
Copy link
Contributor

the existing tests for scan aggregation should suffice

@ray-roestenburg-da Well if they did they should be failing on main now :)

Specifically I wonder if we can have a test that replicates the current situation on MainNet, and fails without these changes.

(I'm not super confident in my context here.)

@ray-roestenburg-da
Copy link
Contributor Author

Well if they did they should be failing on main now :)

Since all results are zero for these values, they will always agree, so the tests should not fail (that use this code I changed, though possibly there is no test). In any case I'll add a test.

@ray-roestenburg-da
Copy link
Contributor Author

ray-roestenburg-da commented Nov 14, 2025

@martinflorian-da @OriolMunoz-da added a test and updated release notes, please have another look.

Also added release notes.

Signed-off-by: Raymond Roestenburg <[email protected]>
Copy link
Contributor

@martinflorian-da martinflorian-da left a comment

Choose a reason for hiding this comment

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

Looks reasonable, thank you! You might want to wait for someone more knowledgeable than me to approve as well though.


- The round-based aggregates for balance values (changes to holding fees and initial amounts since round zero)
have diverged between scans because of how amulets expire in the ``scan_txlog_store``.
The balance values recorded in the round aggregates are effectively not used anymore, and are now set to zero to avoid consensus problems when an SV reads aggregates
Copy link
Contributor

Choose a reason for hiding this comment

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

not used anymore

By splice apps?

I'm not sure this makes sense, but do some people implement their own variant of BFT scan reads? This should probably be fixes as well then? (I.e., do we need to call this out?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll rephrase it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By scan APIs, I'll rephrase

Copy link
Contributor Author

@ray-roestenburg-da ray-roestenburg-da Nov 14, 2025

Choose a reason for hiding this comment

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

rephrased. Oh and no, this is not something people implement by themselves, this is for backfilling and starting from known state for the aggregation. When an SV starts and has no aggregates yet, scan will request the totals from the other SVs in BFT fashion, and continue from that round. It's really all internal API to the scan app.

result shouldBe Some(roundAggregate)
}

"get BFT round aggregates from scans that report having the round aggregate ignoring balance fields" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

sentence is a bit hard to parse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

val result = con.getRoundAggregate(round).futureValue
result shouldBe Some(roundAggregateZeroBalanceValues)

// not using the decoder should fail on the randomized balance values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why even test/commit this? That's a code path that doesn't exist like this anymore, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to be sure the decode stuff does something

Copy link
Contributor

Choose a reason for hiding this comment

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

Well if it didn't the previous should should fail? But I don't mind keeping it

Copy link
Contributor Author

@ray-roestenburg-da ray-roestenburg-da Nov 14, 2025

Choose a reason for hiding this comment

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

yeah true, I could remove it, but liked to see it was failing the consensus, so I didn't do some encode/decode that did nothing

Copy link
Contributor

@OriolMunoz-da OriolMunoz-da left a comment

Choose a reason for hiding this comment

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

There was also this comment by nicu in the original PR:
https://github.com/DACH-NY/canton-network-internal/issues/2493#issuecomment-3472570660
will this be handled in a later PR?

cumulativeChangeToHoldingFeesRate = randomValue,
totalAmuletBalance = randomValue,
)
def encodeRoundTotals(rt: RoundTotals) = {
Copy link
Contributor

Choose a reason for hiding this comment

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

afaict this is duplicate with HttpScanHandler's listRoundTotals, DRY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dried

totalAmuletBalance = Codec.encode(rt.totalAmuletBalance),
)
}
def encodeRoundPartyTotals(rpt: RoundPartyTotals) = {
Copy link
Contributor

Choose a reason for hiding this comment

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

afaict this is duplicate with HttpScanHandler's listRoundPartyTotals, DRY

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh right I'll cleanup thx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dried

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dried

Signed-off-by: Raymond Roestenburg <[email protected]>
@ray-roestenburg-da
Copy link
Contributor Author

Also added #3206 thanks @OriolMunoz-da for the heads up

@ray-roestenburg-da ray-roestenburg-da force-pushed the ray/scan_aggr_ignore_bal branch 2 times, most recently from 00b5587 to 00e9d21 Compare November 14, 2025 15:02
Co-authored-by: Oriol Muñoz <[email protected]>
Signed-off-by: Raymond Roestenburg <[email protected]>
Signed-off-by: Raymond Roestenburg <[email protected]>
@ray-roestenburg-da ray-roestenburg-da enabled auto-merge (squash) November 14, 2025 15:43
@ray-roestenburg-da ray-roestenburg-da merged commit 46c0f58 into main Nov 14, 2025
62 checks passed
@ray-roestenburg-da ray-roestenburg-da deleted the ray/scan_aggr_ignore_bal branch November 14, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants