Describe the bug
ReadStates and WriteStates are currently different flags and the latter doesn't imply the former. I think this is a bit misleading, because in most cases we use WriteStates read is also needed. This can lead to behavior described here nspcc-dev/neo-go#1725 .
Solution
I can think of two of them:
- Make
WriteStates require ReadStates (rename States to WriteStates). States is currently not used, so I think it makes sense.
- Replace
WriteStates with States in Transfer and possibly some other methods with callbacks (deploy and update come to mind immediately).
I prefer first solution.
To Reproduce
Try to read storage in onPayment method, like here nspcc-dev/neo-go#1725
Expected behavior
onPayment executes correctly.
Describe the bug
ReadStatesandWriteStatesare currently different flags and the latter doesn't imply the former. I think this is a bit misleading, because in most cases we useWriteStatesread is also needed. This can lead to behavior described here nspcc-dev/neo-go#1725 .Solution
I can think of two of them:
WriteStatesrequireReadStates(renameStatestoWriteStates).Statesis currently not used, so I think it makes sense.WriteStateswithStatesinTransferand possibly some other methods with callbacks (deployandupdatecome to mind immediately).I prefer first solution.
To Reproduce
Try to read storage in
onPaymentmethod, like here nspcc-dev/neo-go#1725Expected behavior
onPaymentexecutes correctly.