From 287a55072a3784cdb6e96aa553b43ce693d3943b Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Tue, 3 Mar 2026 10:29:09 +0800 Subject: [PATCH] eth, internal: add console endpoint --- eth/api_debug.go | 26 ++------------------------ internal/web3ext/web3ext.go | 11 ++++++----- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/eth/api_debug.go b/eth/api_debug.go index 89d98762be..a3e4cd81b0 100644 --- a/eth/api_debug.go +++ b/eth/api_debug.go @@ -494,9 +494,9 @@ func (api *DebugAPI) StateSize(blockHashOrNumber *rpc.BlockNumberOrHash) (interf }, nil } -func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumber) (*stateless.ExtWitness, error) { +func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumberOrHash) (*stateless.ExtWitness, error) { bc := api.eth.blockchain - block, err := api.eth.APIBackend.BlockByNumber(context.Background(), bn) + block, err := api.eth.APIBackend.BlockByNumberOrHash(context.Background(), bn) if err != nil { return &stateless.ExtWitness{}, fmt.Errorf("block number %v not found", bn) } @@ -515,25 +515,3 @@ func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumber) (*stateless.ExtWitness } return result.Witness().ToExtWitness(), nil } - -func (api *DebugAPI) ExecutionWitnessByHash(hash common.Hash) (*stateless.ExtWitness, error) { - bc := api.eth.blockchain - block := bc.GetBlockByHash(hash) - if block == nil { - return &stateless.ExtWitness{}, fmt.Errorf("block hash %x not found", hash) - } - parent := bc.GetHeader(block.ParentHash(), block.NumberU64()-1) - if parent == nil { - return &stateless.ExtWitness{}, fmt.Errorf("block number %x found, but parent missing", hash) - } - config := core.ExecuteConfig{ - WriteState: false, - EnableTracer: false, - MakeWitness: true, - } - result, err := bc.ProcessBlock(context.Background(), parent.Root, block, config) - if err != nil { - return nil, err - } - return result.Witness().ToExtWitness(), nil -} diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 9ba8776360..1d1b5fbcd1 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -427,11 +427,6 @@ web3._extend({ params: 2, inputFormatter:[null, null], }), - new web3._extend.Method({ - name: 'freezeClient', - call: 'debug_freezeClient', - params: 1, - }), new web3._extend.Method({ name: 'getAccessibleState', call: 'debug_getAccessibleState', @@ -474,6 +469,12 @@ web3._extend({ params: 1, inputFormatter: [null], }), + new web3._extend.Method({ + name: 'executionWitness', + call: 'debug_executionWitness', + params: 1, + inputFormatter: [null], + }), ], properties: [] });