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

[ioctl] support querying delegate by operator address #3904

Merged
merged 6 commits into from
Jul 27, 2023

Conversation

envestcc
Copy link
Member

Description

Fixes #3900

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

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #3904 (9f1448b) into master (e1f0636) will increase coverage by 0.71%.
Report is 72 commits behind head on master.
The diff coverage is 73.70%.

❗ Current head 9f1448b differs from pull request most recent head 8ee1637. Consider uploading reports for the commit 8ee1637 to get more accurate results

@@            Coverage Diff             @@
##           master    #3904      +/-   ##
==========================================
+ Coverage   75.38%   76.09%   +0.71%     
==========================================
  Files         303      327      +24     
  Lines       25923    27833    +1910     
==========================================
+ Hits        19541    21179    +1638     
- Misses       5360     5563     +203     
- Partials     1022     1091      +69     
Files Changed Coverage Δ
action/protocol/execution/evm/evm.go 43.52% <0.00%> (-2.95%) ⬇️
action/protocol/execution/evm/evmstatedbadapter.go 66.77% <ø> (ø)
action/protocol/poll/consortium.go 0.00% <0.00%> (ø)
action/protocol/poll/staking_committee.go 43.85% <0.00%> (ø)
...tion/protocol/staking/contractstake_bucket_type.go 0.00% <0.00%> (ø)
api/grpcserver.go 86.40% <0.00%> (ø)
api/loglistener.go 25.00% <0.00%> (ø)
api/web3server_marshal.go 93.21% <ø> (ø)
api/websocket.go 5.17% <0.00%> (ø)
blockchain/config.go 74.54% <ø> (ø)
... and 51 more

... and 6 files with indirect coverage changes

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

return nil, output.NewError(output.UndefinedError, "failed to find delegate", nil)
}

func getDelegates(cli iotexapi.APIServiceClient, offset, limit uint32) (candidateList *iotextypes.CandidateListV2, err error) {
Copy link
Member

@dustinxie dustinxie Jul 21, 2023

Choose a reason for hiding this comment

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

there is already same func getStakingCandidates() in nodedelegate.go
move it to /util so can re-use the code?

Copy link
Member Author

Choose a reason for hiding this comment

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

good advice

defer conn.Close()
cli := iotexapi.NewAPIServiceClient(conn)

readCandidatesLimit := 20000
Copy link
Member

Choose a reason for hiding this comment

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

200 works and is maybe better?

@@ -366,39 +365,3 @@ func getAllStakingCandidates(chainClient iotexapi.APIServiceClient) (candidateLi
}
return
}

Copy link
Member Author

Choose a reason for hiding this comment

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

move to util pkg to reuse it

@@ -13,6 +13,7 @@ const (
_stakingProtocol = "staking"
)

// GetStakingBuckets returns staking buckets
Copy link
Member

Choose a reason for hiding this comment

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

GetStakingCandidates returns ...

@dustinxie dustinxie merged commit 913a162 into iotexproject:master Jul 27, 2023
1 check passed
@sonarcloud
Copy link

sonarcloud bot commented Jul 27, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

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
7.3% 7.3% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

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.

[ioctl] bc delegate command to accept operation address
3 participants