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

Procedure Execution with StaticCall #17

Closed
Latrasis opened this issue Mar 19, 2018 · 2 comments
Closed

Procedure Execution with StaticCall #17

Latrasis opened this issue Mar 19, 2018 · 2 comments
Assignees

Comments

@Latrasis
Copy link
Member

Latrasis commented Mar 19, 2018

Background

When executing a procedure we need to make sure:

  1. Unprivileged State Access/Modifications are rejected.
  2. State Access using a valid capability is accepted.

Proposal

  1. When executing a procedure from the kernel we use STATICCALL instead of DELEGATECALL.
    When executing a procedure from kernel space:
  2. To prevent state changes instead of checking for opcodes, we rely on STATICCALL to prevent them at runtime.
  3. Whenever a procedure requires a kernel resource, it returns the current memory with a 64 byte header which includes: The capability invoked, argument location, input location, and next valid jump location within the procedure stack.
  4. If a kernel receives a valid invocation, it dispatches the requested resource, if the resource returns any data, the data is included into the input location. The procedure then reads the next jump location, and continues execution.

Considerations

As an example, when accessing SSTORE, this proposal incurs the additional cost of aSTATICCALL, it remains to be seen if it is cheaper to simply encapsulate an opcode than to do context switching.

@JakeOShannessy
Copy link
Contributor

I'm trying to work around a problem with point 2 of the proposal section. All solutions for system calls seem to rely on variable length return values. The problem is these values could be extremely variable, but must be set before the contract is called. If we want to return all the memory from a child contract how big could that be? It could be very large or not much at all. We have to allocate space for the largest quantity possible. We obviously can't do this with the maximum possible amount of 2^256, so it would mean setting a memory constraint, then setting aside that amount in the kernel whenever we call a contract. It would also need to account for nested calls.

@Latrasis
Copy link
Member Author

@JakeOShannessy: I believe we can put this on hold since we have decided on going with delegate re-entrancy.

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

No branches or pull requests

3 participants