diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fbc349..dd1f1cb 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,15 @@ -name: Building +name: Build Torus Runtime on: workflow_dispatch: push: - branches: [github-ci-test] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + tags: + - "v*" + - "runtime-*" + - "runtime/*" + branches: + - github-ci-test + - build-runtime jobs: build: @@ -23,7 +25,6 @@ jobs: run: | rustup set profile minimal rustup show - rustc --version - name: Install Protoc uses: arduino/setup-protoc@v1 @@ -31,7 +32,26 @@ jobs: version: 3.20.1 repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Run build - env: - SKIP_WASM_BUILD: 1 - run: cargo build + - name: Build runtime + run: | + cargo build --release --timings --package torus-runtime + + export SHA256SUM=$(sha256sum target/release/wbuild/torus-runtime/torus_runtime.compact.compressed.wasm | cut -d ' ' -f1) + echo Hash of compact and compressed WASM: $SHA256SUM + + mkdir out + mv target/release/wbuild/torus-runtime/torus_runtime.compact.compressed.wasm out/ + touch out/$SHA256SUM + + - uses: actions/upload-artifact@v4 + with: + name: torus_runtime.compact.compressed + path: out/ + if-no-files-found: error + overwrite: true + + - uses: actions/upload-artifact@v4 + with: + name: torus-runtime-timings + path: target/cargo-timings/cargo-timing.html + overwrite: true diff --git a/pallets/governance/src/config.rs b/pallets/governance/src/config.rs index ca5f1d6..7d91f25 100644 --- a/pallets/governance/src/config.rs +++ b/pallets/governance/src/config.rs @@ -22,7 +22,7 @@ impl Default for GovernanceConfiguration { Self { proposal_cost: T::DefaultProposalCost::get(), proposal_expiration: T::DefaultProposalExpiration::get(), //130_000, - agent_application_cost: T::DefaultAgentApplicationCost::get(), //1_000_000_000_000_000_000_000, + agent_application_cost: T::DefaultAgentApplicationCost::get(), //100_000_000_000_000_000_000, agent_application_expiration: T::DefaultAgentApplicationExpiration::get(), //2_000, proposal_reward_treasury_allocation: T::DefaultProposalRewardTreasuryAllocation::get(), //Percent::from_percent(2), max_proposal_reward_treasury_allocation: diff --git a/pallets/governance/src/lib.rs b/pallets/governance/src/lib.rs index d1240a6..e1586f3 100644 --- a/pallets/governance/src/lib.rs +++ b/pallets/governance/src/lib.rs @@ -3,6 +3,7 @@ pub mod application; pub mod config; pub mod ext; +pub mod migrations; pub mod proposal; pub mod roles; pub mod voting; @@ -136,7 +137,10 @@ pub mod pallet { type WeightInfo: WeightInfo; } + const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::hooks] diff --git a/pallets/governance/src/migrations.rs b/pallets/governance/src/migrations.rs new file mode 100644 index 0000000..40a4f34 --- /dev/null +++ b/pallets/governance/src/migrations.rs @@ -0,0 +1,16 @@ +pub mod next { + use crate::{Config, GlobalGovernanceConfig, Pallet}; + use polkadot_sdk::frame_support::{ + migrations::VersionedMigration, traits::UncheckedOnRuntimeUpgrade, weights::Weight, + }; + + pub type Migration = VersionedMigration<0, 1, MigrateToNext, Pallet, W>; + pub struct MigrateToNext(core::marker::PhantomData); + + impl UncheckedOnRuntimeUpgrade for MigrateToNext { + fn on_runtime_upgrade() -> Weight { + GlobalGovernanceConfig::::put(crate::config::GovernanceConfiguration::default()); + Weight::zero() + } + } +} diff --git a/runtime/src/configs.rs b/runtime/src/configs.rs index 994b640..eb94368 100644 --- a/runtime/src/configs.rs +++ b/runtime/src/configs.rs @@ -380,7 +380,7 @@ impl pallet_governance::Config for Runtime { type DefaultProposalExpiration = ConstU64<75_600>; - type DefaultAgentApplicationCost = ConstU128<{ as_tors(1_000) }>; + type DefaultAgentApplicationCost = ConstU128<{ as_tors(100) }>; type DefaultAgentApplicationExpiration = ConstU64<216_000>; diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 752beb3..3c5c7ae 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -9,6 +9,7 @@ use interface::*; #[cfg(feature = "std")] use sp_version::NativeVersion; use sp_version::RuntimeVersion; +use weights::constants::RocksDbWeight; use polkadot_sdk::{ frame_executive, frame_support, frame_system, @@ -38,7 +39,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("torus-runtime"), impl_name: create_runtime_str!("torus-runtime"), authoring_version: 1, - spec_version: 0, + spec_version: 1, impl_version: 1, apis: apis::RUNTIME_API_VERSIONS, transaction_version: 1, @@ -82,8 +83,7 @@ pub type SignedPayload = sp_runtime::generic::SignedPayload,); /// Executive: handles dispatch to the various modules. pub type RuntimeExecutive = frame_executive::Executive<