Skip to content
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

WIP fix(gnovm): PoC of inter-realm spec #2958

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

ltzmaxwell
Copy link
Contributor

@ltzmaxwell ltzmaxwell commented Oct 16, 2024

WIP: adding filetest for inter-realm spec, NOT FINAL.
relate: #2743

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests

@github-actions github-actions bot added 🧾 package/realm Tag used for new Realms or Packages. 📦 🤖 gnovm Issues or PRs gnovm related labels Oct 16, 2024
Copy link

codecov bot commented Oct 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.30%. Comparing base (aae5d49) to head (a604cdc).
Report is 92 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2958      +/-   ##
==========================================
+ Coverage   60.23%   60.30%   +0.07%     
==========================================
  Files         562      562              
  Lines       75091    75286     +195     
==========================================
+ Hits        45228    45399     +171     
- Misses      26482    26505      +23     
- Partials     3381     3382       +1     
Flag Coverage Δ
contribs/gnodev 61.46% <ø> (+0.06%) ⬆️
contribs/gnofaucet 14.46% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 20.23% <ø> (ø)
tm2 62.06% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jefft0 jefft0 added review/triage-pending PRs opened by external contributors that are waiting for the 1st review and removed review/triage-pending PRs opened by external contributors that are waiting for the 1st review labels Oct 16, 2024
@jefft0
Copy link
Contributor

jefft0 commented Oct 17, 2024

(The "review team" label was added by mistake. This PR is opened by a core dev.)

@ltzmaxwell ltzmaxwell added the in focus Core team is prioritizing this work label Oct 19, 2024
@zivkovicmilos zivkovicmilos added this to the 🚀 Mainnet launch milestone Oct 28, 2024
@Kouteki Kouteki requested review from piux2 and removed request for mvertes and piux2 November 1, 2024 10:14
@moul
Copy link
Member

moul commented Nov 1, 2024

Check this too: #2526

@ltzmaxwell ltzmaxwell marked this pull request as draft November 18, 2024 03:00
@ltzmaxwell ltzmaxwell changed the title WIP fix(gnovm): add filetest for inter-realm spec WIP fix(gnovm): PoC of inter-realm spec Nov 26, 2024
Comment on lines +16 to +30
var b0 *crossrealm.Bar

func init() {
b0 = &crossrealm.Bar{A: 1}
}

func main() {
print(".")
}

// XXX, should work to attach by reference to
// type defined in another realm???

// Output:
// .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this right? &crossrealm.Bar{A: 1}(from external realm) is persisted in current realm as a heapItemValue: heapitem((struct{(1 int)} gno.land/r/demo/tests/crossrealm.Bar))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is right, from my interpretation. The pointer goes to a value in the other realm, but it is attached to r/demo/crossrealm, so it's ok?

Comment on lines +8 to +15
var b0 crossrealm.Bar // run declarations

func main() {
print(".")
}

// Error:
// should not happen while attempting to attach new real object from external realm
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forbid attach object by value with type defined in external-realm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This panic looks correct to me, because Bar is a struct so initialization would create a new value, which would be attached to crossrealm_test but it cannot.


func (foo) Foo() { println("hello " + std.CurrentRealm().PkgPath()) }

var fs []crossrealm.Fooer // panic
Copy link
Contributor Author

@ltzmaxwell ltzmaxwell Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should behave same with var f crossream.Fooer, because the underlying array is persistent in the current realm, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should not panic; at initialization, no crossrealm.Fooer is actually created (so it's all good), and then even on execution we can put in values of crossrealm.Fooer which are not attached to this realm, but instead ie. created by crossrealm - because it's an interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in focus Core team is prioritizing this work 📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: No status
Status: In Progress
Development

Successfully merging this pull request may close these issues.

5 participants