Commit ab6fb9a2 authored by Andrew Jones's avatar Andrew Jones

Merge branch 'master' into aj-runtime-get-storage

parents ae34aeb1 8165b244
Pipeline #69612 failed with stages
in 20 minutes and 35 seconds
......@@ -6,7 +6,8 @@
stages:
- check-workspace
- check
- workspace
- examples
variables:
......@@ -46,17 +47,18 @@ variables:
- /^[0-9]+$/ # PRs
retry:
max: 2
when:
when:
- runner_system_failure
- unknown_failure
- api_failure
tags:
- linux-docker
#### stage: check-workspace
#### stage: check
check-std:
stage: check-workspace
stage: check
<<: *docker-env
script:
- for crate in ${ALL_CRATES}; do
......@@ -64,55 +66,67 @@ check-std:
done
check-wasm:
stage: check-workspace
stage: check
<<: *docker-env
script:
- for crate in ${WASM_CRATES}; do
cargo check --verbose --no-default-features --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
#### stage: workspace
build-std:
stage: check-workspace
stage: workspace
<<: *docker-env
dependencies:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo build --verbose --all-features --release;
done
build-wasm:
stage: check-workspace
stage: workspace
<<: *docker-env
dependencies:
- check-wasm
script:
- for crate in ${WASM_CRATES}; do
cargo build --verbose --no-default-features --release --target wasm32-unknown-unknown --manifest-path ${crate}/Cargo.toml;
done
test-std:
stage: check-workspace
test:
stage: workspace
<<: *docker-env
dependencies:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo test --verbose --all-features --release;
done
clippy-std:
stage: check-workspace
stage: workspace
<<: *docker-env
dependencies:
- check-std
script:
- for crate in ${ALL_CRATES}; do
cargo clippy --verbose --all-features -- -D warnings;
done
clippy-wasm:
stage: check-workspace
stage: workspace
<<: *docker-env
dependencies:
- check-wasm
script:
- for crate in ${WASM_CRATES}; do
cargo clippy --verbose --manifest-path ${crate}/Cargo.toml --no-default-features -- -D warnings;
cargo clippy --verbose --manifest-path ${crate}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
done
fmt:
stage: check-workspace
stage: workspace
<<: *docker-env
script:
- for crate in ${ALL_CRATES}; do
......@@ -126,15 +140,15 @@ examples-test:
stage: examples
<<: *docker-env
script:
- for DIR in examples/lang2/*; do
cargo test --verbose --manifest-path ${DIR}/Cargo.toml;
- for example in examples/lang2/*; do
cargo test --verbose --manifest-path ${example}/Cargo.toml;
done
examples-fmt:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
- for example in examples/lang2/*; do
cargo fmt --verbose --manifest-path ${example}/Cargo.toml -- --check;
done
......@@ -142,16 +156,16 @@ examples-clippy-std:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --all-features -- -D warnings;
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml -- -D warnings;
done
examples-clippy-wasm:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features -- -D warnings;
- for example in examples/lang2/*; do
cargo clippy --verbose --manifest-path ${example}/Cargo.toml --no-default-features --target wasm32-unknown-unknown -- -D warnings;
done
examples-contract-build:
......@@ -164,12 +178,12 @@ examples-contract-build:
popd;
done
examples-generate-abi:
examples-generate-metadata:
stage: examples
<<: *docker-env
script:
- for example in examples/lang2/*; do
- for example in examples/lang2/*; do
pushd $example &&
cargo contract generate-abi &&
cargo contract generate-metadata &&
popd;
done
......@@ -4,16 +4,11 @@ dist: trusty
sudo: true
rust:
# - stable
# - beta
- nightly
- nightly-2019-10-04
- nightly-2019-11-17
matrix:
allow_failures:
- rust: nightly
# - rust: stable
# - rust: beta
env:
global:
......@@ -56,31 +51,9 @@ install:
# Print current work directory state as directions.
- ls -lah
before_script:
- rustup component add clippy rustfmt
- rustup target add wasm32-unknown-unknown
script:
- |
./scripts/check-workspace.sh
check_workspace=$?
if [ $check_workspace -eq 0 ]
then
# Execute and upload kcov results
cargo kcov --verbose --coveralls --all --no-clean-rebuild
kcov=$?
bash <(curl -s https://codecov.io/bash)
fi
./scripts/check-examples.sh
check_examples=$?
if [ $check_examples -eq 0 ] && [ $check_workspace -eq 0 ]
then
echo "All checks have passed!"
exit 0
else
echo "Some checks have not passed!"
exit 1
fi
cargo test --all-features --all
cargo kcov --verbose --coveralls --all --no-clean-rebuild
bash <(curl -s https://codecov.io/bash)
exit 0
This diff is collapsed.
// Copyright {\d+}-{\d+} Parity Technologies (UK) Ltd.
// This file is part of ink!.
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
......@@ -4,18 +4,19 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0"
license = "APACHE-2.0"
readme = "README.md"
description = "Rust based eDSL for writing smart contracts for Substrate"
repository = "https://github.com/paritytech/ink"
documentation = "https://substrate.dev/substrate-contracts-workshop/#/"
homepage = "https://www.parity.io/"
description = "[ink!] Rust based eDSL for writing smart contracts for Substrate"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
categories = ["no-std", "embedded"]
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
[dependencies]
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
derive_more = { version = "0.99.1", default-features = false, features = ["from"] }
derive_more = { version = "0.99.2", default-features = false, features = ["from"] }
ink_abi_derive = { version = "0.1.0", path = "derive", default-features = false, optional = true }
type-metadata = { git = "https://github.com/type-metadata/type-metadata.git", default-features = false, features = ["derive"] }
......@@ -27,11 +28,11 @@ default = [
"std",
"derive",
]
derive = [
"ink_abi_derive"
]
std = [
"ink_abi_derive/std",
"serde/std",
"type-metadata/std",
]
derive = [
"ink_abi_derive"
]
......@@ -3,9 +3,15 @@ name = "ink_abi_derive"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "Apache-2.0"
readme = "../README.md"
license = "GPL-3.0"
readme = "README.md"
repository = "https://github.com/paritytech/ink"
documentation = "https://substrate.dev/substrate-contracts-workshop/#/"
homepage = "https://www.parity.io/"
description = "[ink!] Rust based eDSL for writing smart contracts for Substrate"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
categories = ["no-std", "embedded"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
[lib]
proc-macro = true
......
../../LICENSE
\ No newline at end of file
../../README.md
\ No newline at end of file
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
macro_rules! bail {
($($args:tt)*) => {
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::impl_wrapper::wrap;
use proc_macro2::TokenStream as TokenStream2;
use quote::quote;
use syn::{
......@@ -30,6 +27,8 @@ use syn::{
Token,
};
use crate::impl_wrapper::wrap;
pub fn generate(input: TokenStream2) -> TokenStream2 {
match generate_impl(input) {
Ok(output) => output,
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#[cfg(not(feature = "std"))]
use alloc::{
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
extern crate proc_macro;
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#[cfg(not(feature = "std"))]
use alloc::{
string::String,
vec::Vec,
};
use core::fmt::Write;
use derive_more::From;
use serde::{
Serialize,
Serializer,
};
use std::fmt::Write;
use type_metadata::{
form::{
CompactForm,
......@@ -30,9 +34,6 @@ use type_metadata::{
Registry,
};
#[cfg(not(feature = "std"))]
use alloc::vec::Vec;
/// Implemented by types that have a storage layout.
///
/// Has to be used on previously allocated instances of the types.
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![cfg_attr(not(feature = "std"), no_std)]
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License
// along with ink!. If not, see <http://www.gnu.org/licenses/>.
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![allow(clippy::new_ret_no_self)]
#[cfg(not(feature = "std"))]
use alloc::{
format,
vec,
vec::Vec,
};
use core::marker::PhantomData;
use serde::{
Serialize,
Serializer,
......@@ -30,12 +37,6 @@ use type_metadata::{
Registry,
};
#[cfg(not(feature = "std"))]
use alloc::{
vec,
vec::Vec,
};
/// Describes a contract.
#[derive(Debug, PartialEq, Eq, Serialize)]
#[serde(bound = "F::TypeId: Serialize")]
......@@ -719,7 +720,6 @@ impl EventParamSpecBuilder {
docs: docs.into_iter().collect::<Vec<_>>(),
..self.spec
},
..self
}
}
......@@ -825,6 +825,7 @@ impl MessageParamSpecBuilder {
}
}
#[allow(clippy::trivially_copy_pass_by_ref)]
fn serialize_selector<S>(s: &[u8; 4], serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
......@@ -843,10 +844,10 @@ mod tests {
#[test]
fn construct_selector_must_serialize_to_hex() {
// given
let name = <MetaForm as Form>::String::from("foo");
let name = "foo";
let cs: ConstructorSpec<MetaForm> = ConstructorSpec {
name,
selector: 123456789u32.to_be_bytes(),
selector: 123_456_789u32.to_be_bytes(),
args: Vec::new(),
docs: Vec::new(),
};
......
......@@ -4,18 +4,15 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
license = "GPL-3.0"
license = "APACHE-2.0"
readme = "README.md"
repository = "https://github.com/paritytech/ink"
documentation = "https://github.com/paritytech/ink/wiki"
documentation = "https://substrate.dev/substrate-contracts-workshop/#/"
homepage = "https://www.parity.io/"
description = "[ink!] Rust based eDSL for writing smart contracts for Substrate"
keywords = ["wasm", "parity", "webassembly", "blockchain", "edsl"]
categories = ["no-std", "embedded"]
include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
include = ["Cargo.toml", "src/**/*.rs", "README.md", "LICENSE"]
[dependencies]
wee_alloc = { version = "0.4", default-features = false }
......
// Copyright 2018-2019 Parity Technologies (UK) Ltd.
// This file is part of ink!.
//
// ink! is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ink! is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// http://www.apache.org/licenses/LICENSE-2.0
//
// You should have received a copy of the GNU General Public License