Skip to content

Commit

Permalink
0.7.4 pre (#248)
Browse files Browse the repository at this point in the history
* feat: treasury transfer

* refactor: some parameter adjustments

* refactor: replace testnet chain spec
  • Loading branch information
ytqaljn committed Oct 30, 2023
1 parent 0c1b261 commit fbb64d3
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 89 deletions.
2 changes: 1 addition & 1 deletion c-pallets/audit/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// miner cpu use 50%.
pub(super) const SERVICE_PROVE_RATE: u128 = 25_165_824;
// miner cpu use 50%.
pub(super) const IDLE_PROVE_RATE: u128 = 71_582_788;
pub(super) const IDLE_PROVE_RATE: u128 = 572_662_304;

pub(super) const IDLE_VERIFY_RATE: u128 = 2_147_483_648;

Expand Down
15 changes: 0 additions & 15 deletions c-pallets/audit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,6 @@ pub mod pallet {
#[pallet::storage]
#[pallet::getter(fn verify_slip)]
pub(super) type VerifySlip<T: Config> = StorageDoubleMap<_, Blake2_128Concat, BlockNumberOf<T>, Blake2_128Concat, AccountOf<T>, bool>;
// FOR TEST
#[pallet::storage]
#[pallet::getter(fn test_option_storage)]
pub(super) type TestOptionStorageV3<T: Config> = StorageMap<_, Blake2_128Concat, u32, ProveInfoV2<T>>;

#[pallet::pallet]
#[pallet::storage_version(STORAGE_VERSION)]
Expand Down Expand Up @@ -680,17 +676,6 @@ pub mod pallet {
Ok(())
}
// FOR TEST
#[pallet::call_index(8)]
#[transactional]
#[pallet::weight(Weight::zero())]
pub fn test_insert_option(origin: OriginFor<T>, key: u32, value: ProveInfoV2<T> ) -> DispatchResult {
let _sender = ensure_signed(origin)?;

TestOptionStorageV3::insert(key, value);

Ok(())
}
// FOR TEST
#[pallet::call_index(9)]
#[transactional]
#[pallet::weight(Weight::zero())]
Expand Down
34 changes: 34 additions & 0 deletions c-pallets/cess-treasury/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,40 @@ pub mod pallet {

Ok(())
}

#[pallet::call_index(4)]
// FIX ME!
#[pallet::weight(Weight::zero())]
pub fn pid_send_funds(
origin: OriginFor<T>,
acc: AccountOf<T>,
funds: BalanceOf<T>,
) -> DispatchResult {
let _ = ensure_root(origin)?;

let pid = T::PunishTreasuryId::get().into_account_truncating();

<T as pallet::Config>::Currency::transfer(&pid, &acc, funds, KeepAlive)?;

Ok(())
}

#[pallet::call_index(5)]
// FIX ME!
#[pallet::weight(Weight::zero())]
pub fn sid_send_funds(
origin: OriginFor<T>,
acc: AccountOf<T>,
funds: BalanceOf<T>,
) -> DispatchResult {
let _ = ensure_root(origin)?;

let sid = T::SpaceTreasuryId::get().into_account_truncating();

<T as pallet::Config>::Currency::transfer(&sid, &acc, funds, KeepAlive)?;

Ok(())
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions c-pallets/file-bank/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// The average number of bytes that a storage node can transmit within each block
pub(super) const TRANSFER_RATE: u128 = 4_089_446;
pub(super) const TRANSFER_RATE: u128 = 2_089_446;

pub(super) const CALCULATE_RATE: u128 = 67_108_864;
pub(super) const CALCULATE_RATE: u128 = 651_088;
2 changes: 1 addition & 1 deletion c-pallets/file-bank/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ pub mod pallet {
let max_needed_cal_space = (max_task_count as u32).checked_mul(FRAGMENT_SIZE as u32).ok_or(Error::<T>::Overflow)?;
let mut life: u32 = (max_needed_cal_space / TRANSFER_RATE as u32).checked_add(11).ok_or(Error::<T>::Overflow)?;
life = (max_needed_cal_space / CALCULATE_RATE as u32)
.checked_add(10).ok_or(Error::<T>::Overflow)?
.checked_add(30).ok_or(Error::<T>::Overflow)?
.checked_add(life).ok_or(Error::<T>::Overflow)?;
Self::start_second_task(deal_hash.0.to_vec(), deal_hash, life)?;
if <Bucket<T>>::contains_key(&deal_info.user.user, &deal_info.user.bucket_name) {
Expand Down
151 changes: 83 additions & 68 deletions node/ccg/cess-testnet-spec-raw.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use cess_node_runtime::{
BalancesConfig, Block, CouncilConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig,
IndicesConfig, MaxNominations, BabeConfig, SessionConfig, Signature, StakerStatus,
StakingConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, DOLLARS,
StorageHandlerConfig, SminerConfig,
StorageHandlerConfig, SminerConfig, EVMChainIdConfig,
};

use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
Expand Down Expand Up @@ -579,6 +579,6 @@ fn testnet_genesis(
ethereum: Default::default(),
dynamic_fee: Default::default(),
base_fee: Default::default(),
evm_chain_id: Default::default(),
evm_chain_id: EVMChainIdConfig { chain_id: 11330 },
}
}

0 comments on commit fbb64d3

Please sign in to comment.