Skip to content

Commit

Permalink
Merge branch 'master' into vs/refactor-ri
Browse files Browse the repository at this point in the history
  • Loading branch information
ukint-vs committed Sep 30, 2023
2 parents 9c9dfa9 + 1feb3d2 commit 4b54f1c
Show file tree
Hide file tree
Showing 39 changed files with 161 additions and 338 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ jobs:
build:
needs: status
if: >-
needs.status.outputs.skip-ci != '1' && (
contains(github.event.pull_request.labels.*.name, 'A0-pleasereview')
|| contains(github.event.pull_request.labels.*.name, 'A4-insubstantial')
|| contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen')
)
needs.status.outputs.skip-ci != '1'
&& (
contains(github.event.pull_request.title, '[depbot]')
|| (
contains(github.event.pull_request.labels.*.name, 'A0-pleasereview')
|| contains(github.event.pull_request.labels.*.name, 'A4-insubstantial')
|| contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen')
))
uses: ./.github/workflows/build.yml
with:
cache: ${{ needs.status.outputs.cache }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
chore(runtime): update weights
file_pattern: "pallets/gear/src/ runtime/gear/src/weights/ runtime/vara/src/weights/"

- name: Create pull Request
- name: Create Pull Request
if: ${{ inputs.change-type == 'pull_request' }}
uses: peter-evans/create-pull-request@v5
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: ./scripts/gear.sh init cargo

- name: "Build: Gear"
run: ./scripts/gear.sh build gear -F gear-cli/dev --locked --release
run: ./scripts/gear.sh build gear --locked --release

- name: "Build fuzzer"
run: ./scripts/gear.sh build fuzz --locked --release
Expand All @@ -93,7 +93,7 @@ jobs:

- name: "Test: Runtime benchmarks and benchmark tests work"
run: |
cargo build -p gear-cli --release --features=dev,runtime-benchmarks,runtime-benchmarks-checkers
cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers
# check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number.
./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096
# check that read_big_state benchmarks works
Expand All @@ -108,11 +108,11 @@ jobs:

- name: "Test: `try-runtime` feature tests"
run: |
cargo test -p "pallet-*" --features try-runtime,dev --release --locked
cargo test -p "pallet-*" --features try-runtime --release --locked
- name: "Test: Try runtime migrations"
run: |
cargo build -p gear-cli --features try-runtime,dev --release --locked
cargo build -p gear-cli --features try-runtime --release --locked
./target/release/gear try-runtime --runtime ./target/release/wbuild/vara-runtime/vara_runtime.wasm on-runtime-upgrade --checks live --uri ws://52.32.138.151:9944
env:
RUST_LOG: info
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:

- name: "Build: Production binaries"
if: github.event_name == 'push'
run: cargo build -p gear-cli -F dev,cli --profile production
run: cargo build -p gear-cli -F cli --profile production

- name: Prepare artifacts
if: github.event_name == 'push'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
env:
RUSTUP_HOME: /tmp/rustup_home
if: ${{ !contains(github.event.pull_request.title, '[skip-ci]') }}
if: ${{ !contains(github.event.pull_request.title, '[skip-ci]') && github.actor != 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4

Expand Down
32 changes: 14 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
- name: "Environment: Cargo path"
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH

- name: "Install: Rust toolchain"
- name: "Environment: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1

- name: "Install: Build dependencies"
- name: "Environment: Build dependencies"
run: |
sudo apt update -y
sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler wget bzip2
Expand All @@ -68,41 +68,37 @@ jobs:
echo "GEAR_SPEC=$(cat runtime/gear/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" >> $GITHUB_ENV
echo "VARA_SPEC=$(cat runtime/vara/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" >> $GITHUB_ENV
- name: "Artifact: Make `artifact` directory"
- name: "Environment: Make `artifact` directory"
run: mkdir -p artifact

- name: "Build: `wasm-proc`"
run: |
cargo build -p wasm-proc --release
cp -vf target/release/wasm-proc ./
- name: "Build: Production `gear-cli`"
run: cargo build -p gear-cli --profile production
- name: "Build: Production `vara-runtime`"
run: cargo build -p vara-runtime --profile production --no-default-features --features std

- name: "Test: Production runtimes"
run: |
./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm
./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm
- name: "Test: Production `vara-runtime`"
run: ./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm

- name: "Artifact: Production binaries"
run: |
cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/gear_runtime_v$GEAR_SPEC.wasm"
cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/vara_runtime_v$VARA_SPEC.wasm"
cp target/production/gear artifact/gear
strip artifact/gear || true
- name: "Artifact: Production `vara-runtime`"
run: cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/vara_runtime_v$VARA_SPEC.wasm"

- name: "Build: Development `gear-cli`"
run: cargo build -p gear-cli --profile production -F dev
- name: "Build: Production node with development runtimes"
run: cargo build -p gear-cli --profile production

- name: "Test: Development runtimes"
run: |
./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm
./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm
- name: "Artifact: Development binaries"
- name: "Artifact: Production node and development runtimes"
run: |
cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/gear_devruntime_v$GEAR_SPEC.wasm"
cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/vara_devruntime_v$VARA_SPEC.wasm"
cp target/production/gear artifact/gear
strip artifact/gear || true
- name: Publish
uses: softprops/action-gh-release@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-measurements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
tar -xf /cache/check_cargo_registry_${{ github.ref_name }}.tar -C /
- name: "Build: Gear"
run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks
run: ./scripts/gear.sh build gear --release --locked --features=runtime-benchmarks

- name: "Collect: Gear workspace tests"
run: |
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ gear-lazy-pages = { path = "lazy-pages" }
gear-lazy-pages-common = { path = "lazy-pages/common", default-features = false }
gear-lazy-pages-interface = { path = "lazy-pages/interface", default-features = false }
gear-node-testing = { path = "node/testing" }
gear-runtime = { path = "runtime/gear" }
gear-runtime = { path = "runtime/gear", default-features = false }
gear-runtime-common = { path = "runtime/common", default-features = false }
gear-runtime-interface = { path = "runtime-interface", default-features = false }
gear-sandbox = { path = "sandbox/sandbox", default-features = false }
Expand Down Expand Up @@ -240,7 +240,7 @@ runtime-common = { package = "gear-runtime-common", path = "runtime/common", def
runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", default-features = false }
service = { package = "gear-service", path = "node/service", default-features = false }
testing = { package = "gear-node-testing", path = "node/testing" }
vara-runtime = { path = "runtime/vara" }
vara-runtime = { path = "runtime/vara", default-features = false }
wasm-smith = { version = "0.11.4", git = "https://github.com/gear-tech/wasm-tools.git", branch = "gear-stable" }
validator-set = { package = 'substrate-validator-set', git = 'https://github.com/gear-tech/substrate-validator-set.git', branch = 'gear-polkadot-v0.9.41-canary-no-sandbox', default-features = false }

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ examples-proc: wasm-proc-release

.PHONY: node
node:
@ ./scripts/gear.sh build node -F dev
@ ./scripts/gear.sh build node

.PHONY: node-release
node-release:
@ ./scripts/gear.sh build node -F dev --release
@ ./scripts/gear.sh build node --release

.PHONY: vara
vara:
Expand Down Expand Up @@ -175,11 +175,11 @@ purge-chain-release:

.PHONY: purge-dev-chain
purge-dev-chain:
@ ./scripts/gear.sh run purge-dev-chain -F dev
@ ./scripts/gear.sh run purge-dev-chain

.PHONY: purge-dev-chain-release
purge-dev-chain-release:
@ ./scripts/gear.sh run purge-dev-chain --release -F dev
@ ./scripts/gear.sh run purge-dev-chain --release

# Test section
.PHONY: test # \
Expand Down
2 changes: 1 addition & 1 deletion examples/sys-calls/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn process(syscall_kind: Kind) {
);
}
Kind::ValueAvailable(expected_value) => {
let _ = msg::send_delayed(msg::source(), b"payload", 2000, 0);
let _ = msg::send_delayed(msg::source(), b"payload", 10_000_000_000_000, 0);
let actual_value = exec::value_available();
assert_eq!(
expected_value, actual_value,
Expand Down
2 changes: 1 addition & 1 deletion gcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ reqwest = { workspace = true, default-features = false, features = [ "json", "ru
etc.workspace = true
sp-io = { workspace = true, features = [ "std" ] }
sp-core = { workspace = true, features = [ "std" ] }
vara-runtime = { workspace = true, features = [ "std" ] }
vara-runtime = { workspace = true, features = [ "std", "dev" ] }

[dev-dependencies]
rand.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions gcli/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ pub fn gcli<T: ToString>(args: impl IntoIterator<Item = T>) -> Result<Output> {

/// Run the dev node
pub fn dev() -> Result<Node> {
#[cfg(not(feature = "vara-testing"))]
let args = vec!["--tmp", "--dev"];
#[cfg(feature = "vara-testing")]
let args = vec!["--tmp", "--dev"];
#[cfg(not(feature = "vara-testing"))]
let args = vec![
"--tmp",
"--chain=vara-dev",
"--chain=gear-dev",
"--alice",
"--validator",
"--reserved-only",
Expand Down
2 changes: 1 addition & 1 deletion gclient/tests/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async fn two_nodes_run_independently() {
async fn program_migrated_to_another_node() {
const INIT_VALUE_PAYLOAD: u64 = 42;
const MULTIPLICATOR_VALUE_PAYLOAD: u64 = 4;
const PROGRAM_FUNDS: u128 = 25_000;
const PROGRAM_FUNDS: u128 = 25_000_000_000_000;

// Arrange

Expand Down
8 changes: 6 additions & 2 deletions gclient/tests/set_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ async fn set_code_succeed() {
.await
.unwrap();
let _block_hash = api
.set_code_without_checks_by_path("../target/release/wbuild/gear-runtime/gear_runtime.wasm")
.set_code_without_checks_by_path(
"../target/release/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm",
)
.await
.unwrap();
}
Expand All @@ -38,7 +40,9 @@ async fn set_code_failed() {
.await
.unwrap();
let err = api
.set_code_by_path("../target/release/wbuild/gear-runtime/gear_runtime.wasm")
.set_code_by_path(
"../target/release/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm",
)
.await
.unwrap_err();

Expand Down
2 changes: 1 addition & 1 deletion gcore/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ pub fn pay_program_rent(program_id: ActorId, value: u128) -> Result<(u128, u32)>
pub fn random(subject: [u8; 32]) -> Result<([u8; 32], u32)> {
let mut res: BlockNumberWithHash = Default::default();

unsafe { gsys::gr_random(subject.as_ptr(), res.as_mut_ptr()) };
unsafe { gsys::gr_random(&subject, res.as_mut_ptr()) };

Ok((res.hash, res.bn))
}
4 changes: 2 additions & 2 deletions gsys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ extern "C" {
/// Infallible `gr_random` calculate syscall.
///
/// Arguments type:
/// - `subject`: `const ptr` for the begging of the payload buffer.
/// - `subject`: `const ptr` for the subject.
/// - `bn_random`: `mut ptr` for concatenated block number with hash.
pub fn gr_random(subject: *const BufferStart, bn_random: *mut BlockNumberWithHash);
pub fn gr_random(subject: *const Hash, bn_random: *mut BlockNumberWithHash);

// TODO: issue #1859
/// Fallible `gr_read` get syscall.
Expand Down
2 changes: 1 addition & 1 deletion node/authorship/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ testing = {workspace = true, features = ["vara-native"] }
vara-runtime = { workspace = true, features = ["std", "dev"] }
demo-mul-by-const = { workspace = true, features = ["debug"] }
env_logger.workspace = true
service = { workspace = true, features = ["dev", "vara-native"] }
service = { workspace = true, features = ["vara-native"] }
13 changes: 4 additions & 9 deletions node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ pallet-gear-payment = { workspace = true, features = ["std"] }
pallet-gear-staking-rewards = { workspace = true, optional = true, features = ["std"] }

# Gear Runtimes
gear-runtime = { workspace = true, optional = true, features = ["std"] }
vara-runtime = { workspace = true, optional = true, features = ["std"] }
gear-runtime = { workspace = true, optional = true, features = ["std", "dev"] }
vara-runtime = { workspace = true, optional = true, features = ["std", "dev"] }

# Substrate client
sc-cli.workspace = true
Expand Down Expand Up @@ -65,12 +65,12 @@ substrate-build-script-utils.workspace = true
[features]
default = ["gear-native", "vara-native"]
gear-native = [
"service/gear-native",
"gear-runtime",
"service/gear-native",
]
vara-native = [
"service/vara-native",
"vara-runtime",
"service/vara-native",
"pallet-gear-staking-rewards",
]
runtime-benchmarks = [
Expand All @@ -81,11 +81,6 @@ runtime-benchmarks = [
runtime-benchmarks-checkers = [
"service/runtime-benchmarks-checkers",
]
dev = [
"service/dev",
"gear-runtime?/dev",
"vara-runtime?/dev",
]
try-runtime = [
"service/try-runtime",
"try-runtime-cli/try-runtime",
Expand Down
4 changes: 0 additions & 4 deletions node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ pub struct RunCmd {
#[command(flatten)]
pub base: sc_cli::RunCmd,

/// Force using Vara native runtime.
#[arg(long = "force-vara")]
pub force_vara: bool,

/// The upper limit for the amount of gas a validator can burn in one block.
#[arg(long)]
pub max_gas: Option<u64>,
Expand Down
Loading

0 comments on commit 4b54f1c

Please sign in to comment.