Skip to content

Commit

Permalink
feat: provide reserve capacity height to the staking contract (#4857)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinconic authored Oct 11, 2024
1 parent 646f02d commit 8b50ae6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE: "ethersphere/bee-localchain"
SETUP_CONTRACT_IMAGE_TAG: "0.9.1"
SETUP_CONTRACT_IMAGE_TAG: "0.9.2-rc1"
BEELOCAL_BRANCH: "main"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/coreos/go-semver v0.3.0
github.com/ethereum/go-ethereum v1.14.3
github.com/ethersphere/go-price-oracle-abi v0.2.0
github.com/ethersphere/go-storage-incentives-abi v0.9.1
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1
github.com/ethersphere/go-sw3-abi v0.6.5
github.com/ethersphere/langos v1.0.0
github.com/go-playground/validator/v10 v10.11.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ github.com/ethereum/go-ethereum v1.14.3 h1:5zvnAqLtnCZrU9uod1JCvHWJbPMURzYFHfc2e
github.com/ethereum/go-ethereum v1.14.3/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8=
github.com/ethersphere/go-price-oracle-abi v0.2.0 h1:wtIcYLgNZHY4BjYwJCnu93SvJdVAZVvBaKinspyyHvQ=
github.com/ethersphere/go-price-oracle-abi v0.2.0/go.mod h1:sI/Qj4/zJ23/b1enzwMMv0/hLTpPNVNacEwCWjo6yBk=
github.com/ethersphere/go-storage-incentives-abi v0.9.1 h1:/FGh5Bn78hlxMu0YjSFf1APzmmrCmmThDOZMWY+G2Cs=
github.com/ethersphere/go-storage-incentives-abi v0.9.1/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1 h1:Cf3LFlz87FqlTqcuN4q4Hry4iUaAbbroaFxpCgHVhtY=
github.com/ethersphere/go-storage-incentives-abi v0.9.2-rc1/go.mod h1:SXvJVtM4sEsaSKD0jc1ClpDLw8ErPoROZDme4Wrc/Nc=
github.com/ethersphere/go-sw3-abi v0.6.5 h1:M5dcIe1zQYvGpY2K07UNkNU9Obc4U+A1fz68Ho/Q+XE=
github.com/ethersphere/go-sw3-abi v0.6.5/go.mod h1:BmpsvJ8idQZdYEtWnvxA8POYQ8Rl/NhyCdF0zLMOOJU=
github.com/ethersphere/langos v1.0.0 h1:NBtNKzXTTRSue95uOlzPN4py7Aofs0xWPzyj4AI1Vcc=
Expand Down
2 changes: 1 addition & 1 deletion pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ func NewBee(
stakingContractAddress = common.HexToAddress(o.StakingContractAddress)
}

stakingContract := staking.New(overlayEthAddress, stakingContractAddress, abiutil.MustParseABI(chainCfg.StakingABI), bzzTokenAddress, transactionService, common.BytesToHash(nonce), o.TrxDebugMode)
stakingContract := staking.New(overlayEthAddress, stakingContractAddress, abiutil.MustParseABI(chainCfg.StakingABI), bzzTokenAddress, transactionService, common.BytesToHash(nonce), o.TrxDebugMode, uint8(o.ReserveCapacityDoubling))

if chainEnabled && changedOverlay {
stake, err := stakingContract.GetPotentialStake(ctx)
Expand Down
5 changes: 4 additions & 1 deletion pkg/storageincentives/staking/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type contract struct {
transactionService transaction.Service
overlayNonce common.Hash
gasLimit uint64
height uint8
}

func New(
Expand All @@ -69,6 +70,7 @@ func New(
transactionService transaction.Service,
nonce common.Hash,
setGasLimit bool,
height uint8,
) Contract {

var gasLimit uint64
Expand All @@ -84,6 +86,7 @@ func New(
transactionService: transactionService,
overlayNonce: nonce,
gasLimit: gasLimit,
height: height,
}
}

Expand Down Expand Up @@ -293,7 +296,7 @@ func (c *contract) sendTransaction(ctx context.Context, callData []byte, desc st
}

func (c *contract) sendDepositStakeTransaction(ctx context.Context, stakedAmount *big.Int, nonce common.Hash) (*types.Receipt, error) {
callData, err := c.stakingContractABI.Pack("manageStake", nonce, stakedAmount)
callData, err := c.stakingContractABI.Pack("manageStake", nonce, stakedAmount, c.height)
if err != nil {
return nil, err
}
Expand Down
Loading

0 comments on commit 8b50ae6

Please sign in to comment.