Skip to content

Commit ee89e6a

Browse files
author
Damian Leśniak
committed
Merge branch 'main' into A0-1667-tcp-dialer-timeouts
2 parents 5e9a3e2 + 3274948 commit ee89e6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2120
-1614
lines changed

.github/workflows/build-node-and-runtime.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,24 @@ on:
1212
required: false
1313
type: string
1414

15-
1615
jobs:
1716
build:
1817
name: Build binary artifacts
1918
runs-on: ubuntu-20.04
2019
env:
2120
RUST_BACKTRACE: full
21+
SECRETS_AWS_MAINNET_ACCESS_KEY_ID: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
22+
SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
2223
steps:
2324
- name: Checkout source code
2425
uses: actions/checkout@v2
2526
with:
2627
ref: ${{ inputs.ref }}
2728

29+
- name: Get branch name and commit SHA
30+
id: get_branch
31+
uses: ./.github/actions/get-branch
32+
2833
- name: Install Rust toolchain
2934
uses: actions-rs/toolchain@v1
3035

@@ -61,6 +66,40 @@ jobs:
6166
if-no-files-found: error
6267
retention-days: 7
6368

69+
- name: S3 CI | Configure AWS credentials
70+
if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != ''
71+
uses: aws-actions/configure-aws-credentials@v1
72+
env:
73+
AWS_REGION: us-east-1
74+
with:
75+
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
76+
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
77+
aws-region: ${{ env.AWS_REGION }}
78+
79+
- name: S3 CI | Copy release binary to S3 bucket
80+
if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != ''
81+
shell: bash
82+
env:
83+
BINARY_DIR: target/production
84+
BINARY_FILE: aleph-node
85+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-node
86+
S3BUCKET_FILE: aleph-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
87+
run: |
88+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
89+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
90+
91+
- name: S3 CI | Copy release runtime to S3 bucket
92+
if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != ''
93+
shell: bash
94+
env:
95+
BINARY_DIR: target/production/wbuild/aleph-runtime
96+
BINARY_FILE: aleph_runtime.compact.wasm
97+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
98+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
99+
run: |
100+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
101+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
102+
64103
- name: Build test binary
65104
run: cargo build --release -p aleph-node --features "short_session enable_treasury_proposals only_legacy"
66105

@@ -80,5 +119,29 @@ jobs:
80119
if-no-files-found: error
81120
retention-days: 7
82121

122+
- name: S3 CI | Copy test binary to S3 bucket
123+
if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != ''
124+
shell: bash
125+
env:
126+
BINARY_DIR: target/release
127+
BINARY_FILE: aleph-node
128+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-node
129+
S3BUCKET_FILE: aleph-test-node-${{ steps.get_branch.outputs.sha_short }}.tar.gz
130+
run: |
131+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
132+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
133+
134+
- name: S3 CI | Copy test runtime to S3 bucket
135+
if: env.SECRETS_AWS_MAINNET_ACCESS_KEY_ID != '' && env.SECRETS_AWS_MAINNET_SECRET_ACCESS_KEY != ''
136+
shell: bash
137+
env:
138+
BINARY_DIR: target/release/wbuild/aleph-runtime
139+
BINARY_FILE: aleph_runtime.compact.wasm
140+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-test-runtime
141+
S3BUCKET_FILE: aleph-test-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
142+
run: |
143+
tar -cvzf ${{ env.S3BUCKET_FILE }} -C ${{ env.BINARY_DIR }} ${{ env.BINARY_FILE }}
144+
aws s3 cp ${{ env.S3BUCKET_FILE }} ${{ env.S3BUCKET_URL }}/${{ env.S3BUCKET_FILE }}
145+
83146
- name: Cleanup cache
84147
uses: ./.github/actions/post-cache

.github/workflows/deploy-feature-envs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')
3232
name: Build runtime and aleph-node binary artefacts
3333
uses: ./.github/workflows/build-node-and-runtime.yml
34+
secrets: inherit
3435

3536
push_pr_image:
3637
if: (github.event.label.name == '[AZERO] DEPLOY-FEATURE-ENV') || (github.event.label.name == '[AZERO] DEPLOY-HOT-FEATURE-ENV')

.github/workflows/deploy-mainnet.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,30 @@ jobs:
7272
docker push ${{ env.DOCKERHUB_MAINNET_IMAGE }}
7373
docker push ${{ env.DOCKERHUB_MAINNET_LATEST_IMAGE }}
7474
75+
- name: S3 CI | Configure AWS credentials
76+
uses: aws-actions/configure-aws-credentials@v1
77+
env:
78+
AWS_REGION: us-east-1
79+
with:
80+
aws-access-key-id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
81+
aws-secret-access-key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
82+
aws-region: ${{ env.AWS_REGION }}
83+
84+
- name: S3 CI | Download release runtime from S3 bucket
85+
shell: bash
86+
env:
87+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
88+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
89+
run: |
90+
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}
91+
92+
- name: RELEASE ASSET | Add runtime to the release
93+
uses: softprops/action-gh-release@v1
94+
if: startsWith(github.ref, 'refs/tags/')
95+
with:
96+
files: |
97+
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
98+
7599
- name: GIT | Checkout aleph-apps repo
76100
uses: actions/checkout@master
77101
with:

.github/workflows/deploy-testnet.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,30 @@ jobs:
7979
docker push ${{ env.DOCKERHUB_TESTNET_IMAGE }}
8080
docker push ${{ env.DOCKERHUB_TESTNET_LATEST_IMAGE }}
8181
82+
- name: S3 CI | Configure AWS credentials
83+
uses: aws-actions/configure-aws-credentials@v1
84+
env:
85+
AWS_REGION: us-east-1
86+
with:
87+
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
88+
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
89+
aws-region: ${{ env.AWS_REGION }}
90+
91+
- name: S3 CI | Download release runtime from S3 bucket
92+
shell: bash
93+
env:
94+
S3BUCKET_URL: s3://${{ secrets.CI_MAINNET_S3BUCKET_NAME }}/builds/aleph-node/commits/${{ steps.get_branch.outputs.sha_short }}/aleph-runtime
95+
S3BUCKET_FILE: aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
96+
run: |
97+
aws s3 cp ${{ env.S3BUCKET_URL }}/${{ S3BUCKET_FILE }} ${{ env.S3BUCKET_FILE }}
98+
99+
- name: RELEASE ASSET | Add runtime to the release
100+
uses: softprops/action-gh-release@v1
101+
if: startsWith(github.ref, 'refs/tags/')
102+
with:
103+
files: |
104+
aleph-runtime-${{ steps.get_branch.outputs.sha_short }}.tar.gz
105+
82106
- name: GIT | Checkout aleph-apps repo
83107
uses: actions/checkout@master
84108
with:

.github/workflows/e2e-tests-main-devnet.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
build-new-node:
2424
name: Build node and runtime artifacts (PR version)
2525
uses: ./.github/workflows/build-node-and-runtime.yml
26+
secrets: inherit
2627

2728
build-test-docker:
2829
needs: [build-new-node]
@@ -518,6 +519,21 @@ jobs:
518519
follow-up-finalization-check: true
519520
timeout-minutes: 15
520521

522+
run-e2e-permissionless-ban:
523+
needs: [ build-test-docker, build-test-client ]
524+
name: Run permissionless ban test
525+
runs-on: ubuntu-20.04
526+
steps:
527+
- name: Checkout source code
528+
uses: actions/checkout@v2
529+
530+
- name: Run e2e test
531+
uses: ./.github/actions/run-e2e-test
532+
with:
533+
test-case: permissionless_ban
534+
follow-up-finalization-check: true
535+
timeout-minutes: 15
536+
521537
run-e2e-version-upgrade:
522538
needs: [build-test-docker, build-test-client]
523539
name: Run basic (positive) version-upgrade test
@@ -642,6 +658,7 @@ jobs:
642658
run-e2e-ban-counter-clearing,
643659
run-e2e-ban-threshold,
644660
run-e2e-version-upgrade,
661+
run-e2e-permissionless-ban,
645662
# run-e2e-failing-version-upgrade,
646663
# run-e2e-version-upgrade-catchup,
647664
]

.github/workflows/nightly-pipeline.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
build-new-node:
1313
name: Build node and runtime artifacts (PR version)
1414
uses: ./.github/workflows/build-node-and-runtime.yml
15+
secrets: inherit
1516

1617
build-test-docker:
1718
needs: [build-new-node]

aleph-client/src/pallets/elections.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ use crate::{
66
pallet_elections::pallet::Call::set_ban_config,
77
primitives::{BanReason, CommitteeSeats, EraValidators},
88
},
9-
pallet_elections::pallet::Call::{ban_from_committee, change_validators},
10-
primitives::{BanConfig, BanInfo},
9+
pallet_elections::pallet::Call::{
10+
ban_from_committee, change_validators, set_elections_openness,
11+
},
12+
primitives::{BanConfig, BanInfo, ElectionOpenness},
1113
AccountId, BlockHash,
1214
Call::Elections,
1315
Connection, RootConnection, SudoCall, TxStatus,
@@ -68,6 +70,11 @@ pub trait ElectionsSudoApi {
6870
ban_reason: Vec<u8>,
6971
status: TxStatus,
7072
) -> anyhow::Result<BlockHash>;
73+
async fn set_election_openness(
74+
&self,
75+
mode: ElectionOpenness,
76+
status: TxStatus,
77+
) -> anyhow::Result<BlockHash>;
7178
}
7279

7380
#[async_trait::async_trait]
@@ -212,4 +219,14 @@ impl ElectionsSudoApi for RootConnection {
212219
});
213220
self.sudo_unchecked(call, status).await
214221
}
222+
223+
async fn set_election_openness(
224+
&self,
225+
mode: ElectionOpenness,
226+
status: TxStatus,
227+
) -> anyhow::Result<BlockHash> {
228+
let call = Elections(set_elections_openness { openness: mode });
229+
230+
self.sudo_unchecked(call, status).await
231+
}
215232
}

bin/node/src/commands.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,14 @@ pub struct PurgeChainCmd {
302302

303303
impl PurgeChainCmd {
304304
pub fn run(&self, database_config: DatabaseSource) -> Result<(), Error> {
305-
self.purge_chain.run(database_config)?;
306-
self.purge_backup.run(self.purge_chain.yes)
305+
self.purge_backup.run(
306+
self.purge_chain.yes,
307+
self.purge_chain
308+
.shared_params
309+
.base_path()?
310+
.ok_or_else(|| Error::Input("need base-path to be provided".to_string()))?,
311+
)?;
312+
self.purge_chain.run(database_config)
307313
}
308314
}
309315

@@ -319,16 +325,14 @@ impl CliConfiguration for PurgeChainCmd {
319325

320326
#[derive(Debug, Parser)]
321327
pub struct PurgeBackupCmd {
322-
#[clap(flatten)]
323-
pub node_params: NodeParams,
328+
/// Directory under which AlephBFT backup is stored
329+
#[arg(long, default_value = DEFAULT_BACKUP_FOLDER)]
330+
pub backup_dir: String,
324331
}
325332

326333
impl PurgeBackupCmd {
327-
pub fn run(&self, skip_prompt: bool) -> Result<(), Error> {
328-
let backup_path = backup_path(
329-
self.node_params.base_path().path(),
330-
self.node_params.backup_dir(),
331-
);
334+
pub fn run(&self, skip_prompt: bool, base_path: BasePath) -> Result<(), Error> {
335+
let backup_path = backup_path(base_path.path(), &self.backup_dir);
332336

333337
if !skip_prompt {
334338
print!(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM syntheticnet:latest as synthnet
2+
3+
FROM aleph-node:latest
4+
5+
# Linux networking tools and node.js
6+
RUN apt update && \
7+
apt install nodejs curl iproute2 iputils-ping net-tools netwox tcpdump gdb gdbserver stress -y
8+
9+
COPY --from=synthnet /opt/lib/ /opt/lib/
10+
WORKDIR /opt/lib
11+
ENTRYPOINT []
12+
ENV ENTRY="/node/docker_entrypoint.sh"
13+
CMD ["/opt/lib/setup.sh"]
14+

0 commit comments

Comments
 (0)