Skip to content

Commit

Permalink
defined emergency whitelist validator threshold for emergency upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad committed Feb 8, 2025
1 parent e2d2b55 commit df3985d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cosmwasm/enclaves/execute/src/registration/offchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,17 @@ fn is_export_approved_offchain(mut f_in: File, report: &sgx_report_body_t) -> bo
}

if approved_power * 3 < total_voting_power * 2 {
error!("not enogh voting power");
return false;
#[cfg(feature = "verify-validator-whitelist")]
let emergency_threshold_reached =
approved_whitelisted >= validator_whitelist::VALIDATOR_THRESHOLD_EMERGENCY;

#[cfg(not(feature = "verify-validator-whitelist"))]
let emergency_threshold_reached = false;

if !emergency_threshold_reached {
error!("not enough voting power, emergency threshold not reached");
return false;
}
}

true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ const WHITELIST_FROM_FILE: &str = include_str!("../fixtures/validator_whitelist_

#[cfg(not(feature = "production"))]
pub const VALIDATOR_THRESHOLD: usize = 1;
#[cfg(not(feature = "production"))]
pub const VALIDATOR_THRESHOLD_EMERGENCY: usize = 2;

#[cfg(feature = "production")]
pub const VALIDATOR_THRESHOLD: usize = 5;
#[cfg(feature = "production")]
pub const VALIDATOR_THRESHOLD_EMERGENCY: usize = 25;

lazy_static::lazy_static! {
pub static ref VALIDATOR_WHITELIST: ValidatorList = ValidatorList::from_str(WHITELIST_FROM_FILE);
Expand Down

0 comments on commit df3985d

Please sign in to comment.