You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With pagination, there's a next_key value that is a byte array. The CLI outputs byte arrays as base64 encoded values.
However, the ReadPageRequest function converts the provided --page-key string to a byte array by casting it: []byte(pageKey). That means that if you copy a next_key from a result and provide it as the --page-key in a new request, you get unexpected result. The resulting key in the request wasn't base64 decoded, so it's pretty close to just a random value.
Version
1.3.0
More Details
Anywhere we are calling the ReadPageRequest function, we need to base64 decode the --page-key string first.
From cosmwasm:
// sdk ReadPageRequest expects binary but we encoded to base64 in our marshallerfuncwithPageKeyDecoded(flagSet*flag.FlagSet) *flag.FlagSet {
encoded, err:=flagSet.GetString(flags.FlagPageKey)
iferr!=nil {
panic(err.Error())
}
raw, err:=base64.StdEncoding.DecodeString(encoded)
iferr!=nil {
panic(err.Error())
}
flagSet.Set(flags.FlagPageKey, string(raw))
returnflagSet
}
We need to create a similar function for our CLI stuff to use. Then, wherever we call ReadPageRequest(cmd.Flags()) we would change that to ReadPageRequest(withPageKeyDecoded(cmd.Flags())).
Here's currently all the places that need updating.
Summary of Bug
With pagination, there's a
next_key
value that is a byte array. The CLI outputs byte arrays as base64 encoded values.However, the
ReadPageRequest
function converts the provided--page-key
string to a byte array by casting it:[]byte(pageKey)
. That means that if you copy anext_key
from a result and provide it as the--page-key
in a new request, you get unexpected result. The resultingkey
in the request wasn't base64 decoded, so it's pretty close to just a random value.Version
1.3.0
More Details
Anywhere we are calling the
ReadPageRequest
function, we need to base64 decode the--page-key
string first.From cosmwasm:
We need to create a similar function for our CLI stuff to use. Then, wherever we call
ReadPageRequest(cmd.Flags())
we would change that toReadPageRequest(withPageKeyDecoded(cmd.Flags()))
.Here's currently all the places that need updating.
For Admin Use
The text was updated successfully, but these errors were encountered: