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

beacon-chain, config: get consensus values from beacon config #11798

Merged

Conversation

gballet
Copy link
Contributor

@gballet gballet commented Dec 19, 2022

What type of PR is this?

Other

What does this PR do? Why is it needed?

This allows prysm to get some of its consensus parameters from the config file, instead of getting them from a hardcoded file. This is necessary to support e.g. the gnosis chain, that has a different slot time.

Another approach I considered was to store the hardcoded values for the gnosis chain inside a file in config/fieldparams, protected by a tag. I think this PR is the better approach, however, as adding other chains would require adding a file each time, when the config file can be tweaked instead.

@gballet gballet requested a review from a team as a code owner December 19, 2022 18:02
terencechain
terencechain previously approved these changes Dec 20, 2022
Copy link
Member

@terencechain terencechain left a comment

Choose a reason for hiding this comment

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

Ty!

Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

I will need to think on this more, but the main reason it is a hardcoded value rather than something that can be configured at runtime is because presets are meant to be initialized at compile time. Since these presets determine how a state is hashed, for us currently it is only possible if there was a separate gnosis preset. Although I understand that this would prevent gnosis from running prysm via the default binaries/image. For context, you can take a look at this PR:
#10007

I understand, that this won't work with gnosis chain currently which requires it being changed at runtime. Will discuss with the team first on this change

@gballet
Copy link
Contributor Author

gballet commented Dec 20, 2022

That makes sense, I'll work on the gnosis preset then.

Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

@gballet So we talked internally and while the change isn't great, we would be okay with this. Given that we are the only client that has this strict requirement, it seems that it has limited benefit to forcing this to be a compile time constant

@@ -239,3 +239,15 @@ func configForkNames(b *BeaconChainConfig) map[[fieldparams.VersionLength]byte]s
fvn[bytesutil.ToBytes4(b.BellatrixForkVersion)] = "bellatrix"
return fvn
}

func (b *BeaconChainConfig) Eth1DataVotesLength() uint64 {
Copy link
Member

Choose a reason for hiding this comment

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

Lets add a comment for each new method

@gballet
Copy link
Contributor Author

gballet commented Dec 22, 2022

@nisdas thanks for your feedback, I have added the required comments. Let me know if you would like other changes.

@gballet gballet force-pushed the parameters-from-chain-config branch from f248d1a to 63126de Compare January 3, 2023 12:15
@prylabs-bulldozer prylabs-bulldozer bot merged commit c6338e3 into prysmaticlabs:develop Jan 25, 2023
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.

4 participants