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] Add stake2 transferownership command #4250

Merged
merged 6 commits into from
Jun 5, 2024
Merged

[ioctl] Add stake2 transferownership command #4250

merged 6 commits into from
Jun 5, 2024

Conversation

millken
Copy link
Contributor

@millken millken commented Apr 23, 2024

Description

ioctl Add stake2 transferownership command, allow delegate to transfer the ownership to a new address

ioctl stake2 transferownership  <alias|newOwnerAddress> [payload]

Related PR:
#4236
#4239
#4245

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

require.EqualValues(iotextypes.ReceiptStatus_Success, ccto.Status)
require.NoError(checkCandidateState(sf, candidate1Name, newOwner1.String(), selfStake, cand1Votes, newOwner1))
})
t.Run("candidate transfer ownership to a exist candidate", func(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

an existing candidate

require.EqualValues(iotextypes.ReceiptStatus_ErrUnauthorizedOperator, ccto.Status)
require.NoError(checkCandidateState(sf, candidate1Name, cand1Addr.String(), selfStake, cand1Votes, cand1Addr))
})
t.Run("candidate transfer ownership to a invalid address", func(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

an invalid address

@@ -101,7 +104,7 @@ func (d *Candidate) isSelfStakeBucketSettled() bool {

// Collision checks collsion of 2 candidates
func (d *Candidate) Collision(c *Candidate) error {
if address.Equal(d.Owner, c.Owner) {
if address.Equal(d.Owner, c.Owner) || address.Equal(d.GetIdentifier(), c.GetIdentifier()) {
Copy link
Member

Choose a reason for hiding this comment

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

i think this part has been merged, can you rebase?

@@ -491,6 +545,7 @@ func TestNativeStaking(t *testing.T) {
cfg.Genesis.FbkMigrationBlockHeight = 1
cfg.Genesis.TsunamiBlockHeight = 0
Copy link
Member

Choose a reason for hiding this comment

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

each hard-fork height needs to be >= previous one

}
_stake2TransferOwnershipCmdShorts = map[config.Language]string{
config.English: "Transfer Ownership on IoTeX blockchain",
config.Chinese: "在IoTeX区块链上转移候选人",
Copy link
Member

Choose a reason for hiding this comment

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

转让

Copy link

sonarqubecloud bot commented Jun 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
1.3% Duplication on New Code

See analysis details on SonarCloud

@envestcc envestcc merged commit e50edd5 into iotexproject:master Jun 5, 2024
3 checks passed
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.

4 participants