-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fix CI failure due to recent merge from unstable
#6646
Conversation
unstable
unstable
unstable
unstable
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
const postState = stateTransition(preState as CachedBeaconStateAllForks, block, { |
so not sure if this is the right fix here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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-fork
branchMotivation
Currently
electra-fork
branch has some CIs not passing due to the recent merge fromunstable
. This includeselectra-interop.test.ts
importslodash
package, which was removed inunstable
. See the job log for detailblockRewards.test.ts
has relies ongeneratePerfTestCachedStateAltair()
to generateCachedBeaconStateAltair
(I know this is bad and we need to fix this soon).CachedBeaconStateAltair
is later casted asCachedBeaconStateAllForks
. This is due to a private property namedhistoricalValidatorLengths
being added toEpochCache
. See the job logv1.4.0-beta.6
for spec test which contains experimental forkeip6110
. Inelectra-fork
we removeeip6110
fork and 6110 related code to forkelectra
. Spec test failed because it is looking for forkeip6110
See the job logDescription
electra-interop.test.ts
Epoch.historicalValidatorLengths
eip6110
spec testLong Term Solution
blockRewards.test.ts
from usinggeneratePerfTestCachedStateAltair()
when there is a better utility class to generate a well-formed stateeip6110
fork and addselectra
fork