Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/backend-motoko-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
with:
mops-version: 2
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/backend-motoko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
with:
mops-version: 2
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Run MOPS Test Linux
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eExuo pipefail
cd backend/mo/ic_vetkeys
Expand All @@ -47,12 +52,17 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- uses: ZenVoich/setup-mops@3e94e453352269b34137b5ce49f09a8df81bed7d # v1.4.1
with:
mops-version: 2
- name: Provision Darwin
run: bash .github/workflows/provision-darwin.sh
- name: Run MOPS Test Darwin
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eExuo pipefail
cd backend/mo/ic_vetkeys
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- backend/**/canisters/**
- package.json
- package-lock.json
- .github/workflows/frontend_ic_vetkeys.yml
- .github/workflows/frontend.yml
- .github/workflows/provision-darwin.sh
- .github/workflows/provision-linux.sh
concurrency:
Expand All @@ -24,9 +24,14 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Frontend Tests and Lint
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eExuo pipefail
npm install
Expand All @@ -40,10 +45,15 @@ jobs:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22'
- name: Provision Darwin
run: |
bash .github/workflows/provision-darwin.sh
- name: Frontend Tests and Lint
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eExuo pipefail
npm install
Expand Down
25 changes: 2 additions & 23 deletions .github/workflows/provision-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,8 @@ set -ex
# Enter temporary directory.
pushd /tmp

# Install Node.
brew install nodejs

# Install DFINITY SDK.
curl --location --output install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.26.1} DFXVM_INIT_YES=true bash install-dfx.sh
rm install-dfx.sh
echo "$HOME/Library/Application Support/org.dfinity.dfx/bin" >> $GITHUB_PATH
source "$HOME/Library/Application Support/org.dfinity.dfx/env"
dfx cache install

# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
# if so, update the dfx cache with the latest ic artifacts
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
arch="x86_64-darwin"
if [ "$current_sha" != "$stable_sha" ]; then
export current_sha
export arch
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
fi
fi
# Install icp-cli (requires Node.js >=22, set up via actions/setup-node in the workflow).
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm ic-mops

# Install rust
curl --location --output install-rustup.sh "https://sh.rustup.rs"
Expand Down
26 changes: 3 additions & 23 deletions .github/workflows/provision-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,12 @@ set -ex
# Enter temporary directory.
pushd /tmp

# Install Node.
sudo apt-get install nodejs

# Install DFINITY SDK.
wget --output-document install-dfx.sh "https://raw.githubusercontent.com/dfinity/sdk/master/public/install-dfxvm.sh"
DFX_VERSION=${DFX_VERSION:=0.26.1} DFXVM_INIT_YES=true bash install-dfx.sh
rm install-dfx.sh
echo "$HOME/.local/share/dfx/bin" >>$GITHUB_PATH
source "$HOME/.local/share/dfx/env"
dfx cache install
# check the current ic-commit found in the main branch, check if it differs from the one in this PR branch
# if so, update the dfx cache with the latest ic artifacts
if [ -f "${GITHUB_WORKSPACE}/.ic-commit" ]; then
stable_sha=$(curl https://raw.githubusercontent.com/dfinity/examples/master/.ic-commit)
current_sha=$(sed <"$GITHUB_WORKSPACE/.ic-commit" 's/#.*$//' | sed '/^$/d')
arch="x86_64-linux"
if [ "$current_sha" != "$stable_sha" ]; then
export current_sha
export arch
sh "$GITHUB_WORKSPACE/.github/workflows/update-dfx-cache.sh"
fi
fi
# Install icp-cli (requires Node.js >=22, set up via actions/setup-node in the workflow).
npm install -g @icp-sdk/icp-cli @icp-sdk/ic-wasm ic-mops

# Install rust
wget --output-document install-rustup.sh "https://sh.rustup.rs"
sudo bash install-rustup.sh -y
bash install-rustup.sh -y
rustup target add wasm32-unknown-unknown

# Set environment variables.
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target/
.idea/

**/.dfx/*
**/.icp/cache
**/deps/*
backend/**/declarations
examples/**/declarations
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
canisters:
- name: ic_vetkeys_encrypted_maps_canister
recipe:
type: "@dfinity/motoko@v4.1.0"
configuration:
main: src/Main.mo
14 changes: 0 additions & 14 deletions backend/mo/canisters/ic_vetkeys_manager_canister/dfx.json

This file was deleted.

6 changes: 6 additions & 0 deletions backend/mo/canisters/ic_vetkeys_manager_canister/icp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
canisters:
- name: ic_vetkeys_manager_canister
recipe:
type: "@dfinity/motoko@v4.1.0"
configuration:
main: src/Main.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ ROOT_DIR := $(shell git rev-parse --show-toplevel)
compile-wasm:
cargo build --release --target wasm32-unknown-unknown

.PHONY: test
.SILENT: test
test: compile-wasm
cargo test -p ic-vetkeys-encrypted-maps-canister

.PHONY: extract-candid
.SILENT: extract-candid
extract-candid: compile-wasm
Expand All @@ -14,4 +19,4 @@ extract-candid: compile-wasm
.SILENT: clean
clean:
cargo clean
rm -rf .dfx
rm -rf .icp/cache

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ fn should_access_map_values() {
let map_name = random_map_name(rng);

let mut authorized_users = vec![(caller, AccessRights::ReadWriteManage)];
let mut keyvals = vec![];
let mut keyvals: BTreeMap<ByteBuf, ByteBuf> = BTreeMap::new();

for _ in 0..3 {
let map_key = random_map_key(rng);
Expand Down Expand Up @@ -697,7 +697,7 @@ fn should_access_map_values() {
authorized_users.push((user_to_be_added, access_rights));
}

keyvals.push((map_key, encrypted_value));
keyvals.insert(map_key, encrypted_value);
}

for (map_key, encrypted_value) in keyvals.clone() {
Expand All @@ -714,7 +714,7 @@ fn should_access_map_values() {
}

for (user, _access_rights) in authorized_users.clone() {
let expected_map = BTreeMap::from_iter(keyvals.clone());
let expected_map = keyvals.clone();
let computed_map_single = BTreeMap::from_iter(
env.query::<Result<Vec<(ByteBuf, ByteBuf)>, String>>(
user,
Expand Down Expand Up @@ -984,7 +984,7 @@ impl TestEnvironment {
pic.install_canister(
example_canister_id,
example_wasm_bytes,
encode_one("dfx_test_key").unwrap(),
encode_one("test_key_1").unwrap(),
None,
);

Expand Down Expand Up @@ -1032,14 +1032,20 @@ impl TestEnvironment {

fn load_encrypted_maps_example_canister_wasm() -> Vec<u8> {
let wasm_path_string = match std::env::var("CUSTOM_WASM_PATH") {
Ok(path) if !path.is_empty() => path,
Ok(path) if !path.is_empty() => {
assert!(
Path::new(&path).exists(),
"CUSTOM_WASM_PATH is set to '{}' but the file does not exist; run `make compile-wasm` first",
path
);
path
}
_ => format!(
"{}/target/wasm32-unknown-unknown/release/ic_vetkeys_encrypted_maps_canister.wasm",
git_root_dir()
),
};
let wasm_path = Path::new(&wasm_path_string);
std::fs::read(wasm_path)
std::fs::read(&wasm_path_string)
.expect("wasm does not exist - run `cargo build --release --target wasm32-unknown-unknown`")
}

Expand Down
6 changes: 5 additions & 1 deletion backend/rs/canisters/ic_vetkeys_manager_canister/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ ROOT_DIR := $(shell git rev-parse --show-toplevel)
compile-wasm:
cargo build --release --target wasm32-unknown-unknown

.PHONY: test
.SILENT: test
test: compile-wasm
cargo test -p ic-vetkeys-manager-canister

.PHONY: extract-candid
.SILENT: extract-candid
extract-candid: compile-wasm
candid-extractor $(ROOT_DIR)/target/wasm32-unknown-unknown/release/ic_vetkeys_manager_canister.wasm > ic_vetkeys_manager_canister.did

10 changes: 0 additions & 10 deletions backend/rs/canisters/ic_vetkeys_manager_canister/dfx.json

This file was deleted.

14 changes: 10 additions & 4 deletions backend/rs/canisters/ic_vetkeys_manager_canister/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ impl TestEnvironment {
pic.install_canister(
example_canister_id,
example_wasm_bytes,
encode_one("dfx_test_key").unwrap(),
encode_one("test_key_1").unwrap(),
None,
);

Expand Down Expand Up @@ -579,14 +579,20 @@ impl TestEnvironment {

fn load_key_manager_example_canister_wasm() -> Vec<u8> {
let wasm_path_string = match std::env::var("CUSTOM_WASM_PATH") {
Ok(path) if !path.is_empty() => path,
Ok(path) if !path.is_empty() => {
assert!(
Path::new(&path).exists(),
"CUSTOM_WASM_PATH is set to '{}' but the file does not exist; run `make compile-wasm` first",
path
);
path
}
_ => format!(
"{}/target/wasm32-unknown-unknown/release/ic_vetkeys_manager_canister.wasm",
git_root_dir()
),
};
let wasm_path = Path::new(&wasm_path_string);
std::fs::read(wasm_path)
std::fs::read(&wasm_path_string)
.expect("wasm does not exist - run `cargo build --release --target wasm32-unknown-unknown`")
}

Expand Down
19 changes: 19 additions & 0 deletions backend/rs/canisters/icp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
canisters:
- name: ic_vetkeys_manager_canister
recipe:
type: "@dfinity/rust@v3.2.0"
configuration:
package: ic-vetkeys-manager-canister
candid: ic_vetkeys_manager_canister/ic_vetkeys_manager_canister.did
init_args:
type: text
value: "(\"key_1\")"
- name: ic_vetkeys_encrypted_maps_canister
recipe:
type: "@dfinity/rust@v3.2.0"
configuration:
package: ic-vetkeys-encrypted-maps-canister
candid: ic_vetkeys_encrypted_maps_canister/ic_vetkeys_encrypted_maps_canister.did
init_args:
type: text
value: "(\"key_1\")"
Loading
Loading