MNT Part 3: tests: adapt fixtures and goldens to the QKC account encoding - #50
Open
ping-ke wants to merge 2 commits into
Open
MNT Part 3: tests: adapt fixtures and goldens to the QKC account encoding#50ping-ke wants to merge 2 commits into
ping-ke wants to merge 2 commits into
Conversation
Carry QuarkChain multi-native-token (MNT) balances through the state layer so accounts can hold per-token balances alongside the native Ether balance. - state_object_qkc.go / statedb_qkc.go: MNT balance accessors on stateObject and StateDB (Get/Add/Sub/Set), guarding the per-account token count against the MNT limit. - journal.go: journal entries for MNT balance changes so they revert correctly with snapshots. - state_object.go: deep-copy MntBalances in newObject and on copy, so a mutation through one object cannot leak into another. - reader.go: decode MntBalances and FullShardKey out of the slim account served by the flat reader. - database_mpt.go / database_ubt.go: re-encode AccountsOrigin from slim-RLP to full QKC account RLP before handing it to pathdb, which needs it to match the trie leaf format for history verification. - pathdb/execute.go: decode AccountsOrigin as a full QKC StateAccount instead of slim-RLP, matching the invariant the commit paths now establish. mnt_test.go covers the accessors, journal revert, and copy isolation. The in-package test adaptations (state_test.go, statedb_fuzz_test.go) follow the account encoding change.
The QKC 6-element account encoding changes every account RLP, and with
it trie node hashes, state roots, genesis hashes and derived fork IDs.
Tests outside core/state that assert upstream Ethereum golden values
need to follow.
Recomputed goldens, where the value is derived from code rather than an
external fixture:
- trie/trie_test.go: roots in TestTinyTrie, TestCommitAfterHash and
TestCommitSequence.
- triedb/pathdb/generate_test.go, core/state/snapshot/generate_test.go:
the generation root, plus the trie node hash TestGenerateCorruptAccountTrie
deletes to corrupt the trie.
- core/genesis_test.go: the custom genesis hash.
Encoding-format fixes, where the test hand-rolled an account codec that
the QKC format invalidates:
- eth/protocols/snap/sync_test.go: decode into types.StateAccount so the
QKC-aware DecodeRLP runs, instead of a local 4-field struct.
- triedb/pathdb/database_test.go: encode AccountsOrigin as full QKC
account RLP (mustEncodeAccount) to match the trie leaf format the
history recovery path verifies against.
- core/state/snapshot/*_test.go: build snapshot values with
SlimAccountRLP, since the snapshot layer stores slim-RLP.
Skipped, where the expected values live in external JSON fixtures or
golden files that would have to be regenerated for the MNT layout:
tests/{state,block}_test.go, core/forkid, cmd/{evm,geth,devp2p},
eth/filters, eth/tracers supply tests, internal/ethapi and the
remaining genesis hash tests. Each skip says why.
ping-ke
force-pushed
the
feature/mnt-state
branch
4 times, most recently
from
August 14, 2026 05:35
87ce75f to
3357d5b
Compare
ping-ke
force-pushed
the
feature/mnt-state
branch
2 times, most recently
from
August 24, 2026 07:04
a3d68df to
d31d1a2
Compare
ping-ke
force-pushed
the
feature/mnt-state
branch
from
August 27, 2026 10:13
d31d1a2 to
a1791e3
Compare
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.
Summary
Notes
This is a test-only follow-up based on
feature/mnt-state. It contains no production code changes.