Skip to content

Commit

Permalink
chore: update cosmwasm + other deps
Browse files Browse the repository at this point in the history
  • Loading branch information
gluax committed Nov 27, 2024
1 parent 804c6a1 commit db22567
Show file tree
Hide file tree
Showing 10 changed files with 478 additions and 238 deletions.
651 changes: 450 additions & 201 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ overflow-checks = true
[workspace.dependencies]
anyhow = "1.0"
arbitrary = "1.3"
cosmwasm-schema = "1.5.7"
cosmwasm-std = { version = "1.5.7" }
cw-multi-test = "1.2.0"
cw-storage-plus = "1.2.0"
cw-utils = "1.0.3"
cw2 = "1.1.2"
cosmwasm-schema = "2.1"
cosmwasm-std = { version = "2.1" }
cw-multi-test = "2.2"
cw-storage-plus = "2.0"
cw-utils = "2.0"
cw2 = "2.0"
hex = "0.4.3"
k256 = { version = "0.13", default-features = false, features = ["ecdsa"] }
libfuzzer-sys = "0.4"
rand = "0.8"
schemars = { version = "0.8", features = ["semver"] }
seda-common = { git = "https://github.com/sedaprotocol/seda-common-rs.git", branch = "main" }
# leaving this in to make local development easier
# seda-common = { path = "../seda-common-rs" }
# seda-common = { path = "../seda-common-rs/crates/common" }
semver = { version = "1.0", features = ["serde"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde-big-array = { version = "0.5.1" }
serde_json = "1.0.117"
serde_json = "1.0"
sha3 = "0.10"
thiserror = { version = "1.0" }
thiserror = { version = "2.0" }
vrf-rs = "0.0.0"
xshell = "0.2"

Expand Down
9 changes: 0 additions & 9 deletions contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,9 @@ exclude = [
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# use library feature to disable all instantiate/execute/query exports
library = []

[package.metadata.scripts]
optimize = """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 \
cosmwasm/rust-optimizer:0.14.0
"""

[dependencies]
cosmwasm-schema.workspace = true
cosmwasm-std.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion contract/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ impl From<StdError> for ContractError {

impl From<ContractError> for StdError {
fn from(err: ContractError) -> StdError {
StdError::GenericErr { msg: err.to_string() }
StdError::generic_err(err.to_string())
}
}
8 changes: 4 additions & 4 deletions contract/src/msgs/data_requests/state/data_requests_map.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use super::*;

pub struct DataRequestsMap<'a> {
pub reqs: Map<'a, &'a Hash, DataRequest>,
pub committing: EnumerableSet<'a, Hash>,
pub revealing: EnumerableSet<'a, Hash>,
pub tallying: EnumerableSet<'a, Hash>,
pub reqs: Map<&'a Hash, DataRequest>,
pub committing: EnumerableSet<Hash>,
pub revealing: EnumerableSet<Hash>,
pub tallying: EnumerableSet<Hash>,
pub timeouts: Timeouts<'a>,
}

Expand Down
4 changes: 2 additions & 2 deletions contract/src/msgs/data_requests/state/timeouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use cw_storage_plus::Map;
use seda_common::types::Hash;

pub struct Timeouts<'a> {
pub timeouts: Map<'a, (u64, &'a Hash), ()>,
pub timeouts: Map<(u64, &'a Hash), ()>,
// Need this so we can remove the timeout by dr_id
pub hash_to_timeout: Map<'a, &'a Hash, u64>,
pub hash_to_timeout: Map<&'a Hash, u64>,
}

impl Timeouts<'_> {
Expand Down
10 changes: 5 additions & 5 deletions contract/src/msgs/enumerable_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use cw_storage_plus::PrimaryKey;

use super::*;

pub struct EnumerableSet<'a, Key> {
pub len: Item<'a, u32>,
pub key_to_index: Map<'a, Key, u32>,
pub index_to_key: Map<'a, u32, Key>,
pub struct EnumerableSet<Key> {
pub len: Item<u32>,
pub key_to_index: Map<Key, u32>,
pub index_to_key: Map<u32, Key>,
}

impl<'a, Key> EnumerableSet<'a, Key>
impl<'a, Key> EnumerableSet<Key>
where
Key: PrimaryKey<'a> + serde::de::DeserializeOwned + serde::Serialize,
{
Expand Down
2 changes: 1 addition & 1 deletion contract/src/msgs/owner/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fn get_owner() {
let test_info = TestInfo::init();

let owner_addr = test_info.get_owner();
assert_eq!(owner_addr.as_str(), test_info.creator().addr());
assert_eq!(owner_addr, test_info.creator().addr());
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions contract/src/msgs/staking/state/stakers_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use owner::state::ALLOWLIST;
use super::*;

pub struct StakersMap<'a> {
pub stakers: Map<'a, &'a PublicKey, Staker>,
pub public_keys: EnumerableSet<'a, PublicKey>,
pub stakers: Map<&'a PublicKey, Staker>,
pub public_keys: EnumerableSet<PublicKey>,
}

impl StakersMap<'_> {
Expand Down
8 changes: 4 additions & 4 deletions contract/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use cosmwasm_std::{
coins,
from_json,
testing::{mock_info, MockApi},
testing::{message_info, MockApi},
to_json_binary,
Addr,
MessageInfo,
Expand Down Expand Up @@ -239,10 +239,10 @@ impl TestExecutor {
};
TestExecutor {
name,
info: message_info(&addr, &coins),
addr,
signing_key,
public_key,
info: mock_info(name, &coins),
}
}

Expand All @@ -267,11 +267,11 @@ impl TestExecutor {
}

pub fn add_seda(&mut self, amount: u128) {
self.info = mock_info(self.name, &coins(self.funds().u128() + amount, "aseda"));
self.info = message_info(&self.addr(), &coins(self.funds().u128() + amount, "aseda"));
}

pub fn sub_seda(&mut self, amount: u128) {
self.info = mock_info(self.name, &coins(self.funds().u128() - amount, "aseda"));
self.info = message_info(&self.addr(), &coins(self.funds().u128() - amount, "aseda"));
}

pub fn sign_key(&self) -> Vec<u8> {
Expand Down

0 comments on commit db22567

Please sign in to comment.