Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: e2e and integration test #75

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/cosmwasm-vm/cw-xcall/src/dapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'a> CwCallService<'a> {
id: reply_id,
msg: cosm_msg,
gas_limit: None,
reply_on: cosmwasm_std::ReplyOn::Never,
reply_on: cosmwasm_std::ReplyOn::Always,
};

Ok(submessage)
Expand Down
8 changes: 4 additions & 4 deletions contracts/cosmwasm-vm/cw-xcall/src/execute_rollback.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use cosmwasm_std::DepsMut;
use cosmwasm_std::MessageInfo;
use cosmwasm_std::SubMsgResult;
use cosmwasm_std::{Deps, Env, Reply, Response};

use cosmwasm_std::{Env, Response};

use crate::error::ContractError;
use crate::events::event_rollback_executed;
use crate::state::{CwCallService, EXECUTE_ROLLBACK_ID};
use crate::types::LOG_PREFIX;

impl<'a> CwCallService<'a> {
/// This function executes a rollback operation for a previously made call request.
Expand Down Expand Up @@ -42,7 +41,7 @@ impl<'a> CwCallService<'a> {
.unwrap();
let from = self.get_own_network_address(deps.as_ref().storage, &env)?;

let sub_msg = self.call_dapp_handle_message(
let mut sub_msg = self.call_dapp_handle_message(
info,
// the original caller is stored as from in call request
call_request.from().clone(),
Expand All @@ -51,6 +50,7 @@ impl<'a> CwCallService<'a> {
call_request.protocols().clone(),
EXECUTE_ROLLBACK_ID,
)?;
sub_msg.reply_on = cosmwasm_std::ReplyOn::Never;

let event = event_rollback_executed(sequence_no);

Expand Down
10 changes: 4 additions & 6 deletions contracts/cosmwasm-vm/cw-xcall/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
event_xcall_message_sent,
},
msg::{InstantiateMsg, QueryMsg},
state::{CwCallService, EXECUTE_CALL_ID, EXECUTE_ROLLBACK_ID, SEND_CALL_MESSAGE_REPLY_ID},
state::{CwCallService, EXECUTE_CALL_ID},
types::{
call_request::CallRequest,
message::{CSMessage, CallServiceMessageType},
Expand All @@ -35,17 +35,15 @@ use crate::{

use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{
ensure, ensure_eq, entry_point, to_binary, Addr, Api, Binary, CosmosMsg, Deps, DepsMut, Env,
Event, MessageInfo, QuerierWrapper, Reply, Response, StdError, StdResult, Storage, SubMsg,
SubMsgResult, WasmMsg,
ensure, ensure_eq, entry_point, to_binary, Addr, Api, Binary, Deps, DepsMut, Env, Event,
MessageInfo, QuerierWrapper, Reply, Response, StdError, StdResult, Storage, SubMsg,
};

use cw2::set_contract_version;
use cw_storage_plus::{Item, Map};
use cw_xcall_lib::xcall_msg::ExecuteMsg;
use schemars::JsonSchema;

use serde::{Deserialize, Serialize};
use serde::Serialize;
use thiserror::Error;

/// This function instantiates a contract using the CwCallService.
Expand Down
3 changes: 1 addition & 2 deletions contracts/cosmwasm-vm/cw-xcall/tests/test_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ mod setup;
use account::*;
use cosmwasm_std::{testing::mock_env, Addr};

use cw2::{get_contract_version, ContractVersion};
use cw_xcall::{state::CwCallService, MigrateMsg};
use cw_xcall::state::CwCallService;
use cw_xcall_lib::xcall_msg::ExecuteMsg;
use setup::test::*;

Expand Down
3 changes: 2 additions & 1 deletion scripts/optimize-cosmwasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUSTC_VERS="1.69.0"

MAX_WASM_SIZE=800 # 800 KB

PROJECTS=("cw-xcall" "cw-mock-dapp" "cw-mock-dapp-multi")
PROJECTS=("cw-xcall" "cw-xcall-lib")

# Install wasm-opt binary
if ! which wasm-opt; then
Expand Down Expand Up @@ -65,6 +65,7 @@ rename_wasm_with_version() {
local wasm_file="artifacts/archway/${project_path//-/_}.wasm"

if [[ -f "$wasm_file" ]]; then
cp "$wasm_file" "${wasm_file%.wasm}_latest.wasm"
mv "$wasm_file" "${wasm_file%.wasm}_${version}.wasm"
echo "Renamed: ${wasm_file} -> ${wasm_file%.wasm}_${version}.wasm"
else
Expand Down
5 changes: 3 additions & 2 deletions scripts/optimize-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ cd contracts/javascore
cd -

for jar in $(find . -type f -name "*optimized.jar" | grep /build/libs/); do
NAME=$(basename "$jar" .jar)${SUFFIX}.jar
NAME=$(basename "$jar" .jar).jar
echo "Creating intermediate hash for ${NAME}..."
sha256sum -- "$jar" | tee -a artifacts/icon/checksums_intermediate.txt
echo "Copying $NAME ..."
echo "Copying $NAME"
cp "$jar" "artifacts/icon/$NAME"
cp "$jar" "artifacts/icon/${NAME%%-[0-9]*.[0-9]*.[0-9]*-optimized.jar}-latest.jar"
done
Loading