From 3196a9e348b1e15c5c7769375adf54166c7adc7e Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:59:06 +0200 Subject: [PATCH 1/8] fix(txtar): use previous realm, rework prev realm --- examples/gno.land/p/demo/ownable/ownable.gno | 8 ++----- .../testdata/addpkg_namespace.txtar | 2 +- .../pkg/integration/testdata/prevrealm.txtar | 22 +++++++++---------- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/examples/gno.land/p/demo/ownable/ownable.gno b/examples/gno.land/p/demo/ownable/ownable.gno index c8de82be88a..55c85cfa73d 100644 --- a/examples/gno.land/p/demo/ownable/ownable.gno +++ b/examples/gno.land/p/demo/ownable/ownable.gno @@ -77,16 +77,12 @@ func (o *Ownable) OwnedByPrevious() bool { if o == nil { return false } - return std.CurrentRealm().Address() == o.owner + return std.PreviousRealm().Address() == o.owner } // AssertOwnedByPrevious panics if the caller is not the owner func (o *Ownable) AssertOwnedByPrevious() { - if o == nil { - panic(ErrUnauthorized) - } - caller := std.CurrentRealm().Address() - if caller != o.owner { + if !o.OwnedByPrevious() { panic(ErrUnauthorized) } } diff --git a/gno.land/pkg/integration/testdata/addpkg_namespace.txtar b/gno.land/pkg/integration/testdata/addpkg_namespace.txtar index 50346e16782..f66f51ade46 100644 --- a/gno.land/pkg/integration/testdata/addpkg_namespace.txtar +++ b/gno.land/pkg/integration/testdata/addpkg_namespace.txtar @@ -57,7 +57,7 @@ stderr 'is not authorized to deploy packages to namespace' # test gui register namespace # gui call -> gnoland/users/v1.Register -gnokey maketx call -pkgpath gno.land/r/gnoland/users/v1 -func Register -send "1000000ugnot" -gas-fee 1000000ugnot -gas-wanted 12000000 -broadcast -chainid=tendermint_test -args 'guigui123' gui +gnokey maketx call -pkgpath gno.land/r/gnoland/users/v1 -func Register -send "1000000ugnot" -gas-fee 1000000ugnot -gas-wanted 13000000 -broadcast -chainid=tendermint_test -args 'guigui123' gui stdout 'OK!' # Test gui publishing on guigui123/one diff --git a/gno.land/pkg/integration/testdata/prevrealm.txtar b/gno.land/pkg/integration/testdata/prevrealm.txtar index fd3aa59d68e..bf03deefd30 100644 --- a/gno.land/pkg/integration/testdata/prevrealm.txtar +++ b/gno.land/pkg/integration/testdata/prevrealm.txtar @@ -31,7 +31,6 @@ loadpkg gno.land/p/demo/bar $WORK/p/demo/bar gnoland start env RFOO_USER_ADDR=g1evezrh92xaucffmtgsaa3rvmz5s8kedffsg469 -env R_UNKNOWN_ADDR=g1a9r05e34s7dxe7wh8v00lnewnxtfnfq02gn5ws # XXX: temp # Test cases ## 1. MsgCall -> myrlm.A: user address @@ -69,30 +68,29 @@ stdout ${test1_user_addr} ## 9. MsgRun -> r/foo.A -> myrlm.A: r/foo gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno -stdout ${test1_user_addr} +stdout ${RFOO_USER_ADDR} ## 10. MsgRun -> r/foo.B -> myrlm.B -> r/foo.A: r/foo gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/fooB.gno -stdout ${test1_user_addr} +stdout ${RFOO_USER_ADDR} ## 11. MsgRun -> p/demo/bar.A -> myrlm.A: user address -## crossing call only allowed in realm packages, doesn't work -gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno +## XXX: crossing call only allowed in realm packages, doesn't work +! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno stderr 'crossing' ## 12. MsgRun -> p/demo/bar.B -> myrlm.B -> r/foo.A: user address -## crossing call only allowed in realm packages, doesn't work -gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno +## XXX: crossing call only allowed in realm packages, doesn't work +! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/barB.gno stderr 'crossing' ## 13. MsgCall -> std.PreviousRealm(): user address -gnokey maketx call -pkgpath std -func PreviousRealm -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 -stderr 'crossing' +## gnokey maketx call -pkgpath std -func PreviousRealm -gas-fee 100000ugnot -gas-wanted 4000000 -broadcast -chainid tendermint_test test1 +## stdout ${test1_user_addr} ## 14. MsgRun -> std.PreviousRealm(): user address -## PreviousRealm() not possible in run + main: frame not found -! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno -stderr 'crossing' +gnokey maketx run -gas-fee 100000ugnot -gas-wanted 12000000 -broadcast -chainid tendermint_test test1 $WORK/run/baz.gno +stdout ${test1_user_addr} -- r/myrlm/myrlm.gno -- package myrlm From b97180039797d909e20c8f193b80016f2a8343fc Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 14:27:26 +0200 Subject: [PATCH 2/8] fix(txtar): update Render msgcall to use qeval --- .../gno.land/r/demo/atomicswap/atomicswap.gno | 12 +++++++ examples/gno.land/r/demo/echo/echo.gno | 2 -- examples/gno.land/r/demo/wugnot/wugnot.gno | 2 -- .../gno.land/r/gnoland/ghverify/contract.gno | 2 -- .../pkg/integration/testdata/append.txtar | 33 +++++++------------ .../pkg/integration/testdata/atomicswap.txtar | 7 ++-- .../pkg/integration/testdata/ghverify.txtar | 4 +-- .../testdata/gnoweb_airgapped.txtar | 24 ++++++++++++-- .../pkg/integration/testdata/import.txtar | 7 ++-- .../integration/testdata/infinite_loop.txtar | 10 ++---- .../pkg/integration/testdata/initctx.txtar | 6 ++-- .../pkg/integration/testdata/issue_1167.txtar | 17 +++------- .../testdata/loadpkg_example.txtar | 5 ++- .../testdata/loadpkg_example_and_work.txtar | 6 ++-- .../testdata/maketx_call_pure.txtar | 28 ++++++++++------ .../pkg/integration/testdata/patchpkg.txtar | 4 +-- .../integration/testdata/transfer_lock.txtar | 2 +- .../pkg/integration/testdata/wugnot.txtar | 15 +++------ 18 files changed, 91 insertions(+), 95 deletions(-) diff --git a/examples/gno.land/r/demo/atomicswap/atomicswap.gno b/examples/gno.land/r/demo/atomicswap/atomicswap.gno index 4b65796fa46..b01f8126a04 100644 --- a/examples/gno.land/r/demo/atomicswap/atomicswap.gno +++ b/examples/gno.land/r/demo/atomicswap/atomicswap.gno @@ -59,6 +59,8 @@ var ( // NewCoinSwap creates a new atomic swap contract for native coins. // It uses a default timelock duration. func NewCoinSwap(recipient std.Address, hashlock string) (int, *Swap) { + crossing() + timelock := time.Now().Add(defaultTimelockDuration) return NewCustomCoinSwap(recipient, hashlock, timelock) } @@ -66,6 +68,8 @@ func NewCoinSwap(recipient std.Address, hashlock string) (int, *Swap) { // NewGRC20Swap creates a new atomic swap contract for grc20 tokens. // It uses gno.land/r/demo/grc20reg to lookup for a registered token. func NewGRC20Swap(recipient std.Address, hashlock string, tokenRegistryKey string) (int, *Swap) { + crossing() + timelock := time.Now().Add(defaultTimelockDuration) tokenGetter := grc20reg.MustGet(tokenRegistryKey) token := tokenGetter() @@ -76,6 +80,8 @@ func NewGRC20Swap(recipient std.Address, hashlock string, tokenRegistryKey strin // It allows specifying a custom timelock duration. // It is not callable with `gnokey maketx call`, but can be imported by another contract or `gnokey maketx run`. func NewCustomCoinSwap(recipient std.Address, hashlock string, timelock time.Time) (int, *Swap) { + crossing() + sender := std.PreviousRealm().Address() sent := std.OriginSend() require(len(sent) != 0, "at least one coin needs to be sent") @@ -98,6 +104,8 @@ func NewCustomCoinSwap(recipient std.Address, hashlock string, timelock time.Tim // NewCustomGRC20Swap creates a new atomic swap contract for grc20 tokens. // It is not callable with `gnokey maketx call`, but can be imported by another contract or `gnokey maketx run`. func NewCustomGRC20Swap(recipient std.Address, hashlock string, timelock time.Time, token *grc20.Token) (int, *Swap) { + crossing() + sender := std.PreviousRealm().Address() curAddr := std.CurrentRealm().Address() @@ -125,12 +133,16 @@ func NewCustomGRC20Swap(recipient std.Address, hashlock string, timelock time.Ti // Claim loads a registered swap and tries to claim it. func Claim(id int, secret string) { + crossing() + swap := mustGet(id) swap.Claim(secret) } // Refund loads a registered swap and tries to refund it. func Refund(id int) { + crossing() + swap := mustGet(id) swap.Refund() } diff --git a/examples/gno.land/r/demo/echo/echo.gno b/examples/gno.land/r/demo/echo/echo.gno index 8feee6e46a6..d9933ab2355 100644 --- a/examples/gno.land/r/demo/echo/echo.gno +++ b/examples/gno.land/r/demo/echo/echo.gno @@ -9,7 +9,5 @@ package echo * See also r/demo/print (to print various thing like user address) */ func Render(path string) string { - crossing() - return path } diff --git a/examples/gno.land/r/demo/wugnot/wugnot.gno b/examples/gno.land/r/demo/wugnot/wugnot.gno index 5c32d5c3012..5d86e44f4f7 100644 --- a/examples/gno.land/r/demo/wugnot/wugnot.gno +++ b/examples/gno.land/r/demo/wugnot/wugnot.gno @@ -50,8 +50,6 @@ func Withdraw(amount uint64) { } func Render(path string) string { - crossing() - parts := strings.Split(path, "/") c := len(parts) diff --git a/examples/gno.land/r/gnoland/ghverify/contract.gno b/examples/gno.land/r/gnoland/ghverify/contract.gno index 1eb59c2d31b..f52f0a6ad0b 100644 --- a/examples/gno.land/r/gnoland/ghverify/contract.gno +++ b/examples/gno.land/r/gnoland/ghverify/contract.gno @@ -142,8 +142,6 @@ func GetAddressByHandle(handle string) string { // Render returns a json object string will all verified handle -> address mappings. func Render(_ string) string { - crossing() - result := "{" var appendComma bool handleToAddressMap.Iterate("", "", func(handle string, address any) bool { diff --git a/gno.land/pkg/integration/testdata/append.txtar b/gno.land/pkg/integration/testdata/append.txtar index 55a57bb9a7e..2e3dd048181 100644 --- a/gno.land/pkg/integration/testdata/append.txtar +++ b/gno.land/pkg/integration/testdata/append.txtar @@ -22,27 +22,23 @@ gnokey maketx call -pkgpath gno.land/r/append -func Append -gas-fee 1000000ugnot stdout OK! # Call render -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("1-2-3-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:' +stdout '1-2-3-' # Call Pop gnokey maketx call -pkgpath gno.land/r/append -func Pop -gas-fee 1000000ugnot -gas-wanted 300000 -broadcast -chainid=tendermint_test test1 -stdout OK! # Call render -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("2-3-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:' +stdout '2-3-' # Call Append 42 gnokey maketx call -pkgpath gno.land/r/append -func Append -gas-fee 1000000ugnot -gas-wanted 300000 -args '42' -broadcast -chainid=tendermint_test test1 stdout OK! # Call render -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("2-3-42-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:' +stdout '2-3-42-' gnokey maketx call -pkgpath gno.land/r/append -func CopyAppend -gas-fee 1000000ugnot -gas-wanted 300000 -broadcast -chainid=tendermint_test test1 stdout OK! @@ -51,9 +47,8 @@ gnokey maketx call -pkgpath gno.land/r/append -func PopB -gas-fee 1000000ugnot - stdout OK! # Call render -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("2-3-42-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:' +stdout '2-3-42-' gnokey maketx call -pkgpath gno.land/r/append -func AppendMoreAndC -gas-fee 1000000ugnot -gas-wanted 350000 -broadcast -chainid=tendermint_test test1 stdout OK! @@ -61,13 +56,11 @@ stdout OK! gnokey maketx call -pkgpath gno.land/r/append -func ReassignC -gas-fee 1000000ugnot -gas-wanted 350000 -broadcast -chainid=tendermint_test test1 stdout OK! -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("2-3-42-70-100-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:' +stdout '2-3-42-70-100-' -gnokey maketx call -pkgpath gno.land/r/append -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args 'd' -broadcast -chainid=tendermint_test test1 -stdout '("1-" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/append:d' +stdout '1-' -- append.gno -- package append @@ -132,8 +125,6 @@ func AppendNil() { } func Render(path string) string { - crossing() - source := a if path == "d" { source = d diff --git a/gno.land/pkg/integration/testdata/atomicswap.txtar b/gno.land/pkg/integration/testdata/atomicswap.txtar index 0dd2340ed9d..b2d65ad358d 100644 --- a/gno.land/pkg/integration/testdata/atomicswap.txtar +++ b/gno.land/pkg/integration/testdata/atomicswap.txtar @@ -24,11 +24,10 @@ stdout '(1 int)' stdout ".*$test2_user_addr.*$test3_user_addr.*12345ugnot.*" stdout 'OK!' -gnokey maketx call -pkgpath gno.land/r/demo/atomicswap -func Render -gas-fee 1000000ugnot -gas-wanted 10000000 -args '' -broadcast -chainid=tendermint_test test2 -stdout 'OK!' +gnokey query vm/qrender --data 'gno.land/r/demo/atomicswap:' gnokey query auth/accounts/$test2_user_addr -stdout 'coins.*:.*1007987655ugnot' +stdout 'coins.*:.*1008987655ugnot' gnokey query auth/accounts/$test3_user_addr stdout 'coins.*:.*1010000000ugnot' @@ -36,6 +35,6 @@ gnokey maketx call -pkgpath gno.land/r/demo/atomicswap -func Claim -gas-fee 1000 stdout 'OK!' gnokey query auth/accounts/$test2_user_addr -stdout 'coins.*:.*1007987655ugnot' +stdout 'coins.*:.*1008987655ugnot' gnokey query auth/accounts/$test3_user_addr stdout 'coins.*:.*1009012345ugnot' diff --git a/gno.land/pkg/integration/testdata/ghverify.txtar b/gno.land/pkg/integration/testdata/ghverify.txtar index 2277ab20890..482ffd33322 100644 --- a/gno.land/pkg/integration/testdata/ghverify.txtar +++ b/gno.land/pkg/integration/testdata/ghverify.txtar @@ -35,5 +35,5 @@ stdout "deelawn" gnokey maketx call -pkgpath gno.land/r/gnoland/ghverify -func GetAddressByHandle -args 'deelawn' -gas-fee 1000000ugnot -gas-wanted 800000 -broadcast -chainid=tendermint_test test1 stdout "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" -gnokey maketx call -pkgpath gno.land/r/gnoland/ghverify -func Render -args '' -gas-fee 1000000ugnot -gas-wanted 800000 -broadcast -chainid=tendermint_test test1 -stdout '\("\{\\"deelawn\\": \\"g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5\\"\}" string\)' +gnokey query vm/qrender --data 'gno.land/r/gnoland/ghverify:' +stdout '{"deelawn": "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5"}' diff --git a/gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar b/gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar index c4d0e6bcdf8..46cc21dd08f 100644 --- a/gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar +++ b/gno.land/pkg/integration/testdata/gnoweb_airgapped.txtar @@ -2,7 +2,7 @@ # help page, work as intended. # load the package from $WORK directory -loadpkg gno.land/r/demo/echo +loadpkg gno.land/r/realm $WORK/realm # add a random user adduserfrom user1 'lamp any denial pulse used shoot gap error denial mansion hurry foot solution grab winner congress drastic cat bamboo chicken color digital coffee unknown' @@ -26,7 +26,7 @@ stdout '}' ! stderr '.+' # empty # Create transaction -gnokey maketx call -pkgpath "gno.land/r/demo/echo" -func "Render" -gas-fee 1000000ugnot -gas-wanted 2000000 -send "" -args "HELLO" user1 +gnokey maketx call -pkgpath "gno.land/r/realm" -func "SetName" -gas-fee 1000000ugnot -gas-wanted 2000000 -send "" -args "foo" user1 cp stdout call.tx # Sign @@ -34,9 +34,27 @@ gnokey sign -tx-path $WORK/call.tx -chainid "tendermint_test" -account-number 58 cmpenv stdout sign.stdout.golden gnokey broadcast $WORK/call.tx -stdout '("HELLO" string)' +stdout '("foo" string)' stdout 'GAS WANTED: 2000000' +gnokey query vm/qrender --data '"gno.land/r/realm":' +stdout '# HELLO foo' + -- sign.stdout.golden -- Tx successfully signed and saved to $WORK/call.tx +-- realm/realm.gno -- +package name + +var name string + +func SetName(s string) string { + crossing() + + name = s + return name +} + +func Render(_ string) string { + return "# HELLO "+name +} diff --git a/gno.land/pkg/integration/testdata/import.txtar b/gno.land/pkg/integration/testdata/import.txtar index 34cd6bbeceb..ea4350f77a4 100644 --- a/gno.land/pkg/integration/testdata/import.txtar +++ b/gno.land/pkg/integration/testdata/import.txtar @@ -6,9 +6,8 @@ loadpkg $WORK gnoland start ## execute Render -gnokey maketx call -pkgpath gno.land/r/importtest -func Render -gas-fee 1000000ugnot -gas-wanted 3000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("92054" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/importtest:' +stdout '92054' -- gno.mod -- module gno.land/r/importtest @@ -21,7 +20,5 @@ import ( ) func Render(_ string) string { - crossing() - return ufmt.Sprintf("%d", 92054) } diff --git a/gno.land/pkg/integration/testdata/infinite_loop.txtar b/gno.land/pkg/integration/testdata/infinite_loop.txtar index d05442e62d0..0b9c8483c82 100644 --- a/gno.land/pkg/integration/testdata/infinite_loop.txtar +++ b/gno.land/pkg/integration/testdata/infinite_loop.txtar @@ -38,11 +38,11 @@ stderr 'out of gas.* location: CPUCycles' stderr 'out of gas.* location: CPUCycles' # call on the render function -! gnokey maketx call -pkgpath gno.land/r/demo/r2 -func Render -args '' -simulate skip -gas-fee 100000ugnot -gas-wanted 1000000 -broadcast -chainid tendermint_test test1 +! gnokey query vm/qrender --data 'gno.land/r/demo/r2:' stderr 'out of gas.* location: CPUCycles' # simulated call on the render function -! gnokey maketx call -pkgpath gno.land/r/demo/r2 -func Render -args '' -simulate only -gas-fee 100000ugnot -gas-wanted 1000000 -broadcast -chainid tendermint_test test1 +! gnokey query vm/qrender --data 'gno.land/r/demo/r2:' stderr 'out of gas.* location: CPUCycles' -- run.gno -- @@ -67,9 +67,7 @@ func init() { for {} } -func main() { - crossing() -} +func main() {} -- r2/gno.mod -- module gno.land/r/demo/r2 @@ -79,8 +77,6 @@ module gno.land/r/demo/r2 package r2 func Render(s string) string { - crossing() - for {} return "hello world!" diff --git a/gno.land/pkg/integration/testdata/initctx.txtar b/gno.land/pkg/integration/testdata/initctx.txtar index d5793f4007b..a986c8bbf81 100644 --- a/gno.land/pkg/integration/testdata/initctx.txtar +++ b/gno.land/pkg/integration/testdata/initctx.txtar @@ -6,10 +6,8 @@ loadpkg gno.land/r/foobar/bar $WORK/bar gnoland start # execute Render -gnokey maketx call -pkgpath gno.land/r/foobar/bar -func Render -args X -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 -stdout OK! -stdout '(" orig=g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 prev=g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" string)' -stdout 'OK!' +gnokey query vm/qrender --data='gno.land/r/foobar/bar:X' +stdout ' orig=g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5 prev=g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5' -- bar/bar.gno -- package bar diff --git a/gno.land/pkg/integration/testdata/issue_1167.txtar b/gno.land/pkg/integration/testdata/issue_1167.txtar index 10f445de864..c8f821b6d83 100644 --- a/gno.land/pkg/integration/testdata/issue_1167.txtar +++ b/gno.land/pkg/integration/testdata/issue_1167.txtar @@ -14,30 +14,25 @@ stdout OK! # execute Delta for the first time gnokey maketx call -pkgpath gno.land/r/demo/xx -func Delta -args X -gas-fee 1000000ugnot -gas-wanted 2500000 -broadcast -chainid=tendermint_test test1 stdout OK! -stdout '"1,1,1;" string' +stdout '"1,1,1;' # execute Delta for the second time gnokey maketx call -pkgpath gno.land/r/demo/xx -func Delta -args X -gas-fee 1000000ugnot -gas-wanted 2500000 -broadcast -chainid=tendermint_test test1 stdout OK! -stdout '1,1,1;2,2,2;" string' +stdout '1,1,1;2,2,2;' # execute Delta for the third time gnokey maketx call -pkgpath gno.land/r/demo/xx -func Delta -args X -gas-fee 1000000ugnot -gas-wanted 2500000 -broadcast -chainid=tendermint_test test1 stdout OK! -stdout '1,1,1;2,2,2;3,3,3;" string' +stdout '1,1,1;2,2,2;3,3,3;' # execute Render -gnokey maketx call -pkgpath gno.land/r/demo/xx -func Render -args X -gas-fee 1000000ugnot -gas-wanted 2500000 -broadcast -chainid=tendermint_test test1 -stdout OK! -stdout '1,1,1;2,2,2;3,3,3;" string' +gnokey query vm/qrender --data "gno.land/r/demo/xx:X" +stdout '1,1,1;2,2,2;3,3,3;' -- gno.mod -- module gno.land/r/demo/xx -require ( - gno.land/p/demo/avl v0.0.0-latest -) - -- realm.gno -- package xx @@ -102,8 +97,6 @@ func Delta(s string) string { } func Render(s string) string { - crossing() - v, _ := games.Get(s) g, ok := v.(*Game) if !ok { diff --git a/gno.land/pkg/integration/testdata/loadpkg_example.txtar b/gno.land/pkg/integration/testdata/loadpkg_example.txtar index f7be500f3b6..505832962fc 100644 --- a/gno.land/pkg/integration/testdata/loadpkg_example.txtar +++ b/gno.land/pkg/integration/testdata/loadpkg_example.txtar @@ -8,9 +8,8 @@ gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/importtest -gas-fee 10000 stdout OK! ## execute Render -gnokey maketx call -pkgpath gno.land/r/importtest -func Render -gas-fee 1000000ugnot -gas-wanted 10000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("92054" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/importtest:' +stdout '92054' -- gno.mod -- module gno.land/r/importtest diff --git a/gno.land/pkg/integration/testdata/loadpkg_example_and_work.txtar b/gno.land/pkg/integration/testdata/loadpkg_example_and_work.txtar index 27e357fece4..4ee4994eeab 100644 --- a/gno.land/pkg/integration/testdata/loadpkg_example_and_work.txtar +++ b/gno.land/pkg/integration/testdata/loadpkg_example_and_work.txtar @@ -6,9 +6,8 @@ loadpkg gno.land/r/importtest $WORK gnoland start ## execute Render -gnokey maketx call -pkgpath gno.land/r/importtest -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -args '' -broadcast -chainid=tendermint_test test1 -stdout '("92054" string)' -stdout OK! +gnokey query vm/qrender --data 'gno.land/r/importtest:' +stdout '92054' -- import.gno -- package importtest @@ -20,4 +19,3 @@ import ( func Render(_ string) string { return ufmt.Sprintf("%d", 92054) } - diff --git a/gno.land/pkg/integration/testdata/maketx_call_pure.txtar b/gno.land/pkg/integration/testdata/maketx_call_pure.txtar index e3231eccc01..27f0a0aeb64 100644 --- a/gno.land/pkg/integration/testdata/maketx_call_pure.txtar +++ b/gno.land/pkg/integration/testdata/maketx_call_pure.txtar @@ -1,26 +1,34 @@ # load the package -loadpkg gno.land/p/foo/call_package $WORK/package +loadpkg gno.land/p/foo/call_pure $WORK/pure loadpkg gno.land/r/foo/call_realm $WORK/realm # start a new node gnoland start -# 1. call to package ERROR -! gnokey maketx call -pkgpath gno.land/p/foo/call_package -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 +# 1. eval to pure package SUCCESS +gnokey query vm/qeval --data 'gno.land/p/foo/call_pure.Hello()' +stdout 'notok' + +# 2. call to pure package ERROR +! gnokey maketx call -pkgpath gno.land/p/foo/call_pure -func Hello -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 stderr '"gnokey" error: --= Error =--\nData: invalid package path' -# 2. call to stdlibs ERROR +# 3. call to stdlibs ERROR ! gnokey maketx call -pkgpath strconv -func Itoa -args 11 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 stderr '"gnokey" error: --= Error =--\nData: invalid package path' -# 3. normal call to realm PASS -gnokey maketx call -pkgpath gno.land/r/foo/call_realm -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 -stdout OK! +# 4. normal call to realm ERROR (need crossing) +! gnokey maketx call -pkgpath gno.land/r/foo/call_realm -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 +stderr 'missing crossing\(\) after cross call in Render from to gno.land/r/foo/call_realm' --- package/package.gno -- -package call_package +# 5. normal eval realm SUCCESS +gnokey query vm/qeval --data 'gno.land/r/foo/call_realm.Render()' +stdout 'ok' -func Render() string { +-- pure/package.gno -- +package call_pure + +func Hello() string { return "notok" } diff --git a/gno.land/pkg/integration/testdata/patchpkg.txtar b/gno.land/pkg/integration/testdata/patchpkg.txtar index 58fed49bc2e..da86a0bf482 100644 --- a/gno.land/pkg/integration/testdata/patchpkg.txtar +++ b/gno.land/pkg/integration/testdata/patchpkg.txtar @@ -6,7 +6,7 @@ patchpkg "g1abcde" $dev_user_addr gnoland start -gnokey maketx call -pkgpath gno.land/r/dev/admin -func Render -gas-fee 1000000ugnot -gas-wanted 2000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data 'gno.land/r/dev/admin:' ! stdout g1abcde stdout $dev_user_addr @@ -16,7 +16,5 @@ package admin var admin = "g1abcde" func Render(path string) string { - crossing() - return "# Hello "+admin } diff --git a/gno.land/pkg/integration/testdata/transfer_lock.txtar b/gno.land/pkg/integration/testdata/transfer_lock.txtar index 5fcea46c01f..bc6c80ec3bb 100644 --- a/gno.land/pkg/integration/testdata/transfer_lock.txtar +++ b/gno.land/pkg/integration/testdata/transfer_lock.txtar @@ -37,7 +37,7 @@ gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/bank -gas-fee 1000000ugno stdout 'OK!' ## paying gas fees to call a realm function is acceptable. -gnokey maketx call -pkgpath gno.land/r/demo/echo -func Render -args "Hello!" -gas-fee 1000000ugnot -gas-wanted 12500000 -broadcast -chainid=tendermint_test regular1 +gnokey query vm/qrender --data 'gno.land/r/demo/echo:Hello!' stdout 'Hello!' -- bank.gno -- diff --git a/gno.land/pkg/integration/testdata/wugnot.txtar b/gno.land/pkg/integration/testdata/wugnot.txtar index aa8354a1085..d06c31e7fd8 100644 --- a/gno.land/pkg/integration/testdata/wugnot.txtar +++ b/gno.land/pkg/integration/testdata/wugnot.txtar @@ -2,44 +2,39 @@ loadpkg gno.land/r/demo/wugnot gnoland start -gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Render -gas-fee 10000000ugnot -gas-wanted 6000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" stdout '# wrapped GNOT \(\$wugnot\)' stdout 'Decimals..: 0' stdout 'Total supply..: 0' stdout 'Known accounts..: 0' -stdout 'OK!' gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send 12345678ugnot -gas-fee 1000000ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 stdout 'OK!' -gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Render -gas-fee 1000000ugnot -gas-wanted 6000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" stdout 'Total supply..: 12345678' stdout 'Known accounts..: 1' -stdout 'OK!' # XXX: use test2 instead (depends on https://github.com/gnolang/gno/issues/1269#issuecomment-1806386069) gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Deposit -send 12345678ugnot -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test test1 stdout 'OK!' -gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Render -gas-fee 1000000ugnot -gas-wanted 6000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" stdout 'Total supply..: 24691356' stdout 'Known accounts..: 1' # should be 2 once we can use test2 -stdout 'OK!' # XXX: replace hardcoded address with test3 gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Transfer -gas-fee 1000000ugnot -gas-wanted 100000000 -args 'g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq' -args '10000000' -broadcast -chainid=tendermint_test test1 stdout 'OK!' -gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Render -gas-fee 1000000ugnot -gas-wanted 6000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" stdout 'Total supply..: 24691356' stdout 'Known accounts..: 2' # should be 3 once we can use test2 -stdout 'OK!' # XXX: use test3 instead (depends on https://github.com/gnolang/gno/issues/1269#issuecomment-1806386069) gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Withdraw -args 10000000 -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test test1 stdout 'OK!' -gnokey maketx call -pkgpath gno.land/r/demo/wugnot -func Render -gas-fee 1000000ugnot -gas-wanted 100000000 -args '' -broadcast -chainid=tendermint_test test1 +gnokey query vm/qrender --data "gno.land/r/demo/wugnot:" stdout 'Total supply..: 14691356' stdout 'Known accounts..: 2' # should be 3 once we can use test2 -stdout 'OK!' From 3f1b72bf2fa9f2ca85d55e05258044c7e573f850 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:39:50 +0200 Subject: [PATCH 3/8] fix(txtar): assert origin call --- .../testdata/assertorigincall.txtar | 57 +++++++++++++++---- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/gno.land/pkg/integration/testdata/assertorigincall.txtar b/gno.land/pkg/integration/testdata/assertorigincall.txtar index f6893bd5ca6..f75eabacb5b 100644 --- a/gno.land/pkg/integration/testdata/assertorigincall.txtar +++ b/gno.land/pkg/integration/testdata/assertorigincall.txtar @@ -29,6 +29,7 @@ loadpkg gno.land/r/myrlm $WORK/r/myrlm loadpkg gno.land/r/foo $WORK/r/foo loadpkg gno.land/p/demo/bar $WORK/p/demo/bar + gnoland start # The PANIC is expected to fail at the transaction simulation stage, which is why we set gas-wanted to 1. @@ -84,7 +85,7 @@ stdout 'OK!' stderr 'invalid non-origin call' ## 13. MsgRun -> run.main -> foo.A: PANIC -! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 10_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno +! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 15_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/fooA.gno stderr 'invalid non-origin call' ## 14. MsgRun -> run.main -> foo.B: PASS @@ -92,11 +93,11 @@ gnokey maketx run -gas-fee 100000ugnot -gas-wanted 10_000_000 -broadcast -chaini stdout 'OK!' ## 15. MsgRun -> run.main -> foo.C: PANIC -! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 10_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/fooC.gno +! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 15_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/fooC.gno stderr 'invalid non-origin call' ## 16. MsgRun -> run.main -> bar.A: PANIC -! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 10_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno +! gnokey maketx run -gas-fee 100000ugnot -gas-wanted 15_000_000 -broadcast -chainid tendermint_test test1 $WORK/run/barA.gno stderr 'invalid non-origin call' ## 17. MsgRun -> run.main -> bar.B: PASS @@ -123,16 +124,22 @@ package myrlm import "std" func A() { + crossing() + C() } func B() { + crossing() + if false { C() } } func C() { + crossing() + std.AssertOriginCall() } -- r/foo/foo.gno -- @@ -141,15 +148,21 @@ package foo import "gno.land/r/myrlm" func A() { - myrlm.A() + crossing() + + cross(myrlm.A)() } func B() { - myrlm.B() + crossing() + + cross(myrlm.B)() } func C() { - myrlm.C() + crossing() + + cross(myrlm.C)() } -- p/demo/bar/bar.gno -- package bar @@ -174,7 +187,9 @@ package main import myrlm "gno.land/r/myrlm" func main() { - myrlm.A() + crossing() + + cross(myrlm.A)() } -- run/myrlmB.gno -- package main @@ -182,7 +197,9 @@ package main import "gno.land/r/myrlm" func main() { - myrlm.B() + crossing() + + cross(myrlm.B)() } -- run/myrlmC.gno -- package main @@ -190,7 +207,9 @@ package main import "gno.land/r/myrlm" func main() { - myrlm.C() + crossing() + + cross(myrlm.C)() } -- run/fooA.gno -- package main @@ -198,7 +217,9 @@ package main import "gno.land/r/foo" func main() { - foo.A() + crossing() + + cross(foo.A)() } -- run/fooB.gno -- package main @@ -206,7 +227,9 @@ package main import "gno.land/r/foo" func main() { - foo.B() + crossing() + + cross(foo.B)() } -- run/fooC.gno -- package main @@ -214,7 +237,9 @@ package main import "gno.land/r/foo" func main() { - foo.C() + crossing() + + cross(foo.C)() } -- run/barA.gno -- package main @@ -222,6 +247,8 @@ package main import "gno.land/p/demo/bar" func main() { + crossing() + bar.A() } -- run/barB.gno -- @@ -230,6 +257,8 @@ package main import "gno.land/p/demo/bar" func main() { + crossing() + bar.B() } -- run/barC.gno -- @@ -238,6 +267,8 @@ package main import "gno.land/p/demo/bar" func main() { + crossing() + bar.C() } -- run/baz.gno -- @@ -246,5 +277,7 @@ package main import "std" func main() { + crossing() + std.AssertOriginCall() } From 5832c3313766f37257d854154ba30c28cdd91343 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:41:57 +0200 Subject: [PATCH 4/8] fix(txtar): loadpkg_work --- gno.land/pkg/integration/testdata/loadpkg_work.txtar | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gno.land/pkg/integration/testdata/loadpkg_work.txtar b/gno.land/pkg/integration/testdata/loadpkg_work.txtar index e789c171dc2..c23b8fc920b 100644 --- a/gno.land/pkg/integration/testdata/loadpkg_work.txtar +++ b/gno.land/pkg/integration/testdata/loadpkg_work.txtar @@ -27,5 +27,7 @@ package main import "gno.land/r/foobar/bar" func main() { + crossing() + println("main: ---", bar.Render(""), "---") } From 239e7b7343bee1d21daff545c2f50092e8a22820 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:44:14 +0200 Subject: [PATCH 5/8] fix(txtar): realm call --- gno.land/pkg/integration/testdata/issue_gnochess_97.txtar | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gno.land/pkg/integration/testdata/issue_gnochess_97.txtar b/gno.land/pkg/integration/testdata/issue_gnochess_97.txtar index 89406d328d4..868e3b07536 100644 --- a/gno.land/pkg/integration/testdata/issue_gnochess_97.txtar +++ b/gno.land/pkg/integration/testdata/issue_gnochess_97.txtar @@ -31,10 +31,14 @@ func NewS() S { var s S func RealmCall1() { + crossing() + s = NewS() } func RealmCall2() { + crossing() + arr2 := s.Arr arr2[0] = 8 s = S{Arr: arr2} From 0a44fc987a0edb2082c22d6ac313c634f362546f Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:57:11 +0200 Subject: [PATCH 6/8] fix(txtar): issue 1543, issue 1786, issue 2266 --- gno.land/pkg/integration/testdata/issue_1543.txtar | 11 ++++++----- gno.land/pkg/integration/testdata/issue_1786.txtar | 6 ++++-- gno.land/pkg/integration/testdata/issue_2266.txtar | 9 ++++++--- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/gno.land/pkg/integration/testdata/issue_1543.txtar b/gno.land/pkg/integration/testdata/issue_1543.txtar index 388f126fcda..90de76e6bd8 100644 --- a/gno.land/pkg/integration/testdata/issue_1543.txtar +++ b/gno.land/pkg/integration/testdata/issue_1543.txtar @@ -1,16 +1,14 @@ -# test issue +# test issue loadpkg gno.land/r/demo/realm $WORK # start a new node gnoland start - gnokey maketx call -pkgpath gno.land/r/demo/realm --func Fill --args 0 --gas-fee 1000000ugnot --gas-wanted 2000000 --broadcast -chainid=tendermint_test test1 gnokey maketx call -pkgpath gno.land/r/demo/realm --func UnFill --args 0 --gas-fee 1000000ugnot --gas-wanted 2000000 --broadcast -chainid=tendermint_test test1 gnokey maketx call -pkgpath gno.land/r/demo/realm --func Fill --args 0 --gas-fee 1000000ugnot --gas-wanted 2000000 --broadcast -chainid=tendermint_test test1 - -- realm.gno -- package main @@ -28,7 +26,9 @@ var ( ) func Fill(i int) { - c := B{ + crossing() + + c := B{ A: a, B: "", } @@ -36,6 +36,7 @@ func Fill(i int) { } func UnFill(i int) { + crossing() + b[i] = nil } - diff --git a/gno.land/pkg/integration/testdata/issue_1786.txtar b/gno.land/pkg/integration/testdata/issue_1786.txtar index 2aa33f6a6be..08b28a17da6 100644 --- a/gno.land/pkg/integration/testdata/issue_1786.txtar +++ b/gno.land/pkg/integration/testdata/issue_1786.txtar @@ -64,13 +64,15 @@ func ProxyWrap() { wugnotAddr := std.DerivePkgAddr("gno.land/r/demo/wugnot") banker := std.NewBanker(std.BankerTypeRealmSend) banker.SendCoins(std.CurrentRealm().Address(), wugnotAddr, std.Coins{{"ugnot", int64(ugnotSent)}}) - wugnot.Deposit() // `proxywugnot` has ugnot + cross(wugnot.Deposit)() // `proxywugnot` has ugnot // SEND WUGNOT: PROXY_WUGNOT -> USER - wugnot.Transfer(std.OriginCaller(), ugnotSent) + cross(wugnot.Transfer)(std.OriginCaller(), ugnotSent) } func ProxyUnwrap(wugnotAmount uint64) { + crossing() + if wugnotAmount == 0 { return } diff --git a/gno.land/pkg/integration/testdata/issue_2266.txtar b/gno.land/pkg/integration/testdata/issue_2266.txtar index 046f57802e3..6da89c52f6e 100644 --- a/gno.land/pkg/integration/testdata/issue_2266.txtar +++ b/gno.land/pkg/integration/testdata/issue_2266.txtar @@ -1,4 +1,4 @@ -# test issue +# test issue loadpkg gno.land/r/demo/realm $WORK @@ -28,7 +28,9 @@ var ( ) func Fill(i int) { - c := B{ + crossing() + + c := B{ A: a, B: "", } @@ -36,7 +38,8 @@ func Fill(i int) { } func UnFill() { + crossing() + b[0] = nil b[1] = nil } - From f663354f1261f0655e8e4dfdf28d9eb1ea42d86d Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:04:14 +0200 Subject: [PATCH 7/8] fix(txtar): sysparams --- .../testdata/params_sysparams1.txtar | 5 +- .../testdata/params_sysparams2.txtar | 46 +++++++++++++++---- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/gno.land/pkg/integration/testdata/params_sysparams1.txtar b/gno.land/pkg/integration/testdata/params_sysparams1.txtar index 6800cf18ccb..ffb54b345c4 100644 --- a/gno.land/pkg/integration/testdata/params_sysparams1.txtar +++ b/gno.land/pkg/integration/testdata/params_sysparams1.txtar @@ -37,4 +37,7 @@ import ( ) // This should succeed if it is called from gno.land/r/sys/params -func SetLockTransfer(denom string) { params.SetSysParamStrings("bank","p", "restricted_denoms", []string{denom}) } +func SetLockTransfer(denom string) { + crossing() + params.SetSysParamStrings("bank","p", "restricted_denoms", []string{denom}) +} diff --git a/gno.land/pkg/integration/testdata/params_sysparams2.txtar b/gno.land/pkg/integration/testdata/params_sysparams2.txtar index 054c2c5e5d3..156000a0f47 100644 --- a/gno.land/pkg/integration/testdata/params_sysparams2.txtar +++ b/gno.land/pkg/integration/testdata/params_sysparams2.txtar @@ -77,21 +77,49 @@ import ( ) // This should succeed if it is called from gno.land/r/sys/params -func SetLockTransfer(denom string) { params.SetSysParamStrings("bank","p", "restricted_denoms", []string{denom}) } +func SetLockTransfer(denom string) { + crossing() + params.SetSysParamStrings("bank","p", "restricted_denoms", []string{denom}) +} // # XXX test setting the wrong type, like SetSysParamString() instead of Strings(), and make it error for special case of "p". // # func SetLockTransfer(denom string) { params.SetSysParamString("bank","p", "restricted_denoms", denom) } // This should fail because the parameter does not exist -func SetBankArbitrary(value string) { params.SetSysParamString("bank","p", "newkey", value) } +func SetBankArbitrary(value string) { + crossing() + params.SetSysParamString("bank","p", "newkey", value) +} // SetSysParamXXX must be called from gno.land/r/sys/params; otherwise it panics // This should fail because the key "bank:restricted_denoms" is not valid -func SetInvalidKey(denom string) { params.SetSysParamString("bank", "p", "bank:restricted_denoms", "ugnot") } - -func SetSysParamString(s string) { params.SetSysParamString("bank","p", "foo", s) } -func SetSysParamBool(b bool) { params.SetSysParamBool("bank","p", "bar", b) } -func SetSysParamInt64(i int64) { params.SetSysParamInt64("bank","p", "baz", i) } -func SetSysParamUint64(u uint64) { params.SetSysParamUint64("bank","p", "baz", u) } -func SetSysParamBytes() { params.SetSysParamBytes("bank","p", "baz", []byte{255,255}) } +func SetInvalidKey(denom string) { + crossing() + params.SetSysParamString("bank", "p", "bank:restricted_denoms", "ugnot") +} + +func SetSysParamString(s string) { + crossing() + params.SetSysParamString("bank","p", "foo", s) +} + +func SetSysParamBool(b bool) { + crossing() + params.SetSysParamBool("bank","p", "bar", b) +} + +func SetSysParamInt64(i int64) { + crossing() + params.SetSysParamInt64("bank","p", "baz", i) +} + +func SetSysParamUint64(u uint64) { + crossing() + params.SetSysParamUint64("bank","p", "baz", u) +} + +func SetSysParamBytes() { + crossing() + params.SetSysParamBytes("bank","p", "baz", []byte{255,255}) +} From d0698ecda9592cbb1e95837b790162231a233a25 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:10:05 +0200 Subject: [PATCH 8/8] fix(txtar): realm_banker_issued_coin_denom --- .../testdata/realm_banker_issued_coin_denom.txtar | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar b/gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar index 26f643bd420..34aa84c8187 100644 --- a/gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar +++ b/gno.land/pkg/integration/testdata/realm_banker_issued_coin_denom.txtar @@ -79,11 +79,15 @@ import ( ) func Mint(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.IssueCoin(addr, std.CurrentRealm().CoinDenom(denom), amount) } func Burn(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.RemoveCoin(addr, std.CurrentRealm().CoinDenom(denom), amount) } @@ -97,11 +101,15 @@ import ( ) func Mint(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.IssueCoin(addr, std.CurrentRealm().CoinDenom(denom), amount) } func Burn(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.RemoveCoin(addr, std.CurrentRealm().CoinDenom(denom), amount) } @@ -114,11 +122,15 @@ import ( ) func Mint(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.IssueCoin(addr, denom, amount) } func Burn(addr std.Address, denom string, amount int64) { + crossing() + banker := std.NewBanker(std.BankerTypeRealmIssue) banker.RemoveCoin(addr, denom, amount) }