Commit 31331e2
authored
chore: Fix slash veto demo flake (#16934)
The `slash_veto_demo` e2e test was failing since a view-like call to the
contract to get the committees slashed for a given round reverted:
```
21:15:59 ● veto slash › vetoes true and sets the new tally slasher
21:15:59
21:15:59 ContractFunctionExecutionError: The contract function "getSlashTargetCommittees" reverted.
21:15:59
21:15:59 Error: ValidatorSelection__InsufficientValidatorSetSize(uint256 actual, uint256 expected)
21:15:59 (0, 4)
21:15:59
21:15:59 Contract Call:
21:15:59 address: 0x9debab8762554f8b8f5dfad92e40c1c7d2b0263a
21:15:59 function: getSlashTargetCommittees(uint256 _round)
21:15:59 args: (3)
21:15:59 sender: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
21:15:59
21:15:59 Docs: https://viem.sh/docs/contract/simulateContract
21:15:59 Version: [email protected]
21:15:59
21:15:59 71 | }
21:15:59 72 | /** Returns the slash actions and payload address for a given round (zero if no slash actions) */ async getPayload(round) {
21:15:59 > 73 | const { result: committees } = await this.contract.simulate.getSlashTargetCommittees([
21:15:59 | ^
21:15:59 74 | round
21:15:59 75 | ]);
21:15:59 76 | const tally = await this.contract.read.getTally([
21:15:59
21:15:59 at getContractError (../../node_modules/viem/utils/errors/getContractError.ts:78:10)
21:15:59 at simulateContract (../../node_modules/viem/actions/public/simulateContract.ts:308:11)
21:15:59 at TallySlashingProposerContract.getPayload (../../ethereum/dest/contracts/tally_slashing_proposer.js:73:40)
21:15:59 at e2e_p2p/slash_veto_demo.test.ts:247:40
21:15:59 at retryUntil (../../foundation/dest/retry/index.js:84:24)
21:15:59 at e2e_p2p/slash_veto_demo.test.ts:310:32
21:15:59
21:15:59 Cause:
21:15:59 ContractFunctionRevertedError: The contract function "getSlashTargetCommittees" reverted.
21:15:59
21:15:59 Error: ValidatorSelection__InsufficientValidatorSetSize(uint256 actual, uint256 expected)
21:15:59 (0, 4)
```
My guess is this happened because the round queried included early
epochs where the committee had not yet been formed, so one of the calls
to the rollup to get the committee failed, causing the entire call to
fail even if other epochs in the round did have committees.
This PR fixes the L1 contract so it try/catches calls to the rollup and
returns whatever committees _could_ be fetched.File tree
2 files changed
+32
-2
lines changed- l1-contracts
- src/core/slashing
- test/slashing
2 files changed
+32
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| 490 | + | |
490 | 491 | | |
491 | | - | |
| 492 | + | |
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
| |||
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
500 | | - | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
501 | 506 | | |
502 | 507 | | |
503 | 508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
867 | 892 | | |
0 commit comments