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

E2E EpochManager test + Epoch truffle migrations & Anvil L2 migration build fix #11198

Merged
merged 76 commits into from
Sep 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f9979ce
unit test with mocks
soloseng Aug 19, 2024
75bf938
++ integration tests
soloseng Aug 20, 2024
cb47ec9
clean up
soloseng Aug 20, 2024
fbdc5fd
Merge branch 'feat/l2-epoch-system' into soloseng/startNextEpochProce…
soloseng Aug 20, 2024
b8f5584
-- logging
soloseng Aug 20, 2024
282ef91
removed duplicate interface
soloseng Aug 20, 2024
40711cb
using `MockCeloToken` to get test to pass.
soloseng Aug 20, 2024
654b279
removed endEpochTimestamp
soloseng Aug 20, 2024
2072107
moved IEpochManager to 0.5 folder
soloseng Aug 20, 2024
9a6c01f
added L2 conditions for EpochRewards functions using precompiles
soloseng Aug 20, 2024
c48b8e5
renamed EpochManagerInitializer due to name conflict
soloseng Aug 21, 2024
47f93af
++ more unit test
soloseng Aug 21, 2024
d3b1db4
setup anvil migration
soloseng Aug 22, 2024
a6e2844
Merge branch 'feat/l2-epoch-system' into soloseng/startNextEpochProce…
soloseng Aug 26, 2024
2ba9360
compiles
soloseng Aug 26, 2024
35b637a
++ require fund in unreleased treasury
soloseng Aug 27, 2024
c02c0a4
Updated regex
soloseng Aug 27, 2024
92ac7cf
++ registry 0.8 for testing only
soloseng Aug 27, 2024
f50ac8b
clean up
soloseng Aug 27, 2024
3aa816c
++ unit test
soloseng Aug 27, 2024
180162b
initial integration test using L1 devchain
soloseng Aug 27, 2024
22946ff
++ comment
soloseng Aug 27, 2024
0ed7e93
-- forge based integration test
soloseng Aug 27, 2024
7fcc9a8
Merge branch 'feat/l2-epoch-system' into soloseng/startNextEpochProce…
soloseng Aug 27, 2024
8f0ea64
++ to const
soloseng Aug 27, 2024
cfa7cdb
happy linter
soloseng Aug 28, 2024
cdf7aea
update contract name
soloseng Aug 28, 2024
4b709d3
Adding truffle migrations
pahor167 Aug 29, 2024
969f9d3
Fix of L2 Anvil migrations
pahor167 Aug 29, 2024
8838c5c
Improved anvil devchain compilation
pahor167 Aug 29, 2024
93274c8
Release init params
pahor167 Aug 29, 2024
b49f929
++ PR feedback
soloseng Aug 29, 2024
1b616ca
++ checks
soloseng Sep 10, 2024
b47dba3
updated carbon address
soloseng Sep 10, 2024
f34e7e0
E2E test
pahor167 Sep 11, 2024
a050d27
lint
pahor167 Sep 11, 2024
0e8da38
Merge branch 'soloseng/startNextEpochProcess-unit-and-integration-tes…
pahor167 Sep 11, 2024
48db871
proxy stableToken mint call via Validators contract
soloseng Sep 11, 2024
8a8f4d9
Merge branch 'feat/l2-epoch-system' into soloseng/startNextEpochProce…
soloseng Sep 11, 2024
bbb239f
-- duplicate imports
soloseng Sep 11, 2024
2ffeed2
removed registry08. replaced with vm call
soloseng Sep 11, 2024
b195ebb
PR feedback
soloseng Sep 11, 2024
e84a5b5
generate Ecdsa Pub Key dynamically in migration.s.sol
pahor167 Sep 12, 2024
3c2ebfc
-- coment
soloseng Sep 12, 2024
83bd5aa
passing unit tests
soloseng Sep 12, 2024
1d4eaa4
clean up
soloseng Sep 12, 2024
43ae993
++ mintStable test
soloseng Sep 12, 2024
de06b4e
-- TODO; compiles test when filtering
soloseng Sep 12, 2024
15a5290
E2E test with 3 groups with 2 validators each
pahor167 Sep 13, 2024
84f4349
fix for rewards computation
pahor167 Sep 13, 2024
17c5884
lint
pahor167 Sep 13, 2024
bc53164
merge
pahor167 Sep 13, 2024
9ddb522
anvil migration rename
pahor167 Sep 13, 2024
48cf98c
remove setEpochMangerEnabler
pahor167 Sep 13, 2024
28bf1ff
truffle build fix
pahor167 Sep 16, 2024
e5ffbf1
initializeEpochManagerSystem
pahor167 Sep 16, 2024
96363fc
migration test fix
pahor167 Sep 16, 2024
812604d
prettify
pahor167 Sep 16, 2024
abdbae4
removal of logging
pahor167 Sep 16, 2024
55bd69b
removal of logging2
pahor167 Sep 16, 2024
fe91831
EpochManagerEnabler version
pahor167 Sep 12, 2024
2c5a95f
Enable epoch manager in devchain
pahor167 Sep 16, 2024
13510fd
lint
pahor167 Sep 16, 2024
eb5691b
Merge branch 'feat/l2-epoch-system' into pahor/truffleMigrations
martinvol Sep 17, 2024
6011483
Rolled back contracts/identity/FederatedAttestations.sol added by mis…
martinvol Sep 17, 2024
776f864
removed duplicated function
martinvol Sep 17, 2024
a152a09
Fix tests
martinvol Sep 17, 2024
f5a2cb8
lint
martinvol Sep 17, 2024
95a6b65
Fixed tests and moved ValidatorsMock08 to solidity test folder
martinvol Sep 17, 2024
69b3bd8
Added release data
martinvol Sep 17, 2024
f477f74
Deleted prints in release script
martinvol Sep 17, 2024
4093393
Removed unnecesary mocking
martinvol Sep 17, 2024
fc278cb
Force compilation of validator
martinvol Sep 17, 2024
5bf0d85
moved mocks to right path
martinvol Sep 17, 2024
df7a9e8
Fixed tests
martinvol Sep 17, 2024
1d62d5f
Added ScoreManager to releaseData/initializationData/release12.json
martinvol Sep 17, 2024
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
Prev Previous commit
Next Next commit
added L2 conditions for EpochRewards functions using precompiles
Still missing tests
  • Loading branch information
soloseng committed Aug 20, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9a6c01f893bcc556c80aeafaf705ffce78ab9ca7
18 changes: 17 additions & 1 deletion packages/protocol/contracts/governance/EpochRewards.sol
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import "../common/Freezable.sol";
import "../common/Initializable.sol";
import "../common/UsingRegistry.sol";
import "../common/UsingPrecompiles.sol";
import "../common/interfaces/ICeloToken.sol";
import "../common/interfaces/ICeloVersionedContract.sol";

/**
@@ -450,6 +451,12 @@ contract EpochRewards is
function getTargetTotalEpochPaymentsInGold() public view returns (uint256) {
address stableTokenAddress = registry.getAddressForOrDie(STABLE_TOKEN_REGISTRY_ID);
(uint256 numerator, uint256 denominator) = getSortedOracles().medianRate(stableTokenAddress);
if (isL2()) {
return
getEpochManager().getElected().length.mul(targetValidatorEpochPayment).mul(denominator).div(
numerator
);
}
return
numberValidatorsInCurrentSet().mul(targetValidatorEpochPayment).mul(denominator).div(
numerator
@@ -461,7 +468,16 @@ contract EpochRewards is
* @return The fraction of floating Gold being used for voting in validator elections.
*/
function getVotingGoldFraction() public view returns (uint256) {
uint256 liquidGold = getCeloToken().totalSupply().sub(getReserve().getReserveGoldBalance());
uint256 liquidGold;
if (isL2()) {
liquidGold = ICeloToken(address(getCeloToken())).allocatedSupply().sub(
getReserve().getReserveGoldBalance()
);
} else {
liquidGold = ICeloToken(address(getCeloToken())).totalSupply().sub(
getReserve().getReserveGoldBalance()
);
}
uint256 votingGold = getElection().getTotalVotes();
return FixidityLib.newFixed(votingGold).divide(FixidityLib.newFixed(liquidGold)).unwrap();
}
Original file line number Diff line number Diff line change
@@ -446,6 +446,7 @@ contract EpochRewardsTest_getTargetVoterRewards is EpochRewardsTest {
}

contract EpochRewardsTest_getTargetTotalEpochPaymentsInGold is EpochRewardsTest {
// TODO(soloseng): add L2 test case that uses EpochManager
function test_ShouldgetTargetTotalEpochPaymentsInGold_WhenExchangeRateIsSet() public {
uint256 numberValidators = 100;
epochRewards.setNumberValidatorsInCurrentSet(numberValidators);
@@ -456,6 +457,7 @@ contract EpochRewardsTest_getTargetTotalEpochPaymentsInGold is EpochRewardsTest
}

contract EpochRewardsTest_getRewardsMultiplier is EpochRewardsTest {
// TODO(soloseng): add L2 test case using EpochManager
uint256 constant timeDelta = YEAR * 10;
uint256 expectedTargetTotalSupply;
uint256 expectedTargetRemainingSupply;
@@ -502,6 +504,7 @@ contract EpochRewardsTest_getRewardsMultiplier is EpochRewardsTest {
}

contract EpochRewardsTest_updateTargetVotingYield is EpochRewardsTest {
//TODO(soloseng): add L2 test case that uses epochManager
uint256 constant totalSupply = 6000000 ether;
uint256 constant reserveBalance = 1000000 ether;
uint256 constant floatingSupply = totalSupply - reserveBalance;
@@ -758,7 +761,7 @@ contract EpochRewardsTest_updateTargetVotingYield is EpochRewardsTest {
epochRewards.updateTargetVotingYield();
}
}

// TODO(soloseng): add L2 test case that uses the result from epochManager
contract EpochRewardsTest_WhenThereAreActiveVotesAStableTokenExchangeRateIsSetAndTheActualRemainingSupplyIs10pMoreThanTheTargetRemainingSupplyAfterRewards_calculateTargetEpochRewards is
EpochRewardsTest
{
Loading