From 83d373cebf1e764145e8f2e25382bb695925e12a Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Wed, 7 Feb 2024 20:20:04 +0200 Subject: [PATCH 1/9] Add proposal votes query --- Cargo.lock | 2 +- Cargo.toml | 2 +- .../neutron_interchain_queries/Cargo.toml | 2 +- .../schema/execute_msg.json | 42 ++++ .../schema/query_msg.json | 22 ++ .../src/contract.rs | 35 +++ .../neutron_interchain_queries/src/msg.rs | 7 + .../src/testing/tests.rs | 104 ++++++++- contracts/reflect/schema/execute_msg.json | 211 ------------------ 9 files changed, 212 insertions(+), 215 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d06595..bd7a70d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -720,7 +720,7 @@ dependencies = [ [[package]] name = "neutron-sdk" version = "0.9.0" -source = "git+https://github.com/neutron-org/neutron-sdk.git?branch=main#8645132d09229f717d13bcc5fd74b0886c0c9c31" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#8645132d09229f717d13bcc5fd74b0886c0c9c31" dependencies = [ "bech32", "cosmos-sdk-proto 0.20.0", diff --git a/Cargo.toml b/Cargo.toml index f57b145..664994d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ incremental = false overflow-checks = true [workspace.dependencies] -neutron-sdk = { git = "https://github.com/neutron-org/neutron-sdk.git", branch = "main" } +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" } prost = "0.12.1" prost-types = "0.12.1" cosmos-sdk-proto = { version = "0.20.0", default-features = false } diff --git a/contracts/neutron_interchain_queries/Cargo.toml b/contracts/neutron_interchain_queries/Cargo.toml index fe642f7..f9af084 100644 --- a/contracts/neutron_interchain_queries/Cargo.toml +++ b/contracts/neutron_interchain_queries/Cargo.toml @@ -21,7 +21,7 @@ backtraces = ["cosmwasm-std/backtraces"] library = [] [dependencies] -cosmwasm-std = { workspace = true } +cosmwasm-std = { workspace = true, features = ["stargate", "staking"] } cw2 = { workspace = true } schemars = { workspace = true } serde = { workspace = true } diff --git a/contracts/neutron_interchain_queries/schema/execute_msg.json b/contracts/neutron_interchain_queries/schema/execute_msg.json index c365623..cdc5e0e 100644 --- a/contracts/neutron_interchain_queries/schema/execute_msg.json +++ b/contracts/neutron_interchain_queries/schema/execute_msg.json @@ -163,6 +163,48 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "register_government_proposal_votes_query" + ], + "properties": { + "register_government_proposal_votes_query": { + "type": "object", + "required": [ + "connection_id", + "proposals_ids", + "update_period", + "voters" + ], + "properties": { + "connection_id": { + "type": "string" + }, + "proposals_ids": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "update_period": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "voters": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/contracts/neutron_interchain_queries/schema/query_msg.json b/contracts/neutron_interchain_queries/schema/query_msg.json index 858f554..8deb564 100644 --- a/contracts/neutron_interchain_queries/schema/query_msg.json +++ b/contracts/neutron_interchain_queries/schema/query_msg.json @@ -134,6 +134,28 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "government_proposal_votes" + ], + "properties": { + "government_proposal_votes": { + "type": "object", + "required": [ + "query_id" + ], + "properties": { + "query_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, { "type": "object", "required": [ diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 121ce21..8ee5ac6 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -100,6 +100,18 @@ pub fn execute( proposals_ids, update_period, } => register_gov_proposal_query(connection_id, proposals_ids, update_period), + ExecuteMsg::RegisterGovernmentProposalVotesQuery { + connection_id, + proposals_ids, + voters, + update_period, + } => register_gov_proposal_votes_query( + deps, + connection_id, + proposals_ids, + voters, + update_period, + ), ExecuteMsg::RegisterStakingValidatorsQuery { connection_id, validators, @@ -194,6 +206,26 @@ pub fn register_gov_proposal_query( Ok(Response::new().add_message(msg)) } +pub fn register_gov_proposal_votes_query( + deps: DepsMut, + connection_id: String, + proposals_ids: Vec, + voters: Vec, + update_period: u64, +) -> NeutronResult> { + deps.api + .debug("WASMDEBUG: register_gov_proposal_votes_query"); + + let msg = new_register_gov_proposal_votes_query_msg( + connection_id, + proposals_ids, + voters, + update_period, + )?; + + Ok(Response::new().add_message(msg)) +} + pub fn register_staking_validators_query( connection_id: String, validators: Vec, @@ -341,6 +373,9 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> NeutronResult QueryMsg::GovernmentProposals { query_id } => Ok(to_json_binary( &query_government_proposals(deps, env, query_id)?, )?), + QueryMsg::GovernmentProposalVotes { query_id } => Ok(to_json_binary( + &query_government_proposal_votes(deps, env, query_id)?, + )?), QueryMsg::GetDelegations { query_id } => { Ok(to_json_binary(&query_delegations(deps, env, query_id)?)?) } diff --git a/contracts/neutron_interchain_queries/src/msg.rs b/contracts/neutron_interchain_queries/src/msg.rs index 70ff045..06366b5 100644 --- a/contracts/neutron_interchain_queries/src/msg.rs +++ b/contracts/neutron_interchain_queries/src/msg.rs @@ -34,6 +34,12 @@ pub enum ExecuteMsg { proposals_ids: Vec, update_period: u64, }, + RegisterGovernmentProposalVotesQuery { + connection_id: String, + proposals_ids: Vec, + voters: Vec, + update_period: u64, + }, RegisterTransfersQuery { connection_id: String, update_period: u64, @@ -97,6 +103,7 @@ pub enum QueryMsg { StakingValidators { query_id: u64 }, ValidatorsSigningInfos { query_id: u64 }, GovernmentProposals { query_id: u64 }, + GovernmentProposalVotes { query_id: u64 }, GetDelegations { query_id: u64 }, GetUnbondingDelegations { query_id: u64 }, GetRegisteredQuery { query_id: u64 }, diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 5ec57d2..5e8785d 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -21,7 +21,8 @@ use base64::prelude::*; use cosmos_sdk_proto::cosmos::base::v1beta1::{Coin as CosmosCoin, DecCoin as CosmosDecCoin}; use cosmos_sdk_proto::cosmos::distribution::v1beta1::FeePool as CosmosFeePool; use cosmos_sdk_proto::cosmos::gov::v1beta1::{ - Proposal as CosmosProposal, TallyResult as CosmosTallyResult, + Proposal as CosmosProposal, TallyResult as CosmosTallyResult, Vote, + WeightedVoteOption as CosmosWeightedVoteOption, }; use cosmos_sdk_proto::cosmos::slashing::v1beta1::ValidatorSigningInfo as CosmosValidatorSigningInfo; use cosmos_sdk_proto::cosmos::staking::v1beta1::Validator as CosmosValidator; @@ -227,6 +228,27 @@ fn build_interchain_query_gov_proposal_value(proposal_id: u64) -> StorageValue { } } +#[allow(deprecated)] +fn build_interchain_query_gov_proposal_votes_value(proposal_id: u64) -> StorageValue { + let votes_key = create_gov_proposal_votes_key(proposal_id).unwrap(); + + let vote = Vote { + proposal_id, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + option: 0, + options: vec![CosmosWeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }; + + StorageValue { + storage_prefix: "".to_string(), + key: Binary(votes_key), + value: Binary(vote.encode_to_vec()), + } +} + fn build_interchain_query_balance_response(addr: Addr, denom: String, amount: String) -> Binary { let converted_addr_bytes = decode_and_convert(addr.as_str()).unwrap(); @@ -504,6 +526,86 @@ fn test_gov_proposals_query() { ) } +#[test] +fn test_gov_proposal_votes_query() { + let mut deps = dependencies(&[]); + + let proposals_ids = vec![1, 2, 3]; + + let msg = ExecuteMsg::RegisterGovernmentProposalVotesQuery { + connection_id: "connection".to_string(), + proposals_ids: proposals_ids.clone(), + voters: vec![ + "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + "osmo1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + ], + update_period: 10, + }; + + let keys = register_query(&mut deps, mock_env(), mock_info("", &[]), msg); + + let registered_query = + build_registered_query_response(1, QueryParam::Keys(keys.0), QueryType::KV, 325); + + let mut kv_results: Vec = vec![]; + + for id in proposals_ids { + let value = build_interchain_query_gov_proposal_votes_value(id); + kv_results.push(value); + } + + let proposals_votes_response = QueryRegisteredQueryResultResponse { + result: InterchainQueryResult { + kv_results, + height: 0, + revision: 0, + }, + }; + + deps.querier.add_registered_queries(1, registered_query); + deps.querier + .add_query_response(1, to_json_binary(&proposals_votes_response).unwrap()); + + let government_proposal_votes = QueryMsg::GovernmentProposalVotes { query_id: 1 }; + let resp: ProposalVotesResponse = + from_json(query(deps.as_ref(), mock_env(), government_proposal_votes).unwrap()).unwrap(); + assert_eq!( + resp, + ProposalVotesResponse { + last_submitted_local_height: 325, + votes: GovernmentProposalVotes { + proposal_votes: vec![ + ProposalVote { + proposal_id: 1, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }, + ProposalVote { + proposal_id: 2, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + }, + ProposalVote { + proposal_id: 3, + voter: "cosmos1yz54ncxj9csp7un3xled03q6thrrhy9cztkfzs".to_string(), + options: vec![WeightedVoteOption { + weight: "1000000000000000000".to_string(), + option: 1, + }], + } + ] + } + } + ) +} + #[test] fn test_staking_validators_query() { let mut deps = dependencies(&[]); diff --git a/contracts/reflect/schema/execute_msg.json b/contracts/reflect/schema/execute_msg.json index 466e8ef..fadf1e1 100644 --- a/contracts/reflect/schema/execute_msg.json +++ b/contracts/reflect/schema/execute_msg.json @@ -381,30 +381,6 @@ }, "additionalProperties": false }, - { - "type": "object", - "required": [ - "staking" - ], - "properties": { - "staking": { - "$ref": "#/definitions/StakingMsg" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "distribution" - ], - "properties": { - "distribution": { - "$ref": "#/definitions/DistributionMsg" - } - }, - "additionalProperties": false - }, { "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", "type": "object", @@ -468,10 +444,6 @@ } ] }, - "Decimal": { - "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", - "type": "string" - }, "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", "type": "object", @@ -902,36 +874,6 @@ } }, "additionalProperties": false - }, - { - "description": "This maps directly to [MsgVoteWeighted](https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/proto/cosmos/gov/v1beta1/tx.proto#L66-L78) in the Cosmos SDK with voter set to the contract address.", - "type": "object", - "required": [ - "vote_weighted" - ], - "properties": { - "vote_weighted": { - "type": "object", - "required": [ - "options", - "proposal_id" - ], - "properties": { - "options": { - "type": "array", - "items": { - "$ref": "#/definitions/WeightedVoteOption" - } - }, - "proposal_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - } - } - } - }, - "additionalProperties": false } ] }, @@ -2022,90 +1964,6 @@ } } }, - "StakingMsg": { - "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", - "oneOf": [ - { - "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "delegate" - ], - "properties": { - "delegate": { - "type": "object", - "required": [ - "amount", - "validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "undelegate" - ], - "properties": { - "undelegate": { - "type": "object", - "required": [ - "amount", - "validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - }, - { - "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", - "type": "object", - "required": [ - "redelegate" - ], - "properties": { - "redelegate": { - "type": "object", - "required": [ - "amount", - "dst_validator", - "src_validator" - ], - "properties": { - "amount": { - "$ref": "#/definitions/Coin" - }, - "dst_validator": { - "type": "string" - }, - "src_validator": { - "type": "string" - } - } - } - }, - "additionalProperties": false - } - ] - }, "SudoContractProposal": { "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", "deprecated": true, @@ -2348,60 +2206,6 @@ }, "additionalProperties": false }, - { - "description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.", - "type": "object", - "required": [ - "instantiate2" - ], - "properties": { - "instantiate2": { - "type": "object", - "required": [ - "code_id", - "funds", - "label", - "msg", - "salt" - ], - "properties": { - "admin": { - "type": [ - "string", - "null" - ] - }, - "code_id": { - "type": "integer", - "format": "uint64", - "minimum": 0.0 - }, - "funds": { - "type": "array", - "items": { - "$ref": "#/definitions/Coin" - } - }, - "label": { - "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", - "type": "string" - }, - "msg": { - "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", - "allOf": [ - { - "$ref": "#/definitions/Binary" - } - ] - }, - "salt": { - "$ref": "#/definitions/Binary" - } - } - } - }, - "additionalProperties": false - }, { "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", "type": "object", @@ -2486,21 +2290,6 @@ "additionalProperties": false } ] - }, - "WeightedVoteOption": { - "type": "object", - "required": [ - "option", - "weight" - ], - "properties": { - "option": { - "$ref": "#/definitions/VoteOption" - }, - "weight": { - "$ref": "#/definitions/Decimal" - } - } } } } From ae8bca3299fabb9cb2c5ed81f809e9a0817e65fd Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Sun, 25 Feb 2024 22:18:18 +0200 Subject: [PATCH 2/9] fixes after rebase --- Cargo.lock | 5 +- Cargo.toml | 2 +- .../src/contract.rs | 15 +- .../src/testing/tests.rs | 5 +- contracts/reflect/schema/execute_msg.json | 211 ++++++++++++++++++ 5 files changed, 226 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd7a70d..2bf572b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -719,8 +719,8 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.9.0" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=main#8645132d09229f717d13bcc5fd74b0886c0c9c31" +version = "0.8.0" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/proposal-votes#1cbef1ae0dde2a4a96ad01c94b9bc878d94976f3" dependencies = [ "bech32", "cosmos-sdk-proto 0.20.0", @@ -732,7 +732,6 @@ dependencies = [ "schemars", "serde", "serde-json-wasm 1.0.1", - "serde_json", "speedate", "tendermint-proto 0.34.1", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 664994d..cff3928 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ incremental = false overflow-checks = true [workspace.dependencies] -neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" } +neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/proposal-votes" } prost = "0.12.1" prost-types = "0.12.1" cosmos-sdk-proto = { version = "0.20.0", default-features = false } diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 8ee5ac6..fde2534 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -35,19 +35,22 @@ use neutron_sdk::interchain_queries::get_registered_query; use neutron_sdk::interchain_queries::types::{ QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; -use neutron_sdk::interchain_queries::v047::queries::{ - query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, - query_government_proposals, query_staking_validators, query_unbonding_delegations, - query_validators_signing_infos, +use neutron_sdk::interchain_queries::v045::register_queries::{ + new_register_gov_proposal_votes_query_msg, new_register_validators_signing_infos_query_msg, }; -use neutron_sdk::interchain_queries::v047::register_queries::new_register_validators_signing_infos_query_msg; -use neutron_sdk::interchain_queries::v047::register_queries::{ +use neutron_sdk::interchain_queries::v045::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; +use neutron_sdk::interchain_queries::v045::{ new_register_balance_query_msg, new_register_bank_total_supply_query_msg, new_register_delegator_delegations_query_msg, new_register_delegator_unbonding_delegations_query_msg, new_register_distribution_fee_pool_query_msg, new_register_gov_proposal_query_msg, new_register_staking_validators_query_msg, new_register_transfers_query_msg, }; +use neutron_sdk::interchain_queries::v047::queries::{ + query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, + query_government_proposal_votes, query_government_proposals, query_staking_validators, + query_unbonding_delegations, query_validators_signing_infos, +}; use neutron_sdk::interchain_queries::v047::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; use neutron_sdk::sudo::msg::SudoMsg; use neutron_sdk::{NeutronError, NeutronResult}; diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 5e8785d..2a733cc 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -44,11 +44,12 @@ use neutron_sdk::interchain_queries::types::{ }; use neutron_sdk::interchain_queries::v047::helpers::{ create_account_denom_balance_key, create_fee_pool_key, create_gov_proposal_key, - create_total_denom_key, create_validator_key, create_validator_signing_info_key, + create_gov_proposal_votes_key, create_total_denom_key, create_validator_key, + create_validator_signing_info_key, }; use neutron_sdk::interchain_queries::v047::queries::{ BalanceResponse, DelegatorDelegationsResponse, FeePoolResponse, ProposalResponse, - TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, + ProposalVotesResponse, TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, }; use neutron_sdk::interchain_queries::v047::types::{ Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, TallyResult, diff --git a/contracts/reflect/schema/execute_msg.json b/contracts/reflect/schema/execute_msg.json index fadf1e1..466e8ef 100644 --- a/contracts/reflect/schema/execute_msg.json +++ b/contracts/reflect/schema/execute_msg.json @@ -381,6 +381,30 @@ }, "additionalProperties": false }, + { + "type": "object", + "required": [ + "staking" + ], + "properties": { + "staking": { + "$ref": "#/definitions/StakingMsg" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "distribution" + ], + "properties": { + "distribution": { + "$ref": "#/definitions/DistributionMsg" + } + }, + "additionalProperties": false + }, { "description": "A Stargate message encoded the same way as a protobuf [Any](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/any.proto). This is the same structure as messages in `TxBody` from [ADR-020](https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-020-protobuf-transaction-encoding.md)", "type": "object", @@ -444,6 +468,10 @@ } ] }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, "DenomUnit": { "description": "Replicates the cosmos-sdk bank module DenomUnit type", "type": "object", @@ -874,6 +902,36 @@ } }, "additionalProperties": false + }, + { + "description": "This maps directly to [MsgVoteWeighted](https://github.com/cosmos/cosmos-sdk/blob/v0.45.8/proto/cosmos/gov/v1beta1/tx.proto#L66-L78) in the Cosmos SDK with voter set to the contract address.", + "type": "object", + "required": [ + "vote_weighted" + ], + "properties": { + "vote_weighted": { + "type": "object", + "required": [ + "options", + "proposal_id" + ], + "properties": { + "options": { + "type": "array", + "items": { + "$ref": "#/definitions/WeightedVoteOption" + } + }, + "proposal_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false } ] }, @@ -1964,6 +2022,90 @@ } } }, + "StakingMsg": { + "description": "The message types of the staking module.\n\nSee https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto", + "oneOf": [ + { + "description": "This is translated to a [MsgDelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L81-L90). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "delegate" + ], + "properties": { + "delegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgUndelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L112-L121). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "undelegate" + ], + "properties": { + "undelegate": { + "type": "object", + "required": [ + "amount", + "validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "This is translated to a [MsgBeginRedelegate](https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/staking/v1beta1/tx.proto#L95-L105). `delegator_address` is automatically filled with the current contract's address.", + "type": "object", + "required": [ + "redelegate" + ], + "properties": { + "redelegate": { + "type": "object", + "required": [ + "amount", + "dst_validator", + "src_validator" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Coin" + }, + "dst_validator": { + "type": "string" + }, + "src_validator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] + }, "SudoContractProposal": { "description": "Deprecated. SudoContractProposal defines the struct for sudo execution proposal.", "deprecated": true, @@ -2206,6 +2348,60 @@ }, "additionalProperties": false }, + { + "description": "Instantiates a new contracts from previously uploaded Wasm code using a predictable address derivation algorithm implemented in [`cosmwasm_std::instantiate2_address`].\n\nThis is translated to a [MsgInstantiateContract2](https://github.com/CosmWasm/wasmd/blob/v0.29.2/proto/cosmwasm/wasm/v1/tx.proto#L73-L96). `sender` is automatically filled with the current contract's address. `fix_msg` is automatically set to false.", + "type": "object", + "required": [ + "instantiate2" + ], + "properties": { + "instantiate2": { + "type": "object", + "required": [ + "code_id", + "funds", + "label", + "msg", + "salt" + ], + "properties": { + "admin": { + "type": [ + "string", + "null" + ] + }, + "code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "funds": { + "type": "array", + "items": { + "$ref": "#/definitions/Coin" + } + }, + "label": { + "description": "A human-readable label for the contract.\n\nValid values should: - not be empty - not be bigger than 128 bytes (or some chain-specific limit) - not start / end with whitespace", + "type": "string" + }, + "msg": { + "description": "msg is the JSON-encoded InstantiateMsg struct (as raw Binary)", + "allOf": [ + { + "$ref": "#/definitions/Binary" + } + ] + }, + "salt": { + "$ref": "#/definitions/Binary" + } + } + } + }, + "additionalProperties": false + }, { "description": "Migrates a given contracts to use new wasm code. Passes a MigrateMsg to allow us to customize behavior.\n\nOnly the contract admin (as defined in wasmd), if any, is able to make this call.\n\nThis is translated to a [MsgMigrateContract](https://github.com/CosmWasm/wasmd/blob/v0.14.0/x/wasm/internal/types/tx.proto#L86-L96). `sender` is automatically filled with the current contract's address.", "type": "object", @@ -2290,6 +2486,21 @@ "additionalProperties": false } ] + }, + "WeightedVoteOption": { + "type": "object", + "required": [ + "option", + "weight" + ], + "properties": { + "option": { + "$ref": "#/definitions/VoteOption" + }, + "weight": { + "$ref": "#/definitions/Decimal" + } + } } } } From 21b63563eacdf7a505cf8cc798c0b6f1fe84e991 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Mon, 8 Apr 2024 11:00:59 +0300 Subject: [PATCH 3/9] fixes after rebase --- Cargo.lock | 93 ++++++++++--------- .../src/contract.rs | 10 +- .../src/testing/tests.rs | 29 +++--- 3 files changed, 67 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2bf572b..3d2fcce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -48,9 +48,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "balance-tracker" @@ -131,9 +131,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" dependencies = [ "serde", ] @@ -146,9 +146,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "num-traits", ] @@ -189,8 +189,8 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "tendermint-proto 0.34.1", ] @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -441,8 +441,8 @@ dependencies = [ "cosmwasm-std", "cw2", "neutron-sdk", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "schemars", "serde", ] @@ -576,9 +576,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "a06fddc2749e0528d2813f95e050e87e52c8cbbae56223b9babf73b3e53b0cc6" dependencies = [ "cfg-if", "libc", @@ -651,9 +651,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -669,9 +669,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "k256" @@ -719,19 +719,20 @@ dependencies = [ [[package]] name = "neutron-sdk" -version = "0.8.0" -source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/proposal-votes#1cbef1ae0dde2a4a96ad01c94b9bc878d94976f3" +version = "0.10.0" +source = "git+https://github.com/neutron-org/neutron-sdk?branch=feat/proposal-votes#2dfca1734dfc4cfba478b3067417648733d66cd9" dependencies = [ "bech32", "cosmos-sdk-proto 0.20.0", "cosmwasm-schema", "cosmwasm-std", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "protobuf", "schemars", "serde", "serde-json-wasm 1.0.1", + "serde_json", "speedate", "tendermint-proto 0.34.1", "thiserror", @@ -748,7 +749,7 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.3", + "prost 0.12.4", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -764,8 +765,8 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -896,12 +897,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive 0.12.3", + "prost-derive 0.12.4", ] [[package]] @@ -919,15 +920,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.58", ] [[package]] @@ -941,11 +942,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost 0.12.3", + "prost 0.12.4", ] [[package]] @@ -1016,9 +1017,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "ryu" @@ -1123,7 +1124,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.58", ] [[package]] @@ -1139,9 +1140,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -1243,7 +1244,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.53", + "syn 2.0.58", ] [[package]] @@ -1274,9 +1275,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -1311,8 +1312,8 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "serde", "serde_bytes", "subtle-encoding", @@ -1336,7 +1337,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.58", ] [[package]] diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index fde2534..4503cba 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -36,14 +36,15 @@ use neutron_sdk::interchain_queries::types::{ QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; use neutron_sdk::interchain_queries::v045::register_queries::{ - new_register_gov_proposal_votes_query_msg, new_register_validators_signing_infos_query_msg, + new_register_gov_proposals_voters_votes_query_msg, + new_register_validators_signing_infos_query_msg, }; use neutron_sdk::interchain_queries::v045::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; use neutron_sdk::interchain_queries::v045::{ new_register_balance_query_msg, new_register_bank_total_supply_query_msg, new_register_delegator_delegations_query_msg, new_register_delegator_unbonding_delegations_query_msg, - new_register_distribution_fee_pool_query_msg, new_register_gov_proposal_query_msg, + new_register_distribution_fee_pool_query_msg, new_register_gov_proposals_query_msg, new_register_staking_validators_query_msg, new_register_transfers_query_msg, }; use neutron_sdk::interchain_queries::v047::queries::{ @@ -51,7 +52,6 @@ use neutron_sdk::interchain_queries::v047::queries::{ query_government_proposal_votes, query_government_proposals, query_staking_validators, query_unbonding_delegations, query_validators_signing_infos, }; -use neutron_sdk::interchain_queries::v047::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; use neutron_sdk::sudo::msg::SudoMsg; use neutron_sdk::{NeutronError, NeutronResult}; use prost::Message as ProstMessage; @@ -204,7 +204,7 @@ pub fn register_gov_proposal_query( proposals_ids: Vec, update_period: u64, ) -> NeutronResult> { - let msg = new_register_gov_proposal_query_msg(connection_id, proposals_ids, update_period)?; + let msg = new_register_gov_proposals_query_msg(connection_id, proposals_ids, update_period)?; Ok(Response::new().add_message(msg)) } @@ -219,7 +219,7 @@ pub fn register_gov_proposal_votes_query( deps.api .debug("WASMDEBUG: register_gov_proposal_votes_query"); - let msg = new_register_gov_proposal_votes_query_msg( + let msg = new_register_gov_proposals_voters_votes_query_msg( connection_id, proposals_ids, voters, diff --git a/contracts/neutron_interchain_queries/src/testing/tests.rs b/contracts/neutron_interchain_queries/src/testing/tests.rs index 2a733cc..4e1eeda 100644 --- a/contracts/neutron_interchain_queries/src/testing/tests.rs +++ b/contracts/neutron_interchain_queries/src/testing/tests.rs @@ -52,8 +52,9 @@ use neutron_sdk::interchain_queries::v047::queries::{ ProposalVotesResponse, TotalSupplyResponse, ValidatorResponse, ValidatorSigningInfoResponse, }; use neutron_sdk::interchain_queries::v047::types::{ - Balances, FeePool, GovernmentProposal, Proposal, SigningInfo, StakingValidator, TallyResult, - TotalSupply, Validator, ValidatorSigningInfo, DECIMAL_PLACES, RECIPIENT_FIELD, + Balances, FeePool, GovernmentProposal, GovernmentProposalVotes, Proposal, ProposalVote, + SigningInfo, StakingValidator, TallyResult, TotalSupply, Validator, ValidatorSigningInfo, + WeightedVoteOption, DECIMAL_PLACES, RECIPIENT_FIELD, }; use neutron_sdk::NeutronError; use prost::Message as ProstMessage; @@ -477,10 +478,10 @@ fn test_gov_proposals_query() { voting_end_time: None, voting_start_time: None, final_tally_result: Some(TallyResult { - abstain: "0".to_string(), - yes: "0".to_string(), - no: "0".to_string(), - no_with_veto: "0".to_string(), + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), }), }, Proposal { @@ -496,10 +497,10 @@ fn test_gov_proposals_query() { voting_end_time: None, voting_start_time: None, final_tally_result: Some(TallyResult { - abstain: "0".to_string(), - yes: "0".to_string(), - no: "0".to_string(), - no_with_veto: "0".to_string(), + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), }), }, Proposal { @@ -515,10 +516,10 @@ fn test_gov_proposals_query() { voting_end_time: None, voting_start_time: None, final_tally_result: Some(TallyResult { - abstain: "0".to_string(), - yes: "0".to_string(), - no: "0".to_string(), - no_with_veto: "0".to_string(), + abstain: Uint128::zero(), + yes: Uint128::zero(), + no: Uint128::zero(), + no_with_veto: Uint128::zero(), }), }, ] From 90c4a7b9565247bc8ad345b97951bb2ebe66c9a0 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Mon, 8 Apr 2024 11:12:42 +0300 Subject: [PATCH 4/9] update toolchain version --- .github/workflows/build.yml | 4 ++-- .github/workflows/tests.yml | 6 +++--- artifacts/checksums.txt | 15 --------------- 3 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 artifacts/checksums.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1cb78b..50ed1cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: inputs: toolchain: description: 'Default Rust Toolchain' - default: "1.68.2" + default: "1.70" required: true type: string target: @@ -31,7 +31,7 @@ on: type: string env: - TOOLCHAIN: ${{ inputs.toolchain || '1.68.2' }} + TOOLCHAIN: ${{ inputs.toolchain || '1.70' }} TARGET: ${{ inputs.target || 'wasm32-unknown-unknown' }} REF: ${{ github.event_name == 'push' && github.ref || inputs.branch || 'main' }} ID: ${{ inputs.id || 'scheduled' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84b4f80..1d370bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.70 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.70 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.70 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/artifacts/checksums.txt b/artifacts/checksums.txt deleted file mode 100644 index e1cbbeb..0000000 --- a/artifacts/checksums.txt +++ /dev/null @@ -1,15 +0,0 @@ -0c52b85da277055d45075144d7566d40490519486e93601793e7f298e0b80a99 balance_tracker.wasm -9fc5cc70b25d3faa19199bb83b148274794d7df96e4a16f60a53781410b11da2 before_send_hook_test.wasm -0e145a43d5bce9e04ae8db21f2dcc5c897fa7ae65c3cdbcfc846e3e34b2dd793 client_updater.wasm -8f514402615c949263062772b3481a4919777577ff3841128949e53561d0cc61 dex.wasm -4ebb637e1085f24a7a8a023c7955020fc6db340248361d7f7b2b16c17691d7ea dex_stargate.wasm -cbaf8c3e0f063ed8f5fb8be6dc846196cba26455c8d2b1e4cf60ddce06e68d94 echo.wasm -8d05f93af63df857f0e69c1023b3c1fbbfabc0459a6a4249367588874f795030 ibc_transfer.wasm -ebe171cfafe79343f84e0f49e412fec174ddc8a0753d7ec9749bd81e0bf17f55 msg_receiver.wasm -3efca7bfbab65ff18fdf3ac12626939b2a605a6717eeef404d0eec25c864df57 neutron_interchain_queries.wasm -53508475d18898aaac829a55fa38b8fe31870583ede740d6b175a025ccecd6d1 neutron_interchain_txs.wasm -da2a1e14f3658c69846f7f9773c9eb39bc4dd243946bd22ca47079b314b3ebbb neutron_price_feed_mock.wasm -8b7e9946dc8c86729fdecbebd51fd8eeb360da48c1ce5cb9be52319584c376f9 neutron_validators_test.wasm -14d4dce209e210f20bce9fb835194a1d53fe1a99a5ee78f916e51d41d0679bf6 reflect.wasm -3a720c4ee3de2f9d1bb66d20582f14168084c40c00d8a9240d2c6a26750894c8 stargate_querier.wasm -f49da4ab5ee960686c942408a348cd9125fa6d1b93ad328a6e938374e6e0df7d tokenfactory.wasm From ef98a1303eeee9ecf6bed3b769e865ca15c0893b Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Mon, 8 Apr 2024 11:18:35 +0300 Subject: [PATCH 5/9] change prost version --- .github/workflows/build.yml | 4 ++-- .github/workflows/tests.yml | 6 +++--- Cargo.lock | 32 +++++++++++++++---------------- Cargo.toml | 4 ++-- contracts/dex_stargate/Cargo.toml | 2 +- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50ed1cb..e1cb78b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: inputs: toolchain: description: 'Default Rust Toolchain' - default: "1.70" + default: "1.68.2" required: true type: string target: @@ -31,7 +31,7 @@ on: type: string env: - TOOLCHAIN: ${{ inputs.toolchain || '1.70' }} + TOOLCHAIN: ${{ inputs.toolchain || '1.68.2' }} TARGET: ${{ inputs.target || 'wasm32-unknown-unknown' }} REF: ${{ github.event_name == 'push' && github.ref || inputs.branch || 'main' }} ID: ${{ inputs.id || 'scheduled' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d370bf..84b4f80 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.70 + toolchain: 1.68.2 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.70 + toolchain: 1.68.2 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.70 + toolchain: 1.68.2 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/Cargo.lock b/Cargo.lock index 3d2fcce..d4033ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,8 +189,8 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ - "prost 0.12.4", - "prost-types 0.12.4", + "prost 0.12.3", + "prost-types 0.12.3", "tendermint-proto 0.34.1", ] @@ -441,8 +441,8 @@ dependencies = [ "cosmwasm-std", "cw2", "neutron-sdk", - "prost 0.12.4", - "prost-types 0.12.4", + "prost 0.12.3", + "prost-types 0.12.3", "schemars", "serde", ] @@ -726,8 +726,8 @@ dependencies = [ "cosmos-sdk-proto 0.20.0", "cosmwasm-schema", "cosmwasm-std", - "prost 0.12.4", - "prost-types 0.12.4", + "prost 0.12.3", + "prost-types 0.12.3", "protobuf", "schemars", "serde", @@ -749,7 +749,7 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.4", + "prost 0.12.3", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -765,8 +765,8 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.4", - "prost-types 0.12.4", + "prost 0.12.3", + "prost-types 0.12.3", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -897,9 +897,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.4" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", "prost-derive 0.12.4", @@ -942,11 +942,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.4" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "prost 0.12.4", + "prost 0.12.3", ] [[package]] @@ -1312,8 +1312,8 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.4", - "prost-types 0.12.4", + "prost 0.12.3", + "prost-types 0.12.3", "serde", "serde_bytes", "subtle-encoding", diff --git a/Cargo.toml b/Cargo.toml index cff3928..8c4c3be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ overflow-checks = true [workspace.dependencies] neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/proposal-votes" } -prost = "0.12.1" -prost-types = "0.12.1" +prost = "=0.12.3" +prost-types = "=0.12.3" cosmos-sdk-proto = { version = "0.20.0", default-features = false } cosmwasm-std = { version = "1.4.1", features = [ "stargate", diff --git a/contracts/dex_stargate/Cargo.toml b/contracts/dex_stargate/Cargo.toml index 861d71b..c22c7d5 100644 --- a/contracts/dex_stargate/Cargo.toml +++ b/contracts/dex_stargate/Cargo.toml @@ -39,7 +39,7 @@ cw2 = "1.1.1" schemars = "0.8.15" serde = { version = "1.0.188", default-features = false, features = ["derive"] } prost = "0.12.3" -prost-types = "0.12.1" +prost-types = "0.12.3" cosmos-sdk-proto = { version = "0.20.0", default-features = false } [dev-dependencies] From 58e15263bfbb150057ef059e46ad9cac87cdcfea Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Mon, 8 Apr 2024 11:29:22 +0300 Subject: [PATCH 6/9] pin prost version --- contracts/dex_stargate/Cargo.toml | 4 ++-- contracts/stargate_querier/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/dex_stargate/Cargo.toml b/contracts/dex_stargate/Cargo.toml index c22c7d5..d4a2bb6 100644 --- a/contracts/dex_stargate/Cargo.toml +++ b/contracts/dex_stargate/Cargo.toml @@ -38,8 +38,8 @@ cosmwasm-std = { version = "1.4.0", features = ["stargate"] } cw2 = "1.1.1" schemars = "0.8.15" serde = { version = "1.0.188", default-features = false, features = ["derive"] } -prost = "0.12.3" -prost-types = "0.12.3" +prost = "=0.12.3" +prost-types = "=0.12.3" cosmos-sdk-proto = { version = "0.20.0", default-features = false } [dev-dependencies] diff --git a/contracts/stargate_querier/Cargo.toml b/contracts/stargate_querier/Cargo.toml index d25b4cf..58a43c8 100644 --- a/contracts/stargate_querier/Cargo.toml +++ b/contracts/stargate_querier/Cargo.toml @@ -31,7 +31,7 @@ neutron-sdk = { workspace = true } # These dependencies are slightly outdated because of osmosis-std osmosis-std = "0.19.2" -prost = "0.11" +prost = "=0.11" cosmos-sdk-proto = { version = "0.19.0", default-features = false } [dev-dependencies] From ceccdfa5f75ceed9c69aaaf76fcfccf1572aeef7 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Mon, 8 Apr 2024 11:40:45 +0300 Subject: [PATCH 7/9] bump toolachain version --- .github/workflows/build.yml | 4 ++-- .github/workflows/tests.yml | 6 +++--- Cargo.lock | 32 +++++++++++++++---------------- Cargo.toml | 4 ++-- contracts/dex_stargate/Cargo.toml | 4 ++-- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e1cb78b..2bc01b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ on: inputs: toolchain: description: 'Default Rust Toolchain' - default: "1.68.2" + default: "1.73.0" required: true type: string target: @@ -31,7 +31,7 @@ on: type: string env: - TOOLCHAIN: ${{ inputs.toolchain || '1.68.2' }} + TOOLCHAIN: ${{ inputs.toolchain || '1.73.0' }} TARGET: ${{ inputs.target || 'wasm32-unknown-unknown' }} REF: ${{ github.event_name == 'push' && github.ref || inputs.branch || 'main' }} ID: ${{ inputs.id || 'scheduled' }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84b4f80..18a4d9a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.73.0 components: clippy profile: minimal override: true @@ -31,7 +31,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.73.0 components: rustfmt profile: minimal override: true @@ -49,7 +49,7 @@ jobs: fetch-depth: 1 - uses: actions-rs/toolchain@v1 with: - toolchain: 1.68.2 + toolchain: 1.73.0 profile: minimal - run: cargo fetch --verbose - run: cargo build diff --git a/Cargo.lock b/Cargo.lock index d4033ac..3d2fcce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -189,8 +189,8 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32560304ab4c365791fd307282f76637213d8083c1a98490c35159cd67852237" dependencies = [ - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "tendermint-proto 0.34.1", ] @@ -441,8 +441,8 @@ dependencies = [ "cosmwasm-std", "cw2", "neutron-sdk", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "schemars", "serde", ] @@ -726,8 +726,8 @@ dependencies = [ "cosmos-sdk-proto 0.20.0", "cosmwasm-schema", "cosmwasm-std", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "protobuf", "schemars", "serde", @@ -749,7 +749,7 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.3", + "prost 0.12.4", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -765,8 +765,8 @@ dependencies = [ "cw-storage-plus", "cw2", "neutron-sdk", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "schemars", "serde", "serde-json-wasm 1.0.1", @@ -897,9 +897,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", "prost-derive 0.12.4", @@ -942,11 +942,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost 0.12.3", + "prost 0.12.4", ] [[package]] @@ -1312,8 +1312,8 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost 0.12.3", - "prost-types 0.12.3", + "prost 0.12.4", + "prost-types 0.12.4", "serde", "serde_bytes", "subtle-encoding", diff --git a/Cargo.toml b/Cargo.toml index 8c4c3be..238d598 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ overflow-checks = true [workspace.dependencies] neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/proposal-votes" } -prost = "=0.12.3" -prost-types = "=0.12.3" +prost = "0.12.4" +prost-types = "0.12.4" cosmos-sdk-proto = { version = "0.20.0", default-features = false } cosmwasm-std = { version = "1.4.1", features = [ "stargate", diff --git a/contracts/dex_stargate/Cargo.toml b/contracts/dex_stargate/Cargo.toml index d4a2bb6..c22c7d5 100644 --- a/contracts/dex_stargate/Cargo.toml +++ b/contracts/dex_stargate/Cargo.toml @@ -38,8 +38,8 @@ cosmwasm-std = { version = "1.4.0", features = ["stargate"] } cw2 = "1.1.1" schemars = "0.8.15" serde = { version = "1.0.188", default-features = false, features = ["derive"] } -prost = "=0.12.3" -prost-types = "=0.12.3" +prost = "0.12.3" +prost-types = "0.12.3" cosmos-sdk-proto = { version = "0.20.0", default-features = false } [dev-dependencies] From e54f19e52ac269a9ec74c5a51e1ba12ed45dc378 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Tue, 9 Apr 2024 22:56:15 +0300 Subject: [PATCH 8/9] fix contract --- Cargo.lock | 4 ++-- .../neutron_interchain_queries/src/contract.rs | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d2fcce..b031596 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,9 +576,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06fddc2749e0528d2813f95e050e87e52c8cbbae56223b9babf73b3e53b0cc6" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "libc", diff --git a/contracts/neutron_interchain_queries/src/contract.rs b/contracts/neutron_interchain_queries/src/contract.rs index 4503cba..47135ba 100644 --- a/contracts/neutron_interchain_queries/src/contract.rs +++ b/contracts/neutron_interchain_queries/src/contract.rs @@ -35,23 +35,23 @@ use neutron_sdk::interchain_queries::get_registered_query; use neutron_sdk::interchain_queries::types::{ QueryPayload, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue, }; -use neutron_sdk::interchain_queries::v045::register_queries::{ - new_register_gov_proposals_voters_votes_query_msg, - new_register_validators_signing_infos_query_msg, +use neutron_sdk::interchain_queries::v047::queries::{ + query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, + query_government_proposal_votes, query_government_proposals, query_staking_validators, + query_unbonding_delegations, query_validators_signing_infos, }; -use neutron_sdk::interchain_queries::v045::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; -use neutron_sdk::interchain_queries::v045::{ +use neutron_sdk::interchain_queries::v047::register_queries::{ new_register_balance_query_msg, new_register_bank_total_supply_query_msg, new_register_delegator_delegations_query_msg, new_register_delegator_unbonding_delegations_query_msg, new_register_distribution_fee_pool_query_msg, new_register_gov_proposals_query_msg, new_register_staking_validators_query_msg, new_register_transfers_query_msg, }; -use neutron_sdk::interchain_queries::v047::queries::{ - query_balance, query_bank_total, query_delegations, query_distribution_fee_pool, - query_government_proposal_votes, query_government_proposals, query_staking_validators, - query_unbonding_delegations, query_validators_signing_infos, +use neutron_sdk::interchain_queries::v047::register_queries::{ + new_register_gov_proposals_voters_votes_query_msg, + new_register_validators_signing_infos_query_msg, }; +use neutron_sdk::interchain_queries::v047::types::{COSMOS_SDK_TRANSFER_MSG_URL, RECIPIENT_FIELD}; use neutron_sdk::sudo::msg::SudoMsg; use neutron_sdk::{NeutronError, NeutronResult}; use prost::Message as ProstMessage; From c5ad1411c4d30882e898650be17e9af908866c28 Mon Sep 17 00:00:00 2001 From: Albert Andrejev Date: Thu, 11 Apr 2024 13:49:49 +0300 Subject: [PATCH 9/9] Fixes after rebase --- Cargo.lock | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b031596..de2bf33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -658,15 +658,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11"