Skip to content

Feat/registry integration - #33

Open
funkyenough wants to merge 25 commits into
mainfrom
feat/registry-integration
Open

Feat/registry integration#33
funkyenough wants to merge 25 commits into
mainfrom
feat/registry-integration

Conversation

@funkyenough

@funkyenough funkyenough commented Aug 1, 2025

Copy link
Copy Markdown
  • Update integration test suite
  • Reuse existing unit tests for integrations tests

Resolves #30

garyghayrat and others added 17 commits June 26, 2025 10:33
* Add `validatorTotalWeight` and test

* Add and rename test
* Add validator registration and mock registry

* Add `setRegistry`

* Add `IConsensusRegistry.sol`

* Run Scopelint fmt

* Add event and registry mock

* Remove `era-contracts` for now

* Add events, make adding to registry a public fn, and tests

* Reduce optimizer runs and add test assumes

* Install era-contracts and extend interface

* Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

* Fix nits and organizations of tests

* Test revert if either empty public or pop key

* Rename and remove convenience function

* Fix nits

* Fix nits
* Add `_updateValidatorWeightOnRegistry` and tests

* Add tests

* Reduce optimizer runs

* Remove unused event and rename fn

* Move test

* Fix nits and test validator does not get added to registry when below threshold

* Add back `_isValidatorRegistered` fn
* Add validator registration and mock registry

Add `setRegistry`

Add `IConsensusRegistry.sol`

Run Scopelint fmt

Add event and registry mock

Remove `era-contracts` for now

Add events, make adding to registry a public fn, and tests

Reduce optimizer runs and add test assumes

Install era-contracts and extend interface

Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

Fix nits and organizations of tests

Test revert if either empty public or pop key

Rename and remove convenience function

Fix nits

Fix nits

Add `_updateValidatorWeightOnRegistry` and tests

Add tests

Reduce optimizer runs

Remove unused event and rename fn

Move test

Fix nits and test validator does not get added to registry when below threshold

Add back `_isValidatorRegistered` fn

* Add `validatorTotalWeight` and test

* Move test

* Add withdraw fn and test

* Add `ValidatorTotalWeightUpdated` event and tests

* Add deposit validator check before deducting from stake weight

* Assume validator is not address(0) when testing withdrawals

* Fix nit

* Remove duplicates

* Uncomment and reduce max bound
* Remove duplicates

* Uncomment and reduce max bound

* Add atomic earning power calculation

* Add `MockFullEarningPowerCalculatorExtended.sol`

* empty commit test

---------

Co-authored-by: wildmolasses <changes@gmail.com>
* Add `validatorTotalWeight` and test

Add validator registration and mock registry

Add `setRegistry`

Add `IConsensusRegistry.sol`

Run Scopelint fmt

Add event and registry mock

Remove `era-contracts` for now

Add events, make adding to registry a public fn, and tests

Reduce optimizer runs and add test assumes

Install era-contracts and extend interface

Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

Fix nits and organizations of tests

Test revert if either empty public or pop key

Rename and remove convenience function

Add `_updateValidatorWeightOnRegistry` and tests

Add tests

Reduce optimizer runs

Remove unused event and rename fn

Move test

Add withdraw fn and test

Add `ValidatorTotalWeightUpdated` event and tests

Add deposit validator check before deducting from stake weight

Assume validator is not address(0) when testing withdrawals

Add atomic earning power calculation

Add `MockFullEarningPowerCalculatorExtended.sol`

* Add passthrough methods and tests

* Reduce optimizer runs

* Add additional test

* Fix mismatching test
Co-authored-by: Ed Mazurek <wildmolasses@users.noreply.github.com>
Add `setRegistry`

Add `IConsensusRegistry.sol`

Run Scopelint fmt

Add event and registry mock

Remove `era-contracts` for now

Add events, make adding to registry a public fn, and tests

Reduce optimizer runs and add test assumes

Install era-contracts and extend interface

Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

Fix nits and organizations of tests

Test revert if either empty public or pop key

Rename and remove convenience function

Fix nits

Fix nits

Add `_updateValidatorWeightOnRegistry` and tests

Add tests

Reduce optimizer runs

Remove unused event and rename fn

Move test

Fix nits and test validator does not get added to registry when below threshold

Add back `_isValidatorRegistered` fn

Add `validatorTotalWeight` and test

Move test

Add withdraw fn and test

Add `ValidatorTotalWeightUpdated` event and tests

Add deposit validator check before deducting from stake weight

Assume validator is not address(0) when testing withdrawals

Fix nit

Remove duplicates

Uncomment and reduce max bound

Add atomic earning power calculation

Add `MockFullEarningPowerCalculatorExtended.sol`

