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

chore: update replica version to 072b2a65 #3508

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# UNRELEASED

### feat: large canister modules now supported

When using `dfx deploy` or `dfx canister install`, previously WASM modules larger than 2MiB would be rejected.
They are now automatically submitted via the chunking API if they are large enough.
From a user perspective the limitation will simply have been lifted.

### feat!: update `dfx cycles` commands with mainnet `cycles-ledger` canister ID

The `dfx cycles` command no longer needs nor accepts the `--cycles-ledger-canister-id <canister id>` parameter.
Expand Down
10 changes: 6 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ license = "Apache-2.0"
[workspace.dependencies]
candid = "0.10.0"
candid_parser = "0.1.2"
ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-agent = { git = "https://github.com/dfinity/agent-rs.git", rev = "3bf221238ea0e038aa23c6749151534a3f0bfe85" }
ic-asset = { path = "src/canisters/frontend/ic-asset" }
ic-cdk = "0.12.0"
ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "a7f44ad05e77fc89b8447dd65b345e7a62fd1042" }
ic-identity-hsm = { git = "https://github.com/dfinity/agent-rs.git", rev = "3bf221238ea0e038aa23c6749151534a3f0bfe85" }
ic-utils = { git = "https://github.com/dfinity/agent-rs.git", rev = "3bf221238ea0e038aa23c6749151534a3f0bfe85" }

aes-gcm = "0.10.3"
anyhow = "1.0.56"
Expand Down
10 changes: 10 additions & 0 deletions e2e/assets/large_canister/dfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"canisters": {
"large": {
"type": "custom",
"wasm": "large.wasm",
"candid": "large.did",
"build": []
}
}
}
1 change: 1 addition & 0 deletions e2e/assets/large_canister/large.did
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
service : {}
Binary file added e2e/assets/large_canister/large.wasm
Binary file not shown.
10 changes: 10 additions & 0 deletions e2e/tests-dfx/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ teardown() {
assert_eq "$BUILD_HASH" "$ONCHAIN_HASH"
}

@test "can install >2MiB wasm" {
install_asset large_canister
dfx_start
dfx canister create --all
assert_command dfx build
assert_command dfx canister install --all
assert_command dfx canister info large
assert_match "Module hash: 0x$(sha2sum large.wasm | head -c 64)"
}

@test "--mode=auto selects install or upgrade automatically" {
dfx_start
assert_command dfx canister create e2e_project_backend
Expand Down
166 changes: 83 additions & 83 deletions nix/sources.json

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions src/dfx-core/src/canister/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
use candid::Principal;
use ic_agent::Agent;
use ic_utils::{
call::AsyncCall,
interfaces::{
management_canister::builders::{CanisterInstall, InstallMode},
ManagementCanister, WalletCanister,
Expand Down Expand Up @@ -58,7 +57,7 @@ YOU WILL LOSE ALL DATA IN THE CANISTER.
let mode_str = match mode {
InstallMode::Install => "Installing",
InstallMode::Reinstall => "Reinstalling",
InstallMode::Upgrade => "Upgrading",
InstallMode::Upgrade { .. } => "Upgrading",
};
if let Some(name) = canister_name {
info!(
Expand All @@ -71,12 +70,10 @@ YOU WILL LOSE ALL DATA IN THE CANISTER.
match call_sender {
CallSender::SelectedId => {
let install_builder = mgr
.install_code(&canister_id, &wasm_module)
.install(&canister_id, &wasm_module)
.with_raw_arg(args.to_vec())
.with_mode(mode);
install_builder
.build()
.map_err(CanisterBuilderError::CallSenderBuildError)?
.call_and_wait()
.await
.map_err(CanisterInstallError::InstallWasmError)
Expand Down
82 changes: 41 additions & 41 deletions src/dfx/assets/dfx-asset-sources.toml
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
# generated by write-dfx-asset-sources.sh
replica-rev = '69e1408347723dbaa7a6cd2faa9b65c42abbe861'
replica-rev = '072b2a6586c409efa88f2244d658307ff3a645d8'

[x86_64-darwin.icx-proxy]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/icx-proxy-dev.gz'
sha256 = 'b07f2784abddcb54f0b0d3ce7585b9283cf814870905d58c26a1c8823ead2fdd'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/icx-proxy-dev.gz'
sha256 = '404b248af6dcf1dcf412122976ac4d77ad0d85c71ab7907a16286e7f0cb72d3f'

[x86_64-darwin.ic-admin]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-admin.gz'
sha256 = '4b3f8fbc719a16bef00b14e5ae498253736d931f0fcacb52413f2c9859f52197'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/ic-admin.gz'
sha256 = '03ff9f57aa315270414b8bc4bb0a85db9e0724978c3c41022a368af40a3ca320'

[x86_64-darwin.ic-btc-adapter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-btc-adapter.gz'
sha256 = '3ced0067cc322197af9ba7ee175e7e95eaefa00551690490494884f8f391e978'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/ic-btc-adapter.gz'
sha256 = '81038afad612d0e37cf7779b275d9b4cc066b76c1fe4c91ccc4fd9fbd68145f6'

[x86_64-darwin.ic-https-outcalls-adapter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-https-outcalls-adapter.gz'
sha256 = 'feeb5a08899b4c4c55cd7838928bb75a5845988ecc757ee1059e709e4adfd192'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/ic-https-outcalls-adapter.gz'
sha256 = '249563c669e259aadd0c1a134cb31e8379019a14e9eadd16f9f86104c2752c05'

[x86_64-darwin.ic-nns-init]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-nns-init.gz'
sha256 = '85fd0e91e0a4ebe0272ad0491fd603bf6d313d2293a4266892bff397a26ea930'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/ic-nns-init.gz'
sha256 = '1e78f05b0c5d97b4c4a2a7d22a855e454b59dedc33db1f7ec804c833ba2951a4'

[x86_64-darwin.ic-starter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/ic-starter.gz'
sha256 = '1f33354049b6c83c8be06344d913a8bcfdb61ba9234706a8bf3cdb3d620723ab'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/ic-starter.gz'
sha256 = '86834a7df0c14182c0ce7fc4553cd44c514434bc72317a63917cc11ba6f32914'

[x86_64-darwin.motoko]
url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-Darwin-x86_64-0.10.4.tar.gz'
sha256 = '21cb1e976d4970c64e5335bba74cb76a5b056811b9a6460d1bf9432229026757'
# The replica and canister_sandbox binaries must have the same revision.

[x86_64-darwin.replica]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/replica.gz'
sha256 = 'f320fec5733182e1ceb0dd03d19dc5bec01a1bf7763eb282e3fe14b1e1a6e18b'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/replica.gz'
sha256 = '8688aa4c79ff0a5ad28095d803cb127c9dd70c7a35cf3de44b1243c6e96be1fc'
# The replica and canister_sandbox binaries must have the same revision.

[x86_64-darwin.canister_sandbox]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/canister_sandbox.gz'
sha256 = '4acdd46cf9b1e5be987f6ce72d0118bf9039162e3ff80cd32056da136f753011'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/canister_sandbox.gz'
sha256 = '79804cb8c392723432abafe652b8bae6257d0565508d457203f73b36749fde2c'

[x86_64-darwin.sandbox_launcher]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sandbox_launcher.gz'
sha256 = 'ed0bc2eeaf282012c8475ddf1ca3369488dc80d385e5b194d2823ae84514ff8a'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/sandbox_launcher.gz'
sha256 = '371487252c0ceaa3bb8eaa9c3dd5d58b90fd78c213f01c083c508e3bd0027bdf'

[x86_64-darwin.sns]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-darwin/sns.gz'
sha256 = '04d06a093913ef59d9d4c7cdc14a0751cff6465384d60204e03d5f396edfb38b'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-darwin/sns.gz'
sha256 = 'ac475585362a41de41e73169333992495761b28d9b4839f861f6afc4e0ec7b3f'

[x86_64-darwin.motoko-base]
url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-base-library.tar.gz'
Expand All @@ -56,50 +56,50 @@ url = 'https://github.com/dfinity/bitcoin-canister/releases/download/release%2F2
sha256 = '09f5647a45ff6d5d05b2b0ed48613fb2365b5fe6573ba0e901509c39fb9564ac'

[x86_64-linux.icx-proxy]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/icx-proxy-dev.gz'
sha256 = '2bff6952a65e2d94f49ffa5ce03bfbd0eef0fb6ca82a839844c84fd3efa8b280'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/icx-proxy-dev.gz'
sha256 = '91318ea4c85827681fe691355c1948fa31184d999b41e96cb1ffc38463258317'

[x86_64-linux.ic-admin]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-admin.gz'
sha256 = 'ee6a6d75549bbe355ec4930dd1f6fc1948f973666823d47943adaa2c2bf11902'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/ic-admin.gz'
sha256 = '164f54c98c60bbfb3124f9bac6360278d21539ac05284c17b439a1159f7862f5'

[x86_64-linux.ic-btc-adapter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-btc-adapter.gz'
sha256 = 'd31b5adbf91ba4efa910c80d971c08d591dada6b369119f2b1d444d1e58134ea'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/ic-btc-adapter.gz'
sha256 = '0748bfc4942c3b67f657a40d6b80681373fc398272eeb1134b32803605525ed0'

[x86_64-linux.ic-https-outcalls-adapter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-https-outcalls-adapter.gz'
sha256 = '276faf4aa298c72709076338671fa356a50133ad7996a75748f0a1eabffbfd61'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/ic-https-outcalls-adapter.gz'
sha256 = '65ee3501fa0e6f4b4db216f34bca1b0c33753c877e3ef8f01797972248fcbff8'

[x86_64-linux.ic-nns-init]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-nns-init.gz'
sha256 = 'd58e8efdb8bcd64572bb8dd21a5e9cdb779c06a2c56f3be8ebe7e5709a516897'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/ic-nns-init.gz'
sha256 = 'b00ab9d14d9b0881f00c67f3ef380221cbaccc8f2e71772da52a60c355be2195'

[x86_64-linux.ic-starter]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/ic-starter.gz'
sha256 = '8d8c51033cb2cd20049ca4e048144b895684d7a4fdbd07719476797b53ebafb5'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/ic-starter.gz'
sha256 = 'e65c4cf3fa443ab7cefbf62c871e038852f89e0532642751c305c40532c08261'

[x86_64-linux.motoko]
url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-Linux-x86_64-0.10.4.tar.gz'
sha256 = '48beb994fe4fc1630e83cc98979e0f77130b23bb909ecf7a1b108140d6088856'
# The replica and canister_sandbox binaries must have the same revision.

[x86_64-linux.replica]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/replica.gz'
sha256 = '2cd30cca1818b86785b3d9b808612b7c286252363806c70d196c2fcfa48d1188'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/replica.gz'
sha256 = '3dc274201a2e932b2e170cf364799b598eaed7c63df676c72b1e0cfef1beafcc'
# The replica and canister_sandbox binaries must have the same revision.

[x86_64-linux.canister_sandbox]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/canister_sandbox.gz'
sha256 = '11849a543a162f0f25b3dc10f17c177ea054e4fdb8a8c86509c7f87988ce2913'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/canister_sandbox.gz'
sha256 = 'c6752d7077a5b76a1a9aad00ad56c8f53dd8737d41f2b3cf2d5f8164368a401a'

[x86_64-linux.sandbox_launcher]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sandbox_launcher.gz'
sha256 = '96c416bf98724aa3bf72053d06d559f007f8655261b48f435f9104b605c8f77f'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/sandbox_launcher.gz'
sha256 = '25f575452f68b837c27fe3cda906eb3f966c10c29c95dac8220aaa2e168b0ca9'

[x86_64-linux.sns]
url = 'https://download.dfinity.systems/ic/69e1408347723dbaa7a6cd2faa9b65c42abbe861/openssl-static-binaries/x86_64-linux/sns.gz'
sha256 = '966a84f1e563049e09381b39cbcde24b0c77032ee2cfddb40962eecb70925809'
url = 'https://download.dfinity.systems/ic/072b2a6586c409efa88f2244d658307ff3a645d8/binaries/x86_64-linux/sns.gz'
sha256 = 'ce6f04bae10483bd0e0365f50a65816eb641024b3cc341e7996aaf2ffa8df3de'

[x86_64-linux.motoko-base]
url = 'https://github.com/dfinity/motoko/releases/download/0.10.4/motoko-base-library.tar.gz'
Expand Down
14 changes: 13 additions & 1 deletion src/dfx/src/commands/canister/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ pub fn get_effective_canister_id(
| MgmtMethod::DeleteCanister
| MgmtMethod::DepositCycles
| MgmtMethod::UninstallCode
| MgmtMethod::ProvisionalTopUpCanister => {
| MgmtMethod::ProvisionalTopUpCanister
| MgmtMethod::UploadChunk
| MgmtMethod::ClearChunkStore
| MgmtMethod::StoredChunks => {
#[derive(CandidType, Deserialize)]
struct In {
canister_id: CanisterId,
Expand All @@ -195,6 +198,15 @@ pub fn get_effective_canister_id(
MgmtMethod::ProvisionalCreateCanisterWithCycles => {
Ok(CanisterId::management_canister())
}
MgmtMethod::InstallChunkedCode => {
#[derive(CandidType, Deserialize)]
struct In {
target_canister: Principal,
}
let in_args = Decode!(arg_value, In)
.context("Argument is not valid for InstallChunkedCode")?;
Ok(in_args.target_canister)
}
}
} else {
Ok(canister_id)
Expand Down
10 changes: 9 additions & 1 deletion src/dfx/src/commands/wallet/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ pub async fn exec(env: &dyn Environment, _opts: UpgradeOpts) -> DfxResult {

let agent = env.get_agent();

install_wallet(env, agent, canister_id, InstallMode::Upgrade).await?;
install_wallet(
env,
agent,
canister_id,
InstallMode::Upgrade {
skip_pre_upgrade: false,
},
)
.await?;

println!("Upgraded the wallet wasm module.");
Ok(())
Expand Down
10 changes: 9 additions & 1 deletion src/dfx/src/lib/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ async fn migrate_wallet(
if !wallet.version_supports_u128_cycles() {
if fix {
println!("Upgrading wallet... ");
install_wallet(env, agent, *wallet.canister_id_(), InstallMode::Upgrade).await?
install_wallet(
env,
agent,
*wallet.canister_id_(),
InstallMode::Upgrade {
skip_pre_upgrade: false,
},
)
.await?
} else {
println!("The wallet is outdated; run `dfx wallet upgrade`");
}
Expand Down
11 changes: 7 additions & 4 deletions src/dfx/src/lib/operations/canister/install_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ pub async fn install_canister(
);
let mode = mode.unwrap_or_else(|| {
if installed_module_hash.is_some() {
InstallMode::Upgrade
InstallMode::Upgrade {
skip_pre_upgrade: false,
}
} else {
InstallMode::Install
}
});
if let Some(canister_info) = canister_info {
if !skip_consent && matches!(mode, InstallMode::Reinstall | InstallMode::Upgrade) {
if !skip_consent && matches!(mode, InstallMode::Reinstall | InstallMode::Upgrade { .. }) {
let candid = read_module_metadata(agent, canister_id, "candid:service").await;
if let Some(candid) = &candid {
match check_candid_compatibility(canister_info, candid) {
Expand All @@ -85,7 +87,8 @@ pub async fn install_canister(
}
}
}
if !skip_consent && canister_info.is_motoko() && matches!(mode, InstallMode::Upgrade) {
if !skip_consent && canister_info.is_motoko() && matches!(mode, InstallMode::Upgrade { .. })
{
let stable_types =
read_module_metadata(agent, canister_id, "motoko:stable-types").await;
if let Some(stable_types) = &stable_types {
Expand Down Expand Up @@ -120,7 +123,7 @@ pub async fn install_canister(
let new_hash = Sha256::digest(&wasm_module);
debug!(log, "New wasm module hash: {}", hex::encode(new_hash));

if mode == InstallMode::Upgrade
if matches!(mode, InstallMode::Upgrade { .. })
&& matches!(&installed_module_hash, Some(old_hash) if old_hash[..] == new_hash[..])
&& !upgrade_unchanged
{
Expand Down
Loading