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 startup log for config file values #14865

Merged
merged 1 commit into from
Feb 5, 2025
Merged

Fix startup log for config file values #14865

merged 1 commit into from
Feb 5, 2025

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Feb 3, 2025

when we load a config file, we call eventually UnmarshalConfig which first copies the mainnet config by calling MainnetConfig().Copy().

MainnetConfig() calls InitializeForkSchedule which in turn calls to configForkSchedule(b) and configForkNames(b) so these maps are made from the default config and not from the config file. After that the unmarshaller finishes changing the config values, this will read the new fork versions and epochs from the config file, but not change the maps So the config file values printed at the end have bogus maps that do not corresponds to the config file.

What worries me is that even if this is corrected later, this function UnmarshalConfig is returning a bogus config in inconsistent state.

@potuz potuz requested a review from a team as a code owner February 3, 2025 19:43
@@ -65,6 +65,8 @@ func UnmarshalConfig(yamlFile []byte, conf *BeaconChainConfig) (*BeaconChainConf
}
// recompute SqrRootSlotsPerEpoch constant to handle non-standard values of SlotsPerEpoch
conf.SqrRootSlotsPerEpoch = primitives.Slot(math.IntegerSquareRoot(uint64(conf.SlotsPerEpoch)))
// Recompute the fork schedule
conf.InitializeForkSchedule()
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this already called when a new config set is initialized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but the point is that this function explicitly may overwrite the fork epochs and versions and the maps are left unmodified in inconsistent state

@potuz potuz enabled auto-merge February 4, 2025 10:27
@potuz potuz added this pull request to the merge queue Feb 5, 2025
Merged via the queue into develop with commit 2a7fc84 Feb 5, 2025
17 checks passed
@potuz potuz deleted the forkmaps_log branch February 5, 2025 16:24
potuz added a commit that referenced this pull request Feb 17, 2025
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