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

Extend compatibility with Aurora EVM #11

Merged
merged 13 commits into from
Jan 22, 2023
Merged

Conversation

mrLSD
Copy link
Collaborator

@mrLSD mrLSD commented Jan 14, 2023

Description

The current aurora-eth-connector implementation is based on the NEAR contract standards library. The specificity of this implementation is that the sender is predecessor_account id. However, when interacting with the Aurora EVM, an obvious problem arises - in this case, the sender will always be the Aurora contract. This PR solves this problem.

Solution

In order for the Aurora contract user who initiated the request to act as the sender, additional functions are introduced:

  • engine_ft_transfer
  • engine_ft_transfer_call
  • engine_storage_deposit
  • engine_storage_deposit
  • engine_storage_unregister

These features are compatible with the corresponding features of NEP-141. However, they have a number of additional features:

  • each of these functions has an additional parameter sender_id - which must contain the initiator of the transaction, which on the Aurora EVM side is contained in predecessor_account_id.
  • These functions do not use the predecessor_account_id parameter, instead, the incoming function parameter sender_id.
  • These functions contain an access_rights check that restricts access to these functions to only those users and contracts that are allowed access.

Breaking changes

No breaking changes

Gas costs

INCREASED: ~30%. Gas cost measuring in migration: 1520 TGas to 1981 TGas for accounts migrations.
And for migration total gas cost: 11852 TGas -> 12310 TGas.

Gas cost changes reason

after dependency updates cargo update, also after version changes:

  • ethabi 18.0 - updated because it needed in aurora-engine-types
  • aurora-engine-types - latest develop

Tests

The new functionality is covered with additional tests covering every logical aspect of the new functionality.

What should be changed in Aurora EVM

All functions that interact with the aurora-eth-connector contract that are relevant to NEP-141:

  • ft_transfer
  • ft_transfer_call
  • storage_deposit
  • storage_deposit
  • storage_unregister

must be changed to call the new functions in aurora-eth-connector with the appropriate options.

Aurora EVM tests

Aurora EVM must be modified to accommodate the new features.

@mrLSD mrLSD self-assigned this Jan 14, 2023
@mrLSD mrLSD added the enhancement New feature or request label Jan 14, 2023
@mrLSD mrLSD marked this pull request as ready for review January 18, 2023 22:19
eth-connector-tests/src/connector.rs Outdated Show resolved Hide resolved
eth-connector-tests/src/connector.rs Show resolved Hide resolved
eth-connector/src/lib.rs Outdated Show resolved Hide resolved
eth-connector/src/lib.rs Show resolved Hide resolved
eth-connector/src/lib.rs Show resolved Hide resolved
@mrLSD mrLSD requested review from birchmd and aleksuss January 20, 2023 00:14
Copy link
Contributor

@birchmd birchmd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice job

.transact()
.await?;
assert!(res.is_success());
contract.set_and_check_access_right(user_acc.id()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on reducing code duplication! 🚀

@mrLSD mrLSD merged commit f39c917 into master Jan 22, 2023
@mrLSD mrLSD deleted the feat/extend-engin-compatibility branch January 22, 2023 10:18
@mrLSD mrLSD added this to the v0.3.0 milestone Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants