feat(e2e): simplify the relation between manifest and testnet#3964
feat(e2e): simplify the relation between manifest and testnet#3964
Conversation
4bbb231 to
4991c80
Compare
| // Defaults to "validator". Full nodes do not get a signing key (a dummy key | ||
| // is generated), and seed nodes run in seed mode with the PEX reactor enabled. | ||
| Mode string `toml:"mode"` | ||
| ModeStr string `toml:"mode"` |
There was a problem hiding this comment.
What is the benefit of putting type into a variable name?
There was a problem hiding this comment.
We have Testnet.Mode and had Manifest.Node. They are from different types.
Ok, it is true that type Mode = String but they are different variables.
I renamed all variables in Manifest that collide with names in Testnet.
There was a problem hiding this comment.
I'm also trying to understand the motivation for these renames here, struct fields are scoped to the struct, so you can't experience 'collisions' in a sense that you can't access fields of one struct while referencing another, even if fields have the same names.
Could you please point in the code where this collision could happen ? If it's just a matter of providing context via the field name, I'd think we should just apply KISS principle and leave the way it is. But I might have missed the point with the rename.
andynog
left a comment
There was a problem hiding this comment.
I've reviewed and made some comments and had some questions.
| ValidatorUpdates: map[int64]map[*Node]int64{}, | ||
| Nodes: []*Node{}, | ||
| } | ||
| if testnet.InitialHeight == 0 { |
There was a problem hiding this comment.
Do we need this if in the genesis validation if it's height = 0 it changes it to height = 1 ?
Line 80 in 3323096
| // Defaults to "validator". Full nodes do not get a signing key (a dummy key | ||
| // is generated), and seed nodes run in seed mode with the PEX reactor enabled. | ||
| Mode string `toml:"mode"` | ||
| ModeStr string `toml:"mode"` |
There was a problem hiding this comment.
I'm also trying to understand the motivation for these renames here, struct fields are scoped to the struct, so you can't experience 'collisions' in a sense that you can't access fields of one struct while referencing another, even if fields have the same names.
Could you please point in the code where this collision could happen ? If it's just a matter of providing context via the field name, I'd think we should just apply KISS principle and leave the way it is. But I might have missed the point with the rename.
andynog
left a comment
There was a problem hiding this comment.
lgtm, overall it improves the code
Addresses #3832. Introduces a flag `config` to the manifest. It is a list of strings that should have the format `key = value`. Keys are any of the configuration parameters included in a CometBFT configuration file. The flag can be global, meaning that the configurations will be applied for every node in the network, or specific for a given node, when inserted in the section referring to that node. Local/specific configurations are applied after the global ones, therefore overriding them. Example: ``` config = [ "p2p.send_rate = 51200", "filter_peers = true", ] ``` The configurations are applying using `viper`, as I could not find another way to load configuration parameters. They are always loaded as a string, and this appears to work correctly. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Closes #3961. Similarly to #3967, introduces a new `genesis` field for manifest files. The format is `key = value` and multiple entries can be provided. For example, ``` genesis = [ "consensus_params.evidence.max_bytes = 1000", "chain_id = pr3969" ] ``` After the genesis document is produced by the `setup` implementation of the runner, the provided genesis customized configurations are applied to the generated genesis file. The solution also uses `viper`, as it allows setting only some specific keys, leaving the pre-produced content untouched. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
As per title. It was like this before #3964, so restoring original name. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Refactors the `e2e` testbed to remove some unnecessary duplication between `Manifest` and `Testnet`, and `ManifestNode` and `Node`. Fields that are identical in the two types are removed from the latter, which includes (extends) the former. Fields that had the same name but different types or semantics in the two versions, were renamed in the manifest. With this change, to add a new field to the configuration of a testnet or a node, it is enough to update the `Manifest` or `ManifestNode`. The new field must also be added to `Testnet` or `Node` if it needs to be somehow parsed (see the examples of the `Seeds` and `PersistentPeers` fields). --- - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Refactors the `e2e` testbed to remove some unnecessary duplication between `Manifest` and `Testnet`, and `ManifestNode` and `Node`. Fields that are identical in the two types are removed from the latter, which includes (extends) the former. Fields that had the same name but different types or semantics in the two versions, were renamed in the manifest. With this change, to add a new field to the configuration of a testnet or a node, it is enough to update the `Manifest` or `ManifestNode`. The new field must also be added to `Testnet` or `Node` if it needs to be somehow parsed (see the examples of the `Seeds` and `PersistentPeers` fields). --- - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Refactors the `e2e` testbed to remove some unnecessary duplication between `Manifest` and `Testnet`, and `ManifestNode` and `Node`. Fields that are identical in the two types are removed from the latter, which includes (extends) the former. Fields that had the same name but different types or semantics in the two versions, were renamed in the manifest. With this change, to add a new field to the configuration of a testnet or a node, it is enough to update the `Manifest` or `ManifestNode`. The new field must also be added to `Testnet` or `Node` if it needs to be somehow parsed (see the examples of the `Seeds` and `PersistentPeers` fields). --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev> (cherry picked from commit 40c4b40) # Conflicts: # test/e2e/generator/generate.go # test/e2e/pkg/testnet.go
Addresses #3832. Introduces a flag `config` to the manifest. It is a list of strings that should have the format `key = value`. Keys are any of the configuration parameters included in a CometBFT configuration file. The flag can be global, meaning that the configurations will be applied for every node in the network, or specific for a given node, when inserted in the section referring to that node. Local/specific configurations are applied after the global ones, therefore overriding them. Example: ``` config = [ "p2p.send_rate = 51200", "filter_peers = true", ] ``` The configurations are applying using `viper`, as I could not find another way to load configuration parameters. They are always loaded as a string, and this appears to work correctly. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev> (cherry picked from commit cea82b1)
Closes #3961. Similarly to #3967, introduces a new `genesis` field for manifest files. The format is `key = value` and multiple entries can be provided. For example, ``` genesis = [ "consensus_params.evidence.max_bytes = 1000", "chain_id = pr3969" ] ``` After the genesis document is produced by the `setup` implementation of the runner, the provided genesis customized configurations are applied to the generated genesis file. The solution also uses `viper`, as it allows setting only some specific keys, leaving the pre-produced content untouched. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev> (cherry picked from commit 6c5cd32) # Conflicts: # test/e2e/pkg/manifest.go # test/e2e/pkg/testnet.go # test/e2e/runner/setup.go
#3964) (#4308) Refactors the `e2e` testbed to remove some unnecessary duplication between `Manifest` and `Testnet`, and `ManifestNode` and `Node`. Fields that are identical in the two types are removed from the latter, which includes (extends) the former. Fields that had the same name but different types or semantics in the two versions, were renamed in the manifest. With this change, to add a new field to the configuration of a testnet or a node, it is enough to update the `Manifest` or `ManifestNode`. The new field must also be added to `Testnet` or `Node` if it needs to be somehow parsed (see the examples of the `Seeds` and `PersistentPeers` fields). --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments <hr>This is an automatic backport of pull request #3964 done by [Mergify](https://mergify.com). --------- Co-authored-by: Daniel <daniel.cason@informal.systems>
Closes #3961. Similarly to #3967, introduces a new `genesis` field for manifest files. The format is `key = value` and multiple entries can be provided. For example, ``` genesis = [ "consensus_params.evidence.max_bytes = 1000", "chain_id = pr3969" ] ``` After the genesis document is produced by the `setup` implementation of the runner, the provided genesis customized configurations are applied to the generated genesis file. The solution also uses `viper`, as it allows setting only some specific keys, leaving the pre-produced content untouched. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
…ort #3967) (#4309) Addresses #3832. Introduces a flag `config` to the manifest. It is a list of strings that should have the format `key = value`. Keys are any of the configuration parameters included in a CometBFT configuration file. The flag can be global, meaning that the configurations will be applied for every node in the network, or specific for a given node, when inserted in the section referring to that node. Local/specific configurations are applied after the global ones, therefore overriding them. Example: ``` config = [ "p2p.send_rate = 51200", "filter_peers = true", ] ``` The configurations are applying using `viper`, as I could not find another way to load configuration parameters. They are always loaded as a string, and this appears to work correctly. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments <hr>This is an automatic backport of pull request #3967 done by [Mergify](https://mergify.com). --------- Co-authored-by: Daniel <daniel.cason@informal.systems>
Closes #3961. Similarly to #3967, introduces a new `genesis` field for manifest files. The format is `key = value` and multiple entries can be provided. For example, ``` genesis = [ "consensus_params.evidence.max_bytes = 1000", "chain_id = pr3969" ] ``` After the genesis document is produced by the `setup` implementation of the runner, the provided genesis customized configurations are applied to the generated genesis file. The solution also uses `viper`, as it allows setting only some specific keys, leaving the pre-produced content untouched. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Andy Nogueira <me@andynogueira.dev>
…port #3969) (#4312) Closes #3961. Similarly to #3967, introduces a new `genesis` field for manifest files. The format is `key = value` and multiple entries can be provided. For example, ``` genesis = [ "consensus_params.evidence.max_bytes = 1000", "chain_id = pr3969" ] ``` After the genesis document is produced by the `setup` implementation of the runner, the provided genesis customized configurations are applied to the generated genesis file. The solution also uses `viper`, as it allows setting only some specific keys, leaving the pre-produced content untouched. Note: this PR is based atop #3964 for simplicity, but it does not need to. --- This is an manual backport of pull request #3969. #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments
Refactors the
e2etestbed to remove some unnecessary duplication betweenManifestandTestnet, andManifestNodeandNode. Fields that are identical in the two types are removed from the latter, which includes (extends) the former. Fields that had the same name but different types or semantics in the two versions, were renamed in the manifest.With this change, to add a new field to the configuration of a testnet or a node, it is enough to update the
ManifestorManifestNode. The new field must also be added toTestnetorNodeif it needs to be somehow parsed (see the examples of theSeedsandPersistentPeersfields).PR checklist
.changelog(we use unclog to manage our changelog)docs/orspec/) and code comments