-
Notifications
You must be signed in to change notification settings - Fork 631
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
Wallet Contract placeholder #10269
Wallet Contract placeholder #10269
Conversation
89a9aab
to
dccf038
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #10269 +/- ##
==========================================
+ Coverage 71.81% 71.90% +0.08%
==========================================
Files 712 715 +3
Lines 143098 143755 +657
Branches 143098 143755 +657
==========================================
+ Hits 102763 103361 +598
- Misses 35625 35651 +26
- Partials 4710 4743 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
6a77447
to
3051ba2
Compare
3051ba2
to
7b0a69c
Compare
ca2211f
to
3abf599
Compare
3abf599
to
1614346
Compare
I am not sure how |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job! I have a few comments/questions but overall looks good.
I do not think we want to support dynamic upgrades. It would be a complex feature to get right because you still need to have all the nodes agree on what the right Wallet Contract binary to use is, so you would need its hash to be a property of the epoch or something like that. Upgrades will always have to be protocol upgrades. Both the old and new binaries will need to be kept and the node would need to switch which one is used depending on the protocol version. |
Sorry for the delay, I was busy with investigations, I'll have a look on Monday. |
d3b62bc
to
b138347
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
Please also have it reviewed by someone from the runtime team as there are a lot of pieces that I have absolutely no context on.
Here are the all review changes, mainly:
@Ekleog-NEAR I've built this PR with the I spent some time trying to fix that but without success. The crate was only used during the build and I thought I will separate it from the workspace. Now it is not even used during build by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the vulnerable dependencies, that’s something we definitely need to fix on the near-sdk side, because right now we’re pushing everyone to use these vulnerable dependencies.
For wee-alloc, the change recommended by the rustsec advisory is to just use Rust’s default allocator. For ed25519, bumping near-crypto & co to 0.18 (as soon as I can get it released, currently we’re facing a few issues with the release) should deal with the issue. I’d suggest fixing the wee-alloc issue, and ignoring the red cargo-audit checkmark for ed25519 for now, considering it’s dependencies that only get used for non-wasm32 targets.
Anyway, I think we can merge this as is for now, and merge the wallet contract into the workspace as a follow-up PR :)
I think the only comment here that really needs action before landing is, removing the prebuilt .wasm file, because it’s currently impossible to reproduce. It’ll make operational deployment harder, but if we check in a binary file, we definitely need it to be reproducible.
In order to keep operational deployment easy for now, I’d suggest compiling the include_bytes! conditionally on the nightly feature flag only (and eg. having a hardcoded empty slice on stable), this way we can gain some time to decide what the proper process should be there :)
37d8a88
to
f0163ad
Compare
abbd100
to
53f7a8a
Compare
53f7a8a
to
a1c8633
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! We only need to address the issue of reproducible build for the contract, and I think that can be done as a follow-up PR.
In some circumstances, `runtime/near-wallet-contract/build.rs` is triggered and it regenerates the Wallet Contract WASM file for unrelated PRs: #10422 (comment). The `Wallet Contract` will be generated differently (#10269 (comment)), but for now I would like to include this tiny PR to stops auto-generating the WASM file by default. To test that the WASM file is not auto-regenerated, add a space to `runtime/near-wallet-contract/wallet-contract/src/lib.rs` and run `cargo build --features nightly`.
Context
NEP: near/NEPs#518
Tracking issue: #10018.
Goal
We want the NEAR Protocol's ecosystem to be closer with Ethereum by integrating Web3 wallet support.
To accomplish that, some changes on the protocol level are needed with an emphasis on user experience continuity.
Following the design, the main change on the protocol level would be to have ETH-style addresses managed by a new
Wallet Contract
integrated into the protocol. For seamless onboarding of EVM users, the contract will be free of charge.Previous work
This PR is built on top of two PRs:
Summary
This PR adds
near-wallet-contract
crate (based onruntime/near-test-contracts
) that exposesWallet Contract
WASM code to the runtime.It stops deploying a copy of the
Wallet Contract
to each newly created ETH-implicit account.Instead, it uses an in-memory cached contract code on
execute_function_call
action from such account.Changes
wallet-contract
crate (separated from the workspace) with placeholderWallet Contract
implementation.near-wallet-contract
crate (part of the workspace) that generates (throughbuild.rs
) and exposes theWallet Contract
WASM code.Wallet Contract
when creating ETH-implicit account. Just store reference to theWallet Contract
.Wallet Contract
code).Wallet Contract
where a transfer from an ETH-implicit account is possible depending on the public key passed withrlp_transaction
argument.