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

[api] Clean web3 code #3205

Merged
merged 6 commits into from
Mar 22, 2022
Merged

[api] Clean web3 code #3205

merged 6 commits into from
Mar 22, 2022

Conversation

Liuhaai
Copy link
Member

@Liuhaai Liuhaai commented Mar 17, 2022

getStringAndBoolFromArray and getStringFromArray are removed.

@Liuhaai Liuhaai requested a review from a team as a code owner March 17, 2022 05:21
@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #3205 (310a565) into master (f85274e) will decrease coverage by 0.10%.
The diff coverage is 58.95%.

@@            Coverage Diff             @@
##           master    #3205      +/-   ##
==========================================
- Coverage   75.06%   74.95%   -0.11%     
==========================================
  Files         228      228              
  Lines       21393    21366      -27     
==========================================
- Hits        16058    16015      -43     
- Misses       4483     4491       +8     
- Partials      852      860       +8     
Impacted Files Coverage Δ
api/web3server.go 66.42% <53.50%> (-4.88%) ⬇️
api/web3server_utils.go 68.09% <90.00%> (+0.97%) ⬆️
db/trie/mptrie/branchnode.go 97.22% <0.00%> (-1.39%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f85274e...310a565. Read the comment docs.

}
return
}

func (svr *Web3Server) getBlockWithTransactions(blkMeta *iotextypes.BlockMeta, isDetailed bool) (blockObject, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this function back into web3server.go

gasLimit uint64
value *big.Int
to string = ""
gasLimit uint64 = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 2 not necessary

@@ -224,43 +223,47 @@ func (svr *Web3Server) handleWeb3Req(web3Req gjson.Result) interface{} {
res, err = svr.getHashrate()
case "eth_getLogs":
var filter *filterObject
if filter, err = parseLogRequest(web3Req.Get("params")); err == nil {
filter, err = parseLogRequest(web3Req.Get("params"))
if err == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary

if err != nil {
return nil, err
func (svr *Web3Server) getBlockByNumber(in *gjson.Result) (interface{}, error) {
blkNum, isDetailed := in.Get("params.0"), in.Get("params.1")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good clean-up

@Liuhaai Liuhaai merged commit a9e693b into iotexproject:master Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants