Skip to content

Traffic-Based App Reward: Support bootstrapping with TBA enabled#5685

Open
adetokunbo wants to merge 9 commits into
mainfrom
adetokunbo/cip-104-support-tba-network-bootstrap
Open

Traffic-Based App Reward: Support bootstrapping with TBA enabled#5685
adetokunbo wants to merge 9 commits into
mainfrom
adetokunbo/cip-104-support-tba-network-bootstrap

Conversation

@adetokunbo

@adetokunbo adetokunbo commented May 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #5624

Assumes the following to detect bootstrapping:

  • the activity meta table is initially empty if bootstrapping
  • so if there is any existing row, then it's not bootstrapping

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

@adetokunbo adetokunbo requested a review from dfordivam May 27, 2026 04:46
@adetokunbo adetokunbo self-assigned this May 27, 2026
@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch from 24c8172 to 7331734 Compare May 27, 2026 04:47
@adetokunbo adetokunbo changed the title Traffic-Based App Reward: Support bootstrapping network when TBA Traffic-Based App Reward: Support bootstrapping wtih TBA enabled May 27, 2026
@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch 3 times, most recently from f5477c0 to 2391a94 Compare June 1, 2026 13:46
@adetokunbo adetokunbo changed the title Traffic-Based App Reward: Support bootstrapping wtih TBA enabled Traffic-Based App Reward: Support bootstrapping with TBA enabled Jun 1, 2026
@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch from 2391a94 to 8134561 Compare June 1, 2026 23:22

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

See comments, the logic needs to allow the first SV to bump meta userVersion + us to bump codeVersion

// The first SV has complete history from genesis, so round 0 is always
// the earliest complete round. The query still runs to confirm ingestion
// has started (returns None if no meta row or no activity records).
case Some(_) if isFirstSv => Some(0L)

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.

This means the first SV will never be able to update activity meta?
We should check earliest_ingested_round is 0 and only then return 0. Else fallback to the Some value.

@adetokunbo adetokunbo Jun 3, 2026

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.

I tried that initially, but earliest_ingested_round value as 3 reflecting where the FAP grant was as added, so that check did not work. That's why I've adopted this approach that does not depend on its value. As you have pointed out, as originally implemented this was incorrect, as it blocked bumping the meta versions on firstSV; the latest commit fixes this; PTAL

}
}

"return round 0 on first SV even when ingestion started after genesis" 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.

what is the intention behind this?
We have to handle the ingestion "started" after genesis gracefully right?

@adetokunbo adetokunbo Jun 3, 2026

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.

I've updated the descriptions; PTAL

@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch 3 times, most recently from 55595d4 to 9f9f141 Compare June 4, 2026 02:22
case Some((firstRecordTimeMicros, earliestRound)) =>
// First SV on fresh network: earliest complete round is
// always 0, so override the given value.
val adjustedEarliestRound =

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.

Some how I still feel that actual evidence of bootstrapping, ie round 0 is open, no verdicts ingested, etc is a better way to handle this.
Otherwise the correctness depends upon the state of DB.

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.

Understood; though the upside of depending on that state of the db is that it's unaffected by unexpected errors that might interfere with the other evidence


"assertCompleteActivity" should {

"on first SV" should {

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.

Lets cover scenario where first SV does meta-version bump

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.

Fixed

@adetokunbo adetokunbo requested a review from dfordivam June 4, 2026 06:35

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

Lets get more review from Robert.

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.

Lets change the assertion here also

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.

Fixed

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.

Fix comment

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.

Fixed

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.

fix assertion, confirm all contracts for rounds < 11 are gone

@adetokunbo adetokunbo Jun 4, 2026

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.

Fixed, but only on reverting the environment back 1SV
With the 4SV environment, the contracts did not get archived; an quick investigation was because the non-first-SV scans could not serve root hashes for the early rounds


override def environmentDefinition: SpliceEnvironmentDefinition =
EnvironmentDefinition
.simpleTopology1SvWithSimTime(this.getClass.getSimpleName)

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.

Lets use simpleTopology4SvsWithSimTime now, as we no longer need the actAs = Seq(dsoParty block

@adetokunbo adetokunbo Jun 4, 2026

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.

Implemented then reverted this because it caused one of the changed assertions to fail, as explained above.

@dfordivam

Copy link
Copy Markdown
Contributor

Assumes the following to detect bootstrapping:

the activity meta table is initially empty if bootstrapping
so if there is any existing row, then it's not bootstrapping

Another assumption worth mentioning, the networks which are not bootstrapping must already have meta-table row, when this change lands.

@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch from 2f724e4 to eb03441 Compare June 4, 2026 09:44

final case class InitialRewardConfig(
mintingVersion: String = "RewardVersion_FeaturedAppMarkers",
mintingVersion: String = "RewardVersion_TrafficBasedAppRewards",

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.

I doubt that this is actually doing anything.
Notice initialRewardConfig: Option[InitialRewardConfig] = None,
So lets make sure we test actually turning the rewardConfig ON

…A is enabled

Signed-off-by: Tim Emiola <adetokunbo@emio.la>
…on test

Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Also:
- improve test descriptions

Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Signed-off-by: Tim Emiola <adetokunbo@emio.la>
…e as a test

Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Signed-off-by: Tim Emiola <adetokunbo@emio.la>
Signed-off-by: Tim Emiola <adetokunbo@emio.la>
@adetokunbo adetokunbo force-pushed the adetokunbo/cip-104-support-tba-network-bootstrap branch from eb03441 to 5982308 Compare June 8, 2026 04:07
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.

Support bootstrapping network with traffic-based rewards enabled

2 participants