Skip to content
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

fix: refetch duties after metdata update (main) #1429

Merged
merged 28 commits into from
Jul 2, 2024

Conversation

moshe-blox
Copy link
Contributor

@moshe-blox moshe-blox commented Jun 11, 2024

This PR fixes the same bug as #1411 except it's based for main.

This bug occurs when a validator in an ongoing sync committee is added to the network and the nodes don't fetch their sync committee until the next period, causing incorrect message rejections.

.gitlab-ci.yml Outdated
only:
- stage
- fix/refetch-duties-after-metadata-main
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

@@ -80,10 +80,13 @@ func (opts *DiscV5Options) IPs() (net.IP, net.IP, string) {
return ipAddr, bindIP, n
}

var pid = [6]byte{'s', 's', 'v', 'd', 'v', '5'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to make sure this is also deployed on bootnode

// DiscV5Cfg creates discv5 config from the options
func (opts *DiscV5Options) DiscV5Cfg(logger *zap.Logger) (*discover.Config, error) {
dv5Cfg := discover.Config{
PrivateKey: opts.NetworkKey,
PrivateKey: opts.NetworkKey,
V5ProtocolID: &pid, // TODO: REVERT!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want to revert or leave this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will revert, its just to be able to test on stage env

@@ -16,7 +16,7 @@ var HoleskyStage = NetworkConfig{
RegistrySyncOffset: new(big.Int).SetInt64(84599),
RegistryContractAddr: "0x0d33801785340072C452b994496B19f196b7eE15",
Bootnodes: []string{
"enr:-Li4QPnPGESWx2wnu3s2qeu6keFbkaV2M0ZiGHgxxGI9ThP4XSgSaFzl6zYsF1zAdni3Mh04iA6BEZqoC6LZ52UFnwKGAYxEgLqeh2F0dG5ldHOIAAAAAAAAAACEZXRoMpD1pf1CAAAAAP__________gmlkgnY0gmlwhDQiKqmJc2VjcDI1NmsxoQP2e508AoA0B-KH-IaAd3nVCfI9q16lNztV-oTpcH72tIN0Y3CCE4mDdWRwgg-h",
"enr:-Ja4QDYHVgUs9NvlMqq93ot6VNqbmrIlMrwKnq4X3DPRgyUNB4ospDp8ubMvsf-KsgqY8rzpZKy4GbE1DLphabpRBc-GAY_diLjngmlkgnY0gmlwhDQrLYqJc2VjcDI1NmsxoQKnAiuSlgSR8asjCH0aYoVKM8uPbi4noFuFHZHaAHqknYNzc3YBg3RjcIITiYN1ZHCCD6E",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you deploy the protocolID for prod/mainnet its best to restart there and maybe update the ENR for other networks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be reverted

// Fetch metadata now if there is none. Otherwise, UpdateValidatorsMetadataLoop will handle it.
var hasMetadata bool
for _, share := range shares {
if !share.Liquidated && share.HasBeaconMetadata() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not IsAttesting?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh because metadata might say it doesn't need to attest but still valid metadata

Copy link
Contributor Author

@moshe-blox moshe-blox Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh because metadata might say it doesn't need to attest but still valid metadata

yeah we just want to know that its not a freshly synced database with 0 metadatas fetched, in which case its not crucial to fetch everything immediately and we can rely on the UpdateValidatorsMetadataLoop to fetch/update metadatas more strategically (with prioritization) in the background

@@ -77,6 +82,7 @@ func (s *sharesStorage) load() error {
if err := val.Decode(obj.Value); err != nil {
return fmt.Errorf("failed to deserialize share: %w", err)
}
val.DomainType = types.GetDefaultDomain()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be passed from NetworkConfig to the storage in next version, best to leave a TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably be passed from NetworkConfig to the storage in next version, best to leave a TODO

yeah this will be reverted its just an issue that we have on stage bc we modified domaintype of one of the existing networks which overwrote some shares in the DB :D

if share.Liquidated {
return true
}
if share.BeaconMetadata == nil && share.MetadataLastUpdated().IsZero() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it even be that only one of these is true?

Copy link
Contributor Author

@moshe-blox moshe-blox Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes if we already fetched metadata for an undeposited validator then MetadataLastUpdated will be set, but BeaconMetadata will be nil

if both MetadataLastUpdated and BeaconMetadata are unset then we dont know yet if its an undeposited validator or just a new validator waiting for first metadata fetch (thats because MetadataLastUpdated is not persistent)

y0sher
y0sher previously approved these changes Jun 13, 2024
@liorrutenberg liorrutenberg merged commit cc6f7d1 into main Jul 2, 2024
5 checks passed
@liorrutenberg liorrutenberg deleted the fix/refetch-duties-after-metadata-main branch July 2, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants