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

Enable contract mocks for CALL OP-codes in solEVM #23

Open
johannbarbie opened this Issue Nov 2, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@johannbarbie
Member

johannbarbie commented Nov 2, 2018

When Leap transaction run on Plasma, a virtual state environment is created from the inputs of the transaction:

  • For each fungible input an ERC20 mock is created and a balance minted.
  • For each non-fungible input an ERC721 mock is created and a token minted.
  • A mock for the Plasma bridge is created and the last 100 periods with data are added.

During the execution of a spending condition the CALL and STATICCALL OP-codes are intercepted.

  • If the destination of the OP-codes is any other address than the described mocks, the transaction fails.
  • If the destination is one of the mocks, selected functions are executed.

To create a virtual state environment for Plasma transaction in the EVM enforcer, CALL and STATICCALL OP-codes need to be intercepted in a similar way.

  • for transfer() on a token contract a LOG event should be emitted.
  • for balanceOf() on a token contract the input's balance should be returned.
  • for getPeriod() on the bridge the call should be forwarded to the actual bridge contract.

@johannbarbie johannbarbie changed the title from Enable Contract mocks for CALL OP-codes in solEVM to Enable contract mocks for CALL OP-codes in solEVM Nov 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment