Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

common.gno

0.62 Kb · 19 lines
 1// Package issue5736_common is a regression fixture for
 2// https://github.com/gnolang/gno/issues/5736.
 3//
 4// It mimics the gnoswap pattern that surfaced the bug: a non-crossing
 5// helper in an /r/ realm that performs in-place uint256 arithmetic on
 6// a value handed in from another /r/ realm. Before the fix to
 7// {Array,Struct}Value.Copy, this triggered:
 8//
 9//	panic: cannot directly modify readonly tainted object
10//	  gno.land/p/onbloc/uint256/bitwise.gno (z.arr[0] = z.arr[0] << n)
11package issue5736_common
12
13import (
14	u256 "gno.land/p/onbloc/uint256"
15)
16
17func DoLsh(x *u256.Uint, n uint) *u256.Uint {
18	return u256.Zero().Lsh(x, n)
19}