Skip to content

Commit

Permalink
chore: remove hardcoded value
Browse files Browse the repository at this point in the history
  • Loading branch information
clostao authored and deblanco committed Nov 15, 2023
1 parent 485d219 commit dc97104
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ pub mod pallet {
impl Default for GenesisConfig {
fn default() -> Self {
Self {
initial_default_conversion_rate_controller: <H160 as core::str::FromStr>::from_str(
"0x444212d6E4827893A70d19921E383130281Cda4a",
)
.expect("invalid address"),
initial_default_conversion_rate_controller: H160::zero(),
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ impl pallet_validator_fee_selector::Config for Runtime {

parameter_types! {
pub DefaultOwner : H160 = H160::from_str("0x2dEA828C816cC4D7CF195E0D220CB75354f47F2F").unwrap();
pub InitialDefaultConversionRateController: H160 = H160::from_str(
"0x444212d6E4827893A70d19921E383130281Cda4a",
).unwrap();
}

pub type Precompiles<R> = PrecompileSetBuilder<
Expand Down Expand Up @@ -347,10 +350,8 @@ impl ExtBuilder {
.expect("Pallet balances storage can be assimilated");

let config = pallet_validator_fee_selector::GenesisConfig {
initial_default_conversion_rate_controller: H160::from_str(
"0x444212d6E4827893A70d19921E383130281Cda4a",
)
.expect("invalid address"),
initial_default_conversion_rate_controller: InitialDefaultConversionRateController::get(
),
};

let custom_controller = MeaninglessTokenAddress::get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use precompile_utils::prelude::*;

use crate::{
mock::{
DefaultOwner, ExtBuilder, MeaninglessTokenAddress, NonCryptoAlith, PCall, Precompiles,
PrecompilesValue, Runtime, UnpermissionedAccount, UnpermissionedAccount2,
DefaultOwner, ExtBuilder, InitialDefaultConversionRateController, MeaninglessTokenAddress,
NonCryptoAlith, PCall, Precompiles, PrecompilesValue, Runtime, UnpermissionedAccount,
UnpermissionedAccount2,
},
DefaultAcceptance, SELECTOR_LOG_NEW_OWNER, SELECTOR_LOG_VALIDATOR_CONTROLLER_CHANGED,
SELECTOR_LOG_VALIDATOR_TOKEN_ACCEPTANCE_CHANGED,
Expand Down Expand Up @@ -342,9 +343,7 @@ fn accept_token_and_revoke() {

#[test]
fn default_conversion_rate() {
let default: Address = pallet_validator_fee_selector::GenesisConfig::default()
.initial_default_conversion_rate_controller
.into();
let default: Address = InitialDefaultConversionRateController::get().into();
ExtBuilder::default().build().execute_with(|| {
precompiles()
.prepare_test(
Expand Down

0 comments on commit dc97104

Please sign in to comment.