├── .dockerignore
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── ask-a-question.md
│ ├── report-a-bug.md
│ └── suggest-a-feature.md
├── hooks
│ └── pre-commit
└── workflows
│ ├── benchmark.yml
│ ├── build-docker.yml
│ ├── check.yml
│ ├── deploy-docs.yml
│ ├── lint.yml
│ ├── release.yml
│ ├── stale_activity.yml
│ └── turing-dev-docker.yml
├── .gitignore
├── .maintain
├── Dockerfile
├── HEADER-GPL3
├── build-docs
│ ├── build-docs.sh
│ └── index.html
├── build-only-wasm.sh
├── common
│ └── lib.sh
├── debian
│ ├── deb-maintainer-scripts
│ │ └── postinst
│ ├── defaults
│ └── oak-collator.service
├── deny.toml
├── docker
│ ├── subkey.Dockerfile
│ └── substrate.Dockerfile
├── ensure-deps.sh
├── frame-weight-template.hbs
├── generate-release-notes
├── getgoing.sh
├── github
│ └── check_labels.sh
├── gitlab
│ ├── check_line_width.sh
│ ├── check_polkadot_companion_build.sh
│ ├── check_polkadot_companion_status.sh
│ ├── check_runtime.sh
│ ├── check_signed.sh
│ ├── generate_changelog.sh
│ ├── publish_draft_release.sh
│ ├── skip_if_draft.sh
│ └── trigger_pipeline.sh
├── init.sh
├── kubernetes
│ ├── Chart.yaml
│ ├── README.md
│ ├── templates
│ │ ├── poddisruptionbudget.yaml
│ │ ├── secrets.yaml
│ │ ├── service.yaml
│ │ ├── serviceaccount.yaml
│ │ └── statefulset.yaml
│ └── values.yaml
├── local-docker-test-network
│ ├── docker-compose.yml
│ ├── grafana
│ │ └── provisioning
│ │ │ ├── dashboards
│ │ │ └── dashboards.yml
│ │ │ └── datasources
│ │ │ └── datasource.yml
│ └── prometheus
│ │ └── prometheus.yml
├── monitoring
│ ├── alerting-rules
│ │ ├── alerting-rule-tests.yaml
│ │ └── alerting-rules.yaml
│ └── grafana-dashboards
│ │ ├── README_dashboard.md
│ │ ├── substrate-networking.json
│ │ └── substrate-service-tasks.json
├── node-template-release.sh
├── node-template-release
│ ├── Cargo.toml
│ └── src
│ │ └── main.rs
├── rename-crates-for-2.0.sh
├── runtime-dep.py
├── rustdoc-header.html
├── test-coverage
│ └── test-coverage.sh
├── update-copyright.sh
└── update-deps.sh
├── .rustfmt.toml
├── .vscode
├── launch.json
└── tasks.json
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── distribution
├── neumann_alloc.json
├── neumann_vest_test_alloc.json
├── neumann_vesting.json
├── oak_alloc.json
├── oak_staging_alloc.json
├── oak_vesting.json
├── turing_alloc.json
├── turing_staging_alloc.json
└── turing_vesting.json
├── docker
├── neumann
│ ├── Dockerfile
│ └── build.sh
└── turing
│ ├── Dockerfile
│ └── build.sh
├── media
├── readme-parachain-post-registration.png
└── readme-parachain-registration.png
├── node
├── Cargo.toml
├── build.rs
├── res
│ ├── neumann-rococo-testnet.json
│ ├── neumann.json
│ ├── turing-staging.json
│ └── turing.json
└── src
│ ├── chain_spec
│ ├── mod.rs
│ ├── neumann.rs
│ ├── oak.rs
│ └── turing.rs
│ ├── cli.rs
│ ├── command.rs
│ ├── main.rs
│ ├── rpc.rs
│ └── service.rs
├── pallets
├── automation-price
│ ├── Cargo.toml
│ ├── rpc
│ │ ├── Cargo.toml
│ │ ├── runtime-api
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ │ └── lib.rs
│ │ └── src
│ │ │ └── lib.rs
│ └── src
│ │ ├── benchmarking.rs
│ │ ├── fees.rs
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ ├── tests.rs
│ │ ├── trigger.rs
│ │ ├── types.rs
│ │ └── weights.rs
├── automation-time
│ ├── Cargo.toml
│ ├── rpc
│ │ ├── Cargo.toml
│ │ ├── runtime-api
│ │ │ ├── Cargo.toml
│ │ │ └── src
│ │ │ │ └── lib.rs
│ │ └── src
│ │ │ └── lib.rs
│ └── src
│ │ ├── autocompounding.rs
│ │ ├── benchmarking.rs
│ │ ├── fees.rs
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ ├── tests.rs
│ │ ├── types.rs
│ │ └── weights.rs
├── valve
│ ├── Cargo.toml
│ └── src
│ │ ├── benchmarking.rs
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ ├── tests.rs
│ │ ├── traits.rs
│ │ └── weights.rs
├── vesting
│ ├── Cargo.toml
│ └── src
│ │ ├── benchmarking.rs
│ │ ├── lib.rs
│ │ ├── mock.rs
│ │ ├── tests.rs
│ │ └── weights.rs
└── xcmp-handler
│ ├── Cargo.toml
│ ├── rpc
│ ├── Cargo.toml
│ ├── runtime-api
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ └── src
│ │ └── lib.rs
│ └── src
│ ├── lib.rs
│ ├── migrations
│ └── mod.rs
│ ├── mock.rs
│ └── tests.rs
├── primitives
├── Cargo.toml
└── src
│ ├── assets.rs
│ └── lib.rs
├── resources
├── neumann-testnet-parachain.yaml
├── rococo-local.json
├── rococo-testnet-relaychain.yaml
├── rococo-testnet.json
├── rococo.json
└── types.json
├── runtime
├── common
│ ├── Cargo.toml
│ └── src
│ │ ├── constants.rs
│ │ ├── fees.rs
│ │ └── lib.rs
├── neumann
│ ├── Cargo.toml
│ ├── build.rs
│ └── src
│ │ ├── lib.rs
│ │ ├── weights
│ │ ├── asset_registry_weights.rs
│ │ ├── mod.rs
│ │ └── pallet_xcm.rs
│ │ └── xcm_config.rs
├── oak
│ ├── Cargo.toml
│ ├── build.rs
│ └── src
│ │ ├── lib.rs
│ │ ├── weights
│ │ ├── asset_registry_weights.rs
│ │ ├── mod.rs
│ │ └── pallet_xcm.rs
│ │ └── xcm_config.rs
└── turing
│ ├── Cargo.toml
│ ├── build.rs
│ └── src
│ ├── lib.rs
│ ├── migrations
│ └── mod.rs
│ ├── weights
│ ├── asset_registry_weights.rs
│ ├── mod.rs
│ └── pallet_xcm.rs
│ └── xcm_config.rs
├── rust-toolchain.toml
├── scripts
├── run-pallet-benchmarks.sh
└── try-runtime.sh
└── zombienets
├── neumann
├── single-chain.toml
└── xcmp.toml
├── oak
├── single-chain.toml
└── xcmp.toml
└── turing
├── mangata.toml
├── moonbase.toml
├── shibuya.toml
├── turing-multi-collator.toml
└── turing-simple.toml
/.dockerignore:
--------------------------------------------------------------------------------
1 | .github
2 | .git
3 | .vscode
4 | target
5 | data
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style=space
5 | indent_size=2
6 | tab_width=2
7 | end_of_line=lf
8 | charset=utf-8
9 | trim_trailing_whitespace=true
10 | insert_final_newline = true
11 |
12 | [*.{rs,toml}]
13 | indent_style=tab
14 | indent_size=tab
15 | tab_width=4
16 | max_line_length=100
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/ask-a-question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Ask a Question
3 | about: Ask a question about this template.
4 | title: ""
5 | labels: question
6 | assignees: ""
7 | ---
8 |
9 | **Question**
10 |
11 | _Please include information such as the following: is your question to clarify an existing resource
12 | or are you asking about something new? what are you trying to accomplish? where have you looked for
13 | answers?_
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/report-a-bug.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Report a Bug
3 | about: Report a problem with this template.
4 | title: ""
5 | labels: bug
6 | assignees: ""
7 | ---
8 |
9 | **Description**
10 |
11 | _Tell us what happened. In particular, be specific about any changes you made to this template.
12 | Ideally, provide a link to your project's GitHub repository. Please note that we are not able to
13 | support all conceivable changes to this template project, but the more information you are able to
14 | provide the more equipped we will be to help._
15 |
16 | **Steps to Reproduce**
17 |
18 | _Replace the example steps below with actual steps to reproduce the bug you're reporting._
19 |
20 | 1. Go to '...'
21 | 2. Click on '....'
22 | 3. Scroll down to '....'
23 | 4. See error
24 |
25 | **Expected vs. Actual Behavior**
26 |
27 | _What did you expect to happen after you followed the steps you described in the last section? What
28 | actually happened?_
29 |
30 | **Environment**
31 |
32 | _Describe the environment in which you encountered this bug. Use the list below as a starting point
33 | and add additional information if you think it's relevant._
34 |
35 | - Operating system:
36 | - Template version/tag:
37 | - Rust version (run `rustup show`):
38 |
39 | **Logs, Errors or Screenshots**
40 |
41 | _Please provide the text of any logs or errors that you experienced; if
42 | applicable, provide screenshots to help illustrate the problem._
43 |
44 | **Additional Information**
45 |
46 | _Please add any other details that you think may help us solve your problem._
47 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/suggest-a-feature.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Suggest a Feature
3 | about: Suggest a new feature or an improvement to an existing feature for this template.
4 | title: ""
5 | labels: enhancement
6 | assignees: ""
7 | ---
8 |
9 | **Motivation**
10 |
11 | _Describe the need or frustration that motivated you to make this suggestion. Please note that the
12 | goal of this project is to provide a general-purpose template project, so please take care when
13 | suggesting features that may be specific to a particular use case._
14 |
15 | **Suggested Solution**
16 |
17 | _Describe your suggested solution to the need or frustration that you are experiencing._
18 |
19 | **Alternatives**
20 |
21 | _Describe any alternative solutions or features you considered and why you believe your suggested
22 | solution is preferable._
23 |
24 | **Additional Information**
25 |
26 | _Provide any additional information that you believe may help us evaluate your suggestion._
27 |
--------------------------------------------------------------------------------
/.github/hooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | HAS_ISSUES=0
4 | FIRST_FILE=1
5 |
6 | for file in $(git diff --name-only --staged); do
7 | FMT_RESULT="$(rustfmt +nightly --check $file)"
8 | if [ "$FMT_RESULT" != "" ]; then
9 | if [ $FIRST_FILE -eq 0 ]; then
10 | echo -e ",\n"
11 | fi
12 | echo -n "$file"
13 | HAS_ISSUES=1
14 | FIRST_FILE=0
15 | fi
16 | done
17 |
18 | if [ $HAS_ISSUES -eq 0 ]; then
19 | exit 0
20 | fi
21 |
22 | echo -e "\n\n Your code has formatting issues in files listed above. Format your code with \`cargo +nightly fmt\`."
23 | exit 1
--------------------------------------------------------------------------------
/.github/workflows/benchmark.yml:
--------------------------------------------------------------------------------
1 | name: Benchmark
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | pallet:
7 | description: provided a list of pallet to run benchmark on
8 | default: 'automation_time,automation_price,vesting,valve'
9 | required: true
10 |
11 | concurrency:
12 | group: ${{ github.workflow }}-${{ github.ref }}
13 | cancel-in-progress: true
14 |
15 | jobs:
16 | gen-params:
17 | runs-on: ubuntu-latest
18 | outputs:
19 | pallet: ${{ steps.set-matrix.outputs.pallet }}
20 | steps:
21 | - id: set-matrix
22 | run: |
23 | # Matrix only take a list so we use fromJSON to convert raw json string data to list
24 | # The input is from Github action input, which doesn't support list so we take raw string separate by ','
25 | # Convert the string a,b,c -> a json array ["a", "b", "c"] with bracket and double quote properly
26 | echo "pallet=$(echo -n ${{ inputs.pallet }} | jq --raw-input --slurp 'split(",")' -c)" >> $GITHUB_OUTPUT
27 | cat $GITHUB_OUTPUT
28 |
29 | build-binary:
30 | runs-on: self-hosted
31 | steps:
32 | - name: Checkout
33 | uses: actions/checkout@v2
34 | with:
35 | ref: ${{ github.event.inputs.tag }}
36 | - name: Setup Rust
37 | run: rustup show
38 | - name: Build
39 | run: |
40 | cargo build --release --features runtime-benchmarks,turing-node,oak-node
41 | mkdir -p artifacts/
42 | cp target/release/oak-collator artifacts/
43 | - name: Upload binary
44 | uses: actions/upload-artifact@v2
45 | with:
46 | name: oak-collator
47 | path: artifacts/
48 | retention-days: 1
49 |
50 | run-benchmarks:
51 | name: Run Benchmarks
52 | runs-on: self-hosted
53 | needs: [gen-params, build-binary]
54 | strategy:
55 | matrix:
56 | pallet: ${{ fromJSON(needs.gen-params.outputs.pallet) }}
57 |
58 | steps:
59 | - name: Download binary
60 | uses: actions/download-artifact@v2
61 | with:
62 | name: oak-collator
63 | - name: Execute pallet benchmark
64 | run: |
65 | chmod +x oak-collator
66 | ./oak-collator \
67 | benchmark \
68 | pallet \
69 | --header ./.maintain/HEADER-GPL3 \
70 | --chain turing-dev \
71 | --execution wasm \
72 | --wasm-execution compiled \
73 | --pallet pallet_${{ matrix.pallet }} \
74 | --extrinsic '*' \
75 | --repeat 20 \
76 | --steps 50 \
77 | --output ./${{ matrix.pallet }}-raw-weights.rs \
78 | --template ./.maintain/frame-weight-template.hbs
79 | - name: Upload raw weights
80 | uses: actions/upload-artifact@v2
81 | with:
82 | name: ${{ matrix.pallet }}
83 | path: ${{ matrix.pallet }}-raw-weights.rs
84 | generate-pull-request:
85 | name: Generate pull request
86 | needs: run-benchmarks
87 | runs-on: ubuntu-latest
88 | steps:
89 | - name: Delete binary artifact
90 | uses: geekyeggo/delete-artifact@v1
91 | with:
92 | name: oak-collator
93 | - name: Checkout
94 | uses: actions/checkout@v2
95 | - name: Download benchmark files
96 | uses: actions/download-artifact@v3
97 | with:
98 | path: weight-artifacts
99 | - name: Generate PR body
100 | id: body
101 | run: |
102 | echo > body.md
103 | for file in $(find ./weight-artifacts -type f); do
104 | pallet=$(basename $file | cut -d '-' -f 1 | tr '_' '-')
105 | echo "## $pallet" >> body.md
106 | echo "\`\`\`" >> body.md
107 | join -o auto -e "-" -a 1 -a 2 \
108 | <(echo "$(grep '//:' pallets/$pallet/src/weights.rs | cut -c 4- | sort)") \
109 | <(echo "$(grep '//:' $file | cut -c 4- | sort)") \
110 | | column -t >> body.md
111 | echo "\`\`\`" >> body.md
112 | done
113 | body=$(cat body.md)
114 | body="${body//'%'/'%25'}"
115 | body="${body//$'\n'/'%0A'}"
116 | body="${body//$'\r'/'%0D'}"
117 | echo "::set-output name=md::$body"
118 | - name: Move benchmark files to correct place
119 | run: |
120 | for file in $(find ./weight-artifacts -type f); do
121 | pallet=$(basename $file | cut -d '-' -f 1 | tr '_' '-')
122 | mv $file pallets/$pallet/src/weights.rs
123 | done
124 | - name: Create Pull Request
125 | uses: peter-evans/create-pull-request@v4
126 | with:
127 | title: Update pallet weights
128 | draft: true
129 | base: master
130 | branch: update-weights
131 | branch-suffix: short-commit-hash
132 | body: ${{ steps.body.outputs.md }}
133 | add-paths: pallets/**/weights.rs
134 |
--------------------------------------------------------------------------------
/.github/workflows/build-docker.yml:
--------------------------------------------------------------------------------
1 | name: Publish Turing Docker Image
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | release_action_run_id:
7 | required: true
8 | description: "release action run id(the last number in URL of release action run) where we will download artifact from"
9 | type: string
10 | tag:
11 | description: Tag for release
12 | required: true
13 | type: string
14 | draft:
15 | description: "in draft mode, we won't update the lastest tag"
16 | required: true
17 | default: 'true'
18 | type: boolean
19 |
20 | jobs:
21 | build-docker:
22 | permissions:
23 | contents: 'read'
24 | actions: 'read'
25 |
26 | name: Build and Publish to Docker Hub
27 | runs-on: ubuntu-latest
28 | steps:
29 | - name: Login to Docker Hub
30 | uses: docker/login-action@v2
31 | with:
32 | username: ${{ secrets.DOCKERHUB_USERNAME }}
33 | password: ${{ secrets.DOCKERHUB_TOKEN }}
34 |
35 | - name: Checkout
36 | uses: actions/checkout@v2
37 | with:
38 | ref: ${{ github.event.inputs.tag }}
39 |
40 | - name: download artifact
41 | run: |
42 | artifact_url=$(curl -sL \
43 | -H "Accept: application/vnd.github+json" \
44 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\
45 | -H "X-GitHub-Api-Version: 2022-11-28" \
46 | https://api.github.com/repos/OAK-Foundation/OAK-blockchain/actions/runs/${{ inputs.release_action_run_id }}/artifacts | jq -r '.artifacts[] | select(.name == "oak-collator") | .archive_download_url ')
47 | echo "Found artifact url for oak-collator ${artifact_url}"
48 |
49 | curl \
50 | -sL \
51 | -H "Accept: application/vnd.github+json" \
52 | -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
53 | -H "X-GitHub-Api-Version: 2022-11-28" \
54 | -o oak-collator.zip $artifact_url
55 | unzip oak-collator.zip
56 | chmod +x ./oak-collator
57 |
58 | - name: oak-collator version vs tag validation
59 | run: |
60 | # Ensure the version in the binary match the tag to avoid accidently publish wrong binary
61 | tag=${{ github.event.inputs.tag }}
62 | ./oak-collator --version
63 | ./oak-collator --version 2>&1 | grep "oak-collator ${tag:1}-"
64 |
65 | # In draft mode we will push to below tag:
66 | # reponame/imagename:{{git_revision}}
67 | # reponame/imagename:{{tag}}-{{git_revision}}
68 | # so we will have image such as
69 | # oaknetwork/turing:2.0.0
70 | #
71 | # and we can test these image
72 | - name: Build
73 | run: |
74 | tag=${{ github.event.inputs.tag }}
75 | docker build -f ./docker/turing/Dockerfile -t oaknetwork/turing:${GITHUB_SHA} .
76 |
77 | docker_tag="${tag:1}"
78 | docker tag oaknetwork/turing:${GITHUB_SHA} oaknetwork/turing:${docker_tag}
79 | docker push oaknetwork/turing:$docker_tag
80 |
81 | # when not in draft mode, we will update the pointer tag
82 | # so we will have image such as
83 | # oaknetwork/turing:latest
84 | - name: Push latest tag to docker hub
85 | run: |
86 | docker tag oaknetwork/turing:${GITHUB_SHA} oaknetwork/turing:latest
87 | docker push oaknetwork/turing:latest
88 | if: ${{ inputs.draft == false }}
89 |
--------------------------------------------------------------------------------
/.github/workflows/check.yml:
--------------------------------------------------------------------------------
1 | name: Check Setup, Build, Test
2 |
3 | # Controls when the action will run.
4 | on:
5 | # Triggers the workflow on push or pull request events but only for the master branch
6 | push:
7 | branches:
8 | - master
9 | pull_request:
10 |
11 | # Allows you to run this workflow manually from the Actions tab
12 | workflow_dispatch:
13 |
14 | concurrency:
15 | group: ${{ github.workflow }}-${{ github.ref }}
16 | cancel-in-progress: true
17 |
18 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
19 | jobs:
20 | linting:
21 | name: "Check rustfmt"
22 | runs-on: ubuntu-latest
23 | steps:
24 | - name: Checkout
25 | uses: actions/checkout@v2
26 | - name: Setup Rust
27 | run: rustup show
28 | - name: rustfmt
29 | run: cargo fmt -- --check
30 | build:
31 | name: "Build release"
32 | runs-on: self-hosted
33 | steps:
34 | - name: Checkout
35 | uses: actions/checkout@v2
36 | - name: Setup Rust
37 | run: rustup show
38 | - name: Build
39 | run: |
40 | cargo build --workspace --all-features
41 | - name: Test
42 | run: |
43 | cargo test --workspace --all-features
44 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-docs.yml:
--------------------------------------------------------------------------------
1 | # Please set AWS_ROLE_TO_ASSUME, SLACK_WEBHOOK_URL in Setting > Secrets > Actions.
2 |
3 | name: Deploy rust docs
4 |
5 | # Controls when the action will run.
6 | on:
7 | # Triggers the workflow on push events but only for the master branch
8 | push:
9 | branches: [ 'master' ]
10 |
11 | env:
12 | AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1
13 | BUCKET_NAME: docs.oak.tech
14 |
15 | permissions:
16 | id-token: write # required to use OIDC authentication
17 | contents: read # required to checkout the code from the repo
18 |
19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
20 | jobs:
21 | check-changes:
22 | name: Check change files
23 | # The type of runner that the job will run on
24 | runs-on: ubuntu-20.04
25 |
26 | outputs:
27 | any_changed: ${{ steps.changed-files-specific.outputs.any_changed }}
28 |
29 | # Steps represent a sequence of tasks that will be executed as part of the job
30 | steps:
31 | - uses: actions/checkout@v3
32 | with:
33 | fetch-depth: 0
34 |
35 | - name: Get changed files
36 | id: changed-files-specific
37 | uses: tj-actions/changed-files@v20.2
38 | with:
39 | files: |
40 | pallets/**/lib.rs
41 |
42 | - name: List all changed files
43 | if: steps.changed-files-specific.outputs.any_changed == 'true'
44 | run: |
45 | for file in ${{ steps.changed-files-specific.outputs.all_changed_files }}; do
46 | echo "$file was changed"
47 | done
48 |
49 | build-docs:
50 | name: Deploy docs
51 | needs: [check-changes]
52 | if: needs.check-changes.outputs.any_changed == 'true'
53 |
54 | # The type of runner that the job will run on
55 | runs-on: ubuntu-20.04
56 |
57 | steps:
58 | - name: Check out
59 | uses: actions/checkout@v3
60 |
61 | - name: Set-Up
62 | run: |
63 | sudo apt-get install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl
64 |
65 | - name: Install Rustup
66 | run: |
67 | curl https://sh.rustup.rs -sSf | sh -s -- -y
68 | source ~/.cargo/env
69 |
70 | - name: Build docs
71 | run: |
72 | sh ./.maintain/build-docs/build-docs.sh
73 |
74 | - name: Configure AWS credentials
75 | uses: aws-actions/configure-aws-credentials@v1
76 | with:
77 | role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
78 | role-duration-seconds: 3600 # the ttl of the session, in seconds.
79 | aws-region: ${{ env.AWS_REGION }}
80 |
81 | - name: Deploy files to S3
82 | run: |
83 | aws s3 sync --delete target/doc s3://${{ env.BUCKET_NAME }}/rust
84 |
85 | report-failure:
86 | name: Report failure status
87 | needs: [check-changes, build-docs]
88 | if: failure()
89 |
90 | runs-on: ubuntu-20.04
91 |
92 | steps:
93 | - name: Check workflow status
94 | id: check-workflow-status
95 | uses: martialonline/workflow-status@v2
96 |
97 | - name: Report to slack
98 | uses: ravsamhq/notify-slack-action@v1
99 | with:
100 | status: ${{ steps.check-workflow-status.outputs.status }}
101 | env:
102 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
103 |
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: Lint
2 |
3 | on: [push]
4 |
5 | jobs:
6 | build:
7 | runs-on: self-hosted
8 | steps:
9 | - uses: actions/checkout@v3
10 | # on self-hosted runner, we already pre-installed the rust toolchain
11 | - name: Format the code with rust fmt
12 | id: cargo_fmt
13 | run: |
14 | cargo fmt
15 | if [ -z "$(git diff .)" ]; then
16 | echo code format ok
17 | echo "need_format=false" >> "$GITHUB_OUTPUT"
18 | else
19 | echo "need_format=true" >> "$GITHUB_OUTPUT"
20 | fi
21 |
22 | - name: Format the code
23 | if: steps.cargo_fmt.outputs.need_format == 'true'
24 | run: |
25 | git config --global user.name 'oak-code-formatter'
26 | git config --global user.email 'oak-code-formatter@users.noreply.github.com'
27 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
28 | git checkout $GITHUB_HEAD_REF
29 | git commit -am "fixup: auto format Rust code"
30 | git push
31 |
--------------------------------------------------------------------------------
/.github/workflows/stale_activity.yml:
--------------------------------------------------------------------------------
1 | name: 'Close stale issues and PRs'
2 | on:
3 | schedule:
4 | - cron: '0 13 * * *'
5 | - cron: '39 20 * * *'
6 | workflow_dispatch:
7 | inputs:
8 | days_before_issue_stale:
9 | description: 'how many day before consider an issue as stale'
10 | default: 30
11 | required: false
12 | type: number
13 | days_before_pr_stale:
14 | description: 'how many day before consider a pr as stale'
15 | default: 60
16 | required: false
17 | type: number
18 |
19 | jobs:
20 | stale:
21 | runs-on: ubuntu-latest
22 | steps:
23 | - uses: actions/stale@v4
24 | with:
25 | stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
26 | stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.'
27 | close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'
28 | close-pr-message: 'This PR was closed because it has been stalled for 14 days with no activity.'
29 | days-before-issue-stale: ${{ github.event.inputs.days_before_issue_stale || 30 }}
30 | days-before-pr-stale: ${{ github.event.inputs.days_before_pr_stale || 60 }}
31 | days-before-issue-close: 7
32 | days-before-pr-close: 14
33 |
--------------------------------------------------------------------------------
/.github/workflows/turing-dev-docker.yml:
--------------------------------------------------------------------------------
1 | name: Publish Turing Development Docker Image
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | tag:
7 | description: Tag for release
8 | required: true
9 |
10 | jobs:
11 | build-binary:
12 | name: Build Binary
13 | runs-on: self-hosted
14 | steps:
15 | - name: Checkout
16 | uses: actions/checkout@v2
17 | with:
18 | ref: ${{ github.event.inputs.tag }}
19 | - name: Setup Rust
20 | run: rustup show
21 | - name: Build
22 | run: |
23 | cargo build --locked --release --features turing-node,oak-node,dev-queue
24 | mkdir -p artifacts/
25 | cp target/release/oak-collator artifacts/
26 | - name: Upload binary
27 | uses: actions/upload-artifact@v2
28 | with:
29 | name: oak-collator
30 | path: artifacts/
31 | build-docker:
32 | name: Build Docker
33 | runs-on: ubuntu-latest
34 | needs: build-binary
35 | steps:
36 | - name: Login to Docker Hub
37 | uses: docker/login-action@v2
38 | with:
39 | username: ${{ secrets.DOCKERHUB_USERNAME }}
40 | password: ${{ secrets.DOCKERHUB_TOKEN }}
41 | - name: Checkout
42 | uses: actions/checkout@v2
43 | with:
44 | ref: ${{ github.event.inputs.tag }}
45 | - name: Download binary
46 | uses: actions/download-artifact@v2
47 | with:
48 | name: oak-collator
49 | - name: Build
50 | run: |
51 | tag=${{ github.event.inputs.tag }}
52 | docker_tag="${tag:1}"
53 | docker build -f ./docker/turing/Dockerfile -t oaknetwork/turing-dev:$docker_tag .
54 | docker tag oaknetwork/turing-dev:$docker_tag oaknetwork/turing-dev:latest
55 | docker push oaknetwork/turing-dev:$docker_tag
56 | docker push oaknetwork/turing-dev:latest
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | **/target/
4 | # These are backup files generated by rustfmt
5 | **/*.rs.bk
6 |
7 | .DS_Store
8 |
9 | # The cache for docker container dependency
10 | .cargo
11 |
12 | # The cache for chain data in container
13 | .local
14 | /data/
15 |
16 | # Parachain registration files
17 | genesis-state
18 | genesis-wasm
19 |
20 | # zombienet binary for MacOS to run scripts in the ./zombienets folder
21 | zombienet-macos
--------------------------------------------------------------------------------
/.maintain/Dockerfile:
--------------------------------------------------------------------------------
1 | # Note: We don't use Alpine and its packaged Rust/Cargo because they're too often out of date,
2 | # preventing them from being used to build Substrate/Polkadot.
3 |
4 | FROM phusion/baseimage:0.11 as builder
5 | LABEL maintainer="chevdor@gmail.com"
6 | LABEL description="This is the build stage for Substrate. Here we create the binary."
7 |
8 | ENV DEBIAN_FRONTEND=noninteractive
9 |
10 | ARG PROFILE=release
11 | WORKDIR /substrate
12 |
13 | COPY . /substrate
14 |
15 | RUN apt-get update && \
16 | apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
17 | apt-get install -y cmake pkg-config libssl-dev git clang
18 |
19 | RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
20 | export PATH="$PATH:$HOME/.cargo/bin" && \
21 | rustup toolchain install nightly && \
22 | rustup target add wasm32-unknown-unknown --toolchain nightly && \
23 | rustup default stable && \
24 | cargo build "--$PROFILE"
25 |
26 | # ===== SECOND STAGE ======
27 |
28 | FROM phusion/baseimage:0.11
29 | LABEL maintainer="chevdor@gmail.com"
30 | LABEL description="This is the 2nd stage: a very small image where we copy the Substrate binary."
31 | ARG PROFILE=release
32 |
33 | RUN mv /usr/share/ca* /tmp && \
34 | rm -rf /usr/share/* && \
35 | mv /tmp/ca-certificates /usr/share/ && \
36 | useradd -m -u 1000 -U -s /bin/sh -d /substrate substrate && \
37 | mkdir -p /substrate/.local/share/substrate && \
38 | chown -R substrate:substrate /substrate/.local && \
39 | ln -s /substrate/.local/share/substrate /data
40 |
41 | COPY --from=builder /substrate/target/$PROFILE/substrate /usr/local/bin
42 | COPY --from=builder /substrate/target/$PROFILE/subkey /usr/local/bin
43 | COPY --from=builder /substrate/target/$PROFILE/node-rpc-client /usr/local/bin
44 | COPY --from=builder /substrate/target/$PROFILE/node-template /usr/local/bin
45 | COPY --from=builder /substrate/target/$PROFILE/chain-spec-builder /usr/local/bin
46 |
47 | # checks
48 | RUN ldd /usr/local/bin/substrate && \
49 | /usr/local/bin/substrate --version
50 |
51 | # Shrinking
52 | RUN rm -rf /usr/lib/python* && \
53 | rm -rf /usr/bin /usr/sbin /usr/share/man
54 |
55 | USER substrate
56 | EXPOSE 30333 9933 9944 9615
57 | VOLUME ["/data"]
58 |
59 | CMD ["/usr/local/bin/substrate"]
60 |
--------------------------------------------------------------------------------
/.maintain/HEADER-GPL3:
--------------------------------------------------------------------------------
1 | // This file is part of OAK-blockchain.
2 |
3 | // Copyright (C) OAK Network Ltd.
4 | // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5 |
6 | // This program is free software: you can redistribute it and/or modify
7 | // it under the terms of the GNU General Public License as published by
8 | // the Free Software Foundation, either version 3 of the License, or
9 | // (at your option) any later version.
10 |
11 | // This program is distributed in the hope that it will be useful,
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | // GNU General Public License for more details.
15 |
16 | // You should have received a copy of the GNU General Public License
17 | // along with this program. If not, see