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
The oracle get data from panacea by GetStoreData that verify queried data with merkle proof.
GetStoreData use VerifyMembership function used by cosmos/ibc-go.
In VerifiyMemebership, the MerklePath use url path unescaping like below:
// GetKey will return a byte representation of the key
// after URL escaping the key element
func (mp MerklePath) GetKey(i uint64) ([]byte, error) {
if i >= uint64(len(mp.KeyPath)) {
return nil, fmt.Errorf("index out of range. %d (index) >= %d (len)", i, len(mp.KeyPath))
}
key, err := url.PathUnescape(mp.KeyPath[i])
if err != nil {
return nil, err
}
return []byte(key), nil
}
Path unescaping is that converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any % is not followed by two hexadecimal digits.
Therefore, if we simply do string(key) when creating MerklePath like now, char % can be included in the string, and errors may occur.
To solve this, we can use PathEscape that does inverse transformation of PathUnescape.
The text was updated successfully, but these errors were encountered:
The oracle get data from panacea by
GetStoreData
that verify queried data with merkle proof.GetStoreData
useVerifyMembership
function used bycosmos/ibc-go
.In
VerifiyMemebership
, theMerklePath
use url path unescaping like below:Path unescaping is that converting each 3-byte encoded substring of the form "%AB" into the hex-decoded byte 0xAB. It returns an error if any
%
is not followed by two hexadecimal digits.Therefore, if we simply do
string(key)
when creatingMerklePath
like now, char%
can be included in the string, and errors may occur.To solve this, we can use
PathEscape
that does inverse transformation ofPathUnescape
.The text was updated successfully, but these errors were encountered: