Skip to content

Commit c195696

Browse files
committed
Make execute optional
1 parent 7bd1889 commit c195696

File tree

12 files changed

+8
-57
lines changed

12 files changed

+8
-57
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ and this project adheres to
7070
- all: Rename `init` entry point to `instantiate`.
7171
- all: Rename `system` entry point to `sudo`.
7272
- all: Drop support for Rust versions lower than 1.50.0.
73-
- all: The `query` enpoint is now optional. It is still highly recommended to
74-
expose it an almost any use case though.
73+
- all: The `query` and `execute` entry points are now optional. It is still
74+
highly recommended to implement and expose them in almost any use case though.
7575
- all: Change the encoding of the key/value region of the `db_next` import to a
7676
more generic encoding that supports an arbitrary number of sections. This
7777
encoding can then be reused for other multi value regions.

contracts/burner/examples/schema.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ use std::fs::create_dir_all;
33

44
use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
55

6-
use burner::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg};
6+
use burner::msg::{InstantiateMsg, MigrateMsg};
77

88
fn main() {
99
let mut out_dir = current_dir().unwrap();
1010
out_dir.push("schema");
1111
create_dir_all(&out_dir).unwrap();
1212
remove_schemas(&out_dir).unwrap();
1313

14-
export_schema(&schema_for!(ExecuteMsg), &out_dir);
1514
export_schema(&schema_for!(InstantiateMsg), &out_dir);
1615
export_schema(&schema_for!(MigrateMsg), &out_dir);
1716
}

contracts/burner/schema/execute_msg.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

contracts/burner/src/contract.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use cosmwasm_std::{
22
attr, entry_point, BankMsg, DepsMut, Env, MessageInfo, Order, Response, StdError, StdResult,
33
};
44

5-
use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg};
5+
use crate::msg::{InstantiateMsg, MigrateMsg};
66

77
#[entry_point]
88
pub fn instantiate(
@@ -16,18 +16,6 @@ pub fn instantiate(
1616
))
1717
}
1818

19-
#[entry_point]
20-
pub fn execute(
21-
_deps: DepsMut,
22-
_env: Env,
23-
_info: MessageInfo,
24-
_msg: ExecuteMsg,
25-
) -> StdResult<Response> {
26-
Err(StdError::generic_err(
27-
"You can only use this contract for migrations",
28-
))
29-
}
30-
3119
#[entry_point]
3220
pub fn migrate(deps: DepsMut, env: Env, msg: MigrateMsg) -> StdResult<Response> {
3321
// delete all state

contracts/burner/src/msg.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,3 @@ pub struct MigrateMsg {
1313
/// A placeholder where we don't take any input
1414
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1515
pub struct InstantiateMsg {}
16-
17-
/// ExecuteMsg is a placeholder where we don't take any input
18-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
19-
pub struct ExecuteMsg {}

contracts/crypto-verify/examples/schema.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ use std::fs::create_dir_all;
33

44
use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
55

6-
use crypto_verify::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
6+
use crypto_verify::msg::{InstantiateMsg, QueryMsg};
77

88
fn main() {
99
let mut out_dir = current_dir().unwrap();
1010
out_dir.push("schema");
1111
create_dir_all(&out_dir).unwrap();
1212
remove_schemas(&out_dir).unwrap();
1313

14-
export_schema(&schema_for!(ExecuteMsg), &out_dir);
1514
export_schema(&schema_for!(InstantiateMsg), &out_dir);
1615
export_schema(&schema_for!(QueryMsg), &out_dir);
1716
}

contracts/crypto-verify/schema/execute_msg.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

contracts/crypto-verify/src/contract.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use crate::ethereum::{
1010
decode_address, ethereum_address_raw, get_recovery_param, verify_transaction,
1111
};
1212
use crate::msg::{
13-
list_verifications, ExecuteMsg, InstantiateMsg, ListVerificationsResponse, QueryMsg,
14-
VerifyResponse,
13+
list_verifications, InstantiateMsg, ListVerificationsResponse, QueryMsg, VerifyResponse,
1514
};
1615

1716
pub const VERSION: &str = "crypto-verify-v2";
@@ -26,16 +25,6 @@ pub fn instantiate(
2625
Ok(Response::default())
2726
}
2827

29-
#[entry_point]
30-
pub fn execute(
31-
_deps: DepsMut,
32-
_env: Env,
33-
_info: MessageInfo,
34-
_msg: ExecuteMsg,
35-
) -> StdResult<Response> {
36-
Ok(Response::default())
37-
}
38-
3928
#[entry_point]
4029
pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<QueryResponse> {
4130
match msg {

contracts/crypto-verify/src/msg.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ use serde::{Deserialize, Serialize};
77
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
88
pub struct InstantiateMsg {}
99

10-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
11-
#[serde(rename_all = "snake_case")]
12-
pub enum ExecuteMsg {}
13-
1410
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
1511
#[serde(rename_all = "snake_case")]
1612
pub enum QueryMsg {

packages/vm/src/compatibility.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ const SUPPORTED_IMPORTS: &[&str] = &[
2828
];
2929

3030
/// Lists all entry points we expect to be present when calling a contract.
31-
/// Other optional exports exist, e.g. "query" and "migrate".
31+
/// Other optional exports exist, e.g. "execute", "migrate" and "query".
3232
/// This is unlikely to change much, must be frozen at 1.0 to avoid breaking existing contracts
3333
const REQUIRED_EXPORTS: &[&str] = &[
3434
"interface_version_5",
3535
"instantiate",
36-
"execute",
3736
"allocate",
3837
"deallocate",
3938
];

0 commit comments

Comments
 (0)