Add `validatorTotalWeight` and test

Add validator registration and mock registry

Add `setRegistry`

Add `IConsensusRegistry.sol`

Run Scopelint fmt

Add event and registry mock

Remove `era-contracts` for now

Add events, make adding to registry a public fn, and tests

Reduce optimizer runs and add test assumes

Install era-contracts and extend interface

Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

Fix nits and organizations of tests

Test revert if either empty public or pop key

Rename and remove convenience function

Add `_updateValidatorWeightOnRegistry` and tests

Add tests

Reduce optimizer runs

Remove unused event and rename fn

Move test

Add withdraw fn and test

Add `ValidatorTotalWeightUpdated` event and tests

Add deposit validator check before deducting from stake weight

Assume validator is not address(0) when testing withdrawals

Add atomic earning power calculation

Add `MockFullEarningPowerCalculatorExtended.sol`

Add passthrough methods and tests

Reduce optimizer runs

Add additional test

Fix mismatching test

Add `validatorTotalWeight` and test

Add validator registration and mock registry

Add `setRegistry`

Add `IConsensusRegistry.sol`

Run Scopelint fmt

Add event and registry mock

Remove `era-contracts` for now

Add events, make adding to registry a public fn, and tests

Reduce optimizer runs and add test assumes

Install era-contracts and extend interface

Revert if mismatched keys used to add validator on registry, remove unused file, and add natspec to interface

Fix nits and organizations of tests

Test revert if either empty public or pop key

Rename and remove convenience function

Add `_updateValidatorWeightOnRegistry` and tests

Add tests

Reduce optimizer runs

Remove unused event and rename fn

Move test

Add withdraw fn and test

Add `ValidatorTotalWeightUpdated` event and tests

Add deposit validator check before deducting from stake weight

Assume validator is not address(0) when testing withdrawals

Add atomic earning power calculation

Add `MockFullEarningPowerCalculatorExtended.sol`

Add passthrough methods and tests

Reduce optimizer runs
Co-authored-by: Ed Mazurek <wildmolasses@users.noreply.github.com>
@funkyenough
funkyenough changed the base branch from main to feat/on-behalf-fns August 1, 2025 13:52
Comment thread test/ZkStaker.integration.t.sol Outdated
uint256 newBalance = IERC20(address(zkStaker.REWARD_TOKEN())).balanceOf(_depositor);
// TODO: this will revert with ZeroValidatorWeight. Given our current design, a depositor cannot
// alter validator if the validator have no bonus weight or other depositors.
function testFuzz_ChangesValidatorWeightOnRegistryWhenValidatorIsAlreadyRegistered(

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

As explained in the comment, there is some issue with the alterValidator function under certain conditions

Comment thread test/ZkStaker.integration.t.sol Outdated

// TODO: This test is being skipped right now
function testForkFuzz_CorrectlyUnstakeAndClaimRewardsAfterDuration(
// TODO: Likewise, there may be cases where a single depositor is the sole contributor to a

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same as above

@wildmolasses
wildmolasses force-pushed the feat/registry-integration branch from 3f90de9 to d2f6abe Compare August 3, 2025 18:44
funkyenough and others added 4 commits August 3, 2025 14:44
Co-authored-by: Ed Mazurek <wildmolasses@users.noreply.github.com>
Co-authored-by: Ed Mazurek <wildmolasses@users.noreply.github.com>
….t.sol, add dependencies, and update test suites
@wildmolasses
wildmolasses force-pushed the feat/registry-integration branch from d2f6abe to 4012ca2 Compare August 3, 2025 18:48
@wildmolasses
wildmolasses force-pushed the feat/registry-integration branch from 8ac3a76 to a7dfc8c Compare August 4, 2025 20:05
@funkyenough
funkyenough force-pushed the feat/registry-integration branch from 93fc194 to c65d0c1 Compare August 5, 2025 09:10
…37)

* feat: add sepolia deployment script for ZkStaker and ConsensusRegistry

* test deploy

---------

Co-authored-by: wildmolasses <changes@gmail.com>
@wildmolasses
wildmolasses changed the base branch from feat/on-behalf-fns to main August 11, 2025 19:11
@github-actions

Copy link
Copy Markdown

Coverage after merging feat/registry-integration into feat/on-behalf-fns will be

85.48%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   ZkStaker.sol85.96%71.43%94.29%85.48%479, 485, 642, 647–648, 650, 652, 661, 666, 666, 668, 670–671, 673, 675, 678, 678–679, 682, 682–683, 687–688, 688–689, 692, 697, 699, 702, 705–706

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.

Consider: when removing a validator, do we have to update their weight first?

3 participants