Skip to content

Conversation

@whankinsiv
Copy link
Collaborator

@whankinsiv whankinsiv commented Dec 18, 2025

Description

This PR refactors the GovernanceProtocolParametersBootstrapMessage to publish only the single parameter set required for bootstrapping parameter_state, instead of publishing multiple parameter variants and deriving the active set inside the state module.

As part of this, the snapshot bootstrap logic now decodes directly into ProtocolParamUpdate, removing the snapshot specific conversion logic from parameter_state and simplifying the bootstrap path.

Related Issue(s)

Relates to #387

How was this tested?

  • Validated that parameters bootstrapped in parameter_state for epoch 507 match Blockfrost's response (with the exception of some missing Plutus V3 cost models).
  • Verified that parameter_state now publishes a single ProtocolParamsMessage, eliminating one potential source of deadlock during bootstrap.

Checklist

  • My code builds and passes local tests
  • I added/updated tests for my changes, where applicable
  • I updated documentation (if applicable)
  • CI is green for this PR

Impact / Side effects

  • Parameters are now decoded directly into ProtocolParamUpdate, with current and future parameters merged before publishing the bootstrap message.
  • Only the minimal set of previous/current parameters required for rewards calculation are retained in state via the new RewardParams type.

Reviewer notes / Areas to focus

Snapshot decoding changes in /common/src/snapshot/protocol_parameters.rs.

Note: This refactor also makes it explicit which parameter set applies to a given epoch. I suspect part of our existing reward calculation issues stem from using the current parameter set rather than the parameter set that was active for the epoch being rewarded.

previous_reward_params.desired_number_of_stake_pools
);
eprintln!(
" Max Transaction Size: {}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove all this output from the test streamer? I use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've readded the logging for all parameters (except cost models and deprecated params) for the bootstrap params set in 7bd0fcb.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks!

self.gs_previous_params = Some(gs_previous_params);
self.gs_current_params = Some(gs_current_params);
self.gs_future_params = Some(gs_future_params);
self.previous_reward_params = Some(previous_reward_params);
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these names really better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did this in an attempt to signal that the reward params are a subset of the full params for that epoch. Happy to change it back if you don't think it's useful.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I see. Because you remove the other parameters, they are now just reward params. I would not have done that because I would have kept all of the params and not removed the others because it separates concerns. The parser should supply all of the fields it can, without implementing any reduction based on usage down-stream.

@whankinsiv whankinsiv marked this pull request as ready for review December 19, 2025 23:14
@whankinsiv
Copy link
Collaborator Author

I will be implementing the changes needed to pass reward params to accounts state in a follow up PR.

@lowhung
Copy link
Collaborator

lowhung commented Dec 20, 2025

Great job on this @whankinsiv 🙌🏻

Self(value)
}

pub fn to_network_name(&self) -> &str {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nice.

}
}

pub fn apply_bootstrap(&mut self, params: ProtocolParamUpdate) -> Result<()> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

also nice

Copy link
Collaborator

@buddhisthead buddhisthead left a comment

Choose a reason for hiding this comment

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

Will, this is great work. I don't need any additional changes. Thank you. I recommend asking Dmitry to look at the changes in how you apply the rewards because he wrote the initial function to create the updater.

@whankinsiv whankinsiv merged commit 7f3a678 into main Dec 23, 2025
2 checks passed
@whankinsiv whankinsiv deleted the whankinsiv/deadlock-fixes branch December 23, 2025 02:53
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.

4 participants