Skip to content

Commit

Permalink
chore: fixup (tmp)
Browse files Browse the repository at this point in the history
Signed-off-by: moul <[email protected]>
  • Loading branch information
moul committed Oct 11, 2024
1 parent 8b6acde commit 4c04221
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
11 changes: 8 additions & 3 deletions gno.land/cmd/gnoland/testdata/params.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

gnoland start

# XXX: create a non-sys package that should fail
# XXX: create a non-sys package that should fail?

gnokey maketx addpkg -pkgdir $WORK/setter -pkgpath gno.land/r/sys/setter -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test test1

gnokey query params/vm/gno.land/r/sys/setter.foo.string
stdout ''
stdout 'data: $'

gnokey maketx call -pkgpath gno.land/r/sys/setter -func SetFoo -args foo1 -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1

gnokey query params/vm/gno.land/r/sys/setter.foo.string
#stdout ''
stdout 'data: "foo1"'

gnokey maketx call -pkgpath gno.land/r/sys/setter -func SetFoo -args foo2 -gas-fee 1000000ugnot -gas-wanted 10000000 -broadcast -chainid=tendermint_test test1

gnokey query params/vm/gno.land/r/sys/setter.foo.string
stdout 'data: "foo2"'

-- setter/setter.gno --
package setter
Expand Down
2 changes: 1 addition & 1 deletion gno.land/pkg/sdk/vm/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func NewSDKParams(vmk *VMKeeper, ctx sdk.Context) *SDKParams {

func (prm *SDKParams) SetString(key, value string) {
// if !prm.vmk.prmk.Has(prm.ctx, key) {
if !prm.vmk.prmk.HasTypeKey(key) {
if !prm.vmk.prmk.HasTypeKey(key) { // XXX: bad workaround, maybe we should have a dedicated "dynamic keeper" allowing to create keys on the go?
prm.vmk.prmk.RegisterType(params.NewParamSetPair(key, "", validateNoOp))
}
prm.vmk.prmk.Set(prm.ctx, key, value)
Expand Down
12 changes: 3 additions & 9 deletions tm2/pkg/sdk/params/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,16 @@ func (bh paramsHandler) Query(ctx sdk.Context, req abci.RequestQuery) (res abci.
func (bh paramsHandler) queryParam(ctx sdk.Context, req abci.RequestQuery) (res abci.ResponseQuery) {

Check warning on line 42 in tm2/pkg/sdk/params/handler.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/sdk/params/handler.go#L42

Added line #L42 was not covered by tests
// parse key from path.
key := thirdPartWithSlashes(req.Path)
println("@@@@@@@@@@@@@@@@@@", key)
if key == "" {
res = sdk.ABCIResponseQueryFromError(
std.ErrUnknownRequest("param key is empty"))

Check warning on line 47 in tm2/pkg/sdk/params/handler.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/sdk/params/handler.go#L44-L47

Added lines #L44 - L47 were not covered by tests
}

// XXX: validate
// XXX: validate?

/*
// var out interface{}
var out string
bh.params.GetIfExists(ctx, key, &out)
println("OUT")
println(out)
*/
val := bh.params.GetRaw(ctx, key)

Check warning on line 52 in tm2/pkg/sdk/params/handler.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/sdk/params/handler.go#L52

Added line #L52 was not covered by tests

res.Data = val
return

Check warning on line 55 in tm2/pkg/sdk/params/handler.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/sdk/params/handler.go#L54-L55

Added lines #L54 - L55 were not covered by tests
}

Expand Down

0 comments on commit 4c04221

Please sign in to comment.