fix(simulator): implement missing CLI commands and align help/completer#5
Merged
8lecramm merged 7 commits intoMar 14, 2026
Merged
Conversation
8lecramm
reviewed
Mar 5, 2026
8lecramm
left a comment
There was a problem hiding this comment.
Good. I see no issues with the "core" functions such as "diff", "print_bc" and so on.
Do we really need p2p and mining commands? It has no use in simulator mode.
Author
|
I think it would preferable to get ride of them instead of printing "command is not supported in simulator" unless there's value to have parity with the daemon. I fail to see that. |
This was referenced Jun 23, 2026
DHEBP
added a commit
to DHEBP/derohe
that referenced
this pull request
Jul 2, 2026
…etroactive scrub (review #1/DEROFDN#4/DEROFDN#5/DEROFDN#6) DEROFDN#6 — Entry.String() printed "Sender: %s" unconditionally: a scrubbed ring>2 transfer rendered a bare "Sender: " line that reads as a decode bug — the exact "looks broken" outcome the design meant to avoid, contradicting the truth table documented on SenderVerified in the same file. The Sender line now follows the table: verified -> the address; scrubbed (no payload error) -> "unknown (unverifiable, ring size N)"; decode failure -> a distinct "unknown (payload decode failed)". Blast radius: two CLI debug dumps (%+v in show_transfers error paths); JSON marshalling untouched. Pinned by rpc/wallet_rpc_test.go (offline, sub-second): all three arms, plus forbids the bare line and scrub/decode-failure conflation. DEROFDN#4/DEROFDN#5 — the non-retroactive caveat lived only in commit 4e9de56's message. Now in the docs consumers read: SenderVerified's doc comment states the scrub is decode-time only (pre-upgrade entries keep their guessed Sender and unscrubbed Data[0], served as-is by Get_Transfers; the guarantee holds only for blocks decoded post-upgrade), the upgrade is one-way for the privacy property, and pre-upgrade entries deserialize SenderVerified=false, RingSize=0 — indistinguishable from a scrub without re-decoding, so a migration MUST re-derive RingSize from chain data (a read-path scrub keyed on persisted fields would wrongly blank the wallet's own verified sends — why the rescan is a follow-up, not this commit). RingSize's doc gains the "0 = pre-upgrade/unknown, not a real ring" note; the GetTransfers handler doc points RPC consumers at the contract. #1 hardening — both decode arms bounded sender_idx against Statement.RingSize while indexing Statement.Publickeylist. Safe today (len(Publickeylist)==RingSize holds at that point), but the guard now bounds against the slice actually indexed, so it survives any future break of that invariant. Existing pins green: the scrub-behavior sim test and the source-grep guard (its regexes key on the scrub lines, untouched here).
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.
Description
The simulator CLI had significant command-surface drift: many commands listed in
helphad no dispatch handler, and the three independent surfaces (dispatch switch cases,usage()help text, readline completer) had diverged.This PR implements 11 missing command handlers and synchronizes all three surfaces so every listed command works.
Changes by commit:
feat(simulator): add diff and print_height handlers— Implementsdiff(shows current network difficulty) andprint_height(shows current chain height).feat(simulator): add print_bc handler for topo range output— Implementsprint_bcto display block info for a topo-height range, matching daemon behavior. Addsmath/bigimport for difficulty display.feat(simulator): add print_tx command support— Implementsprint_txto look up and display transaction details by hash. Uncomments thetransactionpackage import.feat(simulator): add peer, sync, ban, and mining stub handlers— Implementspeer_list,sync_info,ban,unban,bansusing existing p2p functions. Addsstart_mining/stop_miningstubs that return explicit "not supported in simulator" messages.fix(simulator): align help and completer with command handlers— Synchronizesusage()and completer with the full set of implemented commands. Fixes swappedmempool_flush/"Flush regpool" andregpool_flush/"Flush mempool" descriptions. Fixes case-sensitivehelpdispatch (wasline == "help", now usescommand == "help"which goes throughstrings.ToLower()).fix(simulator): improve unknown command guidance— Unknown commands now print "unknown command: X, try 'help'" instead of silently falling through.NOTE: This PR targets
community-devrather thandevas this is the active development branch for community contributions.Type of change
Which part is impacted ?
Checklist:
License
I am contributing & releasing the code under DERO Research License (which can be found here).