Skip to content

Commit

Permalink
Disable auto-generation of wallet contract by default (#10436)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
staffik authored Jan 16, 2024
1 parent 4770aa3 commit 31cc86c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions runtime/near-wallet-contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ near-primitives-core.workspace = true
anyhow.workspace = true

[features]
build_wallet_contract = []
nightly_protocol = [
"near-primitives-core/nightly_protocol",
"near-vm-runner/nightly_protocol",
Expand Down
1 change: 1 addition & 0 deletions runtime/near-wallet-contract/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ See https://github.com/near/NEPs/issues/518.
Must not use in production!

Currently, the contract can only be used in nightly build.
Temporarily, we also require `build_wallet_contract` feature flag for `cargo build`.
The `build.rs` generates WASM file and saves it to the `./res` directory.

If you want to use the contract from nearcore, add this crate as a dependency
Expand Down
4 changes: 3 additions & 1 deletion runtime/near-wallet-contract/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use std::path::{Path, PathBuf};
use std::process::Command;

fn main() -> Result<()> {
if cfg!(not(feature = "nightly")) {
// TODO(eth-implicit) Remove the `build_wallet_contract` flag once we have a proper way
// to generate the Wallet Contract WASM file.
if cfg!(not(feature = "nightly")) || cfg!(not(feature = "build_wallet_contract")) {
return Ok(());
}
build_contract("./wallet-contract", &[], "wallet_contract")
Expand Down

0 comments on commit 31cc86c

Please sign in to comment.