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

chore: add test to demonstrate PrevRealm var block bug #1079

Closed
wants to merge 3 commits into from

Conversation

n0izn0iz
Copy link
Contributor

This adds a test to demonstrate the PrevRealm bug in var block outlined in #941

  • 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
  • Added new benchmarks to generated graphs, if any. More info here.

Signed-off-by: Norman Meier <norman@berty.tech>
@n0izn0iz n0izn0iz requested a review from a team as a code owner August 29, 2023 14:51
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Aug 29, 2023

func TestVarPrevRealm(t *testing.T) {
if initRealm.Addr() != varRealm.Addr() {
t.Errorf("initRealm != varRealm")
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the issue and the PR, it would be nice if your test reports something like

Suggested change
t.Errorf("initRealm != varRealm")
t.Errorf("expect initRealm '%s' to be equal to varRealm '%s'", initRealm.Addr(), varRealm.Addr() )

Same for following t.Errorf, thanks in advance!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Norman Meier <norman@berty.tech>
…broken

Signed-off-by: Norman Meier <norman@berty.tech>
@tbruyelle
Copy link
Contributor

tbruyelle commented Aug 29, 2023

I put some logs in std.PrevRealm and the issue is because then test.GetPrevRealm() is invoked inside var (), the frames doesn't contain gno.land/r/demo/bugs/var_prev_realm. It contains only a single frame, which is gno.land/r/demo/tests. Because of that, test.GetPrevReam() returns the user address.

I assume it's something that needs to be fixed in the gnovm, so probably a little tricky!

@moul
Copy link
Member

moul commented Sep 4, 2023

@tbruyelle do you think we can use the txtar stuff for storing known bugs in the repo somewhere?

@tbruyelle
Copy link
Contributor

@tbruyelle do you think we can use the txtar stuff for storing known bugs in the repo somewhere?

Ideally it should go to gnovm/tests/challenges but it's not possible since gno.land/r/demo/tests is required and isn't available for the challenges.

Else txtar can be used also, it just need a proper setup for this kind of bugs.

@n0izn0iz
Copy link
Contributor Author

n0izn0iz commented Sep 4, 2023

if other challenges realms are available I could add two realms in challenges

@tbruyelle
Copy link
Contributor

if other challenges realms are available I could add two realms in challenges

I'm not sure you can interact with more than one realm in the challenges, but maybe that's possible. The code is in gnovm/tests/file_test.go#TestChallenges if you want to have a look.

@n0izn0iz n0izn0iz marked this pull request as draft September 5, 2023 12:15
@moul moul added this to the 🚀 main.gno.land milestone Sep 6, 2023
@leohhhn
Copy link
Contributor

leohhhn commented Sep 17, 2024

closing as #941 has been resolved.

@leohhhn leohhhn closed this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: 🚀 Needed for Launch
Development

Successfully merging this pull request may close these issues.

4 participants