Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project voting data api #224

Merged
merged 112 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
802926e
add back sudo to rococo
samelamin Aug 25, 2023
f8b03b8
runtime api
f-gate Sep 12, 2023
b578bc3
runtime-api-wiring
f-gate Sep 14, 2023
da988ce
Merge branch 'main' into rococo_admin
samelamin Sep 17, 2023
0a4c8f3
some dummy log statements
samelamin Sep 18, 2023
f93d211
attempt 1 to add try-runtime
samelamin Sep 19, 2023
897729f
second attempt
samelamin Sep 19, 2023
33353bb
add to the cli
samelamin Sep 19, 2023
fe1cb42
fix warn issue
samelamin Sep 19, 2023
e3a5dd9
on initialise, remove on runtime upgrade proposasl
f-gate Sep 19, 2023
eb01227
Merge branch 'rococo_admin' of github.com:ImbueNetwork/imbue into roc…
f-gate Sep 19, 2023
c8d46b0
add the new storage version migration
f-gate Sep 20, 2023
661c2a8
pick runtime
f-gate Sep 20, 2023
34b5004
new migration for proposals
f-gate Sep 20, 2023
163b02d
fmt
f-gate Sep 20, 2023
c9cdf6e
fix v3-v4 migration test
f-gate Sep 20, 2023
4b15042
fix 2
f-gate Sep 20, 2023
cfee84e
fix brief migration test
f-gate Sep 20, 2023
a078c2a
clippy
f-gate Sep 20, 2023
e01a72f
fmt
f-gate Sep 20, 2023
1d5122c
Merge branch 'rococo_admin' of github.com:ImbueNetwork/imbue into pro…
f-gate Sep 21, 2023
2b4ce51
new MilestoneVote implementation
f-gate Sep 21, 2023
a44b15a
fix implementation
f-gate Sep 21, 2023
6548e99
get project individual votes
f-gate Sep 21, 2023
8b17b33
remove total votes api
f-gate Sep 21, 2023
6431cbb
fmt
f-gate Sep 21, 2023
9719202
ummm
f-gate Sep 21, 2023
a9cee1c
new format for Individual votes
f-gate Sep 21, 2023
b58ab9d
boom baby, and a fmt
f-gate Sep 22, 2023
8c89cd3
clippy
f-gate Sep 22, 2023
560071b
Merge branch 'main' of github.com:ImbueNetwork/imbue into project-vot…
f-gate Sep 22, 2023
92efaf5
fix build
f-gate Sep 22, 2023
0fc2387
fmt
f-gate Sep 22, 2023
55c5782
bump spec version
f-gate Sep 22, 2023
50bf456
1
f-gate Sep 24, 2023
8ff910d
Merge branch 'main' of github.com:ImbueNetwork/imbue into project-vot…
f-gate Sep 25, 2023
9683bfa
individual votes impl with storage
f-gate Sep 25, 2023
c043e3e
fix buggy impl
f-gate Sep 25, 2023
c666930
define immutability, update on vote
f-gate Sep 25, 2023
dbbef52
use individual votes for oninit and submit and close voting + update …
f-gate Sep 26, 2023
7767b82
fixing build
f-gate Sep 26, 2023
0a570fc
seperated test files, tested ImmutableVotes
f-gate Sep 27, 2023
6f66e35
fix runtime api, reorg proposals
f-gate Sep 27, 2023
15c5f1d
fmt
f-gate Sep 27, 2023
e0989aa
fmt
f-gate Sep 27, 2023
31c9ff4
clippy
f-gate Sep 27, 2023
8d32458
migration, err handling
f-gate Sep 27, 2023
af03d54
fix migration
f-gate Sep 27, 2023
57f379a
fmt
f-gate Sep 27, 2023
ca92226
fix
f-gate Sep 27, 2023
c8000da
clippy
f-gate Sep 27, 2023
ceb62b7
update executive and spec version
f-gate Sep 27, 2023
5d1f8a2
Merge branch 'main' of github.com:ImbueNetwork/imbue into project-vot…
f-gate Sep 27, 2023
d295308
fmt
f-gate Sep 27, 2023
79f6966
remove todos
f-gate Sep 27, 2023
0470140
remove wrong comment
f-gate Sep 27, 2023
15a044c
fix failing test
f-gate Sep 28, 2023
5e6f797
fmt
f-gate Sep 28, 2023
7ba1ec5
run on gcp
samelamin Oct 3, 2023
e39b7c8
bump to rebuild
samelamin Oct 3, 2023
2d4025b
use self hosted runner
samelamin Oct 3, 2023
de09ee1
already installed on runner
samelamin Oct 3, 2023
774d8fa
attempt auto scaling runner
samelamin Oct 4, 2023
9821458
increase disk size
samelamin Oct 4, 2023
2395d74
bump to build again
samelamin Oct 4, 2023
4cf5847
Merge branch 'add_gcp_runner' of github.com:ImbueNetwork/imbue into p…
f-gate Oct 4, 2023
8387d02
dont delete at the end of the job
samelamin Oct 4, 2023
21576f0
remove unused directories
samelamin Oct 4, 2023
8b7a43b
bump
samelamin Oct 4, 2023
3c080e9
change region
samelamin Oct 4, 2023
d90513b
split the jobs
samelamin Oct 5, 2023
c4096ad
add -y flag
f-gate Oct 5, 2023
cf7e201
test menually installing rust
f-gate Oct 5, 2023
6063cd8
-y flag
f-gate Oct 5, 2023
1727932
more -y
f-gate Oct 5, 2023
b0724b3
remove double install of protobugf
f-gate Oct 5, 2023
b0b30d7
-y
f-gate Oct 5, 2023
286a0d7
trial 1
f-gate Oct 5, 2023
db2fcd5
fix
f-gate Oct 5, 2023
055f82f
fix2
f-gate Oct 5, 2023
44377e6
fix3
f-gate Oct 5, 2023
87a6403
bump up
samelamin Oct 5, 2023
7051bb0
bump
samelamin Oct 5, 2023
5745c24
change zone
samelamin Oct 5, 2023
195c77d
bump
samelamin Oct 5, 2023
e1f7670
lol -y
samelamin Oct 5, 2023
3c2d57e
bump
samelamin Oct 5, 2023
9768092
bump 2
samelamin Oct 5, 2023
3094af1
set home directory
samelamin Oct 5, 2023
55d8ee7
try to run as user
samelamin Oct 5, 2023
090cd0f
init commit
samelamin Oct 5, 2023
52749f4
commit 2
samelamin Oct 5, 2023
82a14cd
test
samelamin Oct 5, 2023
f4f9e86
test 3
samelamin Oct 5, 2023
92b1542
attempt 4
samelamin Oct 5, 2023
68b2d09
bump
samelamin Oct 5, 2023
890fd28
bump
samelamin Oct 5, 2023
65881c3
bump
samelamin Oct 5, 2023
f89193d
bump
samelamin Oct 5, 2023
fb9f295
bump
samelamin Oct 5, 2023
fc62ee1
reduce image size
samelamin Oct 5, 2023
8bfe500
bump
samelamin Oct 5, 2023
61b642c
bump
samelamin Oct 5, 2023
2e32bb5
bump again
samelamin Oct 5, 2023
1007bf0
add clippy
samelamin Oct 5, 2023
72982ef
build essentials
samelamin Oct 5, 2023
1987541
clang
samelamin Oct 5, 2023
ded4454
refactor
samelamin Oct 5, 2023
fb2c338
typo
samelamin Oct 5, 2023
03bee25
typo 2
samelamin Oct 5, 2023
13fecb1
make zone configurable
samelamin Oct 5, 2023
faa865c
Merge branch 'gcp_runner' of github.com:ImbueNetwork/imbue into proje…
f-gate Oct 5, 2023
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
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: build-on-self-hosted-runner
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
branches:
- main
paths-ignore:
- "**.md"
env:
CARGO_TERM_COLOR: always
GCP_ZONE: europe-west3-a

jobs:
create-runner:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.create-runner.outputs.label }}
steps:
- id: create-runner
uses: related-sciences/gce-github-runner@v0.10
with:
token: ${{ secrets.GH_SA_TOKEN }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
image_project: ubuntu-os-cloud
image_family: ubuntu-2004-lts
machine_type: e2-highcpu-32
disk_size: 100
machine_zone: ${{ env.GCP_ZONE }}
ephemeral: true

test-features:
needs: create-runner
runs-on: ${{ needs.create-runner.outputs.label }}
steps:
- uses: actions/checkout@v4

- name: Set HOME
run: echo "HOME=/home/ubuntu" >> ${GITHUB_ENV}

- name: Install minimal nightly Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-05-22
target: wasm32-unknown-unknown
override: true
components: rustfmt, clippy

- name: Install Dependencies
run: sudo apt install protobuf-compiler clang build-essential -y

- name: 🫠 rustfmt 🫠
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check

- name: Run tests with benchmarks
run: cargo test --features runtime-benchmarks
148 changes: 74 additions & 74 deletions .github/workflows/collator_actions.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
name: rust
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
branches:
- main
paths-ignore:
- "**.md"

env:
CARGO_TERM_COLOR: always

jobs:
build-imbue-collator:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install minimal nightly Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-05-22
target: wasm32-unknown-unknown
override: true

- name: Update submodules
run: git submodule update --recursive --remote

- name: Clean unused directories
run: sudo rm -rf /usr/share/dotnet;sudo rm -rf /opt/ghc;sudo rm -rf "/usr/local/share/boost";sudo rm -rf "$AGENT_TOOLSDIRECTORY"

- name: Install Protobuf
run: sudo apt install protobuf-compiler

- name: Run tests with benchmarks
run: cargo test --features runtime-benchmarks
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Protobuf
run: sudo apt install protobuf-compiler
- name: Install minimal nightly Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-05-22
target: wasm32-unknown-unknown
override: true
- name: Install clippy
run: rustup component add clippy
- name: Ensure executable
run: chmod +x ./ci/jobs/clippy.sh
- name: Run clippy
run: ./ci/jobs/clippy.sh
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rustfmt
run: rustup component add rustfmt
- name: Ensure executable
run: chmod +x ./ci/jobs/rustfmt.sh
- name: Run rustfmt
run: ./ci/jobs/rustfmt.sh
#name: rust
#on:
# workflow_dispatch:
# push:
# branches:
# - main
# paths-ignore:
# - "**.md"
# pull_request:
# branches:
# - main
# paths-ignore:
# - "**.md"
#
# env:
# CARGO_TERM_COLOR: always
#
#jobs:
# build-imbue-collator:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout sources
# uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: Install minimal nightly Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly-2023-05-22
# target: wasm32-unknown-unknown
# override: true
#
# - name: Update submodules
# run: git submodule update --recursive --remote
#
# - name: Clean unused directories
# run: sudo rm -rf /usr/share/dotnet;sudo rm -rf /opt/ghc;sudo rm -rf "/usr/local/share/boost";sudo rm -rf "$AGENT_TOOLSDIRECTORY"
#
# - name: Install Protobuf
# run: sudo apt install protobuf-compiler
#
# - name: Run tests with benchmarks
# run: cargo test --features runtime-benchmarks
# clippy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install Protobuf
# run: sudo apt install protobuf-compiler
# - name: Install minimal nightly Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly-2023-05-22
# target: wasm32-unknown-unknown
# override: true
# - name: Install clippy
# run: rustup component add clippy
# - name: Ensure executable
# run: chmod +x ./ci/jobs/clippy.sh
# - name: Run clippy
# run: ./ci/jobs/clippy.sh
# rustfmt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install rustfmt
# run: rustup component add rustfmt
# - name: Ensure executable
# run: chmod +x ./ci/jobs/rustfmt.sh
# - name: Run rustfmt
# run: ./ci/jobs/rustfmt.sh
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[profile.release]
panic = 'unwind'
split-debuginfo = "unpacked"
opt-level = 3

[workspace.package]
authors = ["imbue <https://github.com/ImbueNetwork>"]
Expand All @@ -23,3 +24,13 @@ members = [
"runtime/imbue-kusama",
"runtime/common",
]

# make sure dev builds with backtrace do
# not slow us down
[profile.dev.package.backtrace]
inherits = "release"

[profile.production]
inherits = "release"
lto = true
codegen-units = 1
Empty file modified ci/jobs/clippy.sh
100644 → 100755
Empty file.
11 changes: 11 additions & 0 deletions ci/jobs/install_rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -euo pipefail
sudo apt -y install build-essential
sudo apt -y install --assume-yes git clang curl libssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup update
rustup toolchain install nightly-2023-05-22
rustup target add wasm32-unknown-unknown --toolchain nightly-2023-05-22
rustup component add rustfmt
rustup component add clippy
Empty file modified ci/jobs/rustfmt.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
C::Api: BlockBuilder<Block>,
C::Api: pallet_proposals_rpc::ProposalsRuntimeApi<Block, AccountId>,
C::Api: pallet_proposals_rpc::ProposalsRuntimeApi<Block, AccountId, Balance>,
P: TransactionPool + Sync + Send + 'static,
{
use pallet_proposals_rpc::{Proposals, ProposalsApiServer};
Expand Down
1 change: 1 addition & 0 deletions pallets/fellowship/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.2.2", default-features = false, features = [
"derive",
] }
serde = { version = "1.0.101", features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions pallets/proposals/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-l
# Local Dependencies
common-traits = { path = "../../libs/common-traits", default-features = false }
common-types = { path = "../../libs/common-types", default-features = false }
common-runtime = { path = "../../runtime/common", default-features = false }
pallet-deposits = { path = "../deposits", default-features = false }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions pallets/proposals/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =

jsonrpsee = { version = "0.16.2", features = ["server", "macros"] }


# Substrate packages
sp-api = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
sp-rpc = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
sp-blockchain = { default-features = false, version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
pallet-proposals-rpc-runtime-api = {path = "./runtime-api" }
pallet-proposals-rpc-runtime-api = { default-features = false, path = "./runtime-api" }
sp-std = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43"}


[features]
Expand Down
3 changes: 3 additions & 0 deletions pallets/proposals/rpc/runtime-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [
"derive",
] }
serde = { version = "1.0.101", features = ["derive"], default-features = false}
scale-info = { version = "2.0.1", default-features = false, features = ["derive"] }

sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43"}
sp-std = {default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43"}
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
frame-system = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.43" }
Expand Down
7 changes: 6 additions & 1 deletion pallets/proposals/rpc/runtime-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#![cfg_attr(not(feature = "std"), no_std)]

use sp_std::vec::Vec;

sp_api::decl_runtime_apis! {
pub trait ProposalsApi<AccountId> where AccountId: codec::Codec {
pub trait ProposalsApi<AccountId, Balance>
where AccountId: codec::Codec + Ord,
{
fn get_project_account_by_id(project_id: u32) -> AccountId;
fn get_all_project_data(project_id: u32) -> Option<(Vec<u8>, Vec<u8>)>;
}
}
Loading
Loading