From add2302a864d79bf3c93250794dc5373cc788127 Mon Sep 17 00:00:00 2001 From: Lior Bondarevski Date: Tue, 30 Aug 2022 15:59:48 +0300 Subject: [PATCH] Fix gtests --- .../enclaves/shared/contract-engine/src/io.rs | 14 +++++++--- .../internal/keeper/secret_contracts_test.go | 27 ------------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/cosmwasm/enclaves/shared/contract-engine/src/io.rs b/cosmwasm/enclaves/shared/contract-engine/src/io.rs index 0818c2ee2..f0c284535 100644 --- a/cosmwasm/enclaves/shared/contract-engine/src/io.rs +++ b/cosmwasm/enclaves/shared/contract-engine/src/io.rs @@ -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 { @@ -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 { diff --git a/x/compute/internal/keeper/secret_contracts_test.go b/x/compute/internal/keeper/secret_contracts_test.go index 2ab742628..733eab829 100644 --- a/x/compute/internal/keeper/secret_contracts_test.go +++ b/x/compute/internal/keeper/secret_contracts_test.go @@ -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) {