Skip to content

Commit

Permalink
Merge pull request #1098 from scrtlabs/lior-ibc-tests
Browse files Browse the repository at this point in the history
Fix gtests
  • Loading branch information
liorbond authored Aug 30, 2022
2 parents dfd161b + add2302 commit 50551f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
14 changes: 10 additions & 4 deletions cosmwasm/enclaves/shared/contract-engine/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,14 @@ pub fn encrypt_output(
Some(_) => {
let events = match ok.log.len() {
0 => vec![],
_ => vec![Event {
ty: "wasm".to_string(),
attributes: ok.log.clone(),
}],
_ => {
let mut logs = ok.log.clone();
logs.sort_by(|a, b| a.key.cmp(&b.key));
vec![Event {
ty: "wasm".to_string(),
attributes: logs,
}]
}
};

let reply = Reply {
Expand Down Expand Up @@ -647,6 +651,8 @@ pub fn encrypt_output(
if event.ty != "wasm" {
event.ty = custom_contract_event_prefix.clone() + event.ty.as_str();
}

event.attributes.sort_by(|a, b| a.key.cmp(&b.key));
}

let reply = Reply {
Expand Down
27 changes: 0 additions & 27 deletions x/compute/internal/keeper/secret_contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1280,33 +1280,6 @@ func TestInitNotEncryptedInputError(t *testing.T) {
}
}

func TestExecuteNotEncryptedInputError(t *testing.T) {
for _, testContract := range testContracts {
t.Run(testContract.CosmWasmVersion, func(t *testing.T) {
ctx, keeper, codeID, _, walletA, privKeyA, _, _ := setupTest(t, testContract.WasmFilePath, sdk.NewCoins())

_, _, contractAddress, _, initErr := initHelper(t, keeper, ctx, codeID, walletA, privKeyA, `{"nop":{}}`, true, testContract.IsCosmWasmV1, defaultGasForTests)
require.Empty(t, initErr)

//ctx = sdk.NewContext(
// ctx.MultiStore(),
// ctx.BlockHeader(),
// ctx.IsCheckTx(),
// log.NewNopLogger(),
//).WithGasMeter(sdk.NewGasMeter(defaultGas))

execMsg := []byte(`{"empty_log_key_value":{}}`)

ctx = PrepareExecSignedTx(t, keeper, ctx, walletA, privKeyA, execMsg, contractAddress, nil)

_, err := keeper.Execute(ctx, contractAddress, walletA, execMsg, sdk.NewCoins(sdk.NewInt64Coin("denom", 0)), nil)
require.Error(t, err)

require.Contains(t, err.Error(), "failed to decrypt data")
})
}
}

func TestQueryNotEncryptedInputError(t *testing.T) {
for _, testContract := range testContracts {
t.Run(testContract.CosmWasmVersion, func(t *testing.T) {
Expand Down

0 comments on commit 50551f0

Please sign in to comment.