Skip to content

Fix(testnet): Method to fix balance of aurora account#225

Merged
joshuajbouw merged 1 commit into
developfrom
testnet-balance-fix
Aug 11, 2021
Merged

Fix(testnet): Method to fix balance of aurora account#225
joshuajbouw merged 1 commit into
developfrom
testnet-balance-fix

Conversation

@birchmd
Copy link
Copy Markdown
Member

@birchmd birchmd commented Aug 10, 2021

Background:

Previously we minted and burned bridged ETH in the NEP-141 contract when it became usable in the EVM. However, in #133 we changed that design to instead hold all the ETH currently available in the EVM in the Aurora account on the NEP-141 contract. This change was made because it makes the ExitToNear logic much simpler (it is simply a transfer from the Aurora account to the destination account in the NEP-141 contract).

However we did not mint tokens to cover the ones that were burned when they entered the EVM prior to #133. This includes the over 12k ETH that is held by the faucet.

Issue:

As a result, the ExitToNear functionality is now broken on testnet because the Aurora account in the NEP-141 contract has run out of tokens. Note: this only impacts testnet because #133 was merged before the eth-connector was deployed to mainnet, so mainnet has always had the updated design.

Solution (this PR):

This PR introduces a method for testnet only which mints tokens to the Aurora account in the NEP-141 contract, restoring the invariant which exists with the ExitToNear design change introduced in #133. Namely, this invariant is that the total available amount of ETH (ETH sent to the exit precompile addresses is no longer available) in the EVM is equal to the balance of the Aurora account in the NEP-141 contract. A test is included to show the method works properly.

This new method only needs to be called one time on testnet, so after this has happened we can revert this PR to avoid confusion in the future.

To execute the fix:

Ensure that testnet is built with the following command and then deployed on testnet.

make -B testnet

Then execute the following command.

near call --accountId aurora aurora balance_evm_and_nep_141 '{}'

@birchmd birchmd requested review from joshuajbouw and sept-en August 10, 2021 21:27
@birchmd birchmd requested a review from artob as a code owner August 10, 2021 21:27
Comment thread src/connector.rs
Comment thread src/lib.rs
Comment thread src/precompiles/native.rs
Comment thread src/precompiles/native.rs
@birchmd
Copy link
Copy Markdown
Member Author

birchmd commented Aug 11, 2021

@joshuajbouw per my description in the PR:

This new method only needs to be called one time on testnet, so after this has happened we can revert this PR to avoid confusion in the future.

So I don't think we should worry about small details like what should be pub or where code lives. The point of this was to enable a minimal fix for the on-going testnet issue; none of these changes should be considered permanent.

@joshuajbouw
Copy link
Copy Markdown
Contributor

Ah! so I see. Ok, good point.

@joshuajbouw joshuajbouw merged commit 2e2a5fa into develop Aug 11, 2021
@joshuajbouw joshuajbouw deleted the testnet-balance-fix branch August 11, 2021 14:51
Copy link
Copy Markdown
Contributor

@sept-en sept-en left a comment

Choose a reason for hiding this comment

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

Thanks @birchmd !

artob added a commit that referenced this pull request Aug 14, 2021
* ERC-20: forbid using invalid NEP141 AccountID for mapping (#179)
* Timestamp should be in milliseconds for Ethereum compatibility (#208)
* feat(engine): Blockhash definition (#213)
* Update etc/state-migration-test/Cargo.lock (#211)
* Include cost of access list in intrinsic gas (#219)
* Bump tar from 4.4.13 to 4.4.15 in /etc/eth-contracts (#217)
* Feat(engine): Relayer payment (#215)
* Scheduled lint is supposed to run nightly clippy (#214)
* Return actual status of a transaction (#218)
* Added parser for Integer types (#183)
* Update to latest nightly (#221)
* Fix(engine): do not panic when user has insufficient balance to cover gas (#223)
* Update lock files (#224)
* Method to fix balance of aurora account on testnet (#225)
* Use math api host functions on mainnet (#228)
* NEP-141 compliance correctness (#202)
* Adapt workflows to dockerized runners (#231)
* Move block height to the end of hashed data. (#233)
* Ensure solidity artifacts are always recompiled (#234)
* Prevent test binary from deploying (#237)
* Add removal of eth-contracts to `make clean`
* Remove deploy_code feature gate

Co-authored-by: Dmitry Strokov <dmitry@aurora.dev>
Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev>
Co-authored-by: Joshua J. Bouw <joshua@aurora.dev>
Co-authored-by: Kirill <kirill@aurora.dev>
Co-authored-by: Michael Birch <michael@aurora.dev>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
birchmd added a commit that referenced this pull request Aug 16, 2021
@birchmd birchmd mentioned this pull request Aug 16, 2021
joshuajbouw pushed a commit that referenced this pull request Aug 17, 2021
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

Successfully merging this pull request may close these issues.

3 participants