mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 21:01:03 +00:00
Add Auctions and Crowdloans to Kusama and Westend (#2999)
* add to westend * fixes * fix runtime tests * add to kusama * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_auctions.rs * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::crowdloan --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_crowdloan.rs * fix auctions benchmarks * add benchmark to kusama * update weights * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::crowdloan --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_crowdloan.rs * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_auctions.rs * update to use weights * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_auctions.rs * Initiate auctions with 2/3 council * add check and docs * update crowdloan deposits * move tests * move other tests * update ending period * cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_common_auctions.rs * fix origin * cargo run --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_common::auctions --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_common_auctions.rs Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Gavin Wood <gavin@parity.io>
This commit is contained in:
@@ -94,7 +94,7 @@ type WinnersData<T> = Vec<(<T as frame_system::Config>::AccountId, ParaId, Balan
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Config> as Auctions {
|
||||
/// Number of auctions started so far.
|
||||
pub AuctionCounter: AuctionIndex;
|
||||
pub AuctionCounter get(fn auction_counter): AuctionIndex;
|
||||
|
||||
/// Information relating to the current auction, if there is one.
|
||||
///
|
||||
@@ -504,11 +504,9 @@ impl<T: Config> Module<T> {
|
||||
let auction_counter = AuctionCounter::get();
|
||||
Self::deposit_event(RawEvent::WinningOffset(auction_counter, offset));
|
||||
let res = Winning::<T>::get(offset).unwrap_or([Self::EMPTY; SlotRange::SLOT_RANGE_COUNT]);
|
||||
let mut i = T::BlockNumber::zero();
|
||||
while i < ending_period {
|
||||
Winning::<T>::remove(i);
|
||||
i += One::one();
|
||||
}
|
||||
// This `remove_all` statement should remove at most `EndingPeriod` / `SampleLength` items,
|
||||
// which should be bounded and sensibly configured in the runtime.
|
||||
Winning::<T>::remove_all();
|
||||
AuctionInfo::<T>::kill();
|
||||
return Some((res, lease_period_index))
|
||||
}
|
||||
@@ -1517,6 +1515,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
// Worst case: 10 bidders taking all wining spots, and we need to calculate the winner for auction end.
|
||||
// Entire winner map should be full and removed at the end of the benchmark.
|
||||
on_initialize {
|
||||
// Create a new auction
|
||||
let duration: T::BlockNumber = 99u32.into();
|
||||
@@ -1530,6 +1529,12 @@ mod benchmarking {
|
||||
assert!(winner.is_some());
|
||||
}
|
||||
|
||||
let winning_data = Winning::<T>::get(T::BlockNumber::from(0u32)).unwrap();
|
||||
// Make winning map full
|
||||
for i in 0u32 .. (T::EndingPeriod::get() / T::SampleLength::get()).saturated_into() {
|
||||
Winning::<T>::insert(T::BlockNumber::from(i), winning_data.clone());
|
||||
}
|
||||
|
||||
// Move ahead to the block we want to initialize
|
||||
frame_system::Pallet::<T>::set_block_number(duration + now + T::EndingPeriod::get());
|
||||
|
||||
@@ -1546,6 +1551,7 @@ mod benchmarking {
|
||||
} verify {
|
||||
let auction_index = AuctionCounter::get();
|
||||
assert_last_event::<T>(RawEvent::AuctionClosed(auction_index).into());
|
||||
assert!(Winning::<T>::iter().count().is_zero());
|
||||
}
|
||||
|
||||
// Worst case: 10 bidders taking all wining spots, and winning data is full.
|
||||
@@ -1564,7 +1570,7 @@ mod benchmarking {
|
||||
}
|
||||
|
||||
// Make winning map full
|
||||
for i in 0u32 .. T::EndingPeriod::get().saturated_into() {
|
||||
for i in 0u32 .. (T::EndingPeriod::get() / T::SampleLength::get()).saturated_into() {
|
||||
Winning::<T>::insert(T::BlockNumber::from(i), winning_data.clone());
|
||||
}
|
||||
assert!(AuctionInfo::<T>::get().is_some());
|
||||
|
||||
@@ -216,7 +216,6 @@ parameter_types! {
|
||||
pub const CrowdloanId: PalletId = PalletId(*b"py/cfund");
|
||||
pub const SubmissionDeposit: Balance = 100;
|
||||
pub const MinContribution: Balance = 1;
|
||||
pub const RetirementPeriod: BlockNumber = 10;
|
||||
pub const RemoveKeysLimit: u32 = 100;
|
||||
pub const MaxMemoLength: u8 = 32;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user