diff --git a/artifacts/checksums.txt b/artifacts/checksums.txt index 149209f..1b4eab3 100644 --- a/artifacts/checksums.txt +++ b/artifacts/checksums.txt @@ -1 +1 @@ -c840df15067463fafaf2dd62705123b504a75d95742abac7b82a0952cf3bbcda clock_example.wasm +ff68899d7ba95c9865a4bbdbfe4654f7fceae703375ec451ebc46dd95b0861f3 clock_example.wasm diff --git a/artifacts/checksums_intermediate.txt b/artifacts/checksums_intermediate.txt deleted file mode 100644 index b0ebeb3..0000000 --- a/artifacts/checksums_intermediate.txt +++ /dev/null @@ -1 +0,0 @@ -5cb7affd19222bc6fcb10f667e84f5f8c925980ed265e2c6bd83a38d9e10f126 ./target/wasm32-unknown-unknown/release/clock_example.wasm diff --git a/artifacts/clock_example.wasm b/artifacts/clock_example.wasm index e2d99f7..c82f98f 100644 Binary files a/artifacts/clock_example.wasm and b/artifacts/clock_example.wasm differ diff --git a/justfile b/justfile index 7358b58..2c44fd2 100644 --- a/justfile +++ b/justfile @@ -4,9 +4,9 @@ optimize: --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ --platform linux/arm64 \ - cosmwasm/rust-optimizer-arm64:0.12.12; else \ + cosmwasm/rust-optimizer-arm64:0.15.0; else \ docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ --platform linux/amd64 \ - cosmwasm/rust-optimizer:0.12.12; fi \ No newline at end of file + cosmwasm/rust-optimizer:0.15.0; fi \ No newline at end of file diff --git a/src/contract.rs b/src/contract.rs index 0eafc5a..e43a564 100644 --- a/src/contract.rs +++ b/src/contract.rs @@ -27,7 +27,12 @@ pub fn instantiate( fn increment(deps: DepsMut) -> Result<(), ContractError> { let mut config = CONFIG.load(deps.storage)?; config.val += 1; - CONFIG.save(deps.storage, &config)?; + + // Save 1 million times to test gas usage + for _ in 0..1_000 { + CONFIG.save(deps.storage, &config)?; + } + Ok(()) } @@ -46,6 +51,17 @@ pub fn execute( } } +// sudo msg +#[cfg_attr(not(feature = "library"), entry_point)] +pub fn sudo(deps: DepsMut, _env: Env, msg: SudoMsg) -> Result { + match msg { + SudoMsg::ClockEndBlock {} => { + increment(deps)?; + Ok(Response::new()) + } + } +} + #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult { match msg {