-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/metaspan/ibp-node2
- Loading branch information
Showing
18 changed files
with
908 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "Substrate Node template", | ||
"context": "..", | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"lldb.executable": "/usr/bin/lldb" | ||
}, | ||
"extensions": [ | ||
"rust-lang.rust", | ||
"bungcip.better-toml", | ||
"vadimcn.vscode-lldb" | ||
], | ||
"forwardPorts": [ | ||
3000, | ||
9944 | ||
], | ||
"onCreateCommand": ["cargo build", "cargo check"], | ||
"postStartCommand": "./target/debug/node-template --dev --ws-external", | ||
"menuActions": [ | ||
{"id": "polkadotjs", | ||
"label": "Open PolkadotJS Apps", | ||
"type": "external-preview", | ||
"args": ["https://polkadot.js.org/apps/?rpc=wss%3A%2F%2F/$HOST/wss"]} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Support & Troubleshooting with the Substrate Stack Exchange Community | ||
url: https://substrate.stackexchange.com | ||
about: | | ||
For general problems with Substrate or related technologies, please search here first | ||
for solutions, by keyword and tags. If you discover no solution, please then ask and questions in our community! We highly encourage everyone also share their understanding by answering questions for others. | ||
- name: Feature Requests and PRs to be submitted upstream | ||
url: https://github.com/paritytech/substrate/tree/master/bin/node-template | ||
about: | | ||
This template is generated on tagged releases upstream, it is not independently updated and maintained. | ||
Please direct all suggestions for improvements and PRs upstream. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check Set-Up & Build | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
check: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-22.04 | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install linux dependencies | ||
run: sudo apt-get install -y clang libssl-dev llvm libudev-dev protobuf-compiler | ||
|
||
- name: Install Rust | ||
run: | | ||
rustup update stable --no-self-update | ||
rustup target add wasm32-unknown-unknown | ||
# Rust cache | ||
- uses: Swatinem/rust-cache@v2 | ||
|
||
- name: Check Build | ||
run: | | ||
SKIP_WASM_BUILD=1 cargo check --release | ||
- name: Check Build for Benchmarking | ||
run: > | ||
pushd node && | ||
cargo check --features=runtime-benchmarks --release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# This is an example GitHub action that will build and publish the binaries and a Docker image | ||
# You need to add the following secrets to your GitHub Repository or Organization to make this work | ||
# - DOCKERHUB_USERNAME: The username of the DockerHub account. E.g. parity | ||
# - DOCKERHUB_TOKEN: Access token for DockerHub, see https://docs.docker.com/docker-hub/access-tokens/. | ||
# The following is set up as an environment variable below | ||
# - DOCKER_REPO: The unique name of the DockerHub repository. E.g. parity/polkadot | ||
|
||
name: Release | ||
|
||
permissions: | ||
contents: read | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
# Triggers the workflow on tag push events | ||
tags: | ||
- v[0-9]+.* | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
CARGO_NET_RETRY: 10 | ||
RUSTFLAGS: -D warnings | ||
RUSTUP_MAX_RETRIES: 10 | ||
CARGO_TERM_COLOR: always | ||
# Set an environment variable (that can be overriden) for the Docker Repo | ||
DOCKER_REPO: tripleight/node-template | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
|
||
jobs: | ||
create-release: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 60 | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- uses: taiki-e/create-gh-release-action@v1 | ||
with: | ||
title: $version | ||
branch: main | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
upload-assets: | ||
name: ${{ matrix.target }} | ||
needs: | ||
- create-release | ||
strategy: | ||
matrix: | ||
# The list of architechture and OS to build for | ||
# You can add or remove targets here if you want | ||
# | ||
# When updating this list, remember to update the target list in tests too | ||
include: | ||
# - target: aarch64-unknown-linux-gnu | ||
- target: x86_64-unknown-linux-gnu | ||
- target: aarch64-apple-darwin | ||
os: macos-11 | ||
- target: x86_64-apple-darwin | ||
os: macos-11 | ||
# - target: universal-apple-darwin | ||
# os: macos-11 | ||
|
||
# The type of runner that the job will run on | ||
# Runs on Ubuntu if other os is not specified above | ||
runs-on: ${{ matrix.os || 'ubuntu-22.04' }} | ||
timeout-minutes: 90 | ||
permissions: | ||
contents: write | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Install Rust | ||
run: | | ||
rustup update stable --no-self-update | ||
rustup target add wasm32-unknown-unknown | ||
- name: Install linux dependencies | ||
if: (matrix.os == '' || startsWith(matrix.os, 'ubuntu')) | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get install -y protobuf-compiler | ||
- name: Install mac dependencies | ||
if: startsWith(matrix.os, 'macos') | ||
run: brew install protobuf | ||
- uses: taiki-e/setup-cross-toolchain-action@v1 | ||
if: (matrix.os == '' || startsWith(matrix.os, 'ubuntu')) | ||
with: | ||
target: ${{ matrix.target }} | ||
|
||
# Build and upload the binary to the new release | ||
- uses: taiki-e/upload-rust-binary-action@v1 | ||
with: | ||
bin: node-template | ||
target: ${{ matrix.target }} | ||
tar: all | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload x86_64 linux binary to workflow | ||
if: (matrix.target == 'x86_64-unknown-linux-gnu') | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: node-template | ||
path: ${{ github.workspace }}/target/x86_64-unknown-linux-gnu/release/node-template | ||
|
||
build-image: | ||
# The type of runner that the job will run on | ||
needs: | ||
- upload-assets | ||
runs-on: ubuntu-22.04 | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Login to Docker hub using the credentials stored in the repository secrets | ||
- name: Log in to Docker Hub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
# Download the binary from the previous job | ||
- name: Download x86_64 linux binary | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: node-template | ||
path: ${{ github.workspace }} | ||
|
||
# Build and push 2 images, One with the version tag and the other with latest tag | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: ./Containerfile | ||
push: true | ||
build-args: | | ||
DOCKER_REPO=${{ env.DOCKER_REPO }} | ||
tags: | | ||
${{ env.DOCKER_REPO }}:${{ github.ref_name }} | ||
${{ env.DOCKER_REPO }}:latest |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[package] | ||
name = "pallet-ibp-alert" | ||
description = "FRAME pallet template for defining custom runtime logic." | ||
version = "0.0.1-poc" | ||
license = "MIT-0" | ||
authors.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
edition.workspace = true | ||
publish = false | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = [ | ||
"derive", | ||
] } | ||
scale-info = { version = "2.10.0", default-features = false, features = [ | ||
"derive", | ||
] } | ||
|
||
# frame deps | ||
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false, optional = true } | ||
frame-support = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false } | ||
frame-system = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0", default-features = false } | ||
pallet-ibp-member = { path = "../ibp-member", default-features = false } | ||
pallet-ibp-service = { path = "../ibp-service", default-features = false } | ||
|
||
[dev-dependencies] | ||
sp-core = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0" } | ||
sp-io = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0" } | ||
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk.git", tag = "polkadot-v1.9.0" } | ||
|
||
[features] | ||
default = ["std"] | ||
std = [ | ||
"codec/std", | ||
"frame-benchmarking?/std", | ||
"frame-support/std", | ||
"frame-system/std", | ||
"scale-info/std", | ||
"sp-core/std", | ||
"sp-io/std", | ||
"sp-runtime/std", | ||
] | ||
runtime-benchmarks = [ | ||
"frame-benchmarking/runtime-benchmarks", | ||
"frame-support/runtime-benchmarks", | ||
"frame-system/runtime-benchmarks", | ||
"sp-runtime/runtime-benchmarks", | ||
] | ||
try-runtime = [ | ||
"frame-support/try-runtime", | ||
"frame-system/try-runtime", | ||
"sp-runtime/try-runtime", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//! Benchmarking setup for pallet-template | ||
#![cfg(feature = "runtime-benchmarks")] | ||
use super::*; | ||
|
||
#[allow(unused)] | ||
use crate::Pallet as Template; | ||
use frame_benchmarking::v2::*; | ||
use frame_system::RawOrigin; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use super::*; | ||
|
||
#[benchmark] | ||
fn do_something() { | ||
let value = 100u32.into(); | ||
let caller: T::AccountId = whitelisted_caller(); | ||
#[extrinsic_call] | ||
do_something(RawOrigin::Signed(caller), value); | ||
|
||
assert_eq!(Something::<T>::get(), Some(value)); | ||
} | ||
|
||
#[benchmark] | ||
fn cause_error() { | ||
Something::<T>::put(100u32); | ||
let caller: T::AccountId = whitelisted_caller(); | ||
#[extrinsic_call] | ||
cause_error(RawOrigin::Signed(caller)); | ||
|
||
assert_eq!(Something::<T>::get(), Some(101u32)); | ||
} | ||
|
||
impl_benchmark_test_suite!(Template, crate::mock::new_test_ext(), crate::mock::Test); | ||
} |
Oops, something went wrong.