Skip to content

Weight meter #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6d84946
Use MultiLocation as xtokens transfer dest type. (#396)
shaunxw Mar 12, 2021
c98bdff
Use xcm-handler to execute XCM locally (#401)
shaunxw Mar 14, 2021
b2d5938
Replace XcmError::Undefined usage. (#402)
shaunxw Mar 15, 2021
8d7e297
Bump and unify serde versions. (#403)
shaunxw Mar 15, 2021
667a6d7
xtokens and xcm-support documentations (#404)
shaunxw Mar 17, 2021
e4ece39
Add unit tests for xcm-support. (#405)
shaunxw Mar 17, 2021
a78aaed
Added Minterest to the list of users. (#406)
DenisRomanovsky Mar 17, 2021
ce683b0
update step guide link
bette7 Mar 18, 2021
2ab8404
Handle unknown assets in TransactAsset impl (#409)
shaunxw Mar 18, 2021
83b05e2
Fix description and repo link. (#410)
shaunxw Mar 19, 2021
918da40
Unknown tokens pallet (#411)
shaunxw Mar 19, 2021
25db9ed
Remove nonces from oracle pallet. (#413)
shaunxw Mar 22, 2021
68f3081
refactor rewards (#412)
wangjj9219 Mar 22, 2021
523c95a
Bump rococo v1 dependencies (#418)
shaunxw Mar 24, 2021
11175f6
Update orml-unknown-tokens unit tests. (#421)
shaunxw Mar 25, 2021
d81bd25
add build-script-utils from Substrate (#422)
xlc Mar 25, 2021
e6af429
Update README.md (#420)
transxask Mar 25, 2021
53eccda
Bump impl-trait-for-tuples to 0.2.1 (#424)
Noxime Mar 26, 2021
a62cf43
update Cargo.toml (#429)
xlc Mar 30, 2021
db10cfd
add Handler (#431)
xlc Apr 1, 2021
ea01954
remove disable-tokens-by-owner (#434)
xlc Apr 5, 2021
3a77e1a
Cross-chain transfer rework (#432)
shaunxw Apr 6, 2021
e4091cd
Update currency adapter to work with new xtokens impl (#436)
shaunxw Apr 6, 2021
a3724dc
Use CurrencyId convert. (#437)
shaunxw Apr 6, 2021
d1749f0
Update xtokens docs. (#438)
shaunxw Apr 7, 2021
8053ddb
Don't deposit failure event in orml-unknown-tokens. (#440)
shaunxw Apr 8, 2021
af1b069
Update README.md (#441)
sea212 Apr 10, 2021
2cd9ccf
Add PoV size in benchmarking. (#442)
shaunxw Apr 11, 2021
c7758ba
Bump cumulus ref in cargo patch. (#443)
shaunxw Apr 11, 2021
95ca80c
fix missing features (#444)
xlc Apr 12, 2021
57af18a
update auction weight (#445)
wangjj9219 Apr 12, 2021
575518d
Bump dependencies. (#448)
shaunxw Apr 13, 2021
670f6ec
Updated Cargo.dev.toml
brettkolodny Apr 15, 2021
102f144
Updated Cargo.dev.toml
brettkolodny Apr 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 68 additions & 19 deletions Cargo.dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ members = [
"currencies",
"gradually-update",
"oracle",
"oracle/rpc",
"oracle/rpc/runtime-api",
"tokens",
"traits",
"utilities",
Expand All @@ -16,26 +18,73 @@ members = [
"nft",
"xtokens",
"xcm-support",
"unknown-tokens",
"build-script-utils",
"weight-meter",
]
resolver = "2"

[patch.crates-io]
frame-benchmarking = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
frame-support = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
frame-system = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-api = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-inherents = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-trie = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
sp-version = { git = "https://github.com/paritytech/substrate.git", branch = "rococo-v1" }
[patch.'https://github.com/paritytech/substrate']
frame-benchmarking = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
frame-support = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
frame-system = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-balances = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-elections-phragmen = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-scheduler = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-treasury = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-authorship = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-vesting = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-timestamp = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-session = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-staking = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-offences = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
pallet-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-api = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-application-crypto = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-arithmetic = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-core = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-inherents = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-io = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-runtime = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-runtime-interface = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-std = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-trie = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-version = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-externalities = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-state-machine = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-wasm-interface = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-keystore = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-staking = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-storage = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-panic-handler = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-npos-elections = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-npos-elections-compact = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-debug-derive = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-allocator = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-authority-discovery = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sc-executor-common = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sc-executor-wasmi = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sc-executor = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sc-client-api = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-tasks = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-authorship = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-consensus = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-timestamp = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-session = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-blockchain = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }
sp-transaction-pool = { git = "https://github.com/paritytech//substrate", rev = "816ed3d4e77a2463c86e69ec5a26fc307ef452b9" }

[patch.'https://github.com/paritytech/cumulus']
cumulus-primitives-core = { git = "https://github.com/paritytech//cumulus", rev = "3db8a38cfad53c4fe742ca68d7b425b88c61813d" }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech//cumulus", rev = "3db8a38cfad53c4fe742ca68d7b425b88c61813d" }
parachain-info = { git = "https://github.com/paritytech//cumulus", rev = "3db8a38cfad53c4fe742ca68d7b425b88c61813d" }
cumulus-pallet-xcm-handler = { git = "https://github.com/paritytech//cumulus", rev = "3db8a38cfad53c4fe742ca68d7b425b88c61813d" }

[patch.'https://github.com/paritytech/polkadot']
xcm = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
xcm-executor = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
xcm-builder = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
polkadot-core-primitives = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
polkadot-parachain = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
polkadot-primitives = { git = "https://github.com/paritytech//polkadot", rev = "8adff378fe35c850d5155732ae32260bcb5feb9b" }
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ check-tests: githooks

test: githooks
./scripts/run.sh test
cargo test --manifest-path nft/Cargo.toml -p orml-nft --features disable-tokens-by-owner

GITHOOKS_SRC = $(wildcard githooks/*)
GITHOOKS_DEST = $(patsubst githooks/%, $(GITHOOK)/%, $(GITHOOKS_SRC))
Expand Down Expand Up @@ -47,5 +46,4 @@ dev-check-tests: Cargo.toml
cargo check --tests --all

dev-test: Cargo.toml
cargo test --all
cargo test --manifest-path nft/Cargo.toml -p orml-nft --features disable-tokens-by-owner
cargo test --all --features runtime-benchmarks
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ The Open Runtime Module Library (ORML) is a community maintained collection of S
- Provides scheduled balance locking mechanism, in a *graded vesting* way.
- [orml-gradually-update](./gradually-update)
- Provides way to adjust numeric parameter gradually over a period of time.
- [orml-xtokens](./xtokens)
- Provides way to do cross-chain assets transfer.
- [Step-by-Step guide](https://github.com/open-web3-stack/open-runtime-module-library/wiki/xtokens) to make XCM cross-chain fungible asset transfer available on your parachain
- [orml-xcm-support](./xcm-support)
- Provides traits, types, and implementations to support XCM integration.

## Example

Expand All @@ -48,7 +53,7 @@ ORML use `Cargo.dev.toml` to avoid workspace conflicts with project cargo config
- change the command to `make dev-check` etc which does the copy. (For the full list of `make` commands, check `Makefile`)

# Web3 Foundation Grant Project
ORML is part of the bigger `Open-Web3-Stack` initiative, that is currently under a General Grant from Web3 Foundation. See Application details [here](https://github.com/open-web3-stack/General-Grants-Program/blob/master/grants/speculative/open_web3_stack.md). The 1st milestone has been delivered.
ORML is part of the bigger `Open-Web3-Stack` initiative, that is currently under a General Grant from Web3 Foundation. See Application details [here](https://github.com/open-web3-stack/General-Grants-Program/blob/master/grants/speculative/open_web3_stack.md). The 1st milestone has been delivered.

# Projects using ORML
- [If you intend or are using ORML, please add your project here](https://github.com/open-web3-stack/open-runtime-module-library/edit/master/README.md)
Expand All @@ -61,6 +66,10 @@ _In alphabetical order_
- [ChainX](https://github.com/chainx-org/ChainX)
- [HydraDX](https://github.com/galacticcouncil/hack.HydraDX-node)
- [Laminar Chain](https://github.com/laminar-protocol/laminar-chain)
- [Listen](https://github.com/listenofficial)
- [Minterest](https://github.com/minterest-finance/minterest-chain-node)
- [Plasm Network](https://github.com/PlasmNetwork)
- [Setheum Network](https://github.com/Setheum-Labs/Setheum)
- [Valiu Liquidity Network](https://github.com/valibre-org/vln-node)
- [Zeitgeist](https://github.com/zeitgeistpm/zeitgeist)

2 changes: 1 addition & 1 deletion auction/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Acala Developers"]
edition = "2018"

[dependencies]
serde = { version = "1.0.111", optional = true }
serde = { version = "1.0.124", optional = true }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }
Expand Down
10 changes: 0 additions & 10 deletions auction/src/default_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ impl crate::WeightInfo for () {
.saturating_add(DbWeight::get().reads(12 as Weight))
.saturating_add(DbWeight::get().writes(12 as Weight))
}
fn bid_surplus_auction() -> Weight {
(257_830_000 as Weight)
.saturating_add(DbWeight::get().reads(6 as Weight))
.saturating_add(DbWeight::get().writes(5 as Weight))
}
fn bid_debit_auction() -> Weight {
(287_271_000 as Weight)
.saturating_add(DbWeight::get().reads(7 as Weight))
.saturating_add(DbWeight::get().writes(8 as Weight))
}
fn on_finalize(c: u32) -> Weight {
(50_992_000 as Weight)
.saturating_add((171_653_000 as Weight).saturating_mul(c as Weight))
Expand Down
4 changes: 1 addition & 3 deletions auction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub mod module {

pub trait WeightInfo {
fn bid_collateral_auction() -> Weight;
fn bid_surplus_auction() -> Weight;
fn bid_debit_auction() -> Weight;
fn on_finalize(c: u32) -> Weight;
}

Expand Down Expand Up @@ -131,7 +129,7 @@ pub mod module {
Auctions::<T>::try_mutate_exists(id, |auction| -> DispatchResult {
let mut auction = auction.as_mut().ok_or(Error::<T>::AuctionNotExist)?;

let block_number = <frame_system::Module<T>>::block_number();
let block_number = <frame_system::Pallet<T>>::block_number();

// make sure auction is started
ensure!(block_number >= auction.start, Error::<T>::AuctionNotStarted);
Expand Down
5 changes: 3 additions & 2 deletions auction/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl frame_system::Config for Runtime {
type BaseCallFilter = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
}

pub struct Handler;
Expand Down Expand Up @@ -86,8 +87,8 @@ construct_runtime!(
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
AuctionModule: auction::{Module, Storage, Call, Event<T>},
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
AuctionModule: auction::{Pallet, Storage, Call, Event<T>},
}
);

Expand Down
4 changes: 3 additions & 1 deletion authority/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Acala Developers"]
edition = "2018"

[dependencies]
serde = { version = "1.0.111", optional = true }
serde = { version = "1.0.124", optional = true }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }
Expand Down Expand Up @@ -38,4 +38,6 @@ std = [
"orml-traits/std",
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
6 changes: 3 additions & 3 deletions authority/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ pub mod module {
*id = id.checked_add(1).ok_or(Error::<T>::Overflow)?;
Ok(current_id)
})?;
let now = frame_system::Module::<T>::block_number();
let now = frame_system::Pallet::<T>::block_number();
let delay = match when {
DispatchTime::At(x) => x.checked_sub(&now).ok_or(Error::<T>::Overflow)?,
DispatchTime::After(x) => x,
Expand Down Expand Up @@ -283,7 +283,7 @@ pub mod module {
task_id: ScheduleTaskIndex,
when: DispatchTime<T::BlockNumber>,
) -> DispatchResultWithPostInfo {
let now = frame_system::Module::<T>::block_number();
let now = frame_system::Pallet::<T>::block_number();
let new_delay = match when {
DispatchTime::At(x) => x.checked_sub(&now).ok_or(Error::<T>::Overflow)?,
DispatchTime::After(x) => x,
Expand Down Expand Up @@ -317,7 +317,7 @@ pub mod module {
)
.map_err(|_| Error::<T>::FailedToDelay)?;

let now = frame_system::Module::<T>::block_number();
let now = frame_system::Pallet::<T>::block_number();
let dispatch_at = now.saturating_add(additional_delay);

Self::deposit_event(Event::Delayed(initial_origin, task_id, dispatch_at));
Expand Down
7 changes: 4 additions & 3 deletions authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl frame_system::Config for Runtime {
type BaseCallFilter = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
}

parameter_types! {
Expand Down Expand Up @@ -162,9 +163,9 @@ frame_support::construct_runtime!(
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Module, Call, Config, Event<T>},
Authority: authority::{Module, Call, Origin<T>, Event<T>},
Scheduler: pallet_scheduler::{Module, Call, Storage, Event<T>},
System: frame_system::{Pallet, Call, Config, Event<T>},
Authority: authority::{Pallet, Call, Origin<T>, Event<T>},
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
}
);

Expand Down
2 changes: 1 addition & 1 deletion benchmarking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[dependencies]
serde = { version = "1.0.111", optional = true }
serde = { version = "1.0.124", optional = true }
paste = "0.1.16"
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }
Expand Down
20 changes: 15 additions & 5 deletions benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,8 @@ macro_rules! impl_benchmark {
>::instance(&selected_benchmark, c, verify)?;

// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
frame_system::Module::<$runtime>::set_block_number(1u32.into());
if $crate::Zero::is_zero(&frame_system::Pallet::<$runtime>::block_number()) {
frame_system::Pallet::<$runtime>::set_block_number(1u32.into());
}

// Commit the externalities to the database, flushing the DB cache.
Expand All @@ -864,12 +864,21 @@ macro_rules! impl_benchmark {
"Start Benchmark: {:?}", c
);

let start_pov = $crate::benchmarking::proof_size();
let start_extrinsic = $crate::benchmarking::current_time();

closure_to_benchmark()?;

let finish_extrinsic = $crate::benchmarking::current_time();
let elapsed_extrinsic = finish_extrinsic - start_extrinsic;
let end_pov = $crate::benchmarking::proof_size();

// Calculate the diff caused by the benchmark.
let elapsed_extrinsic = finish_extrinsic.saturating_sub(start_extrinsic);
let diff_pov = match (start_pov, end_pov) {
(Some(start), Some(end)) => end.saturating_sub(start),
_ => Default::default(),
};

// Commit the changes to get proper write count
$crate::benchmarking::commit_db();
frame_support::log::trace!(
Expand All @@ -896,6 +905,7 @@ macro_rules! impl_benchmark {
repeat_reads: read_write_count.1,
writes: read_write_count.2,
repeat_writes: read_write_count.3,
proof_size: diff_pov,
});
}

Expand Down Expand Up @@ -990,8 +1000,8 @@ macro_rules! impl_benchmark_test {
>::instance(&selected_benchmark, &c, true)?;

// Set the block number to at least 1 so events are deposited.
if $crate::Zero::is_zero(&frame_system::Module::<$runtime>::block_number()) {
frame_system::Module::<$runtime>::set_block_number(1u32.into());
if $crate::Zero::is_zero(&frame_system::Pallet::<$runtime>::block_number()) {
frame_system::Pallet::<$runtime>::set_block_number(1u32.into());
}

// Run execution + verification
Expand Down
5 changes: 3 additions & 2 deletions benchmarking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl frame_system::Config for Test {
type BaseCallFilter = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
type OnSetCode = ();
}

impl tests::test::Config for Test {
Expand All @@ -97,8 +98,8 @@ construct_runtime!(
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system::{Module, Call, Storage, Config, Event<T>},
Pallet: test::{Module, Call, Storage, Config},
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
Pallet: test::{Pallet, Call, Storage, Config},

}
);
Expand Down
Loading