Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical fixes: TronWeb, transaction relay, receipts and staking compatibility
This change set addresses seven compatibility defects and a genesis-property rename found while deploying and
running contracts against a private network with a Rust producer and observer.
Each numbered commit contains one issue's fix and its regression tests; the final bonus commit contains the rename and its test.
The numbers below match the commit subjects.
1. align created contract receipts with the VM address
Commit: d8eeb06.
The address reported by the index and TransactionInfo used keccak(owner || txID),
while top-level TVM creation derives keccak(txID || owner). A successful deployment
could therefore return an address different from the deployed contract. A client
using that receipt for subsequent proxy deployment would call the wrong address.
Use the VM's derivation order in the shared index helper, which is also used to
build creation receipts. A regression compares the reported address directly
with TVM address derivation. This changes the reported address, not TVM creation.
2. preserve signatures in TronWeb broadcasts
Commit: 3d6fda6.
The HTTP broadcast path extracted raw_data_hex from a signed TronWeb envelope
and passed it as a complete serialized Transaction. raw_data_hex is only the
Transaction.raw message, so signatures were lost before mempool admission.
Preserve the envelope, decode the raw message, and construct the complete
Transaction with every supplied signature. Validate the optional txID and wire
encoding. The full serialized Transaction hex input remains supported.
Regression coverage checks the bytes received by the mempool and rejects
invalid envelopes.
3. build TronWeb-compatible contract transactions
Commit: 299db05.
The state-changing contract builder ignored function_selector and parameter.
Its HTTP response also lacked the TransactionExtention-style result/transaction
wrapper. Empty signature arrays made TronWeb treat unsigned transactions as
already signed, and ref_block_num disagreed with TronWeb's signable encoding.
Build selector-plus-parameters calldata, preserve raw data/input calls, return
the expected wrapper, omit empty unsigned signatures, and use the TAPOS
bytes/hash without the deprecated ref_block_num field. Wire-level tests decode
the built protobuf and check calldata, fee limit, and the unsigned envelope.
The shared calldata parser retains constant-call input compatibility.
4. expose pending Stake V2 unfreezes in getaccount
Commit: 9dc64f8.
Pending unfrozen_v2 entries were stored but omitted from account JSON.
Clients could not inspect the resource, amount, or availability time of
pending Stake 2.0 withdrawals.
Encode unfrozenV2 with type, unfreeze_amount, and unfreeze_expire_time using
the usual omission of default protobuf values. Regression coverage includes
both BANDWIDTH and ENERGY entries and an account without pending unfreezes.
5. snapshot legacy voting power before the first V2 stake
Commit: 3fe6d11.
When ALLOW_NEW_RESOURCE_MODEL is enabled, a zero old_tron_power must be
initialized before the first V2 stake changes the account. Leaving it at zero
allows a new ENERGY stake to be counted as retained legacy voting power.
The private-network excess-votes transaction consequently succeeded before
the fix and reverted after it.
Snapshot existing legacy power once, using -1 when there is none, before
mutating stake. Apply the same initialization to native actuator and TVM paths.
Test fresh and existing accounts, repeated stakes, and TRON_POWER accounting.
The change is conditional on the new resource-model flag; the private-chain
reproduction alone is not evidence of an existing mainnet state divergence.
6. receive inbound transactions with paced inventory fetches
Commit: 7e71a8c.
The inbound peer handler ignored transaction advertisements and payloads.
A node could accept a transaction over RPC while a producer connected through
that inbound connection never obtained it.
Handle Inventory TRX, Trx, and Trxs through normal mempool admission.
Bound and deduplicate pending inventory, batch fetches, and pace requests
under the existing peer FETCH_INV_DATA limit. The regression exercises bursts
over a real duplex connection and checks requests against the peer limiter.
The pacing is part of the new relay path; it is not a separate pre-existing bug.
No private-network wakeup or block-announcement behavior is included.
7. use committed receipts for event outcomes and gaps
Commit: f7bafb8.
Locally produced transactions without block contractRet were classified as
failed even when committed execution receipts showed success. Consumers could
therefore skip valid logs, including constructor events. Partially missing
transaction-info also needs an explicit incomplete-data marker.
Keep explicit block contractRet authoritative; otherwise derive the outcome
from committed TransactionInfo/receipt. Share that rule between the extractor
and Firehose. Mark partially missing transaction-info as incomplete.
Regressions cover successful and reverted receipts, explicit block-result
precedence, missing receipts, and partial gaps.
Bonus: rename CHANGED_DELEGATION to CHANGE_DELEGATION at genesis
Commit: 513faa2.
Genesis committee initialization wrote CHANGED_DELEGATION, while protocol
consumers read CHANGE_DELEGATION. The configured value therefore did not
reach the property read by execution and reward code.
Write the canonical key and test committee seeding using an ordinary
in-memory fixture. This does not introduce private-chain reward activation
settings or force the reward algorithm to activate at cycle zero.
Validation
Compatibility with the parameter-102 change
Based on upstream/master at 82774dd. A clean trial merge with parameter-102 PR #7 (50e11d5) was tested with the proposal actuator, optimized TVM storage, and RPC suites: proposal-102-actuator: 31 passed; proposal-102-tvm: 14 passed; proposal-102-rpc: 140 passed.