From d80281b7fb24d0041536d1f17c579d675509a0e6 Mon Sep 17 00:00:00 2001 From: adu Date: Fri, 13 Dec 2024 17:07:31 +0800 Subject: [PATCH] check conversion safety --- precompiles/assets/query.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/precompiles/assets/query.go b/precompiles/assets/query.go index 5d3903ba..97a27d7b 100644 --- a/precompiles/assets/query.go +++ b/precompiles/assets/query.go @@ -2,6 +2,7 @@ package assets import ( "errors" + "math" assetstype "github.com/ExocoreNetwork/exocore/x/assets/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -101,6 +102,9 @@ func (p Precompile) GetTokenInfo( if err != nil { return nil, err } + if tokenInfo.AssetBasicInfo.Decimals > math.MaxUint8 { + return nil, errors.New("decimals exceed max uint8") + } // Pack the values into the struct result := TokenInfo{