Skip to content

Commit 29fa699

Browse files
committed
test: add minimal test to demo amino.MustMarshalJSON panic
1 parent 3ea0715 commit 29fa699

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

gnovm/pkg/gnolang/values_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package gnolang
2+
3+
import (
4+
"math/big"
5+
"testing"
6+
7+
"github.com/gnolang/gno/tm2/pkg/amino"
8+
)
9+
10+
// This test exposes a panics that occurs when BigintValue is embedded
11+
// in an other struct.
12+
func TestAminoMustMarshalJSONPanics(t *testing.T) {
13+
bi := BigintValue{V: big.NewInt(20)}
14+
b := amino.MustMarshalJSON(bi) // works well
15+
println(string(b))
16+
17+
pv := PackageValue{
18+
Block: bi,
19+
}
20+
b = amino.MustMarshalJSON(pv) // panics
21+
println(string(b))
22+
}

gnovm/stdlibs/std/crypto.gno

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ func (a Address) String() string {
66
return string(a)
77
}
88

9-
const RawAddressSize = int(20)
9+
const RawAddressSize = 20
1010

1111
type RawAddress [RawAddressSize]byte

0 commit comments

Comments
 (0)