Skip to content

Fix CallFlags for native contracts and syscalls#2339

Merged
erikzhang merged 5 commits intomasterfrom
use-flags-states
Feb 17, 2021
Merged

Fix CallFlags for native contracts and syscalls#2339
erikzhang merged 5 commits intomasterfrom
use-flags-states

Conversation

@erikzhang
Copy link
Member

Close #2316

@erikzhang erikzhang requested a review from shargon February 15, 2021 14:15
@erikzhang erikzhang mentioned this pull request Feb 15, 2021
@erikzhang
Copy link
Member Author

@shargon @fyrchik

Copy link
Contributor

@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.

We might as well make GetContext require States (with GetReadOnlyContext requiring ReadStates only), although it can make writing simple getters more complex (it's very convenient to do GetContext in the _initialize and use it everywhere).

public static readonly InteropDescriptor System_Storage_Delete = Register("System.Storage.Delete", nameof(Delete), 0, CallFlags.WriteStates);
public static readonly InteropDescriptor System_Storage_Put = Register("System.Storage.Put", nameof(Put), 0, CallFlags.States);
public static readonly InteropDescriptor System_Storage_PutEx = Register("System.Storage.PutEx", nameof(PutEx), 0, CallFlags.States);
public static readonly InteropDescriptor System_Storage_Delete = Register("System.Storage.Delete", nameof(Delete), 0, CallFlags.States);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably leave these as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to read the IsConstant field before writing. Do we need IsConstant? Maybe we can remove it.

Copy link
Member Author

Choose a reason for hiding this comment

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

@shargon @roman-khimov What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

It can be a significant storage item simplification, but we'll loose a safety feature at the same time that I can't see any substitute for (other than a separate "constant storage context", but that's not really better than the flag we have at the moment). But I'm not sure it's really used by contracts.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's never used.

shargon
shargon previously approved these changes Feb 15, 2021
shargon
shargon previously approved these changes Feb 16, 2021
@erikzhang erikzhang merged commit 79d462e into master Feb 17, 2021
@erikzhang erikzhang deleted the use-flags-states branch February 17, 2021 14:51
@superboyiii superboyiii mentioned this pull request Feb 21, 2021
27 tasks
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Mar 16, 2021
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Mar 16, 2021
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow Transfer to read states

3 participants