diff --git a/tests/e2e/mvp_test.go b/tests/e2e/mvp_test.go index 7a128090..e600e838 100644 --- a/tests/e2e/mvp_test.go +++ b/tests/e2e/mvp_test.go @@ -113,8 +113,22 @@ func TestMVP(t *testing.T) { assert.Equal(t, 70_000_000, providerCli.QueryVaultFreeBalance()) - // Cross Stake - A user pulls out additional liens on the same collateral "cross staking" it on different chains. + // @alpe these lines pass, but when I run them, the following providerCli.MustExecVault(execMsg) fails with + // account sequence mismatch, expected 20, got 19: incorrect account sequence + // Because TestChain only updates sequence on success... + // https://github.com/CosmWasm/wasmd/blob/main/x/wasm/ibctesting/chain.go#L372-L383 + // At error should happen at the bottom, when all processed, not an early return + // + // // Failure mode of cross-stake... trying to stake to an unknown validator + // execMsg = fmt.Sprintf(`{"stake_remote":{"contract":"%s", "amount": {"denom":%q, "amount":"%d"}, "msg":%q}}`, + // providerContracts.externalStaking.String(), + // sdk.DefaultBondDenom, 80_000_000, + // base64.StdEncoding.EncodeToString([]byte(`{"validator": "BAD-VALIDATOR"}`))) + // providerCli.VaultShouldFail(execMsg) + // // no change to free balance + // assert.Equal(t, 70_000_000, providerCli.QueryVaultFreeBalance()) + // Cross Stake - A user pulls out additional liens on the same collateral "cross staking" it on different chains. execMsg = fmt.Sprintf(`{"stake_remote":{"contract":"%s", "amount": {"denom":%q, "amount":"%d"}, "msg":%q}}`, providerContracts.externalStaking.String(), sdk.DefaultBondDenom, 80_000_000, diff --git a/tests/e2e/test_client.go b/tests/e2e/test_client.go index 217cc3aa..94630564 100644 --- a/tests/e2e/test_client.go +++ b/tests/e2e/test_client.go @@ -93,6 +93,23 @@ func (p TestProviderClient) mustExec(contract sdk.AccAddress, payload string, fu return rsp } +func (p TestProviderClient) VaultShouldFail(payload string, funds ...sdk.Coin) error { + return p.execShouldFail(p.contracts.vault, payload, funds) +} + +// This will execute the contract and assert that it fails, returning the error if desired. +// (Unlike most functions, it will panic on failure, returning error is success case) +func (p TestProviderClient) execShouldFail(contract sdk.AccAddress, payload string, funds []sdk.Coin) error { + resp, err := p.chain.SendMsgs(&wasmtypes.MsgExecuteContract{ + Sender: p.chain.SenderAccount.GetAddress().String(), + Contract: contract.String(), + Msg: []byte(payload), + Funds: funds, + }) + require.Error(p.t, err, "Response: %v", resp) + return err +} + func (p TestProviderClient) QueryExtStaking(q Query) map[string]any { return Querier(p.t, p.chain)(p.contracts.externalStaking.String(), q) } @@ -105,8 +122,10 @@ func (p TestProviderClient) QueryVaultFreeBalance() int { qRsp := p.QueryVault(Query{ "account": {"account": p.chain.SenderAccount.GetAddress().String()}, }) - require.NotEmpty(p.t, qRsp["free"], qRsp) - r, err := strconv.Atoi(qRsp["free"].(string)) + require.NotEmpty(p.t, qRsp["account"], qRsp) + acct := qRsp["account"].(map[string]any) + require.NotEmpty(p.t, acct["free"], qRsp) + r, err := strconv.Atoi(acct["free"].(string)) require.NoError(p.t, err, qRsp) return r } diff --git a/tests/e2e/testdata/external_staking.wasm.gz b/tests/e2e/testdata/external_staking.wasm.gz index bc9254a2..ab2b89d8 100644 Binary files a/tests/e2e/testdata/external_staking.wasm.gz and b/tests/e2e/testdata/external_staking.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_converter.wasm.gz b/tests/e2e/testdata/mesh_converter.wasm.gz index 59623612..9cf674d1 100644 Binary files a/tests/e2e/testdata/mesh_converter.wasm.gz and b/tests/e2e/testdata/mesh_converter.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_native_staking.wasm.gz b/tests/e2e/testdata/mesh_native_staking.wasm.gz index 9fb051ab..dd048ec1 100644 Binary files a/tests/e2e/testdata/mesh_native_staking.wasm.gz and b/tests/e2e/testdata/mesh_native_staking.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_native_staking_proxy.wasm.gz b/tests/e2e/testdata/mesh_native_staking_proxy.wasm.gz index eb6b23b8..e76ffcad 100644 Binary files a/tests/e2e/testdata/mesh_native_staking_proxy.wasm.gz and b/tests/e2e/testdata/mesh_native_staking_proxy.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_simple_price_feed.wasm.gz b/tests/e2e/testdata/mesh_simple_price_feed.wasm.gz index a9af9851..9b654ac2 100644 Binary files a/tests/e2e/testdata/mesh_simple_price_feed.wasm.gz and b/tests/e2e/testdata/mesh_simple_price_feed.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_vault.wasm.gz b/tests/e2e/testdata/mesh_vault.wasm.gz index ce520c73..12c206a7 100644 Binary files a/tests/e2e/testdata/mesh_vault.wasm.gz and b/tests/e2e/testdata/mesh_vault.wasm.gz differ diff --git a/tests/e2e/testdata/mesh_virtual_staking.wasm.gz b/tests/e2e/testdata/mesh_virtual_staking.wasm.gz index d0168f94..26e181de 100644 Binary files a/tests/e2e/testdata/mesh_virtual_staking.wasm.gz and b/tests/e2e/testdata/mesh_virtual_staking.wasm.gz differ diff --git a/tests/e2e/testdata/version.txt b/tests/e2e/testdata/version.txt index 5d93b0b0..268b0334 100644 --- a/tests/e2e/testdata/version.txt +++ b/tests/e2e/testdata/version.txt @@ -1 +1 @@ -b5c8df0764aae9928795d5705788816dd0df3e70 +v0.3.0