Skip to content

Commit

Permalink
Contract naming changes + size optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
SecretSaturn committed Jul 11, 2024
1 parent e452da4 commit e323ca1
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 48 deletions.
Binary file modified TNLS-Gateways/secret/contract.wasm.gz
Binary file not shown.
9 changes: 4 additions & 5 deletions TNLS-Gateways/secret/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ pub fn execute(
info: MessageInfo,
msg: ExecuteMsg,
) -> StdResult<Response> {
match msg {
ExecuteMsg::Input { inputs } => {
pad_handle_result(pre_execution(deps, env, inputs), BLOCK_SIZE)
},
let response = match msg {
ExecuteMsg::Input { inputs } => pre_execution(deps, env, inputs),
ExecuteMsg::Output { outputs } => post_execution(deps, env, outputs),
ExecuteMsg::RotateGatewayKeys {} => rotate_gateway_keys(deps, env, info),
}
};
pad_handle_result(response, BLOCK_SIZE)
}

#[entry_point]
Expand Down
16 changes: 3 additions & 13 deletions TNLS-Samples/RNG/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "secret_rng"
version = "0.1.0"
authors = ["kent-3"]
authors = ["SecretSaturn, kent-3"]
edition = "2021"
exclude = ["contract.wasm", "hash.txt"]

Expand All @@ -25,24 +25,14 @@ default = []
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
schema = ["cosmwasm-schema"]

[dependencies]
cosmwasm-schema = { version = "1.1.0", optional = true }
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11" , features = ["stargate"]}
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "1.1.11" }
schemars = "0.8.11"
secret-toolkit = { version = "0.10.0", default-features = false, features = ["utils", "storage", "serialization", "viewing-key", "permit"] }
secret-toolkit = { version = "0.10.0", default-features = false, features = ["utils", "storage"] }
serde = { version = "1.0.144", default-features = false, features = ["derive"] }
serde-json-wasm = "1.0.0"
sha3 = "0.10.4"
base64 = "0.21.0"
secret-toolkit-serialization = { version = "0.10.0", features = ["base64"] }
tnls = { git = "https://github.com/SecretSaturn/TNLS", branch = "main", package = "secret_gateway", default-features = false }
secret-path = { git = "https://github.com/SecretSaturn/SecretPath", branch = "main", package = "secret_gateway", default-features = false }
anybuf = "0.5.0"
hex = "0.4.3"
prost = "0.11.9"

[[bin]]
name = "schema"
required-features = ["schema"]
Binary file modified TNLS-Samples/RNG/contract.wasm.gz
Binary file not shown.
17 changes: 0 additions & 17 deletions TNLS-Samples/RNG/src/bin/schema.rs

This file was deleted.

2 changes: 1 addition & 1 deletion TNLS-Samples/RNG/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
msg::{ExecuteMsg, GatewayMsg, InstantiateMsg, QueryMsg, MigrateMsg},
state::{State, Input, CONFIG},
};
use tnls::{
use secret_path::{
msg::{PostExecutionMsg, PrivContractHandleMsg},
state::Task
};
Expand Down
14 changes: 6 additions & 8 deletions TNLS-Samples/RNG/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
use cosmwasm_std::{Addr, Binary};
use secret_toolkit::utils::HandleCallback;
use tnls::msg::{PostExecutionMsg, PrivContractHandleMsg};

use schemars::JsonSchema;
use secret_path::msg::{PostExecutionMsg, PrivContractHandleMsg};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct InstantiateMsg {
pub gateway_address: Addr,
pub gateway_hash: String,
pub gateway_key: Binary,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Input { message: PrivContractHandleMsg }
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum MigrateMsg {
Migrate {},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Query {}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum GatewayMsg {
Output { outputs: PostExecutionMsg },
Expand Down
6 changes: 2 additions & 4 deletions TNLS-Samples/RNG/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
use cosmwasm_std::{Addr, Binary};
use secret_toolkit::storage::Item;

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

pub static CONFIG: Item<State> = Item::new(b"config");

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct State {
pub gateway_address: Addr,
pub gateway_hash: String,
pub gateway_key: Binary,
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Input {
// Number of Words to generate
pub numWords: u64
Expand Down

0 comments on commit e323ca1

Please sign in to comment.