From 241f1ef527acc12e522c9019b3583d6191547165 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Thu, 9 May 2024 18:02:46 +0900 Subject: [PATCH 1/4] feat: use separator to divide mutli message response for single tx in rpc `block_results` --- gno.land/pkg/sdk/vm/keeper.go | 1 + 1 file changed, 1 insertion(+) diff --git a/gno.land/pkg/sdk/vm/keeper.go b/gno.land/pkg/sdk/vm/keeper.go index c032ca4b7db..17bab5b8ffe 100644 --- a/gno.land/pkg/sdk/vm/keeper.go +++ b/gno.land/pkg/sdk/vm/keeper.go @@ -310,6 +310,7 @@ func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) (res string, err error) { res += "\n" } } + res += "\n\n" // use `\n\n` as seperator to separate results for single tx with multi msgs return res, nil // TODO pay for gas? TODO see context? } From 824e8ffaf5d81dd577d74cb9e7fdf500b75af859 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Thu, 9 May 2024 18:49:33 +0900 Subject: [PATCH 2/4] fix: test --- gno.land/pkg/sdk/vm/keeper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gno.land/pkg/sdk/vm/keeper_test.go b/gno.land/pkg/sdk/vm/keeper_test.go index bd8762b9831..12b2708fb7e 100644 --- a/gno.land/pkg/sdk/vm/keeper_test.go +++ b/gno.land/pkg/sdk/vm/keeper_test.go @@ -333,7 +333,7 @@ func GetAdmin() string { coins := std.MustParseCoins("") msg2 := NewMsgCall(addr, coins, pkgPath, "GetAdmin", []string{}) res, err := env.vmk.Call(ctx, msg2) - addrString := fmt.Sprintf("(\"%s\" string)", addr.String()) + addrString := fmt.Sprintf("(\"%s\" string)\n\n", addr.String()) assert.NoError(t, err) assert.Equal(t, addrString, res) } From 1c153998140a02b6766ef1404e7ebe42a39ce8a2 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Thu, 9 May 2024 19:44:52 +0900 Subject: [PATCH 3/4] fix: test --- gno.land/pkg/gnoclient/integration_test.go | 4 ++-- gno.land/pkg/sdk/vm/keeper_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gno.land/pkg/gnoclient/integration_test.go b/gno.land/pkg/gnoclient/integration_test.go index ace9022e35d..6c8facaa658 100644 --- a/gno.land/pkg/gnoclient/integration_test.go +++ b/gno.land/pkg/gnoclient/integration_test.go @@ -54,7 +54,7 @@ func TestCallSingle_Integration(t *testing.T) { // Execute call res, err := client.Call(baseCfg, msg) - expected := "(\"hi test argument\" string)" + expected := "(\"hi test argument\" string)\n\n" got := string(res.DeliverTx.Data) assert.Nil(t, err) @@ -103,7 +103,7 @@ func TestCallMultiple_Integration(t *testing.T) { Send: "", } - expected := "(\"it works!\" string)(\"hi test argument\" string)" + expected := "(\"it works!\" string)\n\n(\"hi test argument\" string)\n\n" // Execute call res, err := client.Call(baseCfg, msg1, msg2) diff --git a/gno.land/pkg/sdk/vm/keeper_test.go b/gno.land/pkg/sdk/vm/keeper_test.go index 12b2708fb7e..b4c8ec599e6 100644 --- a/gno.land/pkg/sdk/vm/keeper_test.go +++ b/gno.land/pkg/sdk/vm/keeper_test.go @@ -94,7 +94,7 @@ func Echo(msg string) string { msg2 := NewMsgCall(addr, coins, pkgPath, "Echo", []string{"hello world"}) res, err := env.vmk.Call(ctx, msg2) assert.NoError(t, err) - assert.Equal(t, `("echo:hello world" string)`, res) + assert.Equal(t, `("echo:hello world" string)`+"\n\n", res) // t.Log("result:", res) } @@ -237,7 +237,7 @@ func Echo(msg string) string { msg2 := NewMsgCall(addr, coins, pkgPath, "Echo", []string{"hello world"}) res, err := env.vmk.Call(ctx, msg2) assert.NoError(t, err) - assert.Equal(t, `("echo:hello world" string)`, res) + assert.Equal(t, `("echo:hello world" string)`+"\n\n", res) } // Sending too much realm package coins fails. From 054f323136ede71f899463bd48f7eb8fd3b9a2c0 Mon Sep 17 00:00:00 2001 From: n3wbie Date: Fri, 10 May 2024 13:25:58 +0900 Subject: [PATCH 4/4] chore: make fmt, lint --- gno.land/pkg/sdk/vm/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gno.land/pkg/sdk/vm/keeper.go b/gno.land/pkg/sdk/vm/keeper.go index 17bab5b8ffe..c52de6bcc4d 100644 --- a/gno.land/pkg/sdk/vm/keeper.go +++ b/gno.land/pkg/sdk/vm/keeper.go @@ -310,7 +310,7 @@ func (vm *VMKeeper) Call(ctx sdk.Context, msg MsgCall) (res string, err error) { res += "\n" } } - res += "\n\n" // use `\n\n` as seperator to separate results for single tx with multi msgs + res += "\n\n" // use `\n\n` as separator to separate results for single tx with multi msgs return res, nil // TODO pay for gas? TODO see context? }