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

vm: make slots public #3677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

vm: make slots public #3677

wants to merge 1 commit into from

Conversation

ixje
Copy link
Contributor

@ixje ixje commented Nov 13, 2024

@ixje
Copy link
Contributor Author

ixje commented Nov 14, 2024

this will fail signed off because it doesn't like my format, looking at how to fix the commit :|

Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

It would be nice to add a link to the reason of this modification to the commit message (#3674 (comment)).

LGTM, but not merging without @roman-khimov's approval.

@AnnaShaleva
Copy link
Member

looking at how to fix the commit :|

Expected "Erik van den Brink <git@erikvandenbrink.com>", but got "ixje <erik@coz.io>"

If you don't like the suggestion, then we can merge with this job failing, it's not critical.

@AnnaShaleva AnnaShaleva added this to the v0.107.0 milestone Nov 14, 2024
@AnnaShaleva AnnaShaleva added the vm VM tasks/bugs/issues label Nov 14, 2024
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.11%. Comparing base (dda2caf) to head (4cbcaee).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
cli/vm/cli.go 90.00% 1 Missing ⚠️
pkg/vm/context.go 85.71% 1 Missing ⚠️
pkg/vm/vm.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3677      +/-   ##
==========================================
+ Coverage   83.09%   83.11%   +0.02%     
==========================================
  Files         334      334              
  Lines       46573    46612      +39     
==========================================
+ Hits        38699    38742      +43     
+ Misses       6306     6296      -10     
- Partials     1568     1574       +6     

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

@roman-khimov
Copy link
Member

looking at how to fix the commit

Whoever is in the "Author" of commit (git log, git config --get user.email) should be in SOB (at least the email should be the same).

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

I'd suggest deprecating DumpXSlot at the same time, it was always questionable.

pkg/vm/slot.go Outdated
@@ -19,7 +19,7 @@ func (s *slot) init(n int, rc *refCounter) {
}

// Set sets i-th storage slot.
func (s slot) Set(i int, item stackitem.Item, refs *refCounter) {
func (s Slot) Set(i int, item stackitem.Item, refs *refCounter) {
Copy link
Member

Choose a reason for hiding this comment

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

Exported method accepts unexported structure.

pkg/vm/slot.go Show resolved Hide resolved
pkg/vm/context.go Show resolved Hide resolved
@ixje
Copy link
Contributor Author

ixje commented Nov 14, 2024

I'd suggest deprecating DumpXSlot at the same time, it was always questionable.

Those are in use by the cli

neo-go/cli/vm/cli.go

Lines 650 to 655 in cb51eeb

case "sslot":
rawSlot = vmCtx.DumpStaticSlot()
case "lslot":
rawSlot = vmCtx.DumpLocalSlot()
case "aslot":
rawSlot = vmCtx.DumpArgumentsSlot()

You want to remove these CLI commands?

@roman-khimov
Copy link
Member

You want to remove these CLI commands?

Of course not, they can grab slots from VM as is and represent them to user in any way they want including JSON.

…Slot methods

Signed-off-by: ixje <erik@coz.io>
@@ -278,22 +278,26 @@ func (c *Context) IsDeployed() bool {
}

// DumpStaticSlot returns json formatted representation of the given slot.
// Deprecated: to be removed in next version.
Copy link
Member

Choose a reason for hiding this comment

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

Here and below, please, add a note that (*Context).*Slot method should be used to retrieve slot. Also please add an entry to ROADMAP.md (https://github.com/nspcc-dev/neo-go/blob/master/ROADMAP.md#deprecated-functionality) following the document style. Let's schedule deprecation of these methods to 0.108.0 release.

if s == nil {
panic("not initialized")
return 0
Copy link
Member

Choose a reason for hiding this comment

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

I'm OK with this change. @roman-khimov do you think it's OK to return 0 for uninitialized slot?

I thought about returning an error, but it will complicate method's signature for nothing. And we don't use this method inside VM anyway, hence it does not affect the node state in any way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vm VM tasks/bugs/issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants