test: move withdrawal tests to sim tests - #6507
Conversation
| if (!payloadId) throw Error("InvalidPayloadId"); | ||
|
|
||
| // 2. Get the payload | ||
| const payloadWithValue = await executionEngine.getPayload(ForkName.capella, payloadId); |
There was a problem hiding this comment.
I believe it's testing the engine API from the execution engine. Which should not be in our test suite.
The behavior passively is tested in sim tests anyway.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## unstable #6507 +/- ##
============================================
- Coverage 61.72% 61.46% -0.27%
============================================
Files 555 556 +1
Lines 58204 58850 +646
Branches 1844 1850 +6
============================================
+ Hits 35927 36171 +244
- Misses 22238 22638 +400
- Partials 39 41 +2 |
Performance Report鉁旓笍 no performance regression detected 馃殌馃殌 Significant benchmark improvement detected
Full benchmark results
|
jeluard
left a comment
There was a problem hiding this comment.
Not an expert in sim tests, but overall the approach sounds sensible to me. And always 馃憤 removing complexity :)
| */ | ||
| const result = [`Slot,${nodes.map((n) => n.beacon.id).join(", ,")}`]; | ||
| result.push(`,${nodes.map((_) => "Withdrawal Amount,Withdrawal Count").join(",")}`); | ||
| for (let s = 1; s <= slot; s++) { |
There was a problem hiding this comment.
Then TS would not allow to use s++, you can't mutate a const declared primitive.
| let row = `${s}`; | ||
| for (const node of nodes) { | ||
| const {withdrawalAmount, withdrawalCount} = store[node.beacon.id][s] ?? {}; | ||
| row += `,${withdrawalAmount ?? "-"},${withdrawalCount ?? "-"}`; |
There was a problem hiding this comment.
Maybe some combination of Array#join and Array#map could be used here. Just for reference, for this PR looks ok.
There was a problem hiding this comment.
This iteration approach looks more readable.
| const validators: WithdrawalsData["validators"] = {}; | ||
|
|
||
| for (const withdrawal of withdrawals) { | ||
| withdrawalCount++; |
There was a problem hiding this comment.
Looks like it can only ever end up being withdrawals.length ?
There was a problem hiding this comment.
Nice catch. was using different approach earlier so this variable left as counter.
| return { | ||
| id: `withdrawals_${nodeId}`, | ||
| match({forkConfig, epoch, node}) { | ||
| if (nodeId === node.id && epoch === forkConfig.CAPELLA_FORK_EPOCH) |
There was a problem hiding this comment.
I'm surprised this line pass lints (no curly brasses).
There was a problem hiding this comment.
It was actually written as single line, but prettier changed it to this format. And our ESlint don't complaint on Prettier formatting.
| @@ -0,0 +1,98 @@ | |||
| /* eslint-disable @typescript-eslint/naming-convention */ | |||
There was a problem hiding this comment.
According to lints, this directive is useless.
| ENGINE_PORT: 8551 | ||
| ETH_PORT: 8661 | ||
|
|
||
| - name: Pull geth withdrawals |
There was a problem hiding this comment.
looks like we need to remove the whole file?
There was a problem hiding this comment.
Not yet, one other PR in progress then we can remove this file and a lot of utility code along it.
| let withdrawalAmount = BigInt(0); | ||
| const validators: WithdrawalsData["validators"] = {}; | ||
|
|
||
| for (const withdrawal of withdrawals) { |
There was a problem hiding this comment.
what if it's empty withdrawals? is it scanned through assert() function below?
There was a problem hiding this comment.
Yes the assertion works on this logic.
if (nodeId === node.id && epoch === forkConfig.CAPELLA_FORK_EPOCH)
return AssertionMatch.Capture | AssertionMatch.Assert;So even if the above line withdrawals are empty, the assertion will still trigger and results in empty errors array.
twoeths
left a comment
There was a problem hiding this comment.
looks good to me, spent some time to see how capture() and assert() works. Nice work in SimulationTracker @nazarhussain . It's difficult for me to debug it through.
Both works based on the |
|
馃帀 This PR is included in v1.18.0 馃帀 |
Motivation
Remove redundant tests
Description
Steps to test or reproduce