Skip to content

fix: NTT over-limit mint locks down the asset instead of reverting - #1514

Merged
mrq1911 merged 4 commits into
masterfrom
fix/ntt-mint-over-limit-lockdown
Aug 13, 2026
Merged

fix: NTT over-limit mint locks down the asset instead of reverting#1514
mrq1911 merged 4 commits into
masterfrom
fix/ntt-mint-over-limit-lockdown

Conversation

@mrq1911

@mrq1911 mrq1911 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Fixes #1511.

An over-limit NTT mint on the currencies precompile now takes the same reserve-and-lockdown path as an over-limit XCM deposit, instead of reverting MintLimitReached() and stranding source-chain funds until the window rolls.

Root cause → the precompile did a read-only IssuanceIncreaseFuse::can_mint pre-check and reverted over the limit. But the deposit it performs already routes through orml_tokens, whose PostDeposit hook is the circuit breaker (CurrencyHooks::PostDeposit = IssuanceIncreaseFuse, runtime/hydradx/src/assets.rs:130; orml_tokens fires it in do_deposit). So the pre-check was a redundant guard that short-circuited before the breaker's own reserve-and-lockdown could engage.

Fix → drop the can_mint pre-check (+ its now-dead import) from mint. The deposit then behaves exactly like the XCM path:

  • over the per-period budget → the mint lands, the excess is reserved on the recipient, the asset goes into LockdownStatus::Locked(until) and AssetLockdown is emitted;
  • into an already-locked asset → the deposit lands but the full amount is reserved (LockdownActive);
  • within budget → unchanged.

The VAA is consumed (no replay), the recipient's excess is reserved rather than stuck on the source chain, and the safety mechanism the limit exists for actually engages.

Tests (integration-tests/src/evm.rs, currency_precompile_ntt) — updated the three that asserted the old revert:

  • mint_over_the_limit_should_reserve_excess_and_lock_down_the_asset — 600 clean, then 500 over the 1,000 budget → 1,100 minted, 100 reserved, asset Locked.
  • mint_into_a_locked_down_asset_reserves_the_full_amount — mint into a locked asset succeeds but fully reserves.
  • burn_should_refill_mint_budget_within_period — reframed to net accounting (600 mint, burn 400, 700 stays within 1,000, no lockdown).

cargo test -p runtime-integration-tests currency_precompile_ntt → 14 passed / 0 failed; cargo fmt --check clean.

Runtime spec_version bumped 438 → 439 (and hydradx-runtime crate to 439.0.0).

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

Crate versions that have been updated:

  • runtime-integration-tests: v1.107.0 -> v1.107.1
  • hydradx-runtime: v438.0.0 -> v439.0.0

Runtime version has been increased.

@mrq1911
mrq1911 force-pushed the fix/ntt-mint-over-limit-lockdown branch from 4c96f7b to 3c983a6 Compare August 13, 2026 12:43
@mrq1911
mrq1911 changed the base branch from ntt-minter to master August 13, 2026 12:43
Copilot AI lite review requested due to automatic review settings August 13, 2026 12:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes NTT over-limit mint behavior in the EVM currencies precompile so that exceeding the per-period mint budget triggers the circuit breaker’s reserve-and-lockdown mechanism (matching the XCM deposit path) instead of reverting and leaving funds stranded on the source chain.

Changes:

  • Removed the redundant IssuanceIncreaseFuse::can_mint pre-check from the NTT mint precompile entrypoint so the actual PostDeposit hook can reserve excess and lock down the asset.
  • Updated NTT precompile integration tests to assert successful mint + correct reserved/free balances and lockdown state, rather than expecting a MintLimitReached() revert.
  • Reframed the burn test to validate the fuse’s net-issuance accounting within a period.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
runtime/hydradx/src/evm/precompiles/multicurrency.rs Drops the pre-check that caused over-limit mints to revert before the circuit breaker could reserve/lock down.
integration-tests/src/evm.rs Updates currency_precompile_ntt tests to cover reserve + lockdown semantics and net-budget behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown

Quick benchmark at commit 37d539a has been executed successfully.
View results

@mrq1911
mrq1911 merged commit 846b223 into master Aug 13, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: NTT mint over the circuit-breaker limit reverts instead of locking down the asset

3 participants