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

feat: swip 20 staking changes #4728

Merged
merged 13 commits into from
Jul 24, 2024
Merged

feat: swip 20 staking changes #4728

merged 13 commits into from
Jul 24, 2024

Conversation

istae
Copy link
Member

@istae istae commented Jul 18, 2024

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

Changes on the bee side in correspondence to ethersphere/storage-incentives#264 and ethersphere/SWIPs#49

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):

@istae istae requested review from martinconic and acha-bill July 18, 2024 15:35
pkg/api/router.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
Comment on lines 1023 to 1035
transactionMock.WithWaitForReceiptFunc(func(ctx context.Context, txHash common.Hash) (receipt *types.Receipt, err error) {
if txHash == txHashApprove {
return &types.Receipt{
Status: 1,
}, nil
}
if txHash == txHashWithdrawn {
return &types.Receipt{
Status: 1,
}, nil
}
return nil, errors.New("unknown tx hash")
}),
Copy link
Member

Choose a reason for hiding this comment

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

it will not reach the receipt part

pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract_test.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract.go Outdated Show resolved Hide resolved
pkg/api/router.go Outdated Show resolved Hide resolved
pkg/api/export_test.go Outdated Show resolved Hide resolved
@istae istae requested review from acha-bill and nugaon July 22, 2024 16:54
}

if len(prevStakedAmount.Bits()) == 0 {
if stakedAmount.Cmp(MinimumStakeAmount) == -1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

why == -1 and not <= -1 ?

Copy link
Member Author

@istae istae Jul 23, 2024

Choose a reason for hiding this comment

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

-1 means that the staked amount is less than the minimum,
0 would mean equal
1 would mean staked amount is greater than the minimum

Copy link
Member Author

@istae istae Jul 23, 2024

Choose a reason for hiding this comment

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

the Cmp func strictly returns the values above

Copy link
Contributor

Choose a reason for hiding this comment

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

my mistake

Copy link
Member

@nugaon nugaon left a comment

Choose a reason for hiding this comment

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

LGTM!

pkg/api/staking.go Show resolved Hide resolved
pkg/storageincentives/staking/contract.go Outdated Show resolved Hide resolved
pkg/storageincentives/staking/contract.go Outdated Show resolved Hide resolved
Copy link
Contributor

@acha-bill acha-bill left a comment

Choose a reason for hiding this comment

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

don't forget to move beekeeper_branch back to master :)

@istae istae merged commit f6d294c into master Jul 24, 2024
13 of 14 checks passed
@istae istae deleted the swip20 branch July 24, 2024 15:40
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