Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
42f7e62
pass store for GetParamsN()
jaekwon Apr 20, 2025
ff958ec
...
jaekwon Apr 20, 2025
2ac599e
fix emit_test
jaekwon Apr 20, 2025
a4a58bd
temporarily comment out no. 53 debugger test
jaekwon Apr 20, 2025
b3fdfdf
SwitchRealm -> Crossing; switchrealm[] -> finalizerealm[]; minor gno.…
jaekwon Apr 21, 2025
d45cccb
switchrealm -> finalizerealm
jaekwon Apr 21, 2025
4c6ed5f
fill block values from PackageValue.GetBlock
jaekwon Apr 21, 2025
f668cff
fix some integration tests; correctly preprocess block nodes from Mac…
jaekwon Apr 21, 2025
02526dc
allow realm crossing from no realm
jaekwon Apr 21, 2025
cd05420
gno.land integration test fixes
jaekwon Apr 21, 2025
aecec89
remove fuzzer
jaekwon Apr 21, 2025
5c500ea
also init static blocks on inner block nodes from m.Eval
jaekwon Apr 21, 2025
1614062
fix(txtar): prevrealm
gfanton Apr 21, 2025
aa5943d
fix(txtar): addpkg_namespace
gfanton Apr 21, 2025
012e8fa
fix(txtar): append
gfanton Apr 21, 2025
069aebb
fix(txtar): event callback output
gfanton Apr 21, 2025
51e016b
improve comments
jaekwon Apr 21, 2025
8fe1c23
DerivePkgAddr -> DerivePkgCryptoAddr; DerivePkg*Addr returns the embe…
jaekwon Apr 21, 2025
778296d
cross -> _cross for a var name
jaekwon Apr 21, 2025
3ddafc3
some cross fixes for gno.land integration test
jaekwon Apr 21, 2025
e0fb75a
fix more integration tests by adding cross/crossing to examples
jaekwon Apr 21, 2025
8b73c94
more fixes for gno.land TestRoutes; realm/package init has pkgpath de…
jaekwon Apr 21, 2025
ac62b2a
m.Run() and .RunStatement() take an ExecKind
jaekwon Apr 21, 2025
205deeb
...
jaekwon Apr 21, 2025
3632133
ExecKind -> m.Stage
jaekwon Apr 21, 2025
fcc6e10
...
jaekwon Apr 21, 2025
7c1482b
fix(txtar): prevrealm - fix update
gfanton Apr 21, 2025
835df4d
fix(txtar): events msg/normal/stm, ghverify, gnokey gasfee/simulate
gfanton Apr 21, 2025
391a325
wip(txtar): grc20 registry
gfanton Apr 21, 2025
b0a34f2
fix(txtar): grc721 emit output
gfanton Apr 21, 2025
2e7f7c0
wip(txtar) initctx - init() frame not found using PrevRealm
gfanton Apr 21, 2025
fd8f19d
fix(txtar): issue_1167, issue_1588
gfanton Apr 21, 2025
2cac800
wip(txtar): issue 1786 wugnot - NEED UPDATE, cannot send transfer to …
gfanton Apr 21, 2025
b670c0a
fix(txtar): map delete
gfanton Apr 21, 2025
49c35ab
wip(txtar): moul authz - fixme - unauthorized proposer
gfanton Apr 21, 2025
08375c0
fix(txtar): panic
gfanton Apr 21, 2025
2376ac9
wip(txtar): params - fixme - missing module name in error format
gfanton Apr 21, 2025
5b5efe9
chore(ownable): rename CallerIsOwner -> OwnedByPrevious
gfanton Apr 21, 2025
b7a1676
fix(txtar): alloc, adduser, float, airgapped, grc721, import, improve…
gfanton Apr 21, 2025
9840d0c
wip(txtar): infinity loop - need qeval fixup
gfanton Apr 21, 2025
140787d
fix(txtar): map storage, patchpkg, ptr mapkey, restart, run, wugnot, …
gfanton Apr 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ coverage.out

*.swp
*.swo
*.swn
*.swm
*.bak

.tmp/
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/avl/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func main() {
// false 2

// Realm:
// switchrealm["gno.land/r/test"]
// finalizerealm["gno.land/r/test"]
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]=
// @@ -1,8 +1,8 @@
// {
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/avl/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func main() {
// false 3

// Realm:
// switchrealm["gno.land/r/test"]
// finalizerealm["gno.land/r/test"]
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:6]=
// @@ -1,7 +1,7 @@
// {
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/avl/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func main() {
// false 3

// Realm:
// switchrealm["gno.land/r/test"]
// finalizerealm["gno.land/r/test"]
// u[a8ada09dee16d791fd406d629fe29bb0ed084a30:7]=
// @@ -1,7 +1,7 @@
// {
Expand Down
8 changes: 4 additions & 4 deletions examples/gno.land/p/demo/entropy/entropy.gno
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ func (i *Instance) addEntropy() {

// handle callers
{
caller1 := std.CallerAt(1).String()
i.djb2String(caller1)
caller2 := std.CallerAt(2).String()
i.djb2String(caller2)
currentRealm := std.CurrentRealm().Address().String()
i.djb2String(currentRealm)
originCaller := std.OriginCaller().String()
i.djb2String(originCaller)
}

// height
Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/p/demo/memeland/memeland.gno
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (m *Memeland) RemovePost(id string) string {
panic("id cannot be empty")
}

if !m.CallerIsOwner() {
if !m.OwnedByPrevious() {
panic(ownable.ErrUnauthorized)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewAuthorizableWithAddress(addr std.Address) *Authorizable {
}

func (a *Authorizable) AddToAuthList(addr std.Address) error {
if !a.CallerIsOwner() {
if !a.OwnedByPrevious() {
return ErrNotSuperuser
}

Expand All @@ -55,7 +55,7 @@ func (a *Authorizable) AddToAuthList(addr std.Address) error {
}

func (a *Authorizable) DeleteFromAuthList(addr std.Address) error {
if !a.CallerIsOwner() {
if !a.OwnedByPrevious() {
return ErrNotSuperuser
}

Expand Down
14 changes: 7 additions & 7 deletions examples/gno.land/p/demo/ownable/ownable.gno
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Ownable struct {

func New() *Ownable {
return &Ownable{
owner: std.PreviousRealm().Address(),
owner: std.CurrentRealm().Address(),
}
}

Expand All @@ -25,7 +25,7 @@ func NewWithAddress(addr std.Address) *Ownable {

// TransferOwnership transfers ownership of the Ownable struct to a new address
func (o *Ownable) TransferOwnership(newOwner std.Address) error {
if !o.CallerIsOwner() {
if !o.OwnedByPrevious() {
return ErrUnauthorized
}

Expand All @@ -48,7 +48,7 @@ func (o *Ownable) TransferOwnership(newOwner std.Address) error {
// Top-level usage: disables all only-owner actions/functions,
// Embedded usage: behaves like a burn functionality, removing the owner from the struct
func (o *Ownable) DropOwnership() error {
if !o.CallerIsOwner() {
if !o.OwnedByPrevious() {
return ErrUnauthorized
}

Expand All @@ -72,16 +72,16 @@ func (o *Ownable) Owner() std.Address {
return o.owner
}

// CallerIsOwner checks if the caller of the function is the Realm's owner
func (o *Ownable) CallerIsOwner() bool {
// OwnedByPrevious( checks if the caller of the function is the Realm's owner
func (o *Ownable) OwnedByPrevious() bool {
if o == nil {
return false
}
return std.PreviousRealm().Address() == o.owner
}

// AssertCallerIsOwner panics if the caller is not the owner
func (o *Ownable) AssertCallerIsOwner() {
// AssertOwnedByPrevious panics if the caller is not the owner
func (o *Ownable) AssertOwnedByPrevious() {
if o == nil {
panic(ErrUnauthorized)
}
Expand Down
14 changes: 7 additions & 7 deletions examples/gno.land/p/demo/ownable/ownable_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func TestTransferOwnership(t *testing.T) {
uassert.Equal(t, got, bob)
}

func TestCallerIsOwner(t *testing.T) {
func TestOwnedByPrevious(t *testing.T) {
testing.SetRealm(std.NewUserRealm(alice))

o := New()
unauthorizedCaller := bob

testing.SetOriginCaller(unauthorizedCaller)

uassert.False(t, o.CallerIsOwner())
uassert.False(t, o.OwnedByPrevious())
}

func TestDropOwnership(t *testing.T) {
Expand Down Expand Up @@ -90,14 +90,14 @@ func TestErrInvalidAddress(t *testing.T) {
uassert.ErrorContains(t, err, ErrInvalidAddress.Error())
}

func TestAssertCallerIsOwner(t *testing.T) {
func TestAssertOwnedByPrevious(t *testing.T) {
testing.SetRealm(std.NewUserRealm(alice))
testing.SetOriginCaller(alice)

o := New()

// Should not panic when caller is owner
o.AssertCallerIsOwner()
o.AssertOwnedByPrevious()

// Should panic when caller is not owner
testing.SetRealm(std.NewUserRealm(bob))
Expand All @@ -112,7 +112,7 @@ func TestAssertCallerIsOwner(t *testing.T) {
t.Errorf("expected ErrUnauthorized but got %v", r)
}
}()
o.AssertCallerIsOwner()
o.AssertOwnedByPrevious()
}

func TestNilReceiver(t *testing.T) {
Expand All @@ -123,7 +123,7 @@ func TestNilReceiver(t *testing.T) {
t.Errorf("expected empty address but got %v", owner)
}

isOwner := o.CallerIsOwner()
isOwner := o.OwnedByPrevious()
uassert.False(t, isOwner)

defer func() {
Expand All @@ -135,5 +135,5 @@ func TestNilReceiver(t *testing.T) {
t.Errorf("expected ErrUnauthorized but got %v", r)
}
}()
o.AssertCallerIsOwner()
o.AssertOwnedByPrevious()
}
4 changes: 2 additions & 2 deletions examples/gno.land/p/demo/pausable/pausable.gno
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (p Pausable) IsPaused() bool {

// Pause sets the state of Pausable to true, meaning all pausable functions are paused
func (p *Pausable) Pause() error {
if !p.o.CallerIsOwner() {
if !p.o.OwnedByPrevious() {
return ownable.ErrUnauthorized
}

Expand All @@ -44,7 +44,7 @@ func (p *Pausable) Pause() error {

// Unpause sets the state of Pausable to false, meaning all pausable functions are resumed
func (p *Pausable) Unpause() error {
if !p.o.CallerIsOwner() {
if !p.o.OwnedByPrevious() {
return ownable.ErrUnauthorized
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (ls *LifetimeSubscription) HasValidSubscription(addr std.Address) error {

// UpdateAmount allows the owner of the LifetimeSubscription contract to update the subscription price.
func (ls *LifetimeSubscription) UpdateAmount(newAmount int64) error {
if !ls.CallerIsOwner() {
if !ls.OwnedByPrevious() {
return ErrNotAuthorized
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (rs *RecurringSubscription) GetExpiration(addr std.Address) (time.Time, err

// UpdateAmount allows the owner of the subscription contract to change the required subscription amount.
func (rs *RecurringSubscription) UpdateAmount(newAmount int64) error {
if !rs.CallerIsOwner() {
if !rs.OwnedByPrevious() {
return ErrNotAuthorized
}

Expand Down
10 changes: 5 additions & 5 deletions examples/gno.land/p/morgan/chess/engine.gno
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,10 @@ func (p Position) checkCastlingSetup(typ byte) bool {
fg, pfg = 7<<3, PieceBlack
}

// cross are the squares that the king starts from,
// _cross are the squares that the king starts from,
// crosses and "lands". they are recorded as they must all be
// not in check by any opponent piece.
var cross [3]Square
var _cross [3]Square

if typ == 'K' {
if !(b[fg|4] == pfg|PieceKing &&
Expand All @@ -569,7 +569,7 @@ func (p Position) checkCastlingSetup(typ byte) bool {
b[fg|7] == pfg|PieceRook) {
return false
}
cross = [3]Square{fg | 4, fg | 5, fg | 6}
_cross = [3]Square{fg | 4, fg | 5, fg | 6}
} else {
if !(b[fg|4] == pfg|PieceKing &&
b[fg|3] == PieceEmpty &&
Expand All @@ -578,11 +578,11 @@ func (p Position) checkCastlingSetup(typ byte) bool {
b[fg|0] == pfg|PieceRook) {
return false
}
cross = [3]Square{fg | 4, fg | 3, fg | 2}
_cross = [3]Square{fg | 4, fg | 3, fg | 2}
}

testb := p.B
for _, sq := range cross {
for _, sq := range _cross {
testb[sq] = pfg | PieceKing
if testb.InCheck(c) {
return false
Expand Down
8 changes: 4 additions & 4 deletions examples/gno.land/p/n2p5/mgroup/mgroup.gno
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func New(ownerAddress std.Address) *ManagedGroup {
// AddBackupOwner adds a backup owner to the group by std.Address.
// If the caller is not the owner, an error is returned.
func (g *ManagedGroup) AddBackupOwner(addr std.Address) error {
if !g.owner.CallerIsOwner() {
if !g.owner.OwnedByPrevious() {
return ownable.ErrUnauthorized
}
if !addr.IsValid() {
Expand All @@ -57,7 +57,7 @@ func (g *ManagedGroup) AddBackupOwner(addr std.Address) error {
// RemoveBackupOwner removes a backup owner from the group by std.Address.
// The owner cannot be removed. If the caller is not the owner, an error is returned.
func (g *ManagedGroup) RemoveBackupOwner(addr std.Address) error {
if !g.owner.CallerIsOwner() {
if !g.owner.OwnedByPrevious() {
return ownable.ErrUnauthorized
}
if !addr.IsValid() {
Expand Down Expand Up @@ -90,7 +90,7 @@ func (g *ManagedGroup) ClaimOwnership() error {
// AddMember adds a member to the group by std.Address.
// If the caller is not the owner, an error is returned.
func (g *ManagedGroup) AddMember(addr std.Address) error {
if !g.owner.CallerIsOwner() {
if !g.owner.OwnedByPrevious() {
return ownable.ErrUnauthorized
}
if !addr.IsValid() {
Expand All @@ -104,7 +104,7 @@ func (g *ManagedGroup) AddMember(addr std.Address) error {
// The owner cannot be removed. If the caller is not the owner,
// an error is returned.
func (g *ManagedGroup) RemoveMember(addr std.Address) error {
if !g.owner.CallerIsOwner() {
if !g.owner.OwnedByPrevious() {
return ownable.ErrUnauthorized
}
if !addr.IsValid() {
Expand Down
12 changes: 6 additions & 6 deletions examples/gno.land/p/oxtekgrinder/ownable2step/ownable.gno
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewWithAddress(addr std.Address) *Ownable2Step {

// TransferOwnership initiate the transfer of the ownership to a new address by setting the PendingOwner
func (o *Ownable2Step) TransferOwnership(newOwner std.Address) error {
if !o.CallerIsOwner() {
if !o.OwnedByPrevious() {
return ErrUnauthorized
}
if !newOwner.IsValid() {
Expand Down Expand Up @@ -59,7 +59,7 @@ func (o *Ownable2Step) AcceptOwnership() error {
// Top-level usage: disables all only-owner actions/functions,
// Embedded usage: behaves like a burn functionality, removing the owner from the struct
func (o *Ownable2Step) DropOwnership() error {
if !o.CallerIsOwner() {
if !o.OwnedByPrevious() {
return ErrUnauthorized
}

Expand All @@ -85,13 +85,13 @@ func (o *Ownable2Step) PendingOwner() std.Address {
return o.pendingOwner
}

// CallerIsOwner checks if the caller of the function is the Realm's owner
func (o *Ownable2Step) CallerIsOwner() bool {
// OwnedByPrevious( checks if the caller of the function is the Realm's owner
func (o *Ownable2Step) OwnedByPrevious() bool {
return std.PreviousRealm().Address() == o.owner
}

// AssertCallerIsOwner panics if the caller is not the owner
func (o *Ownable2Step) AssertCallerIsOwner() {
// AssertOwnedByPrevious panics if the caller is not the owner
func (o *Ownable2Step) AssertOwnedByPrevious() {
if std.PreviousRealm().Address() != o.owner {
panic(ErrUnauthorized)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ func TestTransferOwnership(t *testing.T) {
uassert.Equal(t, pendingOwner.String(), "")
}

func TestCallerIsOwner(t *testing.T) {
func TestOwnedByPrevious(t *testing.T) {
testing.SetOriginCaller(alice)

o := New()
unauthorizedCaller := bob

testing.SetOriginCaller(unauthorizedCaller)

uassert.False(t, o.CallerIsOwner())
uassert.False(t, o.OwnedByPrevious())
}

func TestDropOwnership(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions examples/gno.land/p/thox/accesscontrol/accesscontrol.gno
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (rs *Roles) CreateRole(name string) (*Role, error) {
return nil, ErrNameRole
}

if !rs.Ownable.CallerIsOwner() {
if !rs.Ownable.OwnedByPrevious() {
return nil, ErrNotOwner
}

Expand Down Expand Up @@ -104,7 +104,7 @@ func (rs *Roles) GrantRole(name string, account std.Address) error {
return ErrRoleNotFound
}

if !r.Ownable.CallerIsOwner() {
if !r.Ownable.OwnedByPrevious() {
return ErrNotOwner
}

Expand Down Expand Up @@ -135,7 +135,7 @@ func (rs *Roles) RevokeRole(name string, account std.Address) error {
return ErrRoleNotFound
}

if !r.Ownable.CallerIsOwner() {
if !r.Ownable.OwnedByPrevious() {
return ErrNotOwner
}

Expand Down
2 changes: 1 addition & 1 deletion examples/gno.land/r/agherasie/forms/forms.gno
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
var db *forms.FormDB

func init() {
hor.Register("Ahgerasle's forms", "")
cross(hor.Register)("Ahgerasle's forms", "")
db = forms.NewDB()
}

Expand Down
4 changes: 3 additions & 1 deletion examples/gno.land/r/demo/bar20/bar20.gno
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ var (
)

func init() {
grc20reg.Register(Token.Getter(), "")
cross(grc20reg.Register)(Token.Getter(), "")
}

func Faucet() string {
crossing()

caller := std.PreviousRealm().Address()
if err := adm.Mint(caller, 1_000_000); err != nil {
return "error: " + err.Error()
Expand Down
Loading
Loading