Skip to content

Added Broad Docs - #3

Merged
Gingerbreadfork merged 1 commit into
masterfrom
energy-fee-parity
Jun 13, 2026
Merged

Added Broad Docs#3
Gingerbreadfork merged 1 commit into
masterfrom
energy-fee-parity

Conversation

@Gingerbreadfork

Copy link
Copy Markdown
Owner

No description provided.

@Gingerbreadfork
Gingerbreadfork merged commit 52903fa into master Jun 13, 2026
Gingerbreadfork added a commit that referenced this pull request Jun 25, 2026
Implements + era-gates 16 of the 20 consensus/replay divergences found in the
2026-06-25 multi-agent java-tron audit. Each fix is gated so the 83.3M
snapshot->tip replay stays byte-identical; verified against java-tron and
unit-test validated (revm/tron-tvm 1009/0, tron-actuator 373/0).

- UNFREEZEBALANCEV2 (TVM): validate frozen balance BEFORE settling voter
  rewards (java validates in a child Repository before execute)
- EXTCODEHASH: key on store existence (journal-aware), not EIP-161 emptiness
- multisig duplicate-signer dedup: per-signature key pre-VERSION_4_7_1,
  recovered-address after (prevents a from-genesis halt on a pre-4.7.1
  distinct-same-key multisig tx java commits)
- CALLTOKEN/TOKENBALANCE: ALLOW_MULTI_SIGN-gated tokenId range check
- nested CREATE/CREATE2 endowment > i64::MAX: spend-all (java ArithmeticEx)
- origin energy-share cap: era-gated to ENERGY_LIMIT_HARD_FORK (4,727,890)
- FreezeBalanceV2 TRON_POWER: gated on ALLOW_NEW_RESOURCE_MODEL
- ExchangeTransaction: rejected once VERSION_4_8_0_1 is active
- ExchangeInject: reject i64-product overflow (java multiplyExact, block-fatal)
- SetAccountId: require printable-ASCII account id (validReadableBytes)
- non-VM actuator dispatch: lenient protobuf decode (skip-on-wire-mismatch)
- FREEZE opcode: dead-account NEW_ACCT_CALL (25000) surcharge
- proposal resolution: descending walk + break-on-processed (java order)
- SELFDESTRUCT/FREEZE: journal-aware dead-beneficiary existence
- VM 3MB memory limit: per-frame, not cumulative across the call stack
- genesis: seed the active-witness list (DposService.start parity)

Adds host methods tron_account_exists_or_created (journal-aware existence)
and tron_allow_multi_sign. Fork-time gates (VERSION_4_7_1 / 4_8_0_1) are
interim pending a faithful ForkController. Audit items #3 (reward-vi
builder), #8 (COINBASE), #9 (bandwidth original-wire), #5 part B and #20
(deferred) remain.
Gingerbreadfork added a commit that referenced this pull request Jun 25, 2026
…LLTOKEN native value

#8 COINBASE (0x41): thread the block's producing witness (20-byte EVM form,
the 0x41 TRON prefix stripped) through the executor into VmBlockEnv.beneficiary
so the opcode returns the producer instead of zero. java builds the coinbase
DataWord via `new DataWord(witnessAddress)` exactly like ADDRESS/CALLER, which
we already carry in 20-byte EVM form (83M-validated) — so COINBASE matches by
construction. Threaded through execute_one_tx / execute_one_tx_versioned /
execute_one_tx_isolated / execute_vm_tx and the Block-STM scheduler; the 3
modify_block_chained sites set b.beneficiary. RPC/simulation callers keep the
zero default (no real producer).

#3 reward-vi: on a from-genesis node the reward-vi store is never built (java's
boot-time RewardViCalService has no analogue, and maintenance only accumulates
the Vi after NEW_REWARD_ALGORITHM_EFFECTIVE_CYCLE), so old_reward read zeros
for every pre-new-algorithm cycle once ALLOW_OLD_REWARD_OPT (#79) was active.
Replay accumulateWitnessVi on the fly from the per-cycle reward/vote when a
store row is absent — byte-exact BigInteger/i128 math — falling back to a
populated row (imported snapshot) when present.

#5 CALLTOKEN pre-ALLOW_MULTI_SIGN native value: isTokenTransfer is tokenId != 0
before the fork, so a CALLTOKEN with tokenId 0 is a NATIVE TRX transfer (value
is the call-value, not a TRC-10 amount) and the token-only self-transfer guard
does not apply. Post-fork is_token_transfer is always true → byte-identical to
the validated path.

Tests: coinbase_returns_block_producer_witness +
old_reward_recomputes_vi_from_per_cycle_data_when_store_is_empty; tron-tvm 414,
reward 22, execute 13, tron-executor 174 green; workspace --tests clean.
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.

1 participant