Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.
Closed
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
153 changes: 153 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
version: 2.1
commands:
install-rust:
steps:
- run:
name: Install Rust
command: |
sudo apt-get update
sudo apt-get -y install apt-utils cmake pkg-config libssl-dev git llvm clang
if [ ! -d /home/circleci/.cargo ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
fi
source ~/.cargo/env
rustup install $RUST_VERSION
rustup default stable
rustup install nightly
rustup target add wasm32-unknown-unknown --toolchain=nightly
export RUSTC_WRAPPER="" # sccache is uninstalled at this point so it must be unset here for `wasm-gc` install
command -v wasm-gc || cargo install --git https://github.com/alexcrichton/wasm-gc --force
rustc --version; cargo --version; rustup --version
install-sccache:
steps:
- run:
name: Install sccache
command: |
curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-unknown-linux-musl.tar.gz | tar -xz
chmod +x sccache-0.2.10-x86_64-unknown-linux-musl/sccache
mv sccache-0.2.10-x86_64-unknown-linux-musl/sccache ~/.cargo/bin/sccache
sccache --version
restore-cache:
steps:
- restore_cache:
name: Restore sccache
key: sccache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
save-cache:
steps:
- save_cache:
name: Save sccache
# We use {{ epoch }} to always upload a fresh cache:
# Of course, restore_cache will not find this exact key,
# but it will fall back to the closest key (aka the most recent).
# See https://discuss.circleci.com/t/add-mechanism-to-update-existing-cache-key/9014/13
key: sccache-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
paths:
- "~/.cache/sccache"
save-target-cache:
steps:
- save_cache:
name: Save target cache
paths:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/debug/incremental
key: target-cache-{{ arch }}-{{ .Environment.RUST_VERSION }}-{{ .Environment.CIRCLE_BRANCH }}-{{ epoch }}
restore-target-cache:
steps:
- restore_cache:
name: Restore target cache
key: target-cache-{{ arch }}-{{ .Environment.RUST_VERSION }}-{{ .Environment.CIRCLE_BRANCH }}
cargo-check:
steps:
- run:
name: Build
command: cargo check
no_output_timeout: 30m
cargo-build-test:
steps:
- run:
command: cargo test --no-run --release --all
no_output_timeout: 30m
cargo-run-test:
steps:
- run:
command: cargo test --release --all
no_output_timeout: 30m
jobs:
build:
machine:
image: ubuntu-1604:201903-01
steps:
- run: echo "successfully built and tested"
build-bin:
machine:
image: ubuntu-1604:201903-01
resource_class: large
environment:
BASH_ENV: ~/.cargo/env
RUST_VERSION: 1.41.0
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 10G
steps:
- checkout
- install-rust
- install-sccache
- restore-cache
- cargo-check
- save-cache
build-test-and-run:
machine:
image: ubuntu-1604:201903-01
resource_class: large
environment:
BASH_ENV: ~/.cargo/env
RUST_VERSION: 1.41.0
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 10G
steps:
- checkout
- install-rust
- install-sccache
- restore-cache
- cargo-build-test
- save-cache
- cargo-run-test
publish-docker:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
name: Build and publish Docker image
command: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
if [ -z "${CIRCLE_TAG}" ]; then
GIT_SHORT="${CIRCLE_SHA1:0:8}"
VERSION="$(grep package -C 5 Cargo.toml | grep version | cut -d \" -f2)"
DOCKER_TAG="$VERSION-$GIT_SHORT"
else
DOCKER_TAG="${CIRCLE_TAG}"
fi
docker build --pull -t plugnet/plugblockchain:latest -t plugnet/plugblockchain:$DOCKER_TAG -f .maintain/Dockerfile .
docker push plugnet/plugblockchain:$DOCKER_TAG
docker push plugnet/plugblockchain:latest
no_output_timeout: 60m
workflows:
version: 2
build-test-publish:
jobs:
- build-bin
- build-test-and-run
- build:
requires:
- build-bin
- build-test-and-run
- publish-docker:
requires:
- build
filters:
branches:
only:
- /^[0-9]+[.][0-9]+[.][0-9]+(-rc[0-9]+)*$/
- master
33 changes: 18 additions & 15 deletions .maintain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,55 +1,58 @@
# Note: We don't use Alpine and its packaged Rust/Cargo because they're too often out of date,
# preventing them from being used to build Substrate/Polkadot.
# preventing them from being used to build Substrate/Polkadot/Plug.

FROM phusion/baseimage:0.10.2 as builder
LABEL maintainer="[email protected]"
LABEL description="This is the build stage for Substrate. Here we create the binary."
LABEL description="Pl^g build image: The Pl^g binary is built here."

ENV DEBIAN_FRONTEND=noninteractive

ARG PROFILE=release
WORKDIR /substrate
WORKDIR /plug

COPY . /substrate
COPY . /plug

RUN apt-get update && \
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y cmake pkg-config libssl-dev git clang
apt-get install -y \
clang \
cmake \
git \
libssl-dev \
pkg-config

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH="$PATH:$HOME/.cargo/bin" && \
rustup target add wasm32-unknown-unknown && \
rustup toolchain install nightly && \
rustup target add wasm32-unknown-unknown --toolchain nightly && \
rustup default nightly && \
rustup default stable && \
cargo build "--$PROFILE"

# ===== SECOND STAGE ======

FROM phusion/baseimage:0.10.2
LABEL maintainer="[email protected]"
LABEL description="This is the 2nd stage: a very small image where we copy the Substrate binary."
LABEL description="Pl^g runner image: A minimal image for running Pl^g."
ARG PROFILE=release

RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/ && \
mkdir -p /root/.local/share/Polkadot && \
ln -s /root/.local/share/Polkadot /data && \
useradd -m -u 1000 -U -s /bin/sh -d /substrate substrate
useradd -m -u 1000 -U -s /bin/sh -d /plug plug

COPY --from=builder /substrate/target/$PROFILE/substrate /usr/local/bin
COPY --from=builder /plug/target/$PROFILE/plug /usr/local/bin

# checks
RUN ldd /usr/local/bin/substrate && \
/usr/local/bin/substrate --version
RUN ldd /usr/local/bin/plug && \
/usr/local/bin/plug --version

# Shrinking
RUN rm -rf /usr/lib/python* && \
rm -rf /usr/bin /usr/sbin /usr/share/man

USER substrate
USER plug
EXPOSE 30333 9933 9944
VOLUME ["/data"]

CMD ["/usr/local/bin/substrate"]
CMD ["/usr/local/bin/plug"]
4 changes: 2 additions & 2 deletions .maintain/rename-crates-for-2.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ TO_RENAME=(
"sr-api-test sp-api-test"
"sr-arithmetic sp-arithmetic"
"sr-arithmetic-fuzzer sp-arithmetic-fuzzer"
"sr-io sp-io"
"sp-io sp-io"
"sr-primitives sp-runtime"
"sr-sandbox sp-sandbox"
"sr-staking-primitives sp-staking"
"sr-std sp-std"
"sp-std sp-std"
"sr-version sp-version"
"substrate-state-machine sp-state-machine"
"substrate-transaction-pool-runtime-api sp-transaction-pool"
Expand Down
80 changes: 80 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Changelog
Track changes made between Plug and it's upstream project `Substrate`.
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## Added
- Add `MultiCurrencyAccounting` trait to support multi currency accounting in contracts module (#39)

- `frame/contracts/src/exec.rs`
- Add optional doughnut type to `ExecutionContext` struct (#44)
- Add `Ext::doughnut()` to get an optional doughnut from a contract (#44)

- `frame/system/src/lib.rs`
- Add `fn ensure_verified_contract_call()` to verify a doughnut attached to origin at `Contract::call()` (#47)

- `frame/support/src/additional_traits.rs`
- Add `DummyDispatchVerifier` struct for easier mock up in tests (#47)

- `frame/contracts/src/exec.rs`
- Add `DelegatedRuntimeCall` variant to `DeferredAction` enum (#48)
- Add `fn note_delegated_dispatch_call()` to dispatch a delegated contract call (#48)

- `frame/contracts/src/wasm/runtime.rs`
- Add `ext_delegated_dispatch_call` method to dispatch a delegated contract cal (#48)

## Changed
- Renamed trait `AssetIdProvider` to `AssetIdAuthority` to reflect it's 'read from chain' behaviour (#39)
- Make GA imbalance types currency aware so that issuance is managed properly on Drop (#39)
- Generic asset create() is root only and requires the root account nominates an owner for the new currency.
- Create flexible interface for handling contract gas payment

- `frame/contracts/src/wasm/runtime.rs`
- Change `ext_call` method to verify doughnut if attached to a contract (#44)

------

## [1.0.0-rc1] - 2019-10-21

### Added
- `prml/attestation/*`
- Added attestation runtime module

- `prml/doughnut/*`
- Add `PlugDoughnut` wrapper struct to allow doughnut integration with `SignedExtension` hooks
- Add `PlugDoughnutDispatcher` as the defacto Plug implementor for `DelegatedDispatchVerifier`

- `node/runtime/src/lib.rs`
- Add doughnut proof as an optional first parameter to the `node/runtime` `SignedExtra` payload allowing doughnut's to be added to extrinsics
- Add `DelegatedDispatchVerifier` and `Doughnut` proof type to `system::Trait` type bounds

- `primitives/runtime/src/traits.rs`
- Blanket impl SignedExtension for `Option<T>` to allow Optional<PlugDoughnut> in extrinsics
- Add `MaybeDoughnut` trait for SignedExtension type to allow extracting doughnut from `SignedExtra` tuple
- impl `MaybeDoughnut` for SignedExtension macro tuple of all lengths

### Changed
- `core/sr-primitives/src/traits.rs`
- Make trait `SignedExtension::pre_dispatch` method receive self by reference (`&self`), instead of move (`self`)

- `frame/staking/*`
- Add `RewardCurrency` type to allow paying out staking rewards in a different currency to the staked currency
- Change `fn make_payout()` so that RewardCurrency is paid to the stash account and not added to the total stake, if the reward currency is not the staked currency

- `frame/system/src/lib.rs` and `frame/support/src/origin.rs`
- Add `DelegatedOrigin` variant to `RawOrigin` for delegated transactions
- Add `MaybeDoughnutRef` trait for extracting doughnut proof from `origin` without move in runtime module methods

- `frame/support/src/dispatch.rs`
- Add `DelegatedDispatchVerifier` check to `decl_module!` expansion. This allows doughnut proofs to be checked when an extrinsic is dispatched using the `<T as system::Trait>::DelegatedDispatchVerifier` impl

- Renamed binary to `plug` changes made to (`Cargo.toml`s and `Dockerfile` to support this)

### Removed

- The majority of `docs/` is substrate specific and has been removed
- `README.adoc` is substrate specific and has been removed
Loading