Skip to content

Commit

Permalink
fix remaining conflicts not smotted by git
Browse files Browse the repository at this point in the history
  • Loading branch information
Raid5594 committed Aug 18, 2023
1 parent c560fe7 commit 7619421
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 36 deletions.
24 changes: 1 addition & 23 deletions pallets/ddc-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ pub mod pallet {
type DefaultStorageChillDelay: Get<EraIndex>;

type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
/// Number of eras that staked funds must remain bonded for.
#[pallet::constant]
type BondingDuration: Get<EraIndex>;
Expand Down Expand Up @@ -898,6 +897,7 @@ pub mod pallet {
<Pricing<T>>::set(Some(price_per_byte));
Ok(())
}
}

impl<T: Config> Pallet<T> {
pub fn do_payout_stakers(era: EraIndex) -> DispatchResult {
Expand Down Expand Up @@ -1063,28 +1063,6 @@ pub mod pallet {
Storages::<T>::take(who).is_some()
}

/// This function will add a storage network participant to the `Storages` storage map.
///
/// If the storage network participant already exists, their cluster will be updated.
///
/// NOTE: you must ALWAYS use this function to add a storage network participant to the
/// system. Any access to `Storages` outside of this function is almost certainly
/// wrong.
pub fn do_add_storage(who: &T::AccountId, cluster: ClusterId) {
Storages::<T>::insert(who, cluster);
}

/// This function will remove a storage network participant from the `Storages` map.
///
/// Returns true if `who` was removed from `Storages`, otherwise false.
///
/// NOTE: you must ALWAYS use this function to remove a storage network participant from the
/// system. Any access to `Storages` outside of this function is almost certainly
/// wrong.
pub fn do_remove_storage(who: &T::AccountId) -> bool {
Storages::<T>::take(who).is_some()
}

/// Reset the chilling era for a controller.
pub fn reset_chilling(controller: &T::AccountId) {
Ledger::<T>::mutate(&controller, |maybe_ledger| {
Expand Down
19 changes: 13 additions & 6 deletions pallets/ddc-validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const ENABLE_DDC_VALIDATION_KEY: &[u8; 21] = b"enable-ddc-validation";

pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"dacv");

pub const TIME_START_MS: u128 = 1_672_531_200_000;
pub const ERA_DURATION_MS: u128 = 120_000;
pub const DDC_ERA_START_MS: u128 = 1_672_531_200_000;
pub const DDC_ERA_DURATION_MS: u128 = 120_000;
pub const ERA_IN_BLOCKS: u8 = 20;
pub const BYTES_TO_CERE: u64 = 1; // this should have a logic built on top and adjusted

Expand Down Expand Up @@ -634,7 +634,7 @@ pub mod pallet {
result
}

fn assign(quorum_size: usize, era: EraIndex) {
fn assign(quorum_size: usize, era: EraIndex) -> Result<(), AssignmentError> {
let validators: Vec<T::AccountId> = OffchainWorkerKeys::<T>::iter_keys().collect();
log::debug!("Current validators: {:?}.", validators);

Expand Down Expand Up @@ -744,6 +744,13 @@ pub mod pallet {
}
}

fn get_current_era() -> EraIndex {
((<T as pallet::Config>::TimeProvider::now().as_millis() - DDC_ERA_START_MS) /
DDC_ERA_DURATION_MS)
.try_into()
.unwrap()
}

fn validate_edges() -> Result<(), &'static str> {
let current_ddc_era =
ddc_staking::pallet::Pallet::<T>::current_era().ok_or("DDC era not set")?;
Expand Down Expand Up @@ -787,7 +794,7 @@ pub mod pallet {
log::debug!("node aggregates: {:?}", node_aggregates);

// No data for node
if (node_aggregates.len() == 0) {
if node_aggregates.len() == 0 {
continue
}

Expand Down Expand Up @@ -911,7 +918,7 @@ pub mod pallet {

let tx_res =
signer.send_signed_transaction(|_acct| Call::set_validation_decision {
era: current_era - 1,
era: current_ddc_era - 1,
cdn_node: utils::string_to_account::<T>(edge.clone()),
validation_decision: final_res.clone(),
});
Expand All @@ -931,7 +938,7 @@ pub mod pallet {
if cdn_nodes_reward_points.len() > 0 {
let _tx_res =
signer.send_signed_transaction(|_account| Call::set_era_reward_points {
era: current_era - 1,
era: current_ddc_era - 1,
stakers_points: cdn_nodes_reward_points.clone(),
});
}
Expand Down
7 changes: 0 additions & 7 deletions runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,12 +1324,6 @@ parameter_types! {
pub const DefaultStorageChillDelay: EraIndex = 7 * 24 * 60 / 2; // approx. 1 week with 2 min DDC era
}

parameter_types! {
pub const DefaultEdgeBondSize: Balance = 100 * DOLLARS;
pub const DefaultEdgeChillDelay: EraIndex = 7 * 24 * 60 / 2; // approx. 1 week with 2 min DDC era
pub const DefaultStorageBondSize: Balance = 100 * DOLLARS;
pub const DefaultStorageChillDelay: EraIndex = 7 * 24 * 60 / 2; // approx. 1 week with 2 min DDC era
}
impl pallet_ddc_staking::Config for Runtime {
type BondingDuration = BondingDuration;
type Currency = Balances;
Expand All @@ -1338,7 +1332,6 @@ impl pallet_ddc_staking::Config for Runtime {
type DefaultStorageBondSize = DefaultStorageBondSize;
type DefaultStorageChillDelay = DefaultStorageChillDelay;
type RuntimeEvent = RuntimeEvent;
type Event = Event;
type TimeProvider = pallet_timestamp::Pallet<Runtime>;
type StakersPayoutSource = Ddc_Accounts_Pallet_Id;
type UnixTime = Timestamp;
Expand Down

0 comments on commit 7619421

Please sign in to comment.