chore: fix CI failure due to recent merge from unstable - #6646
Conversation
unstableunstable
unstableunstable
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## electra-fork #6646 +/- ##
===============================================
Coverage ? 61.97%
===============================================
Files ? 562
Lines ? 59844
Branches ? 1905
===============================================
Hits ? 37089
Misses ? 22714
Partials ? 41 |
|
@ensi321 could you clarify which errors and link to the failed CI |
| const calculatedBlockReward = await computeBlockRewards(block.message, state as CachedBeaconStateAllForks); | ||
| const calculatedBlockReward = await computeBlockRewards( | ||
| block.message, | ||
| state as unknown as CachedBeaconStateAllForks |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
But jokes aside, what happened on electra branch that states between forks can't even be type casted anymore? Doing as unknown as someOtherType is almost the same as just doing as any which means we have disabled typescript at this point. It might be required in some rare cases but should always add a comment to clarify why this is needed
On unstable branch this is not an issue
so not sure if this is the right fix here
There was a problem hiding this comment.
I looked a this locally and don't see the issue, probably not a blocker to merge this but needs to be investigated sooner or later
There was a problem hiding this comment.
In electra-fork, CachedBeaonStateElectra is introduced to CachedBeaconStateAllForks which adds more difference, this is why check-types complains about "insufficiently overlaps". See the job log
Not sure if this explains it, Deneb, or even Bellatrix state have sufficient difference, adding more properties shouldn't break the type cast. I would assume it breaks if you modify or remove a property
There was a problem hiding this comment.
agree, should add a comment to look into that later. Otherwise I'm afraid the same pattern will be applied everywhere
There was a problem hiding this comment.
In electra-fork, CachedBeaonStateElectra is introduced to CachedBeaconStateAllForks which adds more difference, this is why check-types complains about "insufficiently overlaps". See the job log
Not sure if this explains it, Deneb, or even Bellatrix state have sufficient difference, adding more properties shouldn't break the type cast. I would assume it breaks if you modify or remove a property
I just spent some time looking into this. It looks like it's because in electra-fork branch there is a newly added field in EpochCache named private historialValidatorLengths.
So when casting from CachedBeaconStateAltair to CachedBeaconStateAllForks, instead of comparing the two structurally, it's now comparing nominally because of the private property.
I just removed the private modifier of historialValidatorLengths in favour of cleaner code.
Sorry for the incorrect explanation I previous made
There was a problem hiding this comment.
So when casting from CachedBeaconStateAltair to CachedBeaconStateAllForks, instead of comparing the two structurally, it's now comparing nominally because of the private property.
Thanks for investigating that, this is much better than having to cast as unknown. Why marking the property as private causes issues is a bit strange though, it should only check the pubic interface.
Might be related to a typescript bug microsoft/TypeScript#37621, @matthewkeil this is similar to what you observed on the shuffling refactor branch?
@tuyennhv My bad, should've clarified it when opening the PR. Updated the PR description. |
|
e2e tests are failing due to the fork config not being available on github yet |
8a4f66e to
473a04f
Compare
74afc65 to
df88def
Compare
Yea the error should go away when we upgrade our spec test version |
|
🎉 This PR is included in v1.22.0 🎉 |
Fix CI errors on
electra-forkbranchMotivation
Currently
electra-forkbranch has some CIs not passing due to the recent merge fromunstable. This includeselectra-interop.test.tsimportslodashpackage, which was removed inunstable. See the job log for detailblockRewards.test.tshas relies ongeneratePerfTestCachedStateAltair()to generateCachedBeaconStateAltair(I know this is bad and we need to fix this soon).CachedBeaconStateAltairis later casted asCachedBeaconStateAllForks. This is due to a private property namedhistoricalValidatorLengthsbeing added toEpochCache. See the job logv1.4.0-beta.6for spec test which contains experimental forkeip6110. Inelectra-forkwe removeeip6110fork and 6110 related code to forkelectra. Spec test failed because it is looking for forkeip6110See the job logDescription
electra-interop.test.tsEpoch.historicalValidatorLengthseip6110spec testLong Term Solution
blockRewards.test.tsfrom usinggeneratePerfTestCachedStateAltair()when there is a better utility class to generate a well-formed stateeip6110fork and addselectrafork