-
Notifications
You must be signed in to change notification settings - Fork 86
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
Randomize initial nonce in Praos tests #2235
Milestone
Comments
mrBliss
added a commit
that referenced
this issue
Jun 18, 2020
This nonce will be used to construct Shelley's initial `PrtclState`, both when starting a fresh Shelley chain and when forking from Byron to Shelley (when translating the Byron `ConsensusState` to the Shelley one). We store the initial nonce in the `TPraosParams`, which is part of the `ConsensusConfig` for `TPraos`. We need it here, at run-time, because we need it when translating the Byron `ConsensusState` to the Shelley one. `protocolInfoShelley` and `protocolInfoCardano` now take a `Maybe Nonce` argument to allow overriding the default initial nonce for testing purposes, as required for #2235. When the nonce is not overridden, it defaults to `SL.NeutralNonce`, just like before. However, in the future, we want to use the hash of the Shelley genesis config as the default. We don't expose the ability to override the initial nonce to `cardano-node`, we just pick the default one (`Nothing`) in the `protocolInfo` function. NOTE: we must be careful if we change the default from `SL.NeutralNonce` to the Shelley genesis hash in `protocolInfoShelley`. This change would be incompatible with already deployed testnets, which are using `SL.NeutralNonce`, causing a fork.
This was referenced Jun 18, 2020
mrBliss
added a commit
that referenced
this issue
Jun 26, 2020
Fixes #2005. This nonce will be used to construct Shelley's initial `PrtclState`, both when starting a fresh Shelley chain and when forking from Byron to Shelley (when translating the Byron `ConsensusState` to the Shelley one). We store the initial nonce in the `TPraosParams`, which is part of the `ConsensusConfig` for `TPraos`. We need it here, at run-time, because we need it when translating the Byron `ConsensusState` to the Shelley one. `protocolInfoShelley` and `protocolInfoCardano` (as well as `ProtocolReadTPraos` and `ProtocolCardano`) now take a `Nonce` argument that will be used as the initial nonce. Typically the `Nonce` passed to these functions (constructors) should be derived from the hash of the Shelley Genesis config JSON file. Moreover, this allows us to choose a different initial nonce for testing purposes, as required for #2235. NOTE: up until now we have used `SL.NeutralNonce` as the initial nonce for Shelley. When a different nonce is picked in `cardano-node`, i.e., one derived from the hash of the Shelley Genesis config JSON file, it would cause a hard fork.
mrBliss
added a commit
that referenced
this issue
Jun 26, 2020
Fixes #2005. This nonce will be used to construct Shelley's initial `PrtclState`, both when starting a fresh Shelley chain and when forking from Byron to Shelley (when translating the Byron `ChainDepState` to the Shelley one). We store the initial nonce in the `TPraosParams`, which is part of the `ConsensusConfig` for `TPraos`. We need it here, at run-time, because we need it when translating the Byron `ChainDepState` to the Shelley one. `protocolInfoShelley` and `protocolInfoCardano` (as well as `ProtocolRealTPraos` and `ProtocolCardano`) now take a `Nonce` argument that will be used as the initial nonce. Typically the `Nonce` passed to these functions (constructors) should be derived from the hash of the Shelley Genesis config JSON file. Moreover, this allows us to choose a different initial nonce for testing purposes, as required for #2235. NOTE: up until now we have used `SL.NeutralNonce` as the initial nonce for Shelley. When a different nonce is picked in `cardano-node`, i.e., one derived from the hash of the Shelley Genesis config JSON file, it would cause a hard fork.
mrBliss
added a commit
that referenced
this issue
Jun 26, 2020
Fixes #2005. This nonce will be used to construct Shelley's initial `PrtclState`, both when starting a fresh Shelley chain and when forking from Byron to Shelley (when translating the Byron `ChainDepState` to the Shelley one). We store the initial nonce in the `TPraosParams`, which is part of the `ConsensusConfig` for `TPraos`. We need it here, at run-time, because we need it when translating the Byron `ChainDepState` to the Shelley one. `protocolInfoShelley` and `protocolInfoCardano` (as well as `ProtocolRealTPraos` and `ProtocolCardano`) now take a `Nonce` argument that will be used as the initial nonce. Typically the `Nonce` passed to these functions (constructors) should be derived from the hash of the Shelley Genesis config JSON file. Moreover, this allows us to choose a different initial nonce for testing purposes, as required for #2235. NOTE: up until now we have used `SL.NeutralNonce` as the initial nonce for Shelley. When a different nonce is picked in `cardano-node`, i.e., one derived from the hash of the Shelley Genesis config JSON file, it would cause a hard fork.
iohk-bors bot
added a commit
that referenced
this issue
Jun 26, 2020
2289: Shelley/Cardano: take the initial nonce as a parameter r=mrBliss a=mrBliss Fixes #2005. This nonce will be used to construct Shelley's initial `PrtclState`, both when starting a fresh Shelley chain and when forking from Byron to Shelley (when translating the Byron `ChainDepState` to the Shelley one). We store the initial nonce in the `TPraosParams`, which is part of the `ConsensusConfig` for `TPraos`. We need it here, at run-time, because we need it when translating the Byron `ChainDepState` to the Shelley one. `protocolInfoShelley` and `protocolInfoCardano` (as well as `ProtocolRealTPraos` and `ProtocolCardano`) now take a `Nonce` argument that will be used as the initial nonce. Typically the `Nonce` passed to these functions (constructors) should be derived from the hash of the Shelley Genesis config JSON file. Moreover, this allows us to choose a different initial nonce for testing purposes, as required for #2235. NOTE: up until now we have used `SL.NeutralNonce` as the initial nonce for Shelley. When a different nonce is picked in `cardano-node`, i.e., one derived from the hash of the Shelley Genesis config JSON file, it would cause a hard fork. Co-authored-by: Thomas Winant <thomas@well-typed.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In mock
Praos
andRealTPraos
, the genesis block is currently initialized with the same fixed nonce every time. If I understand correctly, that means the leader schedule for the first epoch is similarly fixed. Especially once we start with statistical testing (eg for CG/CP violation rates), we'll want our samples to be more independent than that.Thus this Issue is to have the tests' QuickCheck generators determine the initial nonce.
The text was updated successfully, but these errors were encountered: