Skip to content

Comments

Implement handle specifics transaction#10

Merged
imterryyy merged 13 commits intoBuildOnViction:developfrom
endale98:spec-tx
Feb 23, 2026
Merged

Implement handle specifics transaction#10
imterryyy merged 13 commits intoBuildOnViction:developfrom
endale98:spec-tx

Conversation

@0xendale
Copy link
Contributor

@0xendale 0xendale commented Feb 4, 2026

Summary

Add Viction-specific hooks to the block state processor to support:

  • chain-specific “special” transactions (currently: validator BlockSigner tx)
  • blacklist enforcement + legacy bypass balance patching
  • fork-time state mutations (Saigon periodic minting, Atlas VRC25 minCap upgrade, TIP signing contract deletion)
  • batched VRC25 fee-capacity updates at end-of-block
  • performance improvements by pre-caching tx signer + tx hash in parallel

Key changes

1) Viction hooks in the tx processing loop

  • Run beforeApplyTransaction(block, tx, msg, statedb) before statedb.Prepare(...) to enforce Viction-specific rules early.
  • Add applyVictionTransaction(...) in the tx loop:
    • if the tx is handled as a Viction special-tx, return a receipt without executing the EVM path
    • otherwise fall back to normal applyTransaction(...)

2) Special transaction: validator BlockSigner (TIP signing)

  • Handle txs to ValidatorBlockSignContract when IsTIPSigning(...) is active:
    • validate sender and nonce, increment nonce
    • emit a log and produce a receipt with GasUsed = 0

3) Blacklist enforcement + legacy bypass balance patch

  • Add ErrBlacklistedAddress and enforce blacklist checks (sender + receiver) when IsTIPBlacklist(...) is active.
  • For legacy blocks (<= 9147459), apply configured per-block “bypass balance” overrides via VictionConfig.GetVictionBypassBalance(...).

4) Fork-time state mutations (block start hooks)

  • Add consensus/misc/forks_viction.go:
    • ApplySaigonHardFork(...): periodic minting to ecosystem fund multisig over configured intervals/repeats
    • ApplyVIPVRC25Upgrade(...): Atlas-time VRC25 minCap storage update
  • Add StateDB.DeleteAddress(...) and delete ValidatorBlockSignContract exactly at TIPSigningBlock (if configured).

5) VRC25 / TRC21 fee-capacity batching (end-of-block)

  • Track per-token fee usage during tx processing and batch-commit new fee-capacity values once per block:
    • vrc25.UpdateFeeCapacity(...) writes updated capacities and subtracts the total fee used from the VRC25 contract balance
    • executed in afterProcess(...) when not in Atlas

6) Performance: parallel signer + hash caching

  • Add helpers to cache expensive per-tx values up front:
    • types.CacheSigner(...)
    • (*Transaction).CacheHash()
    • InitSignerInTransactions(...) uses runtime.NumCPU() workers and runs at block start

Files changed

  • consensus/misc/forks_viction.go (new)
  • core/error.go
  • core/state/statedb.go
  • core/state_processor.go
  • core/state_processor_viction.go
  • core/types/transaction_signing.go
  • core/vrc25/vrc25.go
  • params/viction_config.go

Notes / Follow-ups

  • TomoX/TomoZ/Lending special-tx handling is still TODO (placeholders/comments exist in applyVictionTransaction(...) / validation hooks).

Testing

Not included in this PR. Suggested checks:

  • BlockSigner tx: nonce increment, log emission, receipt GasUsed=0
  • Blacklist: reject tx if sender/receiver is blacklisted after TIP blacklist activation
  • Fork hooks: Saigon mint schedule + Atlas minCap update at exact fork block
  • VRC25 batching: per-tx fee capacity decreases persist via end-of-block update
  • Signer/hash caching: ensure no behavioral change vs non-cached paths

@0xendale 0xendale marked this pull request as ready for review February 10, 2026 05:00
@0xendale 0xendale requested a review from imduchuyyy February 11, 2026 02:51
Copy link
Contributor

@imduchuyyy imduchuyyy left a comment

Choose a reason for hiding this comment

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

Look good overall but we need to verify the correction when sync with the mainnet.

@imterryyy imterryyy merged commit 8c281e9 into BuildOnViction:develop Feb 23, 2026
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.

4 participants