Skip to content

Commit

Permalink
Merge branch 'master' into ens/changelog-0.24.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswanson-dfinity authored Nov 14, 2024
2 parents 72cdb3c + bd0e8bb commit 1a6ca1c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 32 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ You must open a new terminal to continue developing. If you'd prefer to stop, qu

## Dependencies

### Motoko

Updated Motoko to [0.13.3](https://github.com/dfinity/motoko/releases/tag/0.13.3)

### Replica

Updated replica to elected commit a62848817cec7ae50618a87a526c85d020283fd9.
Expand Down Expand Up @@ -77,6 +81,15 @@ This incorporates the following executed proposals:

# 0.24.2

### feat: all commands will use the DFX_NETWORK from the environment

If `DFX_NETWORK` is set in the environment, all commands will use that network by default.
The `--network` parameter will take precedence if provided.

### fix: dfx generate now honors the --network parameter
This fixes an issue where `dfx deploy --playground` would fail if the project
had not been previously built for the local network.

### feat: Support canister log allowed viewer list

Added support for the canister log allowed viewer list, enabling specified users to access a canister's logs without needing to be set as the canister's controller.
Expand Down
5 changes: 5 additions & 0 deletions docs/cli-reference/dfx-envars.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ Use the `DFX_INSTALLATION_ROOT` environment variable to specify a different loca

The `.cache/dfinity/uninstall.sh` script uses this environment variable to identify the root directory for your SDK installation.

## DFX_NETWORK

Use the `DFX_NETWORK` environment variable to specify the network that you want to use when you run `dfx` commands.
If you pass the `--network` option to a `dfx` command, the value of the `DFX_NETWORK` environment variable is ignored.

## DFX_VERSION

Use the `DFX_VERSION` environment variable to identify a specific version of the SDK that you want to install.
Expand Down
9 changes: 4 additions & 5 deletions e2e/tests-dfx/generate.bash
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,13 @@ teardown() {
assert_command dfx generate
}

@test "dfx generate --network is still valid" {
# The option has no effect, but is still accepted to not break existing scripts
@test "dfx generate --network is accepted" {
dfx_new hello
assert_command dfx generate --network local
assert_file_exists ".dfx/local/canisters/hello_backend/service.did"

# Option is not advertised anymore
assert_command dfx generate --help
assert_not_contains "--network"
assert_command dfx generate --playground
assert_file_exists ".dfx/playground/canisters/hello_backend/service.did"
}

@test "dfx generate does not delete source candid file of Rust canister when bindings contains no did" {
Expand Down
14 changes: 14 additions & 0 deletions e2e/tests-dfx/playground.bash
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ setup_playground() {
assert_command dfx canister --playground info "$CANISTER"
}

@test "deploy fresh project to playground" {
cd ..
rm -rf hello
dfx_new_frontend hello

[[ "$USE_POCKETIC" ]] && assert_command dfx canister create --all --playground
[[ "$USE_POCKETIC" ]] && assert_command dfx ledger fabricate-cycles --t 9999999 --canister hello_backend --playground
[[ "$USE_POCKETIC" ]] && assert_command dfx ledger fabricate-cycles --t 9999999 --canister hello_frontend --playground

assert_command dfx deploy --playground
assert_command dfx canister --playground call hello_backend greet '("player")'
assert_match "Hello, player!"
}

@test "Handle timeout correctly" {
assert_command dfx canister create hello_backend --playground -vv
assert_match "Reserved canister 'hello_backend'"
Expand Down
18 changes: 9 additions & 9 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,27 @@
"builtin": false,
"description": "The Motoko base library",
"owner": "dfinity",
"sha256": "0qq8dlzjy4dkp5jn2ly21aw8n024fmkvhisca2qswhsqbg2wwv3x",
"sha256": "0i2jrys9qj6w776f3nrifhvs7s4rrhwlnqmd7dlawd0qk8ns4zk9",
"type": "tarball",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-base-library.tar.gz",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-base-library.tar.gz",
"url_template": "https://github.com/dfinity/motoko/releases/download/<version>/motoko-base-library.tar.gz",
"version": "0.13.2"
"version": "0.13.3"
},
"motoko-x86_64-darwin": {
"builtin": false,
"sha256": "1pb5jn7nr5s18hqpcvzc4szkdnrk2h417d6dpwnrrx8l3fqvx1m3",
"sha256": "0c4njswid1z3aw298y2vd7sx618ijb8ixgjsh99vlazm9yai5wi1",
"type": "file",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-Darwin-x86_64-0.13.2.tar.gz",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-Darwin-x86_64-0.13.3.tar.gz",
"url_template": "https://github.com/dfinity/motoko/releases/download/<version>/motoko-Darwin-x86_64-<version>.tar.gz",
"version": "0.13.2"
"version": "0.13.3"
},
"motoko-x86_64-linux": {
"builtin": false,
"sha256": "1i1adh7a5yn10a8k1sjnl8bp8k2sxfmmy5smy2phj28lzwm374j9",
"sha256": "110hx0da5bspv4ida3xwf2mpiwmn6axq8cnnq0vinzfrajb5r2qm",
"type": "file",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-Linux-x86_64-0.13.2.tar.gz",
"url": "https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-Linux-x86_64-0.13.3.tar.gz",
"url_template": "https://github.com/dfinity/motoko/releases/download/<version>/motoko-Linux-x86_64-<version>.tar.gz",
"version": "0.13.2"
"version": "0.13.3"
},
"pocket-ic-x86_64-darwin": {
"rev": "a62848817cec7ae50618a87a526c85d020283fd9",
Expand Down
4 changes: 0 additions & 4 deletions scripts/workflows/e2e-matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ def test_scripts(prefix):
{
"backend": "pocketic",
"test": "dfx/canister_http_adapter"
},
{
"backend": "pocketic",
"test": "dfx/canister_logs"
}
]
}
Expand Down
16 changes: 8 additions & 8 deletions src/dfx/assets/dfx-asset-sources.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ url = 'https://download.dfinity.systems/ic/a62848817cec7ae50618a87a526c85d020283
sha256 = 'f999d8a7e582bee1dce787d36224f749cf17d52c0623e0752cdbffba47879f4c'

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

[x86_64-darwin.replica]
Expand Down Expand Up @@ -53,8 +53,8 @@ url = 'https://download.dfinity.systems/ic/a62848817cec7ae50618a87a526c85d020283
sha256 = 'fd47abe1876c3bf08246f97908c6badb3cf84ca402d8f4015759883d69689af6'

[x86_64-darwin.motoko-base]
url = 'https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-base-library.tar.gz'
sha256 = 'd456d015745af15ce8ee731ce184163b8f2385a1ba45741393da667f08a376db'
url = 'https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-base-library.tar.gz'
sha256 = 'e48cb7ea6685f5afcfc189f7f3292ca015dda5e1b4c19fb30c7f1211f8733adc'

[x86_64-darwin.ic-btc-canister]
url = 'https://github.com/dfinity/bitcoin-canister/releases/download/release%2F2023-10-13/ic-btc-canister.wasm.gz'
Expand All @@ -81,8 +81,8 @@ url = 'https://download.dfinity.systems/ic/a62848817cec7ae50618a87a526c85d020283
sha256 = 'a13497bf7d255b3a235b14967934ec766a93dca1b410ce953880d86fb4b5c422'

[x86_64-linux.motoko]
url = 'https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-Linux-x86_64-0.13.2.tar.gz'
sha256 = '4992332aff140909aff055175fabeb5a4c7417a256ea309102c1faa20e6c2ac4'
url = 'https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-Linux-x86_64-0.13.3.tar.gz'
sha256 = '158b5c9654d97d1b37c0d63284bb32b6f278ab70bc0fd522d957afa21ae81084'
# The replica, canister_sandbox and compiler_sandbox binaries must have the same revision.

[x86_64-linux.replica]
Expand Down Expand Up @@ -112,8 +112,8 @@ url = 'https://download.dfinity.systems/ic/a62848817cec7ae50618a87a526c85d020283
sha256 = '7b14e2a196dd24ab171990ea755746f4b8c0776eaca64951be4150f83c019099'

[x86_64-linux.motoko-base]
url = 'https://github.com/dfinity/motoko/releases/download/0.13.2/motoko-base-library.tar.gz'
sha256 = 'd456d015745af15ce8ee731ce184163b8f2385a1ba45741393da667f08a376db'
url = 'https://github.com/dfinity/motoko/releases/download/0.13.3/motoko-base-library.tar.gz'
sha256 = 'e48cb7ea6685f5afcfc189f7f3292ca015dda5e1b4c19fb30c7f1211f8733adc'

[x86_64-linux.ic-btc-canister]
url = 'https://github.com/dfinity/bitcoin-canister/releases/download/release%2F2023-10-13/ic-btc-canister.wasm.gz'
Expand Down
9 changes: 4 additions & 5 deletions src/dfx/src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::lib::builders::BuildConfig;
use crate::lib::environment::Environment;
use crate::lib::error::DfxResult;
use crate::lib::models::canister::CanisterPool;
use crate::lib::network::network_opt::NetworkOpt;
use clap::Parser;
use tokio::runtime::Runtime;

Expand All @@ -14,14 +15,12 @@ pub struct GenerateOpts {
/// If you do not specify a canister name, generates types for all canisters.
canister_name: Option<String>,

// Deprecated/hidden because it had/has no effect.
// Cannot use 'hide' on a flattened object - inlined the flattened network specifier
#[arg(long, global = true, hide = true)]
network: Option<String>,
#[command(flatten)]
network: NetworkOpt,
}

pub fn exec(env: &dyn Environment, opts: GenerateOpts) -> DfxResult {
let env = create_anonymous_agent_environment(env, None)?;
let env = create_anonymous_agent_environment(env, opts.network.to_network_name())?;
let log = env.get_logger();

// Read the config.
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/lib/network/network_opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct NetworkOpt {
/// A valid URL (starting with `http:` or `https:`) can be used here, and a special
/// ephemeral network will be created specifically for this request. E.g.
/// "http://localhost:12345/" is a valid network name.
#[arg(long, global(true), group = "network-select")]
#[arg(long, env = "DFX_NETWORK", global(true), group = "network-select")]
network: Option<String>,

/// Shorthand for --network=playground.
Expand Down

0 comments on commit 1a6ca1c

Please sign in to comment.