Skip to content

Commit

Permalink
Update teeracle with multiple sources and multiple trading pairs (#107)
Browse files Browse the repository at this point in the history
* Update pallets to get teeracle with multiple srcs
* [CI] add benchmarking build
* run benchmarks on droplet. bad reproducibility. need different setup
* bump version

Co-authored-by: echevrier <edith.chevrier@scs.ch>
Co-authored-by: Alain Brenzikofer <news@brenzi.ch>
  • Loading branch information
3 people authored Dec 22, 2021
1 parent 33a765e commit 7b121e2
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 30 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,52 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

build_benchmark_binaries:
name: Benchmarking build ${{ matrix.binary }} for ${{ matrix.rust-target }} on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
rust: [stable]
binary: [release]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
TARGET: ${{ matrix.rust-target }}
RUST_BIN_DIR: target/${{ matrix.rust-target }}/debug
RELEASE_NAME: debug
steps:
- uses: actions/checkout@v2

- name: Print env
run: |
echo "RUST_BIN_DIR = ${{ env.RUST_BIN_DIR }} "
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: rustup show

- name: Install llvm-10
run: sudo apt-get install llvm-10 clang-10

- uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}-${{ matrix.binary }}-skip-ias-check

- name: Build benchmarking binary
if: ${{ matrix.binary == 'release' }}
run: |
cargo clean -p integritee-node
cargo build --release --features runtime-benchmarks
# Upload artifacts
- name: Upload integritee-node-benchmarks
uses: actions/upload-artifact@v2
with:
name: integritee-node-benchmarks-${{ github.sha }}
path: target/release/integritee-node

# Run all checks and unit test. This always run on debug mode
check:
name: Rust check ${{ matrix.check }} (${{ matrix.rust-target }})
Expand Down
29 changes: 19 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = 'Apache2'
name = 'integritee-node'
repository = 'https://github.com/integritee-network/integritee-node'
#keep with runtime version
version = '1.0.5'
version = '1.0.6'

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = 'Apache2'
name = 'integritee-node-runtime'
repository = 'https://github.com/integritee-network/integritee-node'
# keep patch revision with spec_version of runtime
version = '1.0.5'
version = '1.0.6'

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Version of the runtime specification. A full-node will not attempt to use its native
/// runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`,
/// `spec_version` and `authoring_version` are the same between Wasm and native.
spec_version: 5,
spec_version: 6,

/// Version of the implementation of the specification. Nodes are free to ignore this; it
/// serves only as an indication that the code is different; as long as the other two versions
Expand All @@ -147,7 +147,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// index.
///
/// It need *not* change when a new module is added or when a dispatchable is added.
transaction_version: 1,
transaction_version: 2,
};

/// This determines the average expected block time that we are targeting.
Expand Down
32 changes: 16 additions & 16 deletions runtime/src/weights/pallet_teeracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
//! Autogenerated weights for `pallet_teeracle`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-11-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-12-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("integritee-solo-fresh"), DB CACHE: 128

// Executed Command:
// target/release/integritee-node
// /home/ubuntu/bin/integritee-node
// benchmark
// --chain=integritee-solo-fresh
// --steps=50
Expand All @@ -18,35 +18,35 @@
// --heap-pages=4096
// --output=runtime/src/weights/pallet_teeracle.rs


#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;

/// Weight functions for pallet_teeracle.
/// Weight functions for `pallet_teeracle`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_teeracle::WeightInfo for WeightInfo<T> {
// Storage: Teerex Whitelist (r:1 w:1)
// Storage: Teerex EnclaveIndex (r:1 w:0)
// Storage: Teerex EnclaveRegistry (r:1 w:0)
// Storage: Teeracle Whitelists (r:1 w:0)
// Storage: Teeracle ExchangeRates (r:1 w:1)
fn update_exchange_rate() -> Weight {
(77_556_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Teeracle Whitelists (r:1 w:1)
fn add_to_whitelist() -> Weight {
(86_491_000 as Weight)
(35_065_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Teerex Whitelist (r:1 w:1)
// Storage: Teeracle Whitelists (r:1 w:1)
fn remove_from_whitelist() -> Weight {
(86_491_000 as Weight)
(37_631_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Teerex EnclaveIndex (r:1 w:0)
// Storage: Teeracle ExchangeRates (r:1 w:1)
// Storage: Teerex Whitelist (r:1 w:0)
fn update_exchange_rate() -> Weight {
(86_491_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}

0 comments on commit 7b121e2

Please sign in to comment.