Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Mutli-Block Finalization #2155

Merged
merged 52 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
bbae6b3
`@0x/contracts-staking`: Starting MBF.
merklejerk Sep 10, 2019
73f1aca
`@0x/contracts-staking`: More work on `MixinFinalizer`.
merklejerk Sep 11, 2019
e4b9d14
`@0x/contracts-staking`: Tinkering with crediting rewards.
merklejerk Sep 11, 2019
9c47d22
`@0x/contracts-staking`: Add some tests to check rewards in the EthVa…
merklejerk Sep 11, 2019
94909f1
`@0x/contracts-staking`: Add another delegator payout test.
merklejerk Sep 11, 2019
b57c0a2
`@0x/contracts-staking`: Fully implement MBF (I hope).
merklejerk Sep 12, 2019
294be37
`@0x/contracts-staking`: Got the solidity compiling.
merklejerk Sep 12, 2019
712b256
`@0x/contracts-staking`: Fix solidity linter errors.
merklejerk Sep 12, 2019
06b4d24
`@0x/contracts-staking`: Working on MBF v2
merklejerk Sep 13, 2019
102ca6b
`@0x/contracts-staking`: Almost compiling...
merklejerk Sep 13, 2019
46b8bfe
`@0x/contracts-staking`: It compiles! (again)
merklejerk Sep 13, 2019
6a8242a
`@0x/contracts-staking`: Fix past epoch reward accounting.
merklejerk Sep 13, 2019
58a5ab4
`@0x/contracts-test-utils`: Allow `hexSlice()` to take negative numbe…
merklejerk Sep 13, 2019
d548dda
`@0x/contracts-staking`: Fixing tests.
merklejerk Sep 13, 2019
a1aad2e
`@0x/contracts-exchange`: Fixing tests and writing new ones.
merklejerk Sep 13, 2019
ada1de4
`@0x/order-utils`: Add `PreviousEpochNotFinalizedError` to `StakingRe…
merklejerk Sep 14, 2019
f5ab1e6
`@0x/contracts-staking`: Reduce code duplication in `MixinFinalizer` …
merklejerk Sep 14, 2019
03c59fd
`@0x/contracts-staking`: More `MixinFinalizer` unit tests.
merklejerk Sep 14, 2019
b4929df
`@0x/order-utils`: Ran prettier.
merklejerk Sep 14, 2019
da0f6b5
`@0x/contracts-test-utils`: Finish off finalizer tests... for now.
merklejerk Sep 14, 2019
fa65452
`@0x/contracts-staking`: OK, two more finalizer tests.
merklejerk Sep 14, 2019
38b94ec
`@0x/order-utils`: Add `InvalidMinimumPoolStake` to `StakingRevertErr…
merklejerk Sep 16, 2019
7ef3c12
`@0x/contracts-staking`: Well, it almost worked.
merklejerk Sep 16, 2019
0196ce1
`@0x/contracts-staking`: Last call before embarking of V3 of staking …
merklejerk Sep 16, 2019
e267a0e
`@0x/contracts-staking`: Transition to V3
merklejerk Sep 16, 2019
527ec28
`@0x/contracts-utils`: Add auto-scaling and zero-value optimizations …
merklejerk Sep 17, 2019
a43b494
`@0x/contracts-staking`: All tests passing!
merklejerk Sep 17, 2019
52b0ba5
`@0x/contracts-staking`: Fix linter errors.
merklejerk Sep 17, 2019
7fb5ed0
`@0x/contracts-staking`: Add another test case to delegator rewards t…
merklejerk Sep 18, 2019
ac7f6ae
`@0x/contracts-staking`: It compiles!
merklejerk Sep 18, 2019
993f05d
`@0x/contracts-staking`: Fixing tests.
merklejerk Sep 18, 2019
b4b6d4d
`@0x/contracts-test-utils`: Add `shortZip()`.
merklejerk Sep 18, 2019
d33080c
`@0x/contracts-staking`: Finalizer tests passing.
merklejerk Sep 18, 2019
54ac1c2
`@0x/base-contract`: Properly encode `BigNumber` indexed filter value…
merklejerk Sep 19, 2019
b43fa88
`@0x/contracts-staking`: All tests but `rewards_test` working.
merklejerk Sep 19, 2019
d5bbbe8
`@0x/base-contract`: Fix linter errors.
merklejerk Sep 19, 2019
8610671
`@0x/contracts-staking`: Gag! All tests passing?
merklejerk Sep 19, 2019
0270777
`@0x/contracts-test-utils`: Add `hexHash()` to `hex_utils`.
merklejerk Sep 19, 2019
d064543
`@0x/contracts-staking`: Add some `computeRewardBalanceOfOperator()` …
merklejerk Sep 19, 2019
2bb9b9a
`@0x/contracts-test-utils`: Ran prettier.
merklejerk Sep 19, 2019
2eff213
`@0x/contracts-staking`: Import `randomAddress()` instead of defining…
merklejerk Sep 19, 2019
14c4491
`@0x/contracts-staking`: Add some extra finalizer tests and light ref…
dorothy-zbornak Sep 19, 2019
3ad7728
`@0x/contracts-staking`: Remove `IStructs.CumulativeRewardInfo`, etc.
dorothy-zbornak Sep 21, 2019
6a29654
`@0x/contracts-staking`: Updating tests and making the contracts test…
dorothy-zbornak Sep 22, 2019
c72a15b
`@0x/contracts-staking`: All tests back up and running.
dorothy-zbornak Sep 22, 2019
aa4ee2c
`@0x/dev-utils`: Increase gas limit to 9e6
dorothy-zbornak Sep 22, 2019
e412618
`@0x/order-utils`: Fix staking error codes after rebase.
dorothy-zbornak Sep 22, 2019
eac4520
`@0x/contracts-staking`: Rebase against 3.0
dorothy-zbornak Sep 22, 2019
6d20f0e
`@0x/contracts-staking`: Update compiler version in truffle config.
dorothy-zbornak Sep 22, 2019
9dd8c61
`@0x/contract-staking`: Address review nits.
dorothy-zbornak Sep 23, 2019
196cc43
`@0x/contract-staking`: Make solidity uniformly hideous ;-).
dorothy-zbornak Sep 23, 2019
3883297
`@0x/contracts-staking`: Remove `getTotalBalance()` function.
dorothy-zbornak Sep 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contracts/staking/CHANGELOG.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
{
"note": "Refactored out `_cobbDouglas()` into its own library",
"pr": 2179
},
{
"note": "Introduce multi-block finalization.",
"pr": 2155
}
]
}
Expand Down
20 changes: 18 additions & 2 deletions contracts/staking/contracts/src/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,30 @@ pragma experimental ABIEncoderV2;

import "./interfaces/IStaking.sol";
import "./sys/MixinParams.sol";
import "./sys/MixinFinalizer.sol";
import "./stake/MixinStake.sol";
import "./staking_pools/MixinStakingPool.sol";
import "./fees/MixinExchangeFees.sol";


contract Staking is
IStaking,
IStakingEvents,
MixinAbstract,
MixinConstants,
MixinDeploymentConstants,
Ownable,
MixinStorage,
MixinStakingPoolModifiers,
MixinExchangeManager,
MixinScheduler,
MixinParams,
MixinStakeStorage,
MixinStakingPoolMakers,
MixinStakeBalances,
MixinCumulativeRewards,
Copy link
Member

Choose a reason for hiding this comment

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

I see you got a hold of Greg's linearization script :trollface:

Copy link
Member

Choose a reason for hiding this comment

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

I suppose we can give imports another pass after all big features are merged.

Copy link
Contributor

Choose a reason for hiding this comment

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

Come to the dark side, Amir. These aren't the imports you're looking for.

MixinStakingPoolRewards,
MixinFinalizer,
MixinStakingPool,
MixinStake,
MixinExchangeFees
Expand All @@ -51,9 +67,9 @@ contract Staking is
address _wethProxyAddress,
address _ethVaultAddress,
address payable _rewardVaultAddress,
address _zrxVaultAddress
address _zrxVaultAddress
)
external
public
onlyAuthorized
{
// DANGER! When performing upgrades, take care to modify this logic
Expand Down
12 changes: 11 additions & 1 deletion contracts/staking/contracts/src/StakingProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import "./interfaces/IStakingProxy.sol";

contract StakingProxy is
IStakingProxy,
MixinConstants,
Ownable,
MixinStorage
{
using LibProxy for address;
Expand Down Expand Up @@ -73,7 +75,7 @@ contract StakingProxy is

/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
/// Note that this is callable only by this contract's owner.
/// @param _stakingContract Address of staking contract.
/// @param _stakingContract Address of staking contract.
/// @param _wethProxyAddress The address that can transfer WETH for fees.
/// Use address in storage if NIL_ADDRESS is passed in.
/// @param _ethVaultAddress Address of the EthVault contract.
Expand Down Expand Up @@ -207,6 +209,14 @@ contract StakingProxy is
));
}

// Minimum stake must be > 1
dorothy-zbornak marked this conversation as resolved.
Show resolved Hide resolved
if (minimumPoolStake < 2) {
LibRichErrors.rrevert(
LibStakingRichErrors.InvalidParamValueError(
LibStakingRichErrors.InvalidParamValueErrorCode.InvalidMinimumPoolStake
));
}

// ERC20Proxy and Vault contract addresses must always be initialized
if (address(wethAssetProxy) == NIL_ADDRESS) {
LibRichErrors.rrevert(
Expand Down
Loading