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
5 changes: 4 additions & 1 deletion .github/actions/run-e2e-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
default: '4'
test-case:
description: 'Name of test to run.'
required: true
required: false
randomized:
description: 'Whether to use randomized test params.'
required: false
Expand Down Expand Up @@ -69,15 +69,18 @@ runs:
run: docker logs Node0 --follow &

- name: Download artifact with the test suite image
if: inputs.test-case != ''
uses: actions/download-artifact@v2
with:
name: aleph-e2e-client

- name: Load test suite docker image
if: inputs.test-case != ''
shell: bash
run: docker load -i aleph-e2e-client.tar

- name: Run single e2e test
if: inputs.test-case != ''
shell: bash
run: |
ARGS=(
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/e2e-tests-main-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ jobs:
if-no-files-found: error
retention-days: 7

run-aleph-client-subxt-codegen-check:
needs: [build-test-docker]
name: Checks if runtime file in aleph-client is up-to-date
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Run one node in the background
uses: ./.github/actions/run-e2e-test
with:
node-count: 1
min-validator-count: 1

- name: check if runtime metadata matches
run: |
cd aleph-client
docker pull public.ecr.aws/p6e8q1z1/subxt-client-integration:latest
docker run --rm --network host --mount type=bind,source="$(pwd)/..",target=/subxt/aleph-node public.ecr.aws/p6e8q1z1/subxt-client-integration:latest

run-e2e-finalization-test:
needs: [build-test-docker, build-test-client]
Expand Down
2 changes: 2 additions & 0 deletions aleph-client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**
!docker/subxt-integration-entrypoint.sh
18 changes: 18 additions & 0 deletions aleph-client/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This directory contains following files:
### `subxt-integration.Dockerfile`
This is not a main `aleph-client`, rather it is a helper Dockerfile to run on GH, which has `subxt` tool.

It requires:
* an `aleph-node` chain to be run in the background (ie `127.0.0.1:9944` port must be opened),
* access to `rustfmt.toml`,
* access to current `aleph_zero.rs` file

The docker checks whether a `subxt`-generated runtime metadata is the same as from the current commit.

It needs to be run only from `aleph-client` directory and in network host mode:
```bash
docker run --network host --mount type=bind,source="$(pwd)/..",target=/subxt/aleph-node subxt:latest
```

### `subxt-integration-entrypoint.sh`
An entrypoint for above Dockerfile
12 changes: 12 additions & 0 deletions aleph-client/docker/subxt-integration-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

subxt codegen --derive Clone --derive Debug --derive Eq --derive PartialEq | rustfmt --edition=2021 --config-path aleph-node/rustfmt.toml > aleph_zero.rs
diff -y -W 200 --suppress-common-lines aleph_zero.rs aleph-node/aleph-client/src/aleph_zero.rs
diff_exit_code=$?
if [[ ! $diff_exit_code -eq 0 ]]; then
echo "Current runtime metadata is different than versioned in git!"
echo "Run subxt codegen --derive Clone --derive Debug --derive Eq --derive PartialEq | rustfmt --edition=2021 >" \
"src/aleph_zero.rs from aleph-client directory and commit to git."
exit 1
fi
echo "Current runtime metadata and versioned in git matches."
13 changes: 13 additions & 0 deletions aleph-client/docker/subxt-integration.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM rustlang/rust:nightly-slim

WORKDIR subxt

RUN cargo install subxt-cli
RUN rustup component add rustfmt --toolchain nightly

COPY docker/subxt-integration-entrypoint.sh /subxt/subxt-integration-entrypoint.sh

RUN chmod +x /subxt/subxt-integration-entrypoint.sh
RUN rustc --version

ENTRYPOINT ["./subxt-integration-entrypoint.sh"]
7 changes: 7 additions & 0 deletions aleph-client/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
edition = "2021"
use_field_init_shorthand = true
reorder_modules = true

imports_granularity = "Crate"
group_imports = "StdExternalCrate"
reorder_imports = true
13 changes: 6 additions & 7 deletions aleph-client/src/aleph_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6409,10 +6409,9 @@ pub mod api {
"FinalityVersion",
vec![],
[
134u8, 19u8, 94u8, 247u8, 125u8, 18u8, 148u8, 160u8, 167u8, 235u8,
174u8, 4u8, 107u8, 69u8, 55u8, 187u8, 249u8, 13u8, 129u8, 99u8, 116u8,
158u8, 38u8, 29u8, 239u8, 112u8, 150u8, 92u8, 151u8, 197u8, 223u8,
30u8,
99u8, 158u8, 103u8, 180u8, 128u8, 32u8, 84u8, 110u8, 229u8, 2u8, 3u8,
114u8, 95u8, 125u8, 230u8, 210u8, 56u8, 85u8, 38u8, 136u8, 49u8, 206u8,
6u8, 136u8, 193u8, 164u8, 251u8, 60u8, 125u8, 91u8, 205u8, 144u8,
],
)
}
Expand Down Expand Up @@ -19533,9 +19532,9 @@ pub mod api {
let runtime_metadata_hash = client.metadata().metadata_hash(&PALLETS);
if runtime_metadata_hash
!= [
155u8, 236u8, 207u8, 138u8, 149u8, 114u8, 96u8, 168u8, 143u8, 247u8, 148u8, 106u8,
148u8, 203u8, 48u8, 129u8, 14u8, 48u8, 155u8, 234u8, 78u8, 212u8, 73u8, 65u8,
212u8, 201u8, 174u8, 194u8, 72u8, 70u8, 240u8, 233u8,
10u8, 121u8, 157u8, 11u8, 147u8, 107u8, 235u8, 73u8, 90u8, 254u8, 82u8, 183u8,
112u8, 64u8, 213u8, 99u8, 23u8, 17u8, 10u8, 91u8, 124u8, 231u8, 209u8, 172u8, 59u8,
160u8, 15u8, 142u8, 149u8, 200u8, 95u8, 164u8,
]
{
Err(::subxt::error::MetadataError::IncompatibleMetadata)
Expand Down