Introduce precompiles to manage ERC20 connector#51
Conversation
joshuajbouw
left a comment
There was a problem hiding this comment.
Just some small changes, and also to have it fit with the other precompiles. I believe it also needs to be added to the other precompile functions.
|
@joshuajbouw thanks for your help, LGTM! |
* Add custom erc20 contract to the EVM. To compile the EVM it is required to compile ERC20 first if this change is used. Do this using the following steps: cd eth-contracts yarn yarn compile This will generate relevant binary in: `eth-contracts/res/EvmErc20.bin` * Move eth contract to etc and update Makefile * Fix CI * Add lint
Right, I get the context now. I just saw this PR rust-ethereum/evm#34 as well. Makes sense. The design still feels a little off to me, but this is critical for our deliverable for the end of the week, so let's just roll with how it is for now. Eventually, maybe something will come up where it can be improved. |
|
@mfornet Please fix the merge conflicts and re-request reviews as needed. |
* Introduce precompiles for the ETH & ERC-20 connectors. (#51) * Implement generational storage with `SELFDESTRUCT` tests. (#84) * Remove the dependency on Lunarity. (#115) * Fix Clippy complaint with `+nightly`. (#117) * Simplify the `sdk::read_u64` return type. (#118) * Add an `is_used_proof` interface. (#120) * Add an `evm-bully=yes` build to CI. (#121) * Handle transaction gas limit properly. (#123) * Fix u128 JSON parsing & tests in the ETH connector. (#125) * Fix evm-bully builds. (#130) * Add JSON custom error types. (#131) * Don't burn NEP-141 on deposit. (#133) * Fix needless borrows. (#135) * Improve and refactor the ETH connector. (#136) * Add a macro for logging. (#142) Co-authored-by: Aleksey Kladov <aleksey@near.org> Co-authored-by: Arto Bendiken <arto@aurora.dev> Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev> Co-authored-by: Frank Braun <frank@aurora.dev> Co-authored-by: Joshua J. Bouw <joshua@aurora.dev> Co-authored-by: Kirill <kirill@aurora.dev> Co-authored-by: Marcelo Fornet <marcelo@aurora.dev> Co-authored-by: Michael Birch <michael@aurora.dev>
* Introduce precompiles for the ETH & ERC-20 connectors. (#51) * Implement generational storage with `SELFDESTRUCT` tests. (#84) * Fix u128 JSON parsing & tests in the ETH connector. (#125) * Add JSON custom error types. (#131) * Don't burn NEP-141 on deposit. (#133) * Fix needless borrows. (#135) * Improve and refactor the ETH connector. (#136) * Add a macro for logging. (#142) Co-authored-by: Aleksey Kladov <aleksey@near.org> Co-authored-by: Arto Bendiken <arto@aurora.dev> Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev> Co-authored-by: Frank Braun <frank@aurora.dev> Co-authored-by: Joshua J. Bouw <joshua@aurora.dev> Co-authored-by: Kirill <kirill@aurora.dev> Co-authored-by: Marcelo Fornet <marcelo@aurora.dev> Co-authored-by: Michael Birch <michael@aurora.dev>
This creates two new precompiles:
exit_to_nearexit_to_ethereumTheir main role is scheduling a promise call outside of the EVM to another Near contract.
Check this diagram for reference.
Testing Plan
This are a set of basic tests that should be implemented before merging. This tests only include happy path for expected workflows, but it is important to cover with tests that other interaction are behaving as expected (tokens can't get lost or stolen).
Integration tests should spinup Ganache, and Localnet and run there, to make sure each workflow is behaving correctly in a environment closer to production.
IntegrationManual Test) Send tokens from Near -> EVMIntegrationManual Test) Send tokens from EVM -> NearIntegrationManual Test) Send tokens from Ethereum -> EVMIntegrationManual Test) Send tokens from EVM -> EthereumTest contract_call is only scheduled appropriately:
Create a solidity with these functions:
Scenarios: