Skip to content

Commit

Permalink
Feat: Eth wallet contract implementation (#10850)
Browse files Browse the repository at this point in the history
This PR adds the eth wallet contract implementation which will be
automatically deployed with eth implicit accounts. This is as per the
design outlined in near/NEPs#518 .

It is intentional that the wallet contract implementation is isolated as
its own crate and not contained in the broader nearcore workspace. This
allows it to be reviewed, tested and audited independently from the rest
of the Near code. The crate includes integration tests written using
`near-workspaces`. However, the nearcore integration test related to the
wallet contract has also been updated to check that the contract is
automatically deployed when creating an eth address and that it works as
expected.

This will not be the last PR in this project because I am only adding
the logic for the implementation. It still remains to setup the
reproducible build pipeline and update the tests which check the
contract hashes. Additionally, there are still a few details which need
to be finalized: (1) the Ethereum chain ID that will be associated with
Near and (2) the Near account ID that will have the eth address
registrar contract deployed. The eth address registrar contract stores a
reverse lookup of Ethereum-like address to Near account IDs. It is
necessary for the wallet contract to detect faulty relayers.

However this (relatively large) PR can be reviewed and merged, and the
points above will be addressed in much more manageable follow-up PRs.
  • Loading branch information
birchmd authored Apr 8, 2024
1 parent 52fcaa7 commit ce68b7c
Show file tree
Hide file tree
Showing 34 changed files with 8,970 additions and 1,765 deletions.
671 changes: 628 additions & 43 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ arbitrary = { version = "1.2.3", features = ["derive"] }
arc-swap = "1.5"
assert_matches = "1.5.0"
async-trait = "0.1.58"
aurora-engine-transactions = { git = "https://github.com/aurora-is-near/aurora-engine.git", tag = "3.6.1" }
aurora-engine-types = { git = "https://github.com/aurora-is-near/aurora-engine.git", tag = "3.6.1" }
awc = { version = "3", features = ["openssl"] }
backtrace = "0.3"
base64 = "0.21"
Expand Down Expand Up @@ -170,6 +172,7 @@ ed25519-dalek = { version = "2.1.0", default-features = false, features = [
elastic-array = "0.11"
enum-map = "2.1.0"
enumset = "1.0"
ethabi = "18"
expect-test = "1.3.0"
finite-wasm = "0.5.0"
fs2 = "0.4"
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,14 @@ testlib.workspace = true

[dev-dependencies]
assert_matches.workspace = true
aurora-engine-transactions.workspace = true
aurora-engine-types.workspace = true
derive-enum-from-into.workspace = true
ethabi.workspace = true
insta.workspace = true
near-undo-block.workspace = true
rlp.workspace = true
sha3.workspace = true

[features]
performance_stats = [
Expand Down
368 changes: 258 additions & 110 deletions integration-tests/src/tests/client/features/wallet_contract.rs

Large diffs are not rendered by default.

Loading

0 comments on commit ce68b7c

Please sign in to comment.