Skip to content

feat(gnovm): interrealm spec; cross/crossing; readonly; defer/recover/panic fixes; blank identifier fixes.... #4060

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 61 commits into from
Apr 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
8f2adb2
added Readonly...
jaekwon Mar 27, 2025
222122c
...
jaekwon Mar 27, 2025
e4d39cd
Readonly is a property of TypedValue, rather than ReadonlyValue wrapper
jaekwon Mar 28, 2025
b59c858
fix tests
jaekwon Mar 28, 2025
e93bbd3
Machine.IsReadonly() also checks realm mismatch
jaekwon Mar 30, 2025
663bfc3
nil interface is undefined
jaekwon Mar 31, 2025
8f932fe
fix IsReadonly to use IsImmutable; half of convert check done
jaekwon Mar 31, 2025
a007c95
enable second opconvert check
jaekwon Mar 31, 2025
a7abc9d
...
jaekwon Mar 31, 2025
84e34c7
...
jaekwon Mar 31, 2025
7e99a91
first commit of interrealm_withswitch
jaekwon Apr 1, 2025
489cc84
fix zrealm_crossrealm11.gno test
jaekwon Apr 2, 2025
75a4625
intermediate
jaekwon Apr 2, 2025
d8db4b3
fix tests...
jaekwon Apr 3, 2025
e0459b9
fix gnovm tests
jaekwon Apr 3, 2025
dd30de5
...
jaekwon Apr 3, 2025
e7d65cb
heapitems_for_3693
jaekwon Apr 5, 2025
f182d38
update tests
jaekwon Apr 5, 2025
6b8b41d
fix heap return issues
jaekwon Apr 5, 2025
c1d3652
...
jaekwon Apr 5, 2025
afe5578
cleanup and fixes
jaekwon Apr 7, 2025
44f0a0b
heap item all package vars
jaekwon Apr 7, 2025
872b6a5
update golden tests
jaekwon Apr 7, 2025
f026885
a funcvalue is an object; a func closure has no parent; find heap cap…
jaekwon Apr 8, 2025
b6dc789
update golden tests
jaekwon Apr 8, 2025
cdef2e3
fix one example test
jaekwon Apr 8, 2025
425b919
update golden tests
jaekwon Apr 8, 2025
636b7c3
fix script tests
jaekwon Apr 8, 2025
66213d4
add gno-memory-model
jaekwon Apr 9, 2025
95a06f4
replace IsUndefined(); remove defaultValue() for safety
jaekwon Apr 9, 2025
768cda4
Add interrealm spec
jaekwon Apr 9, 2025
d772663
add note on closures
jaekwon Apr 9, 2025
22506cd
update gno-interrealm.gno
jaekwon Apr 10, 2025
b2d0c97
replace callerat with current/previous realm()
jaekwon Apr 10, 2025
19c159e
borrrow realm -> switchrealm() test
jaekwon Apr 10, 2025
6b6ecee
borrow test; fix tests
jaekwon Apr 10, 2025
fff210b
fix #4019
jaekwon Apr 10, 2025
d9f5925
fix stdlibs/std tests
jaekwon Apr 11, 2025
af10d50
Create exploit.gno
piux2 Apr 11, 2025
274e397
Create realm_exploiter.gno
piux2 Apr 11, 2025
b912d9f
fix blank identifier multiple name valuedecl bug; make faux blocks mo…
jaekwon Apr 11, 2025
e7d85ba
fix realm exploiter test
jaekwon Apr 11, 2025
96c3524
docs: update EOA sections in realms.md
moul Apr 11, 2025
16a37b4
Create defer1.gno
piux2 Apr 11, 2025
328d282
Create recover1.gno
piux2 Apr 11, 2025
c1be915
more recover tests
piux2 Apr 11, 2025
85b0a93
chore(examples): update one example for new interrealm spec
moul Apr 11, 2025
bc6954b
negtive test, cannot capture name in type assert
ltzmaxwell Apr 12, 2025
86d998a
switchrealm -> crossing; withswitch -> cross
jaekwon Apr 12, 2025
9b02f1f
...
jaekwon Apr 12, 2025
2c18fae
add simple return & capture tests
ltzmaxwell Apr 12, 2025
f799a24
Merge commit 'refs/pull/4060/head' of github.com:gnolang/gno into pr-…
ltzmaxwell Apr 12, 2025
452c5a8
add no borrow
ltzmaxwell Apr 14, 2025
0a79c98
Merge branch 'master' into interrealm
moul Apr 17, 2025
8dc7d83
Merge remote-tracking branch 'origin/interrealm' into heapitems_for_3693
moul Apr 18, 2025
25bf34c
chore: update missing generated tests
moul Apr 18, 2025
63134d3
chore: regenerate + fmt
moul Apr 18, 2025
e2d6eb9
fill pointer with heap item base
jaekwon Apr 19, 2025
385720b
fix copy issues; fix blank identifier regression; return after Panic(…
jaekwon Apr 19, 2025
6d241bd
fix RunFiles DidUpdate for heap item
ltzmaxwell Apr 19, 2025
6fa2f69
fix(gnovm): various defer/recover/panic issues (#4188)
jaekwon Apr 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gnovm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ This enables non-web3 developers to contribute without requiring an understandin
Install [`gno`](./cmd/gno) and refer to the [`examples`](../examples) folder to start developing contracts.

Check the [Makefile](./Makefile) to enhance GnoVM, Gnolang, and stdlibs.

## Known Issues

* Switch varnames cannot be captured as heap items. [test](../gnovm/tests/files/closure11_known.gno)
7 changes: 7 additions & 0 deletions gnovm/pkg/gnolang/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ func TestFiles(t *testing.T) {
})
return nil
}
isKnown := strings.HasSuffix(path, "_known.gno")
if isKnown {
t.Run(subTestName, func(t *testing.T) {
t.Skip("skipping known issue")
})
return nil
}

content, err := fs.ReadFile(fsys, path)
if err != nil {
Expand Down
22 changes: 13 additions & 9 deletions gnovm/pkg/gnolang/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,7 @@

// Returns a slice of n values in the stack and decrements NumValues.
// NOTE: The results are on the values stack, so they must be copied or used
// immediately. If you need to use the machine before or during usage,
// immediately. If you need to use the machine before or during usage,
// consider using PopCopyValues().
// NOTE: the values are in stack order, oldest first, the opposite order of
// multiple pop calls. This is used for params assignment, for example.
Expand All @@ -1686,12 +1686,13 @@
return m.Values[m.NumValues : m.NumValues+n]
}

// Like PopValues(), but copies the values onto a new slice.
func (m *Machine) PopCopyValues(n int) []TypedValue {
res := make([]TypedValue, n)
// Like PopValues(), but copies the values onto given slice.
func (m *Machine) PopCopyValues(res []TypedValue) {
n := len(res)
ptvs := m.PopValues(n)
copy(res, ptvs)
return res
for i := 0; i < n; i++ {
res[i] = ptvs[i].Copy(m.Alloc)
}
}

// Decrements NumValues by number of last results.
Expand Down Expand Up @@ -2074,7 +2075,7 @@
// Returns ro = true if the base is readonly,
// or if the base's storage realm != m.Realm and both are non-nil,
// and the lx isn't a name (base is a block),
// and the lx isn't a composit lit expr.

Check failure on line 2078 in gnovm/pkg/gnolang/machine.go

View workflow job for this annotation

GitHub Actions / Run GnoVM suite / Go Lint / lint

`composit` is a misspelling of `compost` (misspell)
func (m *Machine) PopAsPointer2(lx Expr) (pv PointerValue, ro bool) {
switch lx := lx.(type) {
case *NameExpr:
Expand Down Expand Up @@ -2152,6 +2153,8 @@
}
}

// This function does not go-panic:
// caller must return manually.
func (m *Machine) Panic(ex TypedValue) {
m.Exceptions = append(
m.Exceptions,
Expand Down Expand Up @@ -2186,9 +2189,10 @@
// If the frame the exception occurred in is not popped, it's possible that
// the exception is still in scope and can be recovered.
if !exception.Frame.Popped {
// If the frame is not the current frame, the exception is not in scope; return nil.
// This retrieves the second most recent call frame because the first most recent
// is the call to recover itself.
// If the frame is not the current frame, the exception is not
// in scope; return nil. This retrieves the second most recent
// call frame because the first most recent is the call to
// recover itself.
if frame := m.PeekCallFrame(2); frame == nil || frame != exception.Frame {
return nil
}
Expand Down
Loading
Loading