Introduce stake jobs batching and delayed execution#1525
Merged
sam0x17 merged 34 commits intodevnet-readyfrom Apr 23, 2025
Merged
Introduce stake jobs batching and delayed execution#1525sam0x17 merged 34 commits intodevnet-readyfrom
sam0x17 merged 34 commits intodevnet-readyfrom
Conversation
Collaborator
Author
|
Some comments, as well as the benchmarking code, are missing. I will add those after the initial review. |
Extrinsics: - add_stake_aggregate - remove_stake_aggregate
Collaborator
Author
Recent changes
Additional notes
|
l0r1s
reviewed
Apr 15, 2025
l0r1s
reviewed
Apr 15, 2025
l0r1s
reviewed
Apr 15, 2025
Co-authored-by: Loris Moulin <45130584+l0r1s@users.noreply.github.com>
l0r1s
reviewed
Apr 15, 2025
Comment on lines
143
to
151
| if cfg!(feature = "runtime-benchmarks") { | ||
| Self::stake_into_subnet( | ||
| &hotkey, | ||
| &coldkey, | ||
| netuid, | ||
| tao_staked.saturating_to_num::<u64>(), | ||
| fee, | ||
| ); | ||
| } |
l0r1s
reviewed
Apr 15, 2025
Co-authored-by: Loris Moulin <45130584+l0r1s@users.noreply.github.com>
Collaborator
Author
|
The last changes introduce aggregated stake events and move "alpha decrease" operation back to extrinsics. |
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
reviewed
Apr 23, 2025
l0r1s
previously approved these changes
Apr 23, 2025
Collaborator
l0r1s
left a comment
There was a problem hiding this comment.
Mostly nits about missing doc, lgtm 👍
Collaborator
Author
shamil-gadelshin
left a comment
There was a problem hiding this comment.
I copied the original doc comments with that error. Thanks for the review. I changed the original doc comments as well.
l0r1s
previously approved these changes
Apr 23, 2025
gztensor
previously approved these changes
Apr 23, 2025
sam0x17
previously approved these changes
Apr 23, 2025
bcbf59e
sam0x17
approved these changes
Apr 23, 2025
This was referenced Apr 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces changes to stake-related extrinsics (starting with
add_stake). The goal is to address MeV behavior by aggregating stake operations into batches according to their type before executing, thus removing the possibility of the "sandwich" MeV.The PR introduces a new storage map (
StakeJobs) which accumulates the stake operations (jobs) during the extrinsic calling. Those jobs will be executed during theon_finalize()call in the end of the block.Related Issue(s)
Type of Change
Checklist
cargo fmtandcargo clippyto ensure my code is formatted and linted correctlyAdditional Notes
The extrinsic contains parts of the code behind the
runtime-benchmarkfeature to enable the correct weight calculation considering theon_finalize()code.