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

[DO NOT MERGE] Epoch manager WIP #11189

Merged
merged 75 commits into from
Sep 25, 2024

Conversation

martinvol
Copy link
Contributor

Placeholder PR to have the CI

soloseng and others added 3 commits September 16, 2024 20:40
* unit test with mocks

* ++ integration tests

* clean up

* -- logging

* removed duplicate interface

* using `MockCeloToken` to get test to pass.

Fails when it hits a precompile in `EpochRewards.sol`

* removed endEpochTimestamp

* moved IEpochManager to 0.5 folder

* added L2 conditions for EpochRewards functions using precompiles

Still missing tests

* renamed EpochManagerInitializer due to name conflict

* ++ more unit test

* setup anvil migration
fix name conflict

* compiles

* ++ require fund in unreleased treasury

* Updated regex

* ++ registry 0.8 for testing only

* clean up

* ++ unit test

* initial integration test using L1 devchain

* ++ comment

* -- forge based integration test

* ++ to const

* happy linter

* update contract name

* ++ PR feedback

* ++ checks

* updated carbon address

* proxy stableToken mint call via Validators contract

* -- duplicate imports

* removed registry08. replaced with vm call

* PR feedback

* -- coment

* passing unit tests

* clean up

* ++ mintStable test

* -- TODO; compiles test when filtering

* PR feedback

* updated migration script to add more validators

* passing integration test

* removed test for zero amount

* yarn build fix

* clean up comments && TODO

* revert change as out of scope
* dynamically fetch epochManagerEnabler && carbonOffsettingPartner

++ to registry

* PR feedback

* removed onlyL1 modifier in setter functions

* updated unit test to reflect changes

* fixing tests

* fix test

* fixed migration data

* fixed migration script error

* removed unused modifier

* removed duplicate or unused code
packages/protocol/contracts-0.8/common/ScoreManager.sol Outdated Show resolved Hide resolved
*/
function release(address to, uint256 amount) external onlyEpochManager {
require(address(this).balance >= amount, "Insufficient balance.");
require(getCeloToken().transfer(to, amount), "CELO transfer failed.");
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason why we prefer doing an ERC20 transfer, instead of a native transfer. My rule of thumb is that Token Duality is only for cases where you NEED a ERC20, for the rest of use cases we should just use native transfer. They are much cheaper gas wide

Copy link
Contributor Author

@martinvol martinvol Sep 18, 2024

Choose a reason for hiding this comment

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

It's nice to have the event log and the checks the transfer function has, as rule of thumb I always use the ERC20 transfer 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

yo do have an event here. The Release event.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I meant in general, I find it nice to always leave a trace with Celo transfers

packages/protocol/contracts-0.8/governance/Validators.sol Outdated Show resolved Hide resolved
m-chrzan and others added 3 commits September 18, 2024 16:10
* truffle build fix

* build fix

* PR comments

* prettify

* rename of registerValidator overload

* bug fix

* extensing epochManager e2e test

* yarn lint
Reset pending payment to 0 when sending
m-chrzan and others added 2 commits September 20, 2024 21:19
* ++ basic test

* -- celoToken balance check

* cleanup comments

* use celoToken instead of native token for `initializeSystem` balance check

* ++ more test

* removed additional epochs
@soloseng soloseng mentioned this pull request Sep 24, 2024
@lvpeschke lvpeschke removed their request for review September 24, 2024 21:30
pahor167 and others added 4 commits September 25, 2024 08:19
* Update score manager behavior

* scoremanager events

* Remove magic number

---------

Co-authored-by: Martín Volpe <[email protected]>
@martinvol martinvol merged commit 736fbc2 into release/core-contracts/12 Sep 25, 2024
42 checks passed
@martinvol martinvol deleted the feat/l2-epoch-system branch September 25, 2024 11:24
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.

5 participants