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

Implement necessary contract method begin_chain for evm-bully. #30

Merged
merged 6 commits into from
Apr 23, 2021

Conversation

frankbraun
Copy link
Contributor

Issues #1 and #2.

@frankbraun frankbraun added the C-enhancement Category: New feature or request label Apr 14, 2021
@frankbraun frankbraun self-assigned this Apr 14, 2021
@frankbraun
Copy link
Contributor Author

Most work related to this was done on on the evm-bully side.

Regarding issue #1 everything is implemented, issue #2 needs more work. With this PR we can now replay Görli up to block 12842 where we fail with:

Transaction Id B4cfxkbuPG2xjSUzbxzVY7WDVT2udaSXdyajDZ2DwBjn
{
  "Failure": {
    "ActionError": {
      "index": 0,
      "kind": {
        "FunctionCallError": {
          "ExecutionError": "Exceeded the prepaid gas."
        }
      }
    }
  }
}

I would merge this now and do further work with additional PRs.

@frankbraun frankbraun changed the title [WIP] Implement necessary contract methods for evm-bully. Implement necessary contract methods for evm-bully. Apr 23, 2021
@frankbraun frankbraun changed the title Implement necessary contract methods for evm-bully. Implement necessary contract method begin_chain for evm-bully. Apr 23, 2021
@frankbraun frankbraun marked this pull request as ready for review April 23, 2021 02:32
@frankbraun frankbraun assigned joshuajbouw and artob and unassigned frankbraun Apr 23, 2021
Copy link
Contributor

@joshuajbouw joshuajbouw left a comment

Choose a reason for hiding this comment

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

Straight forward.

Copy link
Contributor

@artob artob left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@artob artob merged commit 8ec848c into master Apr 23, 2021
@artob artob deleted the bully-helper branch April 23, 2021 08:30
@@ -10,8 +10,8 @@ use crate::sdk;

pub type AccountId = String;
pub type RawAddress = [u8; 20];
pub type RawU256 = [u8; 32];
pub type RawH256 = [u8; 32];
pub type RawU256 = [u8; 32]; // Little-endian large integer type.
Copy link
Member

Choose a reason for hiding this comment

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

Is it little endian? I thought EVM was always big endian

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I'm finding conflicting info on this.

Copy link
Member

Choose a reason for hiding this comment

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

My question was based on what I read in the Mastering Ethereum book

All numbers in Ethereum are encoded as big-endian integers

https://github.com/ethereumbook/ethereumbook/blob/develop/06transactions.asciidoc

Copy link
Contributor

Choose a reason for hiding this comment

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

In blake2f, they use little endian on parts too, not all of it. shrug

Copy link
Contributor Author

@frankbraun frankbraun Jun 22, 2021

Choose a reason for hiding this comment

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

@birchmd You were right with this. The documentation https://docs.rs/ethereum-types/0.1.4/ethereum_types/ confused me. WebAssembly uses little-endian, but the EVM uses big-endian integers. So larger number were encoded wrongly in the evm-bully which also caused #122.

mrLSD pushed a commit that referenced this pull request May 5, 2021
* Link to docs in the README. (#18)

* Change deprecated `u64::max_value` to `u64::MAX`. (#38)

* Support custom error messages. (#40)

* Implement `begin_chain` for evm-bully. (#30)

* Implement a faucet method. (#39)

* Implement all Istanbul HF precompiles. (#21)

* Check and increment nonces. (#42)

* Fix the RIPEMD160 and ModExp precompiles. (#44)

* Implement a first draft of `COINBASE` and `GASLIMIT`. (#47)

* Refactor and improve error handling. (#49)

* Replace `raw_call` with the new `submit` API. (#48)

The `raw_call` method is hereby removed in favor of the new `submit` method
that has an extended ABI capable of returning a transaction's revert status
and logged events.

Co-authored-by: Michael Birch <michael@near.org>
Co-authored-by: Arto Bendiken <arto@near.org>

* Add benchmarks for common EVM operations. (#41)

* Merge branch 'master' into improved-evm-token-logic

* Update error handling to `master`

* fix missing import

* cargo fmt

* Ensure ETH transfers return an execution result. (#48)

* Update to `master`

* fix str types

Co-authored-by: Frank Braun <frank@near.org>
Co-authored-by: Michael Birch <michael@near.org>
Co-authored-by: Arto Bendiken <arto@near.org>
mrLSD added a commit that referenced this pull request May 5, 2021
* Added prover & extended types

* Mode Borsh args from types to parameters

* Added fungible tokens

* Added eth-connector

* Modify assert for fee

* Fix formatting

* Extend eth-conenctor with EVM token logic

* Changed eth-connector deposit logic

* Added changes for ETH deposit/withdraw and Engine changes

* Mint ETH-tokens

* Added: transfer_eth

* ETH withdraw basic method

* eth-withdraw validation structure & modified Deposit-eth fields

* eth transfer and withdraw logic

* eip712 message verifier - started encoding

* added encode-packed

* virefy EIP712 message for withdraw

* Changed EIP712 message fields

* Modify logs for EIP712 messages

* Test EIP712

* Tests EIP712

* Integration tests for encode_withdraw_eip712

* Integration tests for encode_withdraw_eip712

* EIP712-Withdraw: improvements and fixes.

* EIP712-Withdraw: fixed encoding rules and order.
* EIP712-Withdraw: `verify_withdraw_eip712` returns `true` only if the
  sender address equals to the address of message signer.
* EIP712-Withdraw: update tests.
* EIP712-Withdraw: refactoring.
* ethabit::encode_token_packed: use right-padded encoding for `Address`.
* WithdrawFromEthCallArgs: fixed `amount` type conversion.

* Extend tests for eth-connector

* eth-connector test deposit & balance & total_supply

* Imporved tests

* FT tests

* Fixed verify_transfer_eip712

* Change test_withdraw_near

* Tests for: ft_transfer, ft_transfer_call

* test_eth_deposit_balance_total_supply

* test and ifx: deposit_eth, withdraw_near

* References in fungible token (#29)

* Use references in fungible_token to avoid cloning

* cargo fmt

* Fix: hide logging behind feature flag

* Remove eth-conenctor transfer methods and deposit for new design

* Completed Deposit logic

* Fix clippy; added comments; improved ft_transfer_call

* Extend external functions for eth-connector

* Added deploy_evm_token

* Added ft_on_transfer logic

* Changed ft_on_transfer & remove json depends

* Changed deposit logic and fixed transfers

* Added register relayer

* Added message coder for ft_transfer_call

* ft_on_transfer - added logic for erc20

* Impoved ft_on_transfer

* ft_on_transfer: call erc20 contract adn send fee to Relayer. Added logs

* eth-connector: Removed unsued methods

* tests: deposit & fixed init test

* tests: depoist, withdraw

* tests: fix test_withdraw_near

* Eth-connector: never skip bridge call.

* Tests: fix ft_transfer_call

* ft_transfer_call - changed gas amountr

* Fixed: test_eth_deposit_balance_total_supply, test_ft_transfer

* Added: test_ft_transfer_call_near_eth

* Clippy fix

* Added test_ft_transfer_call_erc20

* Added test_ft_transfer_call_erc20

* tests: ft_transfer_call for ERC20 changes

* Fix finish_deposit - promise flow when failed for ft_transfer_call

* added: test_deposit_with_same_proof

* Improved EVM token master branch update (#50)

* Link to docs in the README. (#18)

* Change deprecated `u64::max_value` to `u64::MAX`. (#38)

* Support custom error messages. (#40)

* Implement `begin_chain` for evm-bully. (#30)

* Implement a faucet method. (#39)

* Implement all Istanbul HF precompiles. (#21)

* Check and increment nonces. (#42)

* Fix the RIPEMD160 and ModExp precompiles. (#44)

* Implement a first draft of `COINBASE` and `GASLIMIT`. (#47)

* Refactor and improve error handling. (#49)

* Replace `raw_call` with the new `submit` API. (#48)

The `raw_call` method is hereby removed in favor of the new `submit` method
that has an extended ABI capable of returning a transaction's revert status
and logged events.

Co-authored-by: Michael Birch <michael@near.org>
Co-authored-by: Arto Bendiken <arto@near.org>

* Add benchmarks for common EVM operations. (#41)

* Merge branch 'master' into improved-evm-token-logic

* Update error handling to `master`

* fix missing import

* cargo fmt

* Ensure ETH transfers return an execution result. (#48)

* Update to `master`

* fix str types

Co-authored-by: Frank Braun <frank@near.org>
Co-authored-by: Michael Birch <michael@near.org>
Co-authored-by: Arto Bendiken <arto@near.org>

* Update src/connector.rs misspel

Co-authored-by: Joshua J. Bouw <dev@joshuajbouw.com>

* Update src/connector.rs change constants error

Co-authored-by: Joshua J. Bouw <dev@joshuajbouw.com>

Co-authored-by: Septen <gammerxpower@gmail.com>
Co-authored-by: Michael Birch <michael@near.org>
Co-authored-by: Joshua J. Bouw <dev@joshuajbouw.com>
Co-authored-by: Frank Braun <frank@near.org>
Co-authored-by: Arto Bendiken <arto@near.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants