Skip to content

Commit

Permalink
feat: improve multisig utility and usability
Browse files Browse the repository at this point in the history
BREAKING CHANGES:

- (api-changes) `CanRegisterAnyTrigger` `CanUnregisterAnyTrigger` permissions for system authority
- (api-changes) `GenesisWasmTrigger` in `RawGenesisTransaction` for `genesis.json` readability
- (api-changes) `Multisig*Args` for multi-signature operations
- (config-changes) `genesis.json` assumes `wasm_triggers[*].action.executable` is prebuilt under `wasm_dir`

Major commits:

- feat: support multisig recursion
- feat: introduce multisig quorum and weights
- feat: add multisig subcommand to client CLI
- feat: introduce multisig transaction time-to-live
- feat: predefine multisig world-level trigger in genesis
- feat: allow accounts in domain to register multisig accounts

Signed-off-by: Shunkichi Sato <49983831+s8sato@users.noreply.github.com>
  • Loading branch information
s8sato committed Oct 26, 2024
1 parent ac0ec33 commit 20cba30
Show file tree
Hide file tree
Showing 93 changed files with 2,275 additions and 689 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ updates:
target-branch: "main"
directories:
- /
- /wasm_samples
- /wasm
schedule:
interval: "daily"
commit-message:
Expand Down
44 changes: 25 additions & 19 deletions .github/workflows/iroha2-custom-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ env:
IROHA2_RUSTFLAGS: -C force-frame-pointers=on
IROHA2_FEATURES: profiling
IROHA2_CARGOFLAGS: -Z build-std
DOCKER_COMPOSE_PATH: defaults
DEFAULTS_DIR: defaults

jobs:
build_executor:
build_wasm_libs:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
Expand All @@ -49,30 +49,32 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.CHECKOUT_REF }}
- name: Build iroha executor
run: mold --run cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
- name: Build wasm libs
run: ./scripts/build_wasm.sh libs
- name: Upload wasm libs to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
retention-days: 1

registry-profiling-image:
if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'false' }}
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
needs: build_wasm_libs
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.CHECKOUT_REF }}
- name: Download executor.wasm file
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Get the release tag
run: |
RELEASE_VERSION=${{ github.ref_name }}
Expand Down Expand Up @@ -115,18 +117,20 @@ jobs:
registry-glibc-image:
if: ${{ inputs.BUILD_GLIBC_IMAGE == 'true' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'false' }}
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
needs: build_wasm_libs
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.CHECKOUT_REF }}
- name: Download executor.wasm file
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
Expand All @@ -152,18 +156,20 @@ jobs:
registry-alpine-image:
if: ${{ inputs.BUILD_GLIBC_IMAGE == 'false' }} and ${{ inputs.BUILD_ALPINE_IMAGE == 'true' }}
runs-on: [self-hosted, Linux, iroha2]
needs: build_executor
needs: build_wasm_libs
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.CHECKOUT_REF }}
- name: Download executor.wasm file
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/iroha2-dev-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,39 @@ name: I2::Dev::Nightly::Publish
on: workflow_dispatch

env:
DOCKER_COMPOSE_PATH: defaults
DEFAULTS_DIR: defaults

jobs:
build_executor:
build_wasm_libs:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build iroha executor
run: mold --run cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
- name: Build wasm libs
run: ./scripts/build_wasm.sh libs
- name: Upload wasm libs to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
retention-days: 1

dockerhub:
runs-on: ubuntu-latest
needs: build_executor
needs: build_wasm_libs
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm file
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/iroha2-dev-pr-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

env:
DOCKER_COMPOSE_PATH: defaults
DEFAULTS_DIR: defaults

jobs:
smart_contracts_analysis:
Expand All @@ -24,8 +24,8 @@ jobs:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
- name: cargo fmt (wasm_samples)
working-directory: wasm_samples
- name: cargo fmt (wasm)
working-directory: wasm
run: cargo fmt --all -- --check

python_static_analysis:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ concurrency:
cancel-in-progress: true

env:
DOCKER_COMPOSE_PATH: defaults
DEFAULTS_DIR: defaults

jobs:
build_executor:
Expand All @@ -46,13 +46,13 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build iroha executor
run: mold --run cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Build wasm libs
run: mold --run cargo run --bin iroha_wasm_builder -- build ./wasm/libs/default_executor --optimize --out-file ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Upload executor to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
path: ${{ env.DEFAULTS_DIR }}/executor.wasm
retention-days: 1

tests:
Expand All @@ -66,7 +66,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
path: ${{ env.DEFAULTS_DIR }}
- name: Install iroha_wasm_test_runner
run: which iroha_wasm_test_runner || cargo install --path crates/iroha_wasm_test_runner
- name: Run smart contract tests on WebAssembly VM
Expand Down
59 changes: 26 additions & 33 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ concurrency:
env:
CARGO_TERM_COLOR: always
IROHA_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
DOCKER_COMPOSE_PATH: defaults
WASM_SAMPLES_TARGET_DIR: wasm_samples/target/prebuilt
DEFAULTS_DIR: defaults
WASM_TARGET_DIR: wasm/target/prebuilt
TEST_NETWORK_TMP_DIR: /tmp
NEXTEST_PROFILE: ci

Expand Down Expand Up @@ -63,49 +63,40 @@ jobs:
name: report-clippy
path: clippy.json

build_wasm_samples:
build_wasm:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build
run: ./scripts/build_wasm_samples.sh
run: ./scripts/build_wasm.sh
- name: Upload all built WASMs
uses: actions/upload-artifact@v4
with:
name: wasm_samples
path: ${{ env.WASM_SAMPLES_TARGET_DIR }}
retention-days: 1
- name: Upload executor.wasm specifically
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
name: wasm
path: ${{ env.WASM_TARGET_DIR }}
retention-days: 1

test_with_coverage:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
needs: build_wasm_samples
needs: build_wasm
env:
LLVM_PROFILE_FILE_NAME: "iroha-%p-%m.profraw"
steps:
- uses: actions/checkout@v4
- uses: taiki-e/install-action@nextest
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Download executor.wasm
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Download the rest of WASM samples
- name: Download wasm
uses: actions/download-artifact@v4
with:
name: wasm_samples
path: ${{ env.WASM_SAMPLES_TARGET_DIR }}
name: wasm
path: ${{ env.WASM_TARGET_DIR }}
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Install irohad
run: which irohad || cargo install --path crates/irohad --locked
- name: Test with no default features
Expand Down Expand Up @@ -169,7 +160,7 @@ jobs:
context: .

docker-compose-and-pytests:
needs: build_wasm_samples
needs: build_wasm
runs-on: [self-hosted, Linux, iroha2]
timeout-minutes: 60
env:
Expand All @@ -181,11 +172,13 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download executor.wasm
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.WASM_TARGET_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Install Python and Poetry
run: |
yum install -y python${{ env.PYTHON_VERSION }} python${{ env.PYTHON_VERSION }}-devel
Expand All @@ -211,14 +204,14 @@ jobs:
cache-to: type=gha,mode=max
- name: Test docker-compose.single.yml
run: |
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.single.yml up --wait || exit 1
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.single.yml down
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.single.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.single.yml down
- name: Test docker-compose.local.yml
run: |
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.local.yml up --wait || exit 1
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.local.yml down
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.local.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.local.yml down
- name: Run docker-compose.yml containers
run: docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.yml up --wait || exit 1
run: docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.yml up --wait || exit 1
- name: Install Torii pytest dependencies
working-directory: pytests/iroha_torii_tests
run: ${{ env.POETRY_PATH }} install
Expand Down Expand Up @@ -248,8 +241,8 @@ jobs:
cd pytests/iroha_cli_tests
${{ env.POETRY_PATH }} run pytest
on_retry_command: |
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.yml down
docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.local.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.yml down
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.local.yml up --wait || exit 1
- name: Wipe docker-compose.yml containers
if: always()
run: docker compose -f ${{ env.DOCKER_COMPOSE_PATH }}/docker-compose.yml down
run: docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.yml down
Loading

0 comments on commit 20cba30

Please sign in to comment.