Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug namespace re-structure #24808

Open
s1na opened this issue May 3, 2022 · 6 comments
Open

Debug namespace re-structure #24808

s1na opened this issue May 3, 2022 · 6 comments
Assignees
Labels

Comments

@s1na
Copy link
Contributor

s1na commented May 3, 2022

The debug namespace is cluttered with a mix of methods used for low-level client debugging and anything that wasn't standardised into the eth namespace. Creating this issue to track and decide how to go forward with this.

I'll start with a list of all the methods (50 in total):

  • eth:

    • Public:
      • DumpBlock (can be potentially modified to make use of snapshots when available)
      • AccountRange
    • Private:
      • Preimage
      • GetBadBlocks
      • StorageRangeAt
      • GetModifiedAccountsByNumber
      • GetModifiedAccountsByHash
      • GetAccessibleState
  • les (private):

    • FreezeClient
  • internal/ethapi:

    • Public:
      • GetHeaderRlp
      • GetBlockRlp
      • TestSignCliqueBlock
      • PrintBlock
      • SeedHash
    • Private:
      • ChaindbProperty (we can list the possible properties on the website)
      • ChaindbCompact
      • SetHead
      • DbGet
  • eth/tracers (private):

    • TraceChain
    • TraceBlockByNumber
    • TraceBlockByHash
    • TraceBlock
    • TraceBlockFromFile
    • TraceBadBlock
    • StandardTraceBlockToFile
    • IntermediateRoots
    • StandardTraceBadBlockToFile
    • TraceTransaction
    • TraceCall
  • internal/debug:

    • Verbosity
    • Vmodule
    • BacktraceAt
    • MemStats
    • GcStats
    • CpuProfile
    • StartCPUProfile
    • StopCPUProfile
    • GoTrace
    • StartGoTrace
    • StopGoTrace
    • BlockProfile
    • SetBlockProfileRate
    • WriteBlockProfile
    • MutexProfile
    • SetMutexProfileFraction
    • WriteMutexProfile
    • WriteMemProfile
    • Stacks
    • FreeOSMemory
    • SetGCPercent

    This is the list of methods not documented on the website:

    ['intermediateroots', 'tracebadblock', 'chaindbcompact', 'getheaderrlp', 'accountrange', 'setmutexprofilefraction', 'getmodifiedaccountsbyhash', 'mutexprofile', 'preimage', 'writemutexprofile', 'storagerangeat', 'freezeclient', 'printblock', 'chaindbproperty', 'dbget', 'testsigncliqueblock', 'getmodifiedaccountsbynumber', 'setgcpercent', 'freeosmemory', 'tracechain', 'getbadblocks', 'getaccessiblestate']
    

    Also traceChain is not exposed to JS (Edit: Ah I remember/see now it's because traceChain returns a subscription)

@s1na s1na added the area:rpc label May 3, 2022
@s1na s1na self-assigned this May 3, 2022
@s1na
Copy link
Contributor Author

s1na commented May 6, 2022

@holiman do you still need TestSignCliqueBlock? it seems to have been added as part of #19003 with a note that it can be removed after integration is stable.

// TODO: Remove this method when the integration is mature

@holiman
Copy link
Contributor

holiman commented May 6, 2022

@holiman do you still need TestSignCliqueBlock?

Nope

@s1na
Copy link
Contributor Author

s1na commented May 9, 2022

Re the re-structuring, I feel like there are 2 categories that can be relatively cleanly separated from debug:

  • All the tracing methods into a trace namespace
  • State retrieval methods into a state namespace, the exact list would be:
    • DumpBlock
    • AccountRange
    • StorageRangeAt
    • GetModifiedAccountsByNumber
    • GetModifiedAccountsByHash
    • GetAccessibleState
    • maybePreimage?
    • maybe DbGet?

Also it seems DumpBlock, AccountRange and StorageRangeAt are similar in logic. Maybe we can combine them into a swiss-state-dump-method?

@lightclient
Copy link
Member

lightclient commented Jun 8, 2022

So I've prepared a proposal for the restructuring of the RPCs -- I'll hide it behind a drop down so it doesn't take over this issue.

tldr; make debug a standard namespace across clients to implement for debugging chain issues. Make txpool standard across clients. Remove eth methods that require signing. Move the go-specific debug methods to the go namespace. Create a new trace namespace for tracing. Move all other methods that don't yet have a home to the x namespace.

Proposal
Current method, right. Proposed methods, left. `engine` namespace omitted.
admin_addPeer							admin_addPeer
admin_removePeer						admin_removePeer
admin_addTrustedPeer						admin_addTrustedPeer
admin_removeTrustedPeer						admin_removeTrustedPeer
admin_peerEvents						admin_peerEvents
admin_startHTTP							admin_startHTTP
admin_startRPC							admin_startRPC
admin_startWS							admin_startWS
admin_stopHTTP							admin_stopHTTP
admin_stopRPC							admin_stopRPC
admin_stopWS							admin_stopWS
admin_peers							admin_peers
admin_datadir							admin_datadir
admin_clientVersion						admin_clientVersion
admin_sha3						      <
admin_exportChain						admin_exportChain
admin_importChain						admin_importChain
clique_getSnapshot						clique_getSnapshot
clique_getSnapshotAtHash					clique_getSnapshotAtHash
clique_getSigners						clique_getSigners
clique_getSignersAtHash						clique_getSignersAtHash
clique_proposals						clique_proposals
clique_propose							clique_propose
clique_discard							clique_discard
clique_status							clique_status
clique_getSigner						clique_getSigner
debug_verbosity						      |	admin_verbosity
debug_vmodule						      |	go_vmodule
debug_backtraceAt					      |	go_backtraceAt
debug_memStats						      |	go_memStats
debug_gcStats						      |	go_gcStats
debug_cpuProfile					      |	go_cpuProfile
debug_startCPUProfile					      |	go_startCPUProfile
debug_stopCPUProfile					      |	go_stopCPUProfile
debug_goTrace						      |	go_trace
debug_blockProfile					      |	go_blockProfile
debug_setBlockProfileRate				      |	go_setBlockProfileRate
debug_writeBlockProfile					      |	go_writeBlockProfile
debug_mutexProfile					      |	go_mutexProfile
debug_setMutexProfileFraction				      |	go_setMutexProfileFraction
debug_writeMutexProfile					      |	go_writeMutexProfile
debug_writeMemProfile					      |	go_writeMemProfile
debug_stacks						      |	go_stacks
debug_freeOSMemory					      |	go_freeOSMemory
debug_setGCPercent					      |	go_setGCPercent
debug_startGoTrace					      |	go_startTrace
debug_stopGoTrace					      |	go_stopTrace
debug_getHeaderRlp						debug_getHeaderRlp
debug_getBlockRlp						debug_getBlockRlp
debug_getRawReceipts						debug_getRawReceipts
debug_printBlock					      |	x_printBlock
debug_seedHash						      |	x_seedHash
debug_chaindbProperty					      |	x_chaindbProperty
debug_chaindbCompact					      |	x_chaindbCompact
debug_setHead							debug_setHead
debug_dumpBlock							debug_dumpBlock
debug_preimage						      |	x_preimage
debug_getBadBlocks					       	debug_getBadBlocks
debug_accountRange					      |	x_accountRange
debug_storageRangeAt					      |	x_storageRangeAt
debug_getModifiedAccountsByNumber			      |	x_getModifiedAccountsByNumber
debug_getModifiedAccountsByHash				      |	x_getModifiedAccountsByHash
debug_getAccessibleState				      |	x_getAccessibleState
debug_freezeClient					      |	x_freezeClient
debug_traceChain					      |	trace_chain
debug_traceBlockByNumber				      |	trace_blockByNumber
debug_traceBlockByHash					      |	trace_blockByHash
debug_traceBlock					      |	trace_block
debug_traceBadBlock					      |	trace_badBlock
debug_standardTraceBlockToFile				      |	trace_blockToFile
debug_intermediateRoots					      |	x_intermediateRoots
debug_standardTraceBadBlockToFile			      |	trace_badBlockToFile
debug_traceTransaction					      |	trace_transaction
debug_traceCall						      |	trace_call
les_serverInfo							les_serverInfo
les_clientInfo							les_clientInfo
les_priorityClientInfo						les_priorityClientInfo
les_setClientParams						les_setClientParams
les_setDefaultParams						les_setDefaultParams
les_setConnectedBias						les_setConnectedBias
les_addBalance							les_addBalance
les_benchmark							les_benchmark
les_getCheckpoint						les_getCheckpoint
les_getCheckpointContractAddress				les_getCheckpointContractAddress
eth_gasPrice							eth_gasPrice
eth_maxPriorityFeePerGas					eth_maxPriorityFeePerGas
eth_feeHistory							eth_feeHistory
eth_syncing							eth_syncing
eth_accounts							eth_accounts
eth_chainId							eth_chainId
eth_blockNumber							eth_blockNumber
eth_getBalance							eth_getBalance
eth_getProof							eth_getProof
eth_getHeaderByNumber						eth_getHeaderByNumber
eth_getHeaderByHash						eth_getHeaderByHash
eth_getBlockByNumber						eth_getBlockByNumber
eth_gethBlockByHash						eth_gethBlockByHash
eth_getUncleBlockByNumberAndIndex				eth_getUncleBlockByNumberAndIndex
eth_getUncleBlockByHashAndIndex					eth_getUncleBlockByHashAndIndex
eth_getUncleCountByBlockNumber					eth_getUncleCountByBlockNumber
eth_getUncleCountByBlockHash					eth_getUncleCountByBlockHash
eth_getCode							eth_getCode
eth_getStorageAt						eth_getStorageAt
eth_call							eth_call
eth_estimateGas							eth_estimateGas
eth_createAccessList						eth_createAccessList
eth_getBlockTransactionCountByNumber				eth_getBlockTransactionCountByNumber
eth_getBlockTransactionCountByHash				eth_getBlockTransactionCountByHash
eth_getTransactionByBlockHashAndIndex				eth_getTransactionByBlockHashAndIndex
eth_getRawTransactionByBlockNumberAndIndex			eth_getRawTransactionByBlockNumberAndIndex
eth_getTransactionCount						eth_getTransactionCount
eth_getTransactionByHash					eth_getTransactionByHash
eth_getRawTransactionByHash					eth_getRawTransactionByHash
eth_getTransactionByReceipt					eth_getTransactionByReceipt
eth_submitTransaction						eth_submitTransaction
eth_sendTransaction						eth_sendTransaction
eth_fillTransaction						eth_fillTransaction
eth_sendRawTransaction						eth_sendRawTransaction
eth_sign							eth_sign
eth_signTransaction						eth_signTransaction
eth_pendingTransaction						eth_pendingTransaction
eth_resend							eth_resend
eth_newPendingTransactionFilter					eth_newPendingTransactionFilter
eth_newPendingTransactions					eth_newPendingTransactions
eth_newBlockFilter						eth_newBlockFilter
eth_newHeads							eth_newHeads
eth_logs							eth_logs
eth_newFilter							eth_newFilter
eth_getLogs							eth_getLogs
eth_uninstallFilter						eth_uninstallFilter
eth_getFilterLogs						eth_getFilterLogs
eth_getFilterChanges						eth_getFilterChanges
eth_subscribe							eth_subscribe
eth_unsubscribe							eth_unsubscribe
miner_etherbase							miner_etherbase
miner_coinbase							miner_coinbase
miner_hashrate							miner_hashrate
miner_mining							miner_mining
miner_start							miner_start
miner_stop							miner_stop
miner_setExtra							miner_setExtra
miner_setGasPrice						miner_setGasPrice
miner_setEtherbase						miner_setEtherbase
miner_setRecommitInterval					miner_setRecommitInterval
txpool_content							txpool_content
txpool_contentFrom						txpool_contentFrom
txpool_status							txpool_status
txpool_inspect							txpool_inspect
personal_listAccounts						personal_listAccounts
personal_listWallets						personal_listWallets
personal_openWallet						personal_openWallet
personal_deriveAccount						personal_deriveAccount
personal_newAccount						personal_newAccount
personal_importRawKey						personal_importRawKey
personal_unlockAccount						personal_unlockAccount
personal_lockAccount						personal_lockAccount
personal_sendTransaction					personal_sendTransaction
personal_signTransaction					personal_signTransaction
personal_sign							personal_sign
personal_ecRecover						personal_ecRecover
personal_signAndSendTransaction					personal_signAndSendTransaction
personal_initializeWallet					personal_initializeWallet
personal_unpair							personal_unpair

Next Steps

There are some other potential restructuring items that go beyond just naming. A few ideas:

  • get rid of the concept of "public" and "private" API definitions
  • more clearly map what a namespace a method is in
    • via file/package?
    • via struct name?
  • sort out naming conflicts with Erigon (e.g. their trace_call maps to old parity implementation)
  • Auto generate github pages docs (although, I almost wonder if we want to move in the opposite direction for the "standard" namespaces and just point people to ethereum/execution-specs)
  • spec out methods in open-rpc
  • some of the trace methods conflict with the old parity methods that erigon now implements - above is the "happy case". May need to rename a bit to work with that. Also, Sina had an interesting idea of making one-tracing-method-to-rule-them-all so that could resolve that issue.

What is the best order of these changes? Is it better to do the code maintenance first and then do the renaming, or vice versa? Or maybe spec first?

I also plan to talk to some other client teams to determine if these debug methods are okay to standardize.

@quickchase
Copy link

Related: #21963

@Nov1kov
Copy link

Nov1kov commented Jul 30, 2024

By the way, is geth support only "debug_traceCall"? That could completely implement "trace_call"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants
@holiman @s1na @Nov1kov @lightclient @quickchase and others