Skip to content

Fix online reps weight sampling#4927

Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:online-reps-calc-fix
Jul 12, 2025
Merged

Fix online reps weight sampling#4927
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:online-reps-calc-fix

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

No description provided.

@gr0vity-dev-bot
Copy link
Copy Markdown

gr0vity-dev-bot commented Jul 9, 2025

Test Results for Commit a77d37b

Pull Request 4927: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 111s)
  • 5n4pr_conf_10k_change: PASS (Duration: 123s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 129s)
  • 5n4pr_conf_change_independant: PASS (Duration: 133s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 118s)
  • 5n4pr_conf_send_independant: PASS (Duration: 171s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 107s)
  • 5n4pr_rocks_10k_change: PASS (Duration: 143s)

Last updated: 2025-07-12 08:13:15 UTC

@pwojcikdev pwojcikdev force-pushed the online-reps-calc-fix branch 2 times, most recently from c7ec75f to a7ee511 Compare July 11, 2025 15:44
@pwojcikdev pwojcikdev force-pushed the online-reps-calc-fix branch from a7ee511 to a77d37b Compare July 12, 2025 07:16
@pwojcikdev pwojcikdev requested a review from Copilot July 12, 2025 09:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors how online representative weights are recalculated and sampled over time, ensuring updates happen both on new observations and within the background loop.

  • Encapsulate online weight updates in a new update_online() method and invoke it in both observe() and the run() loop.
  • Introduce last_sample timestamp in online_reps.hpp to gate trended weight sampling by weight_interval.
  • Update existing tests to use timed assertions and add a new test verifying online weight recalculation when a representative’s delegated weight changes.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
nano/node/online_reps.hpp Added update_online() method and last_sample member for sampling
nano/node/online_reps.cpp Implemented update_online(), adjusted run() loop timing and logic
nano/core_test/online_reps.cpp Switched to ASSERT_TIMELY_EQ and added weight_change_recalculation test
nano/core_test/node.cpp Introduced local delta variable in test and updated related asserts
Comments suppressed due to low confidence (1)

nano/node/online_reps.hpp:103

  • [nitpick] Consider adding a brief comment to explain that last_sample tracks the timestamp of the last trended weight collection, improving readability and maintenance.
	std::chrono::steady_clock::time_point last_sample;

@pwojcikdev pwojcikdev merged commit 7a69c29 into nanocurrency:develop Jul 12, 2025
25 of 26 checks passed
@pwojcikdev pwojcikdev deleted the online-reps-calc-fix branch July 12, 2025 09:22
pwojcikdev added a commit that referenced this pull request Jul 12, 2025
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.

3 participants