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

x/simulator: plan using not created key returns an error #883

Merged
merged 11 commits into from
May 29, 2024

Conversation

najeal
Copy link
Contributor

@najeal najeal commented May 4, 2024

Closes #861

@iFrostizz using a key that has not been created will fail except for key endpoint (endpoint for key creation)

@iFrostizz
Copy link
Collaborator

Hey @najeal , I think that it's a very reasonable fix, thank you very much!
Do you want to write a test that shows that the error is returned when not interacting with the key endpoint and that the key was not registered and it is not anymore after registering the key ?
If you don't want, I can too! As you want :)

@najeal
Copy link
Contributor Author

najeal commented May 16, 2024

Thank for your answer !
I tried to make a unit test instead of creating one test over the CLI. I also wrapped a cleanup function (manageCleanup()) to reuse it in the test but the function has approximately the same name than cleanupFn.

I would also prefer to avoid initialize a VM but #796 is not yet merged

Copy link
Collaborator

@iFrostizz iFrostizz left a comment

Choose a reason for hiding this comment

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

Small nit, very nice work thanks a lot!

Comment on lines 33 to 34
actual, err := borsh.Serialize(tt.actual)
require.NoError(err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's much nicer being more explicit about the encoding, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

go test was not compiling before using borsh.Serialize I think simulator go tests are not run by the CI.
Not sure to understander your comment. Are you just saying it is better right now, or are you asking to be more explicit? 😀

Copy link
Collaborator

Choose a reason for hiding this comment

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

It was a CI issue, some static checks were not done and it led me to think that go was inferring the type, it was an actual bug that was apparently ignored! I'm not asking you to change anything

x/programs/cmd/simulator/cmd/plan.go Show resolved Hide resolved
x/programs/cmd/simulator/cmd/plan_test.go Outdated Show resolved Hide resolved
x/programs/cmd/simulator/cmd/program.go Outdated Show resolved Hide resolved
najeal and others added 2 commits May 21, 2024 09:40
Co-authored-by: Franfran <51274081+iFrostizz@users.noreply.github.com>
Signed-off-by: nathan haim <nathan.haim@free.fr>
@najeal najeal requested a review from iFrostizz May 23, 2024 17:57
iFrostizz
iFrostizz previously approved these changes May 23, 2024
Copy link
Collaborator

@iFrostizz iFrostizz left a comment

Choose a reason for hiding this comment

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

This is looking good to me, looking for an additional approval

richardpringle
richardpringle previously approved these changes May 24, 2024
@richardpringle
Copy link
Contributor

@najeal, just need to update the branch and fix the lint-issue

@najeal najeal dismissed stale reviews from richardpringle and iFrostizz via ed1aeff May 24, 2024 12:39
@najeal
Copy link
Contributor Author

najeal commented May 24, 2024

@richardpringle lint is fixed and branch is up-to-date with main 👍

@richardpringle richardpringle enabled auto-merge (squash) May 29, 2024 14:29
@richardpringle richardpringle merged commit 82f6e05 into ava-labs:main May 29, 2024
20 checks passed
@najeal najeal deleted the using-not-created-key branch May 29, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[x/programs] Simulator should fail if a key that is used was not created
3 participants