Skip to content

Commit 6c4d89b

Browse files
committed
fixup
1 parent 98ae8d9 commit 6c4d89b

3 files changed

Lines changed: 15 additions & 33 deletions

File tree

gno.land/pkg/integration/testdata/append_string.txtar

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ gnoland start
55
! gnokey maketx call -pkgpath gno.land/r/append -func Doappend -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
66

77
stdout 'TX HASH:'
8-
stderr 'Data: panic running expression main(): allocation limit exceeded'
8+
stderr 'Data: allocation limit exceeded'
9+
10+
! gnokey maketx call -pkgpath gno.land/r/append -func Doappend2 -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1
11+
12+
stdout 'TX HASH:'
13+
stderr 'Data: allocation limit exceeded'
914

1015

1116
-- append.gno --
@@ -17,4 +22,12 @@ func Doappend(_ realm) {
1722
// bypass alloc.maxBytes ("allocation limit exceeded") //
1823
hugeString += string(make([]byte, 150_000_000))
1924
}
25+
}
26+
27+
func Doappend2(_ realm) {
28+
var hugeString string
29+
for i := 0; ; i++ {
30+
// bypass alloc.maxBytes ("allocation limit exceeded") //
31+
hugeString += string(make([]byte, 100_000_000))
32+
}
2033
}

gno.land/pkg/integration/testdata/append_string2.txtar

Lines changed: 0 additions & 20 deletions
This file was deleted.

gnovm/pkg/gnolang/values_string.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -270,20 +270,9 @@ func (b *Block) StringIndented(indent string) string {
270270
lines = append(lines,
271271
fmt.Sprintf("%s%s: undefined static:%s", indent, n, types[i]))
272272
} else {
273-
maxLength := 1 * 1024 * 1024
274-
275-
var valueStr string
276-
277-
// Only compute .String() if we know we'll use it
278-
if len(b.Values[i].String()) > maxLength {
279-
valueStr = b.Values[i].String()[:10] + "...[truncated]"
280-
} else {
281-
valueStr = b.Values[i].String()
282-
}
283-
284273
lines = append(lines,
285274
fmt.Sprintf("%s%s: %s static:%s",
286-
indent, n, valueStr, types[i]))
275+
indent, n, b.Values[i].String(), types[i]))
287276
}
288277
}
289278
}

0 commit comments

Comments
 (0)