Skip to content

Commit

Permalink
fix: rewards:show on l2 (#456)
Browse files Browse the repository at this point in the history
### Description

fixes the `rewards:show` to work on cel2

#### Other changes

More Cel2  coverage in wrappers

### Tested

_An explanation of how the changes were tested or an explanation as to
why they don't need to be._

### Related issues

- Fixes #[issue number here]

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on improving support for Layer 2 (L2) functionality
within the Celo ecosystem, including deprecating certain methods and
enhancing compatibility for L2 operations.

### Detailed summary
- Updated `rewards:show` command description to indicate removal in L2.
- Added backward compatibility for methods using epoch's block numbers
in `@celo/contractkit`.
- Deprecated methods in `DowntimeSlasher`, `Governance`, and
`Validators` for L2 support.
- Adjusted tests to accommodate L2 changes, including new functionality
for fetching epoch block information.
- Enhanced coverage for `show` and `show-l2` commands with additional
tests.

> The following files were skipped due to too many changes:
`docs/sdk/contractkit/classes/wrappers_Election.ElectionWrapper.md`,
`docs/sdk/contractkit/classes/wrappers_Validators.ValidatorsWrapper.md`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
nicolasbrugneaux authored Nov 25, 2024
1 parent 36c4369 commit d5c9204
Show file tree
Hide file tree
Showing 40 changed files with 890 additions and 192 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-days-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/celocli': patch
---

Fix rewards:show for L2
5 changes: 5 additions & 0 deletions .changeset/yellow-chicken-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@celo/contractkit': patch
---

Backwards compat for some methods using epoch's block numbers
2 changes: 1 addition & 1 deletion docs/command-line-interface/rewards.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ FLAGS
<options: csv|json|yaml>
--slashing
Show rewards for slashing
Show rewards for slashing (will be removed in L2)
--sort=<value>
property to sort by (prepend '-' for descending)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ the specific interval.

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:133](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L133)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:134](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L134)

___

Expand All @@ -233,7 +233,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:147](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L147)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:148](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L148)

___

Expand Down Expand Up @@ -461,7 +461,7 @@ True if the user already called the `setBitmapForInterval` for intervals.

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:140](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L140)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:141](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L141)

___

Expand All @@ -485,7 +485,7 @@ intervals.

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:181](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L181)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:182](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L182)

___

Expand Down Expand Up @@ -555,7 +555,7 @@ Tests if the given validator or signer did not sign any blocks in the interval.

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:154](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L154)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:155](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L155)

___

Expand All @@ -581,4 +581,4 @@ True if the validator signature does not appear in any block within the window.

#### Defined in

[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:168](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L168)
[packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts:169](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/DowntimeSlasher.ts#L169)
68 changes: 34 additions & 34 deletions docs/sdk/contractkit/classes/wrappers_Election.ElectionWrapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Election threshold.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:93](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L93)
[packages/sdk/contractkit/src/wrappers/Election.ts:94](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L94)

___

Expand Down Expand Up @@ -201,7 +201,7 @@ use EpochManagerWrapper.getElectedSigners instead. see see https://specs.celo.or

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:159](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L159)
[packages/sdk/contractkit/src/wrappers/Election.ts:160](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L160)

___

Expand Down Expand Up @@ -235,7 +235,7 @@ The groups that `account` has voted for.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:233](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L233)
[packages/sdk/contractkit/src/wrappers/Election.ts:234](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L234)

___

Expand Down Expand Up @@ -265,7 +265,7 @@ The total votes received across all groups.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:152](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L152)
[packages/sdk/contractkit/src/wrappers/Election.ts:153](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L153)

___

Expand All @@ -289,7 +289,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:271](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L271)
[packages/sdk/contractkit/src/wrappers/Election.ts:272](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L272)

___

Expand Down Expand Up @@ -327,7 +327,7 @@ The total votes for `group` made by `account`.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:211](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L211)
[packages/sdk/contractkit/src/wrappers/Election.ts:212](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L212)

___

Expand Down Expand Up @@ -371,7 +371,7 @@ Size of the current elected validator set.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:142](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L142)
[packages/sdk/contractkit/src/wrappers/Election.ts:143](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L143)

___

Expand Down Expand Up @@ -405,7 +405,7 @@ Size of the validator set.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:132](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L132)
[packages/sdk/contractkit/src/wrappers/Election.ts:133](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L133)

___

Expand Down Expand Up @@ -439,7 +439,7 @@ Address of validator at the requested index.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:120](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L120)
[packages/sdk/contractkit/src/wrappers/Election.ts:121](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L121)

___

Expand Down Expand Up @@ -478,7 +478,7 @@ Address of validator at the requested index.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:105](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L105)
[packages/sdk/contractkit/src/wrappers/Election.ts:106](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L106)

## Accessors

Expand Down Expand Up @@ -521,7 +521,7 @@ Activates any activatable pending votes.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:352](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L352)
[packages/sdk/contractkit/src/wrappers/Election.ts:353](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L353)

___

Expand Down Expand Up @@ -550,7 +550,7 @@ See https://en.wikipedia.org/wiki/D%27Hondt_method#Allocation for more informati

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:181](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L181)
[packages/sdk/contractkit/src/wrappers/Election.ts:182](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L182)

___

Expand All @@ -568,7 +568,7 @@ The minimum and maximum number of validators that can be elected.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:84](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L84)
[packages/sdk/contractkit/src/wrappers/Election.ts:85](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L85)

___

Expand All @@ -589,7 +589,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:469](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L469)
[packages/sdk/contractkit/src/wrappers/Election.ts:470](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L470)

___

Expand All @@ -614,7 +614,7 @@ The active votes for `group`.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:222](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L222)
[packages/sdk/contractkit/src/wrappers/Election.ts:223](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L223)

___

Expand All @@ -630,7 +630,7 @@ Returns current configuration parameters.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:305](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L305)
[packages/sdk/contractkit/src/wrappers/Election.ts:306](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L306)

___

Expand All @@ -652,7 +652,7 @@ Retrieves the set of validatorsparticipating in BFT at epochNumber.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:498](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L498)
[packages/sdk/contractkit/src/wrappers/Election.ts:499](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L499)

___

Expand All @@ -668,7 +668,7 @@ Returns the current eligible validator groups and their total votes.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:454](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L454)
[packages/sdk/contractkit/src/wrappers/Election.ts:455](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L455)

___

Expand All @@ -690,7 +690,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:593](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L593)
[packages/sdk/contractkit/src/wrappers/Election.ts:600](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L600)

___

Expand All @@ -713,7 +713,7 @@ Retrieves GroupVoterRewards at epochNumber.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:510](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L510)
[packages/sdk/contractkit/src/wrappers/Election.ts:511](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L511)

___

Expand Down Expand Up @@ -765,7 +765,7 @@ The total votes for `group`.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:199](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L199)
[packages/sdk/contractkit/src/wrappers/Election.ts:200](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L200)

___

Expand All @@ -785,7 +785,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:321](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L321)
[packages/sdk/contractkit/src/wrappers/Election.ts:322](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L322)

___

Expand All @@ -801,7 +801,7 @@ Returns the current registered validator groups and their total votes and eligib

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:338](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L338)
[packages/sdk/contractkit/src/wrappers/Election.ts:339](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L339)

___

Expand Down Expand Up @@ -829,7 +829,7 @@ see https://specs.celo.org/smart_contract_updates_from_l1.html

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:169](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L169)
[packages/sdk/contractkit/src/wrappers/Election.ts:170](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L170)

___

Expand All @@ -850,7 +850,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:259](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L259)
[packages/sdk/contractkit/src/wrappers/Election.ts:260](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L260)

___

Expand All @@ -875,7 +875,7 @@ Retrieves VoterRewards for address at epochNumber.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:544](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L544)
[packages/sdk/contractkit/src/wrappers/Election.ts:551](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L551)

___

Expand All @@ -898,7 +898,7 @@ Retrieves a voter's share of active votes.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:578](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L578)
[packages/sdk/contractkit/src/wrappers/Election.ts:585](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L585)

___

Expand All @@ -920,7 +920,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:237](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L237)
[packages/sdk/contractkit/src/wrappers/Election.ts:238](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L238)

___

Expand All @@ -940,7 +940,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:294](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L294)
[packages/sdk/contractkit/src/wrappers/Election.ts:295](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L295)

___

Expand All @@ -964,7 +964,7 @@ The groups that `account` has voted for.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:282](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L282)
[packages/sdk/contractkit/src/wrappers/Election.ts:283](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L283)

___

Expand All @@ -986,7 +986,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:415](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L415)
[packages/sdk/contractkit/src/wrappers/Election.ts:416](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L416)

___

Expand Down Expand Up @@ -1016,7 +1016,7 @@ Must pass both `lesserAfterVote` and `greaterAfterVote` or neither.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:390](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L390)
[packages/sdk/contractkit/src/wrappers/Election.ts:391](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L391)

___

Expand All @@ -1038,7 +1038,7 @@ ___

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:366](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L366)
[packages/sdk/contractkit/src/wrappers/Election.ts:367](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L367)

___

Expand Down Expand Up @@ -1079,4 +1079,4 @@ Increments the number of total and pending votes for `group`.

#### Defined in

[packages/sdk/contractkit/src/wrappers/Election.ts:442](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L442)
[packages/sdk/contractkit/src/wrappers/Election.ts:443](https://github.com/celo-org/developer-tooling/blob/master/packages/sdk/contractkit/src/wrappers/Election.ts#L443)
Loading

0 comments on commit d5c9204

Please sign in to comment.