Skip to content
Snippets Groups Projects
  • Hugo Trentesaux's avatar
    ef73a0d0
    improve documentation (!101) · ef73a0d0
    Hugo Trentesaux authored and Éloïs's avatar Éloïs committed
    * fix
    
    * doc(end2end): detail test users
    
    * doc(all): update docker tag
    
    update docker image name from 0.2.0 to 0.3.0
    use "docker compose" everywhere instead of "docker-compose"
    improve table of content
    fix layout
    
    * doc(all): improve docs
    
    add logo to readme
    add table of content
    rewording
    complete
    
    * doc(all): fix typos
    ef73a0d0
    History
    improve documentation (!101)
    Hugo Trentesaux authored and Éloïs's avatar Éloïs committed
    * fix
    
    * doc(end2end): detail test users
    
    * doc(all): update docker tag
    
    update docker image name from 0.2.0 to 0.3.0
    use "docker compose" everywhere instead of "docker-compose"
    improve table of content
    fix layout
    
    * doc(all): improve docs
    
    add logo to readme
    add table of content
    rewording
    complete
    
    * doc(all): fix typos

How to benchmarks weights of a Call/Hook/Pallet

  1. Create the benchmarking tests, see commit 31057e37 for a complete real example.
  2. Run the benchmark test on your local machine: cargo test -p <pallet> --features runtime-benchmarks
  3. If the benchmark tests compiles and pass, compile the binary with benchmarks on your local machine: cargo build --release --features runtime-benchmarks
  4. Run the benchmarks on your local machine (to test if it work with a real runtime). The command is: duniter benchmark pallet --chain=CURRENCY-dev --steps=50 --repeat=20 --pallet=pallet_universal_dividend --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=.
  5. If it worked, use the generated file content to create or update the WeightInfo trait and the () dummy implementation. Then use the WeightInfo tarit in the real code of the pallet. See 79e0fd4b for a complete real example.
  6. Redo steps 3. and 4. on the reference machine.
  7. Put the generated file on runtime/common/src/weights and use it in the runtimes configuration. See cee7c3b2 for a complete real example.

Note 1: You must replace CURRENCY by the currency type, or for ĞDev use directly --chain=dev.

Note 2: If the reference machine does not support wasmtime, you should replace --wasm-execution=compiled by --wasm-execution=interpreted-i-know-what-i-do.

What is the reference machine?

For now (09/2022), it's a Raspberry Pi 4 Model B - 4GB with an SSD connected via USB3.

To cross-compile the benchmarks binary for armv7:

./scripts/cross-build-arm.sh --features runtime-benchmarks

The cross compiled binary is generated here: target/armv7-unknown-linux-gnueabihf/release/duniter