Skip to content
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

fix(pswap-distribution): add pool and liquidity of TBCD for benchmark #1092

Merged
merged 5 commits into from
Jun 20, 2024

Conversation

i3ima
Copy link
Contributor

@i3ima i3ima commented Jun 13, 2024

Fixes #849. Not sure if my fix is correct as it's my first task after onboarding. Also I'm not sure if feature flags should be changed after this one because benchmarks are running with --features private-net,runtime-benchmarks,ready-to-test

pallets/dex-api/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@wer1st wer1st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benches are run by 2 ways:

  • As unit tests
  • As benchmarking process

Please test both scenarios:
To run as unit test:

cargo test --features private-net,wip,ready-to-test,runtime-benchmarks

To run as benchmarks:

mkdir benches
cargo run --release --bin framenode --features private-net,runtime-benchmarks benchmark pallet --chain=local --execution=wasm --wasm-execution=compiled --pallet pswap-distribution --extrinsic "*" --steps 50 --repeat 20 --output  ./benches

@i3ima
Copy link
Contributor Author

i3ima commented Jun 13, 2024

Benches are run by 2 ways:

  • As unit tests
  • As benchmarking process

Please test both scenarios: To run as unit test:

cargo test --features private-net,wip,ready-to-test,runtime-benchmarks

To run as benchmarks:

mkdir benches
cargo run --release --bin framenode --features private-net,runtime-benchmarks benchmark pallet --chain=local --execution=wasm --wasm-execution=compiled --pallet pswap-distribution --extrinsic "*" --steps 50 --repeat 20 --output  ./benches

All passes.

Tests:

❯ cargo test --features private-net,wip,ready-to-test,runtime-benchmarks
# Bunch of test lines...
   Doc-tests xst-benchmarking

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

❯ echo $?
0

Benchmarks:

❯ cargo run --release --bin framenode --features private-net,runtime-benchmarks benchmark pallet --chain=local --execution=wasm --wasm-execution=compiled --pallet pswap-distribution --extrinsic "*" --steps 50 --repeat 20 --output  ./benches
# Benchmark logs...

Quality and confidence:
param     error
a         0.151
b         0.774
c         0.081

Model:
Time ~=    339.7
    + a    4.746
    + b    273.7
    + c    6.805
              µs

Reads = 123 + (1 * a) + (0 * b) + (1 * c)
Writes = 91 + (0 * a) + (0 * b) + (0 * c)
Recorded proof Size = 4889 + (248 * a) + (947 * b) + (50 * c)

Created file: "./benches/pswap_distribution.rs"echo $?
0

By the way I thought one of CIs runs such scenarios 🤷.

@wer1st
Copy link
Contributor

wer1st commented Jun 13, 2024

By the way I thought one of CIs runs such scenarios 🤷.

Unit tests - yes, benchmarks - no.
There is a separate benchmarking CI pocess that should be running manually before new release.

Copy link
Contributor

@Alexey-N-Chernyshov Alexey-N-Chernyshov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! 🎉

@i3ima i3ima merged commit a53ea2e into master Jun 20, 2024
6 checks passed
@i3ima i3ima deleted the 849-fix-pswap-distribution-benchmark branch June 20, 2024 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix pswap-distribution benchmark
3 participants