-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(evm-consenus): implement
getAllValidators
and `getDirtyValidat…
…ors` on ValidatorSet (#734) * Add getAllValidators * Move method * Update abi * Add all validators values * Get all validators * style: resolve style guide violations --------- Co-authored-by: sebastijankuzner <[email protected]>
- Loading branch information
1 parent
990ac1a
commit 42de4ad
Showing
6 changed files
with
201 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: GNU GENERAL PUBLIC LICENSE | ||
pragma solidity ^0.8.13; | ||
|
||
import {Test, console} from "@forge-std/Test.sol"; | ||
import {Consensus, ValidatorData, Validator} from "@contracts/consensus/Consensus.sol"; | ||
import {Base} from "./Base.sol"; | ||
|
||
contract ConsensusTest is Base { | ||
Consensus public consensus; | ||
|
||
function setUp() public { | ||
consensus = new Consensus(); | ||
} | ||
|
||
|
||
function test_200_validators() public { | ||
vm.pauseGasMetering(); | ||
assertEq(consensus.registeredValidatorsCount(), 0); | ||
|
||
|
||
uint256 n = 200; | ||
for (uint256 i = 0; i < n; i++) { | ||
address addr = address(uint160(i + 1)); | ||
|
||
vm.startPrank(addr); | ||
consensus.registerValidator(prepareBLSKey(addr)); | ||
consensus.vote(addr); | ||
vm.stopPrank(); | ||
} | ||
|
||
vm.resumeGasMetering(); | ||
|
||
Validator[] memory validators = consensus.getAllValidators(); | ||
assertEq(validators.length, n); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.