diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fb6bdbdf..b3ba0025 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -51,12 +51,9 @@ jobs: binary-hash: ${{ needs.build-operator.outputs.binary-hash }} docker-build-release: - needs: [build-operator] if: github.ref == 'refs/heads/main' uses: ./.github/workflows/task-docker-release.yml secrets: inherit - with: - binary-hash: ${{ needs.build-operator.outputs.binary-hash }} moonwall-tests: needs: [build-operator] diff --git a/.github/workflows/task-docker-release.yml b/.github/workflows/task-docker-release.yml index 1ea5f5ed..1fae2697 100644 --- a/.github/workflows/task-docker-release.yml +++ b/.github/workflows/task-docker-release.yml @@ -17,11 +17,6 @@ on: type: boolean default: false workflow_call: - inputs: - binary-hash: - description: "The hash of the operator binary (for CI builds)" - required: true - type: string outputs: image-tag: description: "The tag portion of the docker image (without registry)" @@ -48,21 +43,6 @@ jobs: ref: ${{ github.event.inputs.branch || github.ref }} - uses: ./.github/workflows/actions/cleanup-runner - if: github.event_name == 'workflow_dispatch' - - # --- Conditional: Download binary for CI builds --- - - name: Download binary artifact (CI build) - if: github.event_name != 'workflow_dispatch' - uses: actions/download-artifact@v4 - with: - name: datahaven-node-${{ inputs.binary-hash }} - path: ./build/ - - - name: Prepare binary (CI build) - if: github.event_name != 'workflow_dispatch' - run: | - chmod +x ./build/datahaven-node - ls -la ./build/ # --- Docker metadata --- - name: Docker meta (dispatch) @@ -100,9 +80,8 @@ jobs: echo "image-tag=$TAG_ONLY" >> $GITHUB_OUTPUT echo "image-name=datahavenxyz/datahaven:$TAG_ONLY" >> $GITHUB_OUTPUT - # --- Conditional: Cargo cache for full builds --- - - name: Set up cargo cache (full build) - if: github.event_name == 'workflow_dispatch' + # --- Cargo cache for full builds --- + - name: Set up cargo cache uses: actions/cache@v4 id: cache with: @@ -115,8 +94,7 @@ jobs: cache-mount-${{ hashFiles('./docker/datahaven-build.Dockerfile') }} cache-mount- - - name: Inject cache into docker (full build) - if: github.event_name == 'workflow_dispatch' + - name: Inject cache into docker uses: reproducible-containers/buildkit-cache-dance@v3.1.0 with: cache-map: | @@ -126,9 +104,8 @@ jobs: } skip-extraction: ${{ steps.cache.outputs.cache-hit }} - # --- Build and push: Full build (workflow_dispatch) --- - - name: Build and push Docker image (full build) - if: github.event_name == 'workflow_dispatch' + # --- Build and push Docker image --- + - name: Build and push Docker image uses: ./.github/workflow-templates/publish-docker with: dockerfile: ./docker/datahaven-build.Dockerfile @@ -136,28 +113,13 @@ jobs: registry: docker.io registry_username: ${{ secrets.DOCKERHUB_USERNAME }} registry_password: ${{ secrets.DOCKERHUB_TOKEN }} - image_tags: ${{ steps.meta-dispatch.outputs.tags }} + image_tags: ${{ steps.meta-dispatch.outputs.tags || steps.meta-ci.outputs.tags }} image_title: "DataHaven Node - Release" image_description: "Release build of DataHaven blockchain node" cache_scope: datahaven-release-build build_args: | FAST_RUNTIME=${{ github.event.inputs.fast_runtime == 'true' && 'TRUE' || 'FALSE' }} - # --- Build and push: CI binary reuse (workflow_call) --- - - name: Build and push Docker image (CI binary) - if: github.event_name != 'workflow_dispatch' - uses: ./.github/workflow-templates/publish-docker - with: - dockerfile: ./operator/Dockerfile - context: . - registry: docker.io - registry_username: ${{ secrets.DOCKERHUB_USERNAME }} - registry_password: ${{ secrets.DOCKERHUB_TOKEN }} - image_tags: ${{ steps.meta-ci.outputs.tags }} - image_title: "DataHaven Node - Release" - image_description: "Release build of DataHaven operator node" - cache_scope: datahaven-release-ci - # --- Smoke tests --- - name: Pull and test node --help run: | diff --git a/operator/runtime/common/src/constants.rs b/operator/runtime/common/src/constants.rs index 4ebb1979..ad358771 100644 --- a/operator/runtime/common/src/constants.rs +++ b/operator/runtime/common/src/constants.rs @@ -26,8 +26,11 @@ pub mod time { const ONE_MINUTE: BlockNumber = MINUTES; frame_support::parameter_types! { + /// Session/epoch duration: + /// - Production: 1 hour (600 blocks) + /// - Fast-runtime: 1 minute (10 blocks) pub const EpochDurationInBlocks: BlockNumber = prod_or_fast!(ONE_HOUR, ONE_MINUTE); - pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 3); + pub const SessionsPerEra: SessionIndex = prod_or_fast!(6, 1); } // These time units are defined in number of blocks. diff --git a/operator/runtime/mainnet/src/configs/mod.rs b/operator/runtime/mainnet/src/configs/mod.rs index fcbc5361..4a0602c0 100644 --- a/operator/runtime/mainnet/src/configs/mod.rs +++ b/operator/runtime/mainnet/src/configs/mod.rs @@ -86,7 +86,7 @@ use datahaven_runtime_common::{ ReleaseDelayNone, RuntimeCallFilter, SafeModeDuration, SafeModeEnterDeposit, SafeModeExtendDeposit, TxPauseWhitelistedCalls, }, - time::{EpochDurationInBlocks, DAYS, MILLISECS_PER_BLOCK}, + time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ @@ -138,7 +138,7 @@ use sp_runtime::{ traits::{Convert, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys, UniqueSaturatedInto}, FixedPointNumber, Perbill, Perquintill, }; -use sp_staking::{EraIndex, SessionIndex}; +use sp_staking::EraIndex; use sp_std::{ convert::{From, Into}, prelude::*, @@ -164,7 +164,6 @@ const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; parameter_types! { pub const MaxAuthorities: u32 = 32; pub const BondingDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(28, 3); - pub const SessionsPerEra: SessionIndex = polkadot_runtime_common::prod_or_fast!(6, 1); pub const AuthorRewardPoints: u32 = 20; } diff --git a/operator/runtime/stagenet/src/configs/mod.rs b/operator/runtime/stagenet/src/configs/mod.rs index cc32e7d2..e923ab67 100644 --- a/operator/runtime/stagenet/src/configs/mod.rs +++ b/operator/runtime/stagenet/src/configs/mod.rs @@ -86,7 +86,7 @@ use datahaven_runtime_common::{ ReleaseDelayNone, RuntimeCallFilter, SafeModeDuration, SafeModeEnterDeposit, SafeModeExtendDeposit, TxPauseWhitelistedCalls, }, - time::{EpochDurationInBlocks, DAYS, MILLISECS_PER_BLOCK}, + time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ @@ -138,7 +138,7 @@ use sp_runtime::{ traits::{Convert, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys, UniqueSaturatedInto}, FixedPointNumber, Perbill, Perquintill, }; -use sp_staking::{EraIndex, SessionIndex}; +use sp_staking::EraIndex; use sp_std::{ convert::{From, Into}, prelude::*, @@ -164,7 +164,6 @@ const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; parameter_types! { pub const MaxAuthorities: u32 = 32; pub const BondingDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(28, 3); - pub const SessionsPerEra: SessionIndex = polkadot_runtime_common::prod_or_fast!(6, 1); pub const AuthorRewardPoints: u32 = 20; } diff --git a/operator/runtime/testnet/src/configs/mod.rs b/operator/runtime/testnet/src/configs/mod.rs index 3cac0126..72d7f3df 100644 --- a/operator/runtime/testnet/src/configs/mod.rs +++ b/operator/runtime/testnet/src/configs/mod.rs @@ -86,7 +86,7 @@ use datahaven_runtime_common::{ ReleaseDelayNone, RuntimeCallFilter, SafeModeDuration, SafeModeEnterDeposit, SafeModeExtendDeposit, TxPauseWhitelistedCalls, }, - time::{EpochDurationInBlocks, DAYS, MILLISECS_PER_BLOCK}, + time::{EpochDurationInBlocks, SessionsPerEra, DAYS, MILLISECS_PER_BLOCK}, }; use dhp_bridge::{EigenLayerMessageProcessor, NativeTokenTransferMessageProcessor}; use frame_support::{ @@ -138,7 +138,7 @@ use sp_runtime::{ traits::{Convert, ConvertInto, IdentityLookup, Keccak256, OpaqueKeys, UniqueSaturatedInto}, FixedPointNumber, Perbill, Perquintill, }; -use sp_staking::{EraIndex, SessionIndex}; +use sp_staking::EraIndex; use sp_std::{ convert::{From, Into}, prelude::*, @@ -164,7 +164,6 @@ const SS58_FORMAT: u16 = EVM_CHAIN_ID as u16; parameter_types! { pub const MaxAuthorities: u32 = 32; pub const BondingDuration: EraIndex = polkadot_runtime_common::prod_or_fast!(28, 3); - pub const SessionsPerEra: SessionIndex = polkadot_runtime_common::prod_or_fast!(6, 1); pub const AuthorRewardPoints: u32 = 20; }