Skip to content

Commit

Permalink
Merge pull request #86 from xssnick/v14-1
Browse files Browse the repository at this point in the history
V14.1
  • Loading branch information
xssnick authored Oct 27, 2022
2 parents 556292c + 72353be commit b839942
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<img align="right" width="425px" src="https://github.com/xssnick/props/blob/master/logoimg.png?raw=true">

[![Based on TON][ton-svg]][ton]
![Coverage](https://img.shields.io/badge/Coverage-70.6%25-brightgreen)
![Coverage](https://img.shields.io/badge/Coverage-70.5%25-brightgreen)

Golang library for interacting with TON blockchain.

Expand Down
3 changes: 1 addition & 2 deletions ton/nft/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package nft

import (
"crypto/sha256"
"errors"
"fmt"

"github.com/xssnick/tonutils-go/tvm/cell"
Expand Down Expand Up @@ -36,7 +35,7 @@ func ContentFromCell(c *cell.Cell) (ContentAny, error) {
func ContentFromSlice(s *cell.Slice) (ContentAny, error) {
if s.BitsLeft() < 8 {
if s.RefsNum() == 0 {
return nil, errors.New("invalid content")
return &ContentOffchain{}, nil
}
s = s.MustLoadRef()
}
Expand Down
12 changes: 10 additions & 2 deletions tvm/cell/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ func (c *Slice) MustLoadBigUInt(sz uint) *big.Int {

func (c *Slice) LoadBigUInt(sz uint) (*big.Int, error) {
if sz > 256 {
return nil, ErrTooBigValue
return nil, ErrTooBigSize
}

return c.loadBigNumber(sz)
}

func (c *Slice) loadBigNumber(sz uint) (*big.Int, error) {
b, err := c.LoadSlice(sz)
if err != nil {
return nil, err
Expand All @@ -190,7 +194,11 @@ func (c *Slice) LoadBigUInt(sz uint) (*big.Int, error) {
}

func (c *Slice) LoadBigInt(sz uint) (*big.Int, error) {
u, err := c.LoadBigUInt(sz)
if sz > 257 {
return nil, ErrTooBigSize
}

u, err := c.loadBigNumber(sz)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit b839942

Please sign in to comment.