Skip to content

Commit

Permalink
Merge branch 'develop' into mesh-1225
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdossa authored Aug 26, 2020
2 parents bf05d0f + f609ee2 commit 2d413ec
Show file tree
Hide file tree
Showing 16 changed files with 460 additions and 303 deletions.
27 changes: 14 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ jobs:
- "a1:99:47:ca:fa:32:4c:9d:4b:b8:50:99:c7:64:e3:80"
- run:
name: Pull submodules
command: GIT_SSH_COMMAND="ssh -i /root/.ssh/id_rsa_a19947cafa324c9d4bb85099c764e380" git submodule update --init pallets/settlement
command: >-
GIT_SSH_COMMAND="ssh -i /root/.ssh/id_rsa_a19947cafa324c9d4bb85099c764e380" git submodule update --init pallets/settlement &&
git submodule update --init external/cryptography
- run:
name: Check formatting
command: ./scripts/rustfmt.sh
Expand All @@ -32,9 +34,8 @@ jobs:
command: rustc --version > rust.version
- restore_cache:
keys:
- v2-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v2-release-cache-{{ checksum "./rust.version" }}
- v2-cli-cache-{{ checksum "./rust.version" }}
- v3-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v3-release-cache-{{ checksum "./rust.version" }}
- run:
name: Pull submodules
command: >-
Expand All @@ -45,7 +46,7 @@ jobs:
command: cargo +nightly build --release || cargo +nightly build -j 1 --release
no_output_timeout: 4h
- save_cache:
key: v2-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
key: v3-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
Expand All @@ -65,8 +66,8 @@ jobs:
command: rustc --version > rust.version
- restore_cache:
keys:
- v8-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v8-test-cache-{{ checksum "./rust.version" }}
- v9-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v9-test-cache-{{ checksum "./rust.version" }}
- run:
name: Pull submodules
command: >-
Expand Down Expand Up @@ -95,7 +96,7 @@ jobs:
--features default_identity
no_output_timeout: 30m
- save_cache:
key: v8-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
key: v9-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
Expand All @@ -115,7 +116,7 @@ jobs:
command: rustc --version > rust.version
- restore_cache:
keys:
- v5-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v6-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- run:
name: Pull submodules
command: >-
Expand All @@ -140,7 +141,7 @@ jobs:
working_directory: ./scripts/cli
no_output_timeout: 10m
- save_cache:
key: v5-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
key: v6-cli-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
Expand All @@ -161,8 +162,8 @@ jobs:
command: rustc +nightly --version > rust.version
- restore_cache:
keys:
- v3-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v3-clippy-cache-{{ checksum "./rust.version" }}
- v4-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- v4-clippy-cache-{{ checksum "./rust.version" }}
- run:
name: Pull submodules
command: >-
Expand All @@ -173,7 +174,7 @@ jobs:
command: cargo +nightly clippy -j 1
no_output_timeout: 60m
- save_cache:
key: v3-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
key: v4-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "~/.cargo"
- "./target"
Expand Down
18 changes: 18 additions & 0 deletions .concourse/pipelines/develop-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ resources:
regexp: concourse/polymesh/polymesh-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: s3-polymesh-runtime
type: s3
source:
bucket: polymesh-testnet-artifacts
region_name: ca-central-1
regexp: concourse/polymesh-runtime/polymesh_runtime_(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: dockerimage-polymesh
type: docker-image
source:
Expand All @@ -46,6 +54,7 @@ resources:

jobs:
- name: build-polymesh
serial: true
plan:
- get: git-polymesh
params:
Expand All @@ -57,6 +66,7 @@ jobs:
- get: semver-git-polymesh
params:
pre: develop.((.:gitshortref))
pre_without_version: true
- in_parallel:
- task: run-lint
config:
Expand Down Expand Up @@ -161,6 +171,14 @@ jobs:
params:
file: artifact/polymesh-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_develop-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_testnet_v1-*
acl: public-read
- put: dockerimage-polymesh
params:
build: artifact
Expand Down
17 changes: 17 additions & 0 deletions .concourse/pipelines/develop-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ resources:
regexp: concourse/polymesh/polymesh-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: s3-polymesh-runtime
type: s3
source:
bucket: polymesh-testnet-artifacts
region_name: ca-central-1
regexp: concourse/polymesh-runtime/polymesh_runtime-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: dockerimage-polymesh
type: docker-image
source:
Expand All @@ -40,6 +48,7 @@ resources:

jobs:
- name: build-polymesh
serial: true
plan:
- get: githubpr-polymesh
params:
Expand Down Expand Up @@ -166,6 +175,14 @@ jobs:
params:
file: artifact/polymesh-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_develop-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_testnet-v1-*
acl: public-read
- put: dockerimage-polymesh
params:
build: artifact
Expand Down
28 changes: 25 additions & 3 deletions .concourse/pipelines/tooling-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ resources:
regexp: concourse/polymesh/polymesh-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: s3-polymesh-runtime
type: s3
source:
bucket: polymesh-testnet-artifacts
region_name: ca-central-1
regexp: concourse/polymesh-runtime/polymesh_runtime_(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: dockerimage-polymesh
type: docker-image
source:
Expand All @@ -46,15 +54,16 @@ resources:

jobs:
- name: build-polymesh
serial: true
plan:
- put: semver-git-polymesh
params:
bump: patch
- get: git-polymesh
params:
list_changed_files: true
trigger: true
version: every
- put: semver-git-polymesh
params:
bump: patch
- in_parallel:
- task: run-lint
config:
Expand Down Expand Up @@ -159,6 +168,14 @@ jobs:
params:
file: artifact/polymesh-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_develop-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_testnet_v1-*
acl: public-read
- put: dockerimage-polymesh
params:
build: artifact
Expand All @@ -184,5 +201,10 @@ jobs:
params:
mode: normal
alert_type: failed
on_error:
put: slack-polymesh
params:
mode: normal
alert_type: failed


17 changes: 17 additions & 0 deletions .concourse/pipelines/tooling-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ resources:
regexp: concourse/polymesh/polymesh-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: s3-polymesh-runtime
type: s3
source:
bucket: polymesh-testnet-artifacts
region_name: ca-central-1
regexp: concourse/polymesh-runtime/polymesh_runtime-(.*)
access_key_id: ((s3-polymath-concourse.access_key_id))
secret_access_key: ((s3-polymath-concourse.secret_access_key))
- name: dockerimage-polymesh
type: docker-image
source:
Expand All @@ -40,6 +48,7 @@ resources:

jobs:
- name: build-polymesh
serial: true
plan:
- get: githubpr-polymesh
params:
Expand Down Expand Up @@ -165,6 +174,14 @@ jobs:
params:
file: artifact/polymesh-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_develop-*
acl: public-read
- put: s3-polymesh-runtime
params:
file: artifact/polymesh_runtime_testnet-v1-*
acl: public-read
- put: dockerimage-polymesh
params:
build: artifact
Expand Down
14 changes: 8 additions & 6 deletions .concourse/scripts/t-cargo-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ mkdir -p ${ARTIFACT_DIR}/lib/x86_64-linux-gnu
touch ${ARTIFACT_DIR}/var/lib/polymesh/.keep
echo -n "${GIT_REF}-distroless" > ${ARTIFACT_DIR}/additional_tags.distroless
echo -n "${GIT_REF}-debian" > ${ARTIFACT_DIR}/additional_tags.debian
cp ${GIT_DIR}/.concourse/dockerfiles/Dockerfile.distroless ${ARTIFACT_DIR}/
cp ${GIT_DIR}/.concourse/dockerfiles/Dockerfile.debian ${ARTIFACT_DIR}/
cp ${VERSION_DIR}/version ${ARTIFACT_DIR}/tag_file
cp ${GIT_DIR}/target/release/polymesh ${ARTIFACT_DIR}/usr/local/bin/polymesh
cp ${GIT_DIR}/target/release/polymesh ${ARTIFACT_DIR}/polymesh-${VERSION}
cp -a /lib/x86_64-linux-gnu/* ${ARTIFACT_DIR}/lib/x86_64-linux-gnu
cp ${GIT_DIR}/.concourse/dockerfiles/Dockerfile.distroless ${ARTIFACT_DIR}/
cp ${GIT_DIR}/.concourse/dockerfiles/Dockerfile.debian ${ARTIFACT_DIR}/
cp ${VERSION_DIR}/version ${ARTIFACT_DIR}/tag_file
cp ${GIT_DIR}/target/release/polymesh ${ARTIFACT_DIR}/usr/local/bin/polymesh
cp ${GIT_DIR}/target/release/polymesh ${ARTIFACT_DIR}/polymesh-${VERSION}
cp ${GIT_DIR}/target/release/wbuild/polymesh-runtime-develop/polymesh_runtime_develop.compact.wasm ${ARTIFACT_DIR}/polymesh_runtime_develop-${VERSION}.wasm
cp ${GIT_DIR}/target/release/wbuild/polymesh-runtime-testnet-v1/polymesh_runtime_testnet_v1.compact.wasm ${ARTIFACT_DIR}/polymesh_runtime_testnet_v1-${VERSION}.wasm
cp -a /lib/x86_64-linux-gnu/* ${ARTIFACT_DIR}/lib/x86_64-linux-gnu
for LIB in $LDLIBS; do
mkdir -p ${ARTIFACT_DIR}/$(dirname $LIB | cut -c 2-)
cp $LIB ${ARTIFACT_DIR}/$(dirname $LIB | cut -c 2-)/
Expand Down
2 changes: 1 addition & 1 deletion .concourse/scripts/t-rustfmt-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
set -x
set -o pipefail

if [ -z "$(find . -name "Cargo.toml" -not -path "*/target/*" -execdir bash -c "cargo fmt -- --check" \;)" ]; then
if [ -z "$(find . -name "Cargo.toml" -not -path "*/target/*" -not -path "*/external/*" -execdir bash -c "cargo fmt -- --check" \;)" ]; then
echo "rustfmt ok"
exit 0
else
Expand Down
13 changes: 9 additions & 4 deletions pallets/asset/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ pub enum IdentifierType {
Cins,
Cusip,
Isin,
Dti,
}

impl Default for IdentifierType {
Expand Down Expand Up @@ -282,7 +283,6 @@ pub struct FocusedBalances<Balance> {
pub portfolio: Balance,
}


pub mod weight_for {
use super::*;

Expand Down Expand Up @@ -2300,11 +2300,16 @@ impl<T: Trait> Module<T> {
}

/// Compute the result of the transfer
pub fn compute_transfer_result(final_result: bool, tm_count: u32, cm_result: Weight) -> (u8, Weight) {
let weight_for_valid_transfer = weight_for::weight_for_is_valid_transfer::<T>(tm_count, cm_result);
pub fn compute_transfer_result(
final_result: bool,
tm_count: u32,
cm_result: Weight,
) -> (u8, Weight) {
let weight_for_valid_transfer =
weight_for::weight_for_is_valid_transfer::<T>(tm_count, cm_result);
let transfer_status = match final_result {
true => ERC1400_TRANSFER_SUCCESS,
false => SMART_EXTENSION_FAILURE
false => SMART_EXTENSION_FAILURE,
};
(transfer_status, weight_for_valid_transfer)
}
Expand Down
6 changes: 4 additions & 2 deletions pallets/compliance-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ impl<T: Trait> ComplianceManagerTrait<T::Balance> for Module<T> {
continue;
}
}

if let Some(to_did) = to_did_opt {
rules_count += active_rule.receiver_rules.len();
if Self::are_all_rules_satisfied(
Expand All @@ -919,7 +919,9 @@ impl<T: Trait> ComplianceManagerTrait<T::Balance> for Module<T> {
// All rules satisfied, return early
return Ok((
ERC1400_TRANSFER_SUCCESS,
weight_for::weight_for_verify_restriction::<T>(u64::try_from(rules_count).unwrap_or(0)),
weight_for::weight_for_verify_restriction::<T>(
u64::try_from(rules_count).unwrap_or(0),
),
));
}
}
Expand Down
Loading

0 comments on commit 2d413ec

Please sign in to comment.