Repository navigation
fix!: set zero consensus evidence budget at protocol 15 #5489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b3cc3b8
fix!: set zero consensus evidence budget at protocol 15
lklimek b29147a
chore: merge v5.1-dev into consensus evidence budget
lklimek 26802f6
Merge remote-tracking branch 'origin/v5.1-dev' into fix/consensus-evi…
lklimek f9d4dab
Merge branch 'v5.1-dev' into fix/consensus-evidence-max-bytes-v15
lklimek f135b5e
Merge remote-tracking branch 'origin/v5.1-dev' into pr5489-refresh
lklimek cdc0652
refactor: simplify consensus evidence parameter updates
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
67 changes: 67 additions & 0 deletions
67
packages/rs-drive-abci/src/execution/engine/consensus_params_update/v2/mod.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| use crate::platform_types::epoch_info::v0::EpochInfoV0Methods; | ||
| use crate::platform_types::epoch_info::EpochInfo; | ||
| use dpp::dashcore::Network; | ||
| use dpp::version::PlatformVersion; | ||
| use tenderdash_abci::proto::google::protobuf::Duration; | ||
| use tenderdash_abci::proto::types::{ConsensusParams, EvidenceParams, VersionParams}; | ||
|
|
||
| #[inline(always)] | ||
| pub(super) fn consensus_params_update_v2( | ||
| network: Network, | ||
| original_platform_version: &PlatformVersion, | ||
| new_platform_version: &PlatformVersion, | ||
| epoch_info: &EpochInfo, | ||
| ) -> Option<ConsensusParams> { | ||
| let evidence = if original_platform_version.consensus.evidence | ||
| != new_platform_version.consensus.evidence | ||
| { | ||
| new_platform_version | ||
| .consensus | ||
| .evidence | ||
| .map(|policy| EvidenceParams { | ||
| max_age_num_blocks: policy.max_age_num_blocks, | ||
| max_age_duration: Some(Duration { | ||
| seconds: policy.max_age_duration_seconds, | ||
| nanos: 0, | ||
| }), | ||
| max_bytes: policy.max_bytes, | ||
| }) | ||
| } else { | ||
| None | ||
| }; | ||
|
|
||
| // These are emergency consensus updates | ||
| let emergency_update = match network { | ||
| Network::Mainnet => epoch_info.is_first_block_of_epoch(3), | ||
| Network::Testnet => epoch_info.is_first_block_of_epoch(1480), | ||
|
lklimek marked this conversation as resolved.
Resolved
|
||
| _ => false, | ||
| }; | ||
| let consensus_version = if emergency_update { | ||
| 1 | ||
| } else { | ||
| // Update versions or the evidence policy when they change | ||
| if original_platform_version | ||
| .consensus | ||
| .tenderdash_consensus_version | ||
| == new_platform_version.consensus.tenderdash_consensus_version | ||
| && original_platform_version.protocol_version == new_platform_version.protocol_version | ||
| && evidence.is_none() | ||
| { | ||
| return None; | ||
| } | ||
| new_platform_version.consensus.tenderdash_consensus_version as i32 | ||
| }; | ||
|
|
||
| Some(ConsensusParams { | ||
| block: None, | ||
| evidence, | ||
| validator: None, | ||
| version: Some(VersionParams { | ||
| app_version: new_platform_version.protocol_version as u64, | ||
| consensus_version, | ||
| }), | ||
| synchrony: None, | ||
| timeout: None, | ||
| abci: None, | ||
| }) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.