Skip to content

Commit

Permalink
Bump cosm-orc (#7)
Browse files Browse the repository at this point in the history
* Bump cosm-orc

* update junod docker

* Update config

* rm cargo install

* fix
  • Loading branch information
de-husk authored Aug 2, 2022
1 parent 3268c58 commit 80d5d67
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/gas_benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@ jobs:
gas:
name: Calculate gas costs in local juno
runs-on: ubuntu-latest
env:
ADMIN_ADDR: juno10j9gpw9t4jsz47qgnkvl5n3zlm2fz72k67rxsg
defaults:
run:
working-directory: ./ci-gas-benchmark
container:
image: ghcr.io/cosmoscontracts/juno:v6.0.0
env:
PASSWORD: xxxxxxxxx
STAKE_TOKEN: ujunox
GAS_LIMIT: -1
UNSAFE_CORS: true
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install deps
run: apk --no-cache add rustup cargo

- name: Setup Juno Node
run: cd /opt && /opt/setup_and_run.sh juno10j9gpw9t4jsz47qgnkvl5n3zlm2fz72k67rxsg > /dev/null 2>&1 &
- name: Run Local Juno Node
run: |
docker run --rm -d --name juno \
-e PASSWORD=xxxxxxxxx \
-e STAKE_TOKEN=ujunox \
-e GAS_LIMIT=100000000 \
-e UNSAFE_CORS=true \
-p 1317:1317 \
-p 26656:26656 \
-p 26657:26657 \
ghcr.io/cosmoscontracts/juno:v9.0.0 /opt/setup_and_run.sh $ADMIN_ADDR
- name: Calculate gas costs
run: RUST_LOG=DEBUG cargo run
Expand Down
2 changes: 1 addition & 1 deletion ci-gas-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
cosm-orc = { version = "0.5.5" }
cosm-orc = { version = "1.1.0" }
anyhow = { version = "1.0.51"}
cw20-base = "0.13"
cw20 = "0.13"
Expand Down
Binary file removed ci-gas-benchmark/choad.png
Binary file not shown.
4 changes: 3 additions & 1 deletion ci-gas-benchmark/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
chain_cfg:
binary: "junod"
denom: "ujunox"
prefix: "juno"
chain_id: "testing"
rpc_endpoint: "http://localhost:26657/"
gas_prices: 0.1
gas_adjustment: 1.5

key_name: "validator"
21 changes: 14 additions & 7 deletions ci-gas-benchmark/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use anyhow::Result;
use cosm_orc::{
config::cfg::Config,
config::{
cfg::Config,
key::{Key, SigningKey},
},
orchestrator::cosm_orc::{CosmOrc, WasmMsg},
profilers::gas_profiler::GasProfiler,
};
Expand All @@ -11,11 +14,15 @@ use std::fs;
fn main() -> Result<()> {
env_logger::init();

let gas_report_out = "./gas_report.json";
let mut cosm_orc =
CosmOrc::new(Config::from_yaml("config.yaml")?).add_profiler(Box::new(GasProfiler::new()));
CosmOrc::new(Config::from_yaml("config.yaml")?)?.add_profiler(Box::new(GasProfiler::new()));

cosm_orc.store_contracts("./artifacts")?;
let key = SigningKey {
name: "validator".to_string(),
key: Key::Mnemonic("siren window salt bullet cream letter huge satoshi fade shiver permit offer happy immense wage fitness goose usual aim hammer clap about super trend".to_string()),
};

cosm_orc.store_contracts("./artifacts", &key)?;

let msgs: Vec<WasmMsg<InstantiateMsg, ExecuteMsg, QueryMsg>> = vec![
WasmMsg::InstantiateMsg(InstantiateMsg {
Expand All @@ -29,12 +36,12 @@ fn main() -> Result<()> {
WasmMsg::QueryMsg(QueryMsg::TokenInfo {}),
];

cosm_orc.process_msgs("cw20_base".to_string(), &msgs)?;
cosm_orc.process_msgs("cw20_base", "ex_tok_info", &msgs, &key)?;

let reports = cosm_orc.profiler_reports()?;
let reports = cosm_orc.profiler_reports().unwrap();

let j: Value = serde_json::from_slice(&reports[0].json_data)?;
fs::write(gas_report_out, j.to_string())?;
fs::write("./gas_report.json", j.to_string())?;

Ok(())
}

0 comments on commit 80d5d67

Please sign in to comment.