diff --git a/tests/e2e/e2e.go b/tests/e2e/e2e.go index b8340734..cab70123 100644 --- a/tests/e2e/e2e.go +++ b/tests/e2e/e2e.go @@ -99,6 +99,7 @@ type example struct { ConsumerChain *ibctesting.TestChain ProviderChain *ibctesting.TestChain ConsumerApp *app.MeshApp + ProviderApp *app.MeshApp IbcPath *ibctesting.Path ProviderDenom string ConsumerDenom string @@ -114,6 +115,7 @@ func setupExampleChains(t *testing.T) example { ConsumerChain: consChain, ProviderChain: provChain, ConsumerApp: consChain.App.(*app.MeshApp), + ProviderApp: provChain.App.(*app.MeshApp), IbcPath: ibctesting.NewPath(consChain, provChain), ProviderDenom: sdk.DefaultBondDenom, ConsumerDenom: sdk.DefaultBondDenom, @@ -132,7 +134,7 @@ func setupMeshSecurity(t *testing.T, x example) (*TestConsumerClient, ConsumerCo x.ConsumerChain.DefaultMsgFees = sdk.NewCoins(sdk.NewCoin(x.ConsumerDenom, math.NewInt(1_000_000))) providerCli := NewProviderClient(t, x.ProviderChain) - providerContracts := providerCli.BootstrapContracts(x.IbcPath.EndpointA.ConnectionID, converterPortID) + providerContracts := providerCli.BootstrapContracts(x.ProviderApp, x.IbcPath.EndpointA.ConnectionID, converterPortID) // setup ibc control path: consumer -> provider (direction matters) x.IbcPath.EndpointB.ChannelConfig = &ibctesting2.ChannelConfig{ diff --git a/tests/e2e/mvp_test.go b/tests/e2e/mvp_test.go index 71e615c6..06981fe3 100644 --- a/tests/e2e/mvp_test.go +++ b/tests/e2e/mvp_test.go @@ -59,8 +59,8 @@ func TestMVP(t *testing.T) { // provider chain // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account - execMsg := `{"bond":{}}` - providerCli.MustExecVault(execMsg, sdk.NewInt64Coin(x.ProviderDenom, 100_000_000)) + execMsg := fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"100000000"}}}`, x.ProviderDenom) + providerCli.MustExecVault(execMsg) // then query contract state assert.Equal(t, 100_000_000, providerCli.QueryVaultFreeBalance()) diff --git a/tests/e2e/slashing_test.go b/tests/e2e/slashing_test.go index d068a0ea..f9abdbab 100644 --- a/tests/e2e/slashing_test.go +++ b/tests/e2e/slashing_test.go @@ -21,8 +21,8 @@ func TestSlashingScenario1(t *testing.T) { // Provider chain // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account - execMsg := `{"bond":{}}` - providerCli.MustExecVault(execMsg, sdk.NewInt64Coin(x.ProviderDenom, 200_000_000)) + execMsg := fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"200000000"}}}`, x.ProviderDenom) + providerCli.MustExecVault(execMsg) // Stake Locally - A user triggers a local staking action to a chosen validator. myLocalValidatorAddr := sdk.ValAddress(x.ProviderChain.Vals.Validators[0].Address).String() @@ -121,8 +121,8 @@ func TestSlashingScenario2(t *testing.T) { // Provider chain // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account - execMsg := `{"bond":{}}` - providerCli.MustExecVault(execMsg, sdk.NewInt64Coin(x.ProviderDenom, 200_000_000)) + execMsg := fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"200000000"}}}`, x.ProviderDenom) + providerCli.MustExecVault(execMsg) // Stake Locally - A user triggers a local staking action to a chosen validator. myLocalValidatorAddr := sdk.ValAddress(x.ProviderChain.Vals.Validators[0].Address).String() @@ -208,8 +208,8 @@ func TestSlashingScenario3(t *testing.T) { // Provider chain // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account - execMsg := `{"bond":{}}` - providerCli.MustExecVault(execMsg, sdk.NewInt64Coin(x.ProviderDenom, 200_000_000)) + execMsg := fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"200000000"}}}`, x.ProviderDenom) + providerCli.MustExecVault(execMsg) // Stake Locally - A user triggers a local staking action to a chosen validator. myLocalValidatorAddr := sdk.ValAddress(x.ProviderChain.Vals.Validators[0].Address).String() diff --git a/tests/e2e/test_client.go b/tests/e2e/test_client.go index 392f3077..a67917de 100644 --- a/tests/e2e/test_client.go +++ b/tests/e2e/test_client.go @@ -78,8 +78,7 @@ type ProviderContracts struct { externalStaking sdk.AccAddress } -func (p *TestProviderClient) BootstrapContracts(connId, portID string) ProviderContracts { - var ( +func (p *TestProviderClient) BootstrapContracts(provApp *app.MeshApp, connId, portID string) ProviderContracts { var ( unbondingPeriod = 21 * 24 * 60 * 60 // 21 days - make configurable? localSlashRatioDoubleSign = "0.20" localSlashRatioOffline = "0.10" @@ -95,7 +94,10 @@ func (p *TestProviderClient) BootstrapContracts(connId, portID string) ProviderC nativeInitMsg := []byte(fmt.Sprintf(`{"denom": %q, "proxy_code_id": %d, "slash_ratio_dsign": %q, "slash_ratio_offline": %q }`, localTokenDenom, proxyCodeID, localSlashRatioDoubleSign, localSlashRatioOffline)) initMsg := []byte(fmt.Sprintf(`{"denom": %q, "local_staking": {"code_id": %d, "msg": %q}}`, localTokenDenom, nativeStakingCodeID, base64.StdEncoding.EncodeToString(nativeInitMsg))) vaultContract := InstantiateContract(p.t, p.chain, vaultCodeID, initMsg) - + ctx := p.chain.GetContext() + params := provApp.MeshSecProvKeeper.GetParams(ctx) + params.VaultAddress = vaultContract.String() + provApp.MeshSecProvKeeper.SetParams(ctx, params) // external staking extStakingCodeID := p.chain.StoreCodeFile(buildPathToWasm("mesh_external_staking.wasm")).CodeID initMsg = []byte(fmt.Sprintf( diff --git a/tests/starship/mvp_test.go b/tests/starship/mvp_test.go index 524a797e..a0e29634 100644 --- a/tests/starship/mvp_test.go +++ b/tests/starship/mvp_test.go @@ -52,8 +52,8 @@ func Test2WayContract(t *testing.T) { // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account fmt.Println("provider chain: deposit vault denom to provide some collateral to account") - execMsg := `{"bond":{}}` - vault, err := providerClient1.MustExecVault(execMsg, sdk.NewInt64Coin(providerClient1.Chain.Denom, 100_000_000)) + execMsg := fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"100000000"}}}`, providerClient1.Chain.Denom) + vault, err := providerClient1.MustExecVault(execMsg) require.NoError(t, err) require.NotEmpty(t, vault) @@ -130,8 +130,8 @@ func Test2WayContract(t *testing.T) { // ============== // Deposit - A user deposits the vault denom to provide some collateral to their account fmt.Println("provider chain: deposit vault denom to provide some collateral to account") - execMsg = `{"bond":{}}` - vault, err = providerClient2.MustExecVault(execMsg, sdk.NewInt64Coin(providerClient2.Chain.Denom, 100_000_000)) + execMsg = fmt.Sprintf(`{"bond":{"amount":{"denom":"%s", "amount":"100000000"}}}`, providerClient2.Chain.Denom) + vault, err = providerClient2.MustExecVault(execMsg) require.NoError(t, err) require.NotEmpty(t, vault) diff --git a/tests/testdata/copy_local_wasm.sh b/tests/testdata/copy_local_wasm.sh index 9754f26a..b85023cd 100755 --- a/tests/testdata/copy_local_wasm.sh +++ b/tests/testdata/copy_local_wasm.sh @@ -4,14 +4,14 @@ command -v shellcheck > /dev/null && shellcheck "$0" echo "DEV-only: copy from local built instead of downloading" -for contract in external_staking mesh_converter mesh_native_staking mesh_native_staking_proxy mesh_simple_price_feed \ +for contract in mesh_external_staking mesh_converter mesh_native_staking mesh_native_staking_proxy mesh_simple_price_feed \ mesh_vault mesh_virtual_staking ; do -cp -f ../../../../mesh-security/artifacts/${contract}.wasm . +cp -f ../../../mesh-security/artifacts/${contract}.wasm . gzip -fk ${contract}.wasm rm -f ${contract}.wasm done -cd ../../../../mesh-security +cd ../../../mesh-security tag=$(git rev-parse HEAD) cd - rm -f version.txt diff --git a/tests/testdata/mesh_converter.wasm.gz b/tests/testdata/mesh_converter.wasm.gz index 9a3e33d5..72a0e716 100644 Binary files a/tests/testdata/mesh_converter.wasm.gz and b/tests/testdata/mesh_converter.wasm.gz differ diff --git a/tests/testdata/mesh_external_staking.wasm.gz b/tests/testdata/mesh_external_staking.wasm.gz index 1381a305..63319fa2 100644 Binary files a/tests/testdata/mesh_external_staking.wasm.gz and b/tests/testdata/mesh_external_staking.wasm.gz differ diff --git a/tests/testdata/mesh_native_staking.wasm.gz b/tests/testdata/mesh_native_staking.wasm.gz index e59633de..6f4a87c3 100644 Binary files a/tests/testdata/mesh_native_staking.wasm.gz and b/tests/testdata/mesh_native_staking.wasm.gz differ diff --git a/tests/testdata/mesh_native_staking_proxy.wasm.gz b/tests/testdata/mesh_native_staking_proxy.wasm.gz index 2efacb69..e56378bf 100644 Binary files a/tests/testdata/mesh_native_staking_proxy.wasm.gz and b/tests/testdata/mesh_native_staking_proxy.wasm.gz differ diff --git a/tests/testdata/mesh_simple_price_feed.wasm.gz b/tests/testdata/mesh_simple_price_feed.wasm.gz index 6c0ee595..31a9944c 100644 Binary files a/tests/testdata/mesh_simple_price_feed.wasm.gz and b/tests/testdata/mesh_simple_price_feed.wasm.gz differ diff --git a/tests/testdata/mesh_vault.wasm.gz b/tests/testdata/mesh_vault.wasm.gz index a9333c18..117a1eab 100644 Binary files a/tests/testdata/mesh_vault.wasm.gz and b/tests/testdata/mesh_vault.wasm.gz differ diff --git a/tests/testdata/mesh_virtual_staking.wasm.gz b/tests/testdata/mesh_virtual_staking.wasm.gz index ceb80a0b..c2977a7f 100644 Binary files a/tests/testdata/mesh_virtual_staking.wasm.gz and b/tests/testdata/mesh_virtual_staking.wasm.gz differ diff --git a/tests/testdata/version.txt b/tests/testdata/version.txt index da48689d..d7bfc037 100644 --- a/tests/testdata/version.txt +++ b/tests/testdata/version.txt @@ -1 +1 @@ -v0.10.0-alpha.1 +34284a38601ff132e8d7b5594a87794faa71bbed