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] Remove ActionsByBlock() in coreService #3432

Merged
merged 2 commits into from
Jun 7, 2022

Conversation

Liuhaai
Copy link
Member

@Liuhaai Liuhaai commented Jun 4, 2022

Description

Solve TODO in the codebase

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Code refactor or improvement
  • [] Breaking change (fix or feature that would cause a new or changed behavior of existing functionality)
  • [] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • [] make test
  • [] fullsync
  • [] Other test (please specify)

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

@Liuhaai Liuhaai marked this pull request as ready for review June 4, 2022 00:07
@Liuhaai Liuhaai requested a review from a team as a code owner June 4, 2022 00:07
@codecov
Copy link

codecov bot commented Jun 4, 2022

Codecov Report

Merging #3432 (5d0abb1) into master (30e0cdf) will increase coverage by 0.02%.
The diff coverage is 82.45%.

@@            Coverage Diff             @@
##           master    #3432      +/-   ##
==========================================
+ Coverage   75.13%   75.15%   +0.02%     
==========================================
  Files         236      236              
  Lines       22077    22069       -8     
==========================================
- Hits        16587    16586       -1     
+ Misses       4598     4594       -4     
+ Partials      892      889       -3     
Impacted Files Coverage Δ
api/coreservice.go 68.79% <75.00%> (+0.04%) ⬆️
api/grpcserver.go 78.80% <79.54%> (-0.03%) ⬇️
api/web3server.go 61.55% <100.00%> (ø)
api/web3server_utils.go 65.11% <100.00%> (ø)

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 30e0cdf...5d0abb1. Read the comment docs.

// ActionsByBlock returns all actions in a block
func (core *coreService) ActionsByBlock(blkHash string, start uint64, count uint64) ([]*iotexapi.ActionInfo, error) {
// BlockByHash returns the block and its receipt
func (core *coreService) BlockByHash(blkHash string) (*block.Block, []*action.Receipt, error) {
Copy link
Member

Choose a reason for hiding this comment

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

can remove []*action.Receipt, see comment below

@@ -1051,7 +1025,7 @@ func (core *coreService) ActionsInBlockByHash(blkHash string) ([]action.SealedEn
if err != nil {
return nil, nil, errors.Wrap(ErrNotFound, err.Error())
}
return blk.Actions, receipts, nil
return blk, receipts, nil
Copy link
Member

Choose a reason for hiding this comment

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

blk.Receipts = receipts
return blk, nil

@@ -185,6 +195,54 @@ func (svr *GRPCServer) GetActions(ctx context.Context, in *iotexapi.GetActionsRe
}, nil
}

func actionsInBlock(blk *block.Block, receipts []*action.Receipt, start, count uint64) ([]*iotexapi.ActionInfo, error) {
Copy link
Member

Choose a reason for hiding this comment

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

can remove []*action.Receipt, see comment above

@Liuhaai Liuhaai merged commit 2e8ef35 into iotexproject:master Jun 7, 2022
saitofun pushed a commit that referenced this pull request Jun 8, 2022
* remove ActionsByBlock() in coreService
saitofun pushed a commit that referenced this pull request Jun 9, 2022
* remove ActionsByBlock() in coreService
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