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

[staking] remove unnecessary call from GetStakingStateReader #3695

Merged
merged 2 commits into from
Nov 16, 2022
Merged

Conversation

dustinxie
Copy link
Member

Description

as title

Fixes #(issue)

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)

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

@dustinxie dustinxie requested a review from a team as a code owner November 16, 2022 16:48
height: height,
view: view,
}, nil
}
Copy link
Member Author

Choose a reason for hiding this comment

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

protocol.Start() calls CreateBaseView() and after that the view will be written, so there's no need to check and call CreateBaseView() again here. In other words, if error happens sth is wrong

Copy link
Collaborator

Choose a reason for hiding this comment

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

in this case, do we still need to keep this function?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Merging #3695 (c8a0f43) into master (263ff82) will decrease coverage by 0.77%.
The diff coverage is 88.75%.

❗ Current head c8a0f43 differs from pull request most recent head 042f4db. Consider uploading reports for the commit 042f4db to get more accurate results

@@            Coverage Diff             @@
##           master    #3695      +/-   ##
==========================================
- Coverage   74.47%   73.70%   -0.78%     
==========================================
  Files         269      276       +7     
  Lines       23925    24135     +210     
==========================================
- Hits        17818    17788      -30     
- Misses       5174     5440     +266     
+ Partials      933      907      -26     
Impacted Files Coverage Δ
action/protocol/staking/candidate_statereader.go 54.87% <ø> (-2.44%) ⬇️
db/db_bolt.go 68.53% <0.00%> (-3.60%) ⬇️
ioctl/newcmd/action/actiontransfer.go 100.00% <ø> (ø)
ioctl/newcmd/action/stake2withdraw.go 95.74% <ø> (ø)
ioctl/newcmd/action/xrc20transferfrom.go 100.00% <ø> (ø)
ioctl/newcmd/did/didgethash.go 100.00% <ø> (ø)
ioctl/newcmd/did/didgeturi.go 100.00% <ø> (ø)
server/itx/server.go 62.20% <ø> (+2.20%) ⬆️
action/protocol/staking/handlers.go 74.47% <33.33%> (-0.64%) ⬇️
ioctl/newcmd/did/didgenerate.go 83.67% <83.67%> (ø)
... and 16 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -123,18 +123,6 @@ func (c *candSR) ActiveBucketsCount() uint64 {
func GetStakingStateReader(sr protocol.StateReader) (CandidateStateReader, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Replace GetStakingStateReader with ConstructBaseView?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@sonarcloud
Copy link

sonarcloud bot commented Nov 16, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dustinxie dustinxie merged commit e0578da into master Nov 16, 2022
@dustinxie dustinxie deleted the fixsr branch November 16, 2022 19:49
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.

5 participants