Skip to content

Commit 070c102

Browse files
Add High Gas Contract
1 parent 4e6ded1 commit 070c102

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

artifacts/checksums.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c840df15067463fafaf2dd62705123b504a75d95742abac7b82a0952cf3bbcda clock_example.wasm
1+
ff68899d7ba95c9865a4bbdbfe4654f7fceae703375ec451ebc46dd95b0861f3 clock_example.wasm

artifacts/checksums_intermediate.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

artifacts/clock_example.wasm

1.09 KB
Binary file not shown.

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ optimize:
44
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
55
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
66
--platform linux/arm64 \
7-
cosmwasm/rust-optimizer-arm64:0.12.12; else \
7+
cosmwasm/rust-optimizer-arm64:0.15.0; else \
88
docker run --rm -v "$(pwd)":/code \
99
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
1010
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
1111
--platform linux/amd64 \
12-
cosmwasm/rust-optimizer:0.12.12; fi
12+
cosmwasm/rust-optimizer:0.15.0; fi

src/contract.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ pub fn instantiate(
2727
fn increment(deps: DepsMut) -> Result<(), ContractError> {
2828
let mut config = CONFIG.load(deps.storage)?;
2929
config.val += 1;
30-
CONFIG.save(deps.storage, &config)?;
30+
31+
// Save 1 million times to test gas usage
32+
for _ in 0..1_000 {
33+
CONFIG.save(deps.storage, &config)?;
34+
}
35+
3136
Ok(())
3237
}
3338

@@ -46,6 +51,17 @@ pub fn execute(
4651
}
4752
}
4853

54+
// sudo msg
55+
#[cfg_attr(not(feature = "library"), entry_point)]
56+
pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result<Response, ContractError> {
57+
match msg {
58+
SudoMsg::ClockEndBlock {} => {
59+
increment(deps)?;
60+
Ok(Response::new())
61+
}
62+
}
63+
}
64+
4965
#[cfg_attr(not(feature = "library"), entry_point)]
5066
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
5167
match msg {

0 commit comments

Comments
 (0)