You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user enqueues a batch of calls in their account contract, all private functions get processed first, and all public functions get enqueued afterwards. But this can be a problem if one of the private functions enqueues a public call, since it breaks the expected ordering. For instance, if the user creates a batch with:
Enqueue call to public function A
Call private function privB (which enqueues a call to public function B)
It'd be expected that A gets processed before B. However, since privB is processed first by the account contract, then B is enqueued before A. This can be confusing to the user. I know first-hand because I just lost over an hour trying to debug an issue #1639 caused by this. And to make it more humilliating it was me who wrote the code account contract entrypoint. Oh well.
Self-rant aside, we should tweak the entrypoint so, instead of receiving two arrays of FunctionCalls (one for private, one for public), it receives a single array of FunctionCalls with a flag indicating whether each is private or public. This requires modifying the entrypoint_payload.ts and entrypoint.nr files. We should also update accordingly the pseudocode for the account contract in the Accounts guide in the docs.
The text was updated successfully, but these errors were encountered:
An attempt to summarise the issue in my own words, to make sure I've grasped it:
Currently, the entrypoint interface doesn't give a user enough freedom to express the ordering of their transaction request. This can lead to public functions being enqueued in the wrong order.
This is an independent problem from us trying to fix the ordering of public function calls which are enqueued by private functions?
)
Fixes#1645
This issue became more pressing since the introduction of
`is_valid_public` in accounts, since a user now should first invoke
`set_is_valid_storage` (a public function call) as many times as needed
to set up authorisations needed for public executions, and _then_ have
these public functions run. Otherwise, these runs will fail to find the
`is_valid` flags in storage.
When a user enqueues a batch of calls in their account contract, all private functions get processed first, and all public functions get enqueued afterwards. But this can be a problem if one of the private functions enqueues a public call, since it breaks the expected ordering. For instance, if the user creates a batch with:
A
privB
(which enqueues a call to public functionB
)It'd be expected that
A
gets processed beforeB
. However, sinceprivB
is processed first by the account contract, thenB
is enqueued beforeA
. This can be confusing to the user. I know first-hand because I just lost over an hour trying to debug an issue #1639 caused by this. And to make it more humilliating it was me who wrote the code account contract entrypoint. Oh well.Self-rant aside, we should tweak the entrypoint so, instead of receiving two arrays of FunctionCalls (one for private, one for public), it receives a single array of FunctionCalls with a flag indicating whether each is private or public. This requires modifying the
entrypoint_payload.ts
andentrypoint.nr
files. We should also update accordingly the pseudocode for the account contract in the Accounts guide in the docs.The text was updated successfully, but these errors were encountered: