-
Notifications
You must be signed in to change notification settings - Fork 193
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
refactor: general code style cleanups on precompile and statedb journal #2100
Changes from all commits
295a2d9
80dd2d7
c624912
7f904a0
08a73ee
717ce1c
04a6897
7c34423
4e3bf3c
576cf6c
90fecf7
5fcb361
c1bb21a
10885f1
f04b1e5
78c835a
5b38ec5
d7db81b
7236e22
f6cccc7
2dc5646
5bae79e
94121a7
6dc3c9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,8 +30,8 @@ | |
// | ||
// Retrieves information from a particular block in the blockchain. | ||
BlockNumber() (hexutil.Uint64, error) | ||
GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) | ||
GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) | ||
GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]any, error) | ||
GetBlockByHash(hash common.Hash, fullTx bool) (map[string]any, error) | ||
GetBlockTransactionCountByHash(hash common.Hash) *hexutil.Uint | ||
GetBlockTransactionCountByNumber(blockNum rpc.BlockNumber) *hexutil.Uint | ||
|
||
|
@@ -97,15 +97,15 @@ | |
// and replaced by a canonical block instead. | ||
GetUncleByBlockHashAndIndex( | ||
hash common.Hash, idx hexutil.Uint, | ||
) map[string]interface{} | ||
) map[string]any | ||
GetUncleByBlockNumberAndIndex( | ||
number, idx hexutil.Uint, | ||
) map[string]interface{} | ||
) map[string]any | ||
GetUncleCountByBlockHash(hash common.Hash) hexutil.Uint | ||
GetUncleCountByBlockNumber(blockNum rpc.BlockNumber) hexutil.Uint | ||
|
||
// Other | ||
Syncing() (interface{}, error) | ||
Syncing() (any, error) | ||
GetTransactionLogs(txHash common.Hash) ([]*gethcore.Log, error) | ||
FillTransaction( | ||
args evm.JsonTxArgs, | ||
|
@@ -144,13 +144,13 @@ | |
} | ||
|
||
// GetBlockByNumber returns the block identified by number. | ||
func (e *EthAPI) GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) { | ||
func (e *EthAPI) GetBlockByNumber(ethBlockNum rpc.BlockNumber, fullTx bool) (map[string]any, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add test coverage for modified RPC methods. The following methods lack test coverage:
These are critical RPC methods that should be thoroughly tested to ensure compatibility with Ethereum clients. Would you like me to help generate comprehensive test cases for these methods? The test suite should include:
Also applies to: 153-153, 362-362, 370-370, 399-399 |
||
e.logger.Debug("eth_getBlockByNumber", "number", ethBlockNum, "full", fullTx) | ||
return e.backend.GetBlockByNumber(ethBlockNum, fullTx) | ||
} | ||
|
||
// GetBlockByHash returns the block identified by hash. | ||
func (e *EthAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]interface{}, error) { | ||
func (e *EthAPI) GetBlockByHash(hash common.Hash, fullTx bool) (map[string]any, error) { | ||
e.logger.Debug("eth_getBlockByHash", "hash", hash.Hex(), "full", fullTx) | ||
return e.backend.GetBlockByHash(hash, fullTx) | ||
} | ||
|
@@ -359,15 +359,15 @@ | |
// Always returns nil. | ||
func (e *EthAPI) GetUncleByBlockHashAndIndex( | ||
_ common.Hash, _ hexutil.Uint, | ||
) map[string]interface{} { | ||
) map[string]any { | ||
return nil | ||
} | ||
|
||
// GetUncleByBlockNumberAndIndex returns the uncle identified by number and | ||
// index. Always returns nil. | ||
func (e *EthAPI) GetUncleByBlockNumberAndIndex( | ||
_, _ hexutil.Uint, | ||
) map[string]interface{} { | ||
) map[string]any { | ||
return nil | ||
} | ||
|
||
|
@@ -396,7 +396,7 @@ | |
// - highestBlock: block number of the highest block header this node has received from peers | ||
// - pulledStates: number of state entries processed until now | ||
// - knownStates: number of known state entries that still need to be pulled | ||
func (e *EthAPI) Syncing() (interface{}, error) { | ||
func (e *EthAPI) Syncing() (any, error) { | ||
e.logger.Debug("eth_syncing") | ||
return e.backend.Syncing() | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider simplifying the parameter type.
Since a map is already a reference type, consider simplifying the parameter type from
*map[string]any
tomap[string]any
to avoid unnecessary pointer indirection.This change would require updating the function body to remove the pointer dereference when accessing the map: