Skip to content

Conversation

@salaheldinsoliman
Copy link
Contributor

@salaheldinsoliman salaheldinsoliman commented Oct 23, 2025

Description of change

This PR adds update to the neural network third party server via a function inform_model. inform_model is called at the end of process_checkpoint_effects.
Any logic regarding the update itself is placed in model_updater.rs, that is not to clutter congestion_tracker with un-related logic

Links to any relevant issues

Be sure to reference any related issues by adding fixes #(issue).

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

@salaheldinsoliman salaheldinsoliman requested review from a team as code owners October 23, 2025 13:21
@vercel
Copy link

vercel bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
apps-backend Ignored Ignored Preview Nov 3, 2025 2:23pm
apps-ui-kit Ignored Ignored Preview Comment Nov 3, 2025 2:23pm
iota-evm-bridge Ignored Ignored Preview Nov 3, 2025 2:23pm
iota-multisig-toolkit Ignored Ignored Preview Nov 3, 2025 2:23pm
rebased-explorer Ignored Ignored Preview Nov 3, 2025 2:23pm
wallet-dashboard Ignored Ignored Preview Comment Nov 3, 2025 2:23pm

@salaheldinsoliman salaheldinsoliman requested review from a team as code owners October 23, 2025 13:22
@iota-ci iota-ci added the devrel Issues related to the DevRel team label Oct 23, 2025
@salaheldinsoliman salaheldinsoliman requested review from vekkiokonio and removed request for a team October 23, 2025 13:48
) {
// 1) Build touched set
let mut touched: std::collections::HashSet<ObjectID> = std::collections::HashSet::new();
for tx in congestion_txs_data {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here you don't differentiate between write shared objects, read shared objects and owned objects. That means that read-only or owned objects would affect the prediction, which shouldn't be the case

Copy link
Contributor

Choose a reason for hiding this comment

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

For instance, check the filter at line 327

Copy link
Contributor

Choose a reason for hiding this comment

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

@salaheldinsoliman I think my comment was wrong here: you are using the same congestion_txs_data and cleared_txs_data from process_checkpoint_effect() so there is actually no need to include the mutate filter for congested objects -- in fact, we can only have congestion for write shared objects. I suggest to revert ddb1243

}
}

// 3) Build per-checkpoint stats
Copy link
Contributor

Choose a reason for hiding this comment

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

Both 2) and 3) are "per-checkpoint stats". The difference is that 2) is retrieved directly from congestion_info, while 3) is computed in this function. Stats in 2) provide richer information as they also include gas prices. I'm wondering if stats in 3) are really needed and if they actually contributed to improve the NN prediction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point 👍
Step (2) is a post‑checkpoint snapshot from the cache (latest_* times, gas‑price extremes, hotness),
while step (3) adds per‑checkpoint intensity: how many congested/clearing txs touched the object. The booleans in (3) are redundant (derivable from (2) by comparing latest_*_time to this checkpoint), but the counts are not and provide extra signal for the predictor.
I think we should keep the counts for now, WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, there is no harm to keep them

gas_price_feedback: None,
touched_objects: tx.objects.clone(),
});
for oid in &tx.objects {
Copy link
Contributor

Choose a reason for hiding this comment

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

Your per_obj_min_clearing vector corresponds to get_prediction_suggested_gas_price computed for all objects in the checkpoint. However, your code doesn't handle the rare but possible case where no clearing data are present and all transactions are canceled for a given checkpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch, what I did now is basically:
A second accumulator that tracks, per object, the highest congestion requirement seen in the checkpoint (using gas_price_feedback if present, otherwise the gas price,).
After the single pass over transactions, I merge the two into a per_obj_required_in_cp map: it prefers the lowest clearing price when available, and otherwise falls back to that highest congestion value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here, I would suggest to reuse the existing congestion tracker logic. Specifically, I would suggest to directly use the get_suggested_gas_price_for_objects() function which already does what you want. I would remove per_obj_min_clearing and per_obj_max_congestion and use something like:

let price = self.get_suggested_gas_price_for_objects(std::iter::once(*oid));

to store data into per_obj_required_in_cp.

Signed-off-by: salaheldinsoliman <[email protected]>
@salaheldinsoliman salaheldinsoliman requested review from a team as code owners October 23, 2025 18:49
salaheldinsoliman and others added 5 commits November 3, 2025 14:47
@salaheldinsoliman
Copy link
Contributor Author

Changes summary to address the PR comments:

  • Consider only mutated objects, not all objects
  • Refactored multiple for loops into a single pass
  • Addressed the case where no clearing Txs are in a checkpoint

Copy link
Contributor

@vekkiokonio vekkiokonio left a comment

Choose a reason for hiding this comment

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

LGTM

Please address the two comments I added to the PR and then it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devrel Issues related to the DevRel team research

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants