Skip to content

Use prod_or_fast!#1932

Merged
sam0x17 merged 16 commits intodevnet-readyfrom
prod-or-fast
Aug 14, 2025
Merged

Use prod_or_fast!#1932
sam0x17 merged 16 commits intodevnet-readyfrom
prod-or-fast

Conversation

@liamaharon
Copy link
Collaborator

@liamaharon liamaharon commented Aug 9, 2025

I'm using the prod_or_fast! macro a lot in #1708 to keep the new config clean. This follows convention in runtimes maintained by Parity and is less verbose.

It allows replacing code like this:

#[cfg(not(feature = "fast-blocks"))]
pub const INITIAL_SUBNET_TEMPO: u16 = 360;

#[cfg(feature = "fast-blocks")]
pub const INITIAL_SUBNET_TEMPO: u16 = 10;

#[cfg(not(feature = "fast-blocks"))]
pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = 216000; // 30 days at 12 seconds per block

#[cfg(feature = "fast-blocks")]
pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = 5;

with this

pub const INITIAL_SUBNET_TEMPO: u16 = prod_or_fast!(360, 10);

// 30 days at 12 seconds per block = 216000
pub const INITIAL_CHILDKEY_TAKE_RATELIMIT: u64 = prod_or_fast!(216000, 5);

@liamaharon liamaharon requested a review from basfroman August 9, 2025 01:35
@liamaharon liamaharon mentioned this pull request Aug 9, 2025
@liamaharon liamaharon added the no-spec-version-bump PR does not contain changes that requires bumping the spec version label Aug 9, 2025
basfroman
basfroman previously approved these changes Aug 9, 2025
Copy link
Collaborator

@basfroman basfroman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from Cortex related parts

@liamaharon liamaharon added no-spec-version-bump PR does not contain changes that requires bumping the spec version and removed no-spec-version-bump PR does not contain changes that requires bumping the spec version labels Aug 12, 2025
open-junius
open-junius previously approved these changes Aug 12, 2025
Copy link
Contributor

@open-junius open-junius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a really good macro.

open-junius
open-junius previously approved these changes Aug 13, 2025
camfairchild
camfairchild previously approved these changes Aug 14, 2025
@liamaharon liamaharon dismissed stale reviews from camfairchild and open-junius via 4336255 August 14, 2025 02:00
@sam0x17 sam0x17 merged commit cefa073 into devnet-ready Aug 14, 2025
23 of 25 checks passed
@liamaharon liamaharon deleted the prod-or-fast branch August 14, 2025 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-spec-version-bump PR does not contain changes that requires bumping the spec version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants