Skip to content

feat(e2e): allow customizing genesis parameters on the manifest#3969

Merged
cason merged 25 commits intomainfrom
cason/3961-e2e-genesis
Sep 4, 2024
Merged

feat(e2e): allow customizing genesis parameters on the manifest#3969
cason merged 25 commits intomainfrom
cason/3961-e2e-genesis

Conversation

@cason
Copy link
Copy Markdown

@cason cason commented Sep 2, 2024

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 to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

@cason cason requested a review from a team as a code owner September 2, 2024 15:54
@cason cason requested a review from a team September 2, 2024 15:54
@cason cason self-assigned this Sep 2, 2024
@cason cason added the e2e Related to our end-to-end tests label Sep 2, 2024
@cason cason linked an issue Sep 2, 2024 that may be closed by this pull request
@cason cason changed the title e2e: allow customizing genesis parameters on the manifest feat(e2e): allow customizing genesis parameters on the manifest Sep 2, 2024
Copy link
Copy Markdown
Collaborator

@melekes melekes left a comment

Choose a reason for hiding this comment

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

👍

@cason
Copy link
Copy Markdown
Author

cason commented Sep 3, 2024

There is a lint error I don't have idea what it means:

 golangci-lint-full.......................................................Failed
- hook id: golangci-lint-full
- exit code: 1

WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar. 
test/e2e/runner/setup.go:18:2: import 'github.com/mitchellh/mapstructure' is not allowed from list 'main' (depguard)
	"github.com/mitchellh/mapstructure"
	^

Copy link
Copy Markdown
Collaborator

@andynog andynog left a comment

Choose a reason for hiding this comment

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

Same comment made in #3967

We need to validate the key with a valid field in genesis otherwise we might get undesired behaviors

(e2e) > ./build/runner -f networks/single.toml setup
I[2024-09-03|14:34:21.615] setup                                        msg="Generating testnet files in `networks/single`"
D[2024-09-03|14:34:21.616] Applying Genesis config                      consensus_params.evidence.max_bytes=1000
D[2024-09-03|14:34:21.616] Applying Genesis config                      chain_id=pr3969

here chain_id was set in the genesis.json file, but mispelling the field name to chainid

(e2e) > ./build/runner -f networks/single.toml setup
I[2024-09-03|14:34:32.827] setup                                        msg="Generating testnet files in `networks/single`"
D[2024-09-03|14:34:32.827] Applying Genesis config                      consensus_params.evidence.max_bytes=1000
D[2024-09-03|14:34:32.827] Applying Genesis config                      chainid=pr3969

validation accepted invalid field name, so of course it was not set

{
  "genesis_time": "2024-09-03T14:34:32.827736Z",
  "chain_id": "single",

Copy link
Copy Markdown
Collaborator

@andynog andynog 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 just unblock this, my previous comment is still valid but the implementation to solve the validation problem is not easy. Might need a future PR if we can get it to work.

Base automatically changed from cason/e2e-refactor to main September 4, 2024 13:17
@cason cason enabled auto-merge September 4, 2024 13:20
@cason cason added this pull request to the merge queue Sep 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Sep 4, 2024
tokens := strings.Split(entry, " = ")
if len(tokens) != 2 {
return fmt.Errorf("invalid config entry: \"%s\", "+

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Suggested change

@cason cason enabled auto-merge September 4, 2024 13:51
@cason cason added this pull request to the merge queue Sep 4, 2024
Merged via the queue into main with commit 6c5cd32 Sep 4, 2024
@cason cason deleted the cason/3961-e2e-genesis branch September 4, 2024 14:03
github-merge-queue bot pushed a commit that referenced this pull request Sep 10, 2024
…eys (#4016)

Addresses comments
#3969 (review)
and
#3967 (review)
on previous PRs.

The solution is in fact simple, as it is possible to tell viper to
return an error if one of the configured entries (key/value pairs) were
not applied to the destination structure, because they don't exist or
are invalid.

---

#### 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>
mergify bot pushed a commit that referenced this pull request Oct 20, 2024
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
mergify bot pushed a commit that referenced this pull request Oct 20, 2024
…eys (#4016)

Addresses comments
#3969 (review)
and
#3967 (review)
on previous PRs.

The solution is in fact simple, as it is possible to tell viper to
return an error if one of the configured entries (key/value pairs) were
not applied to the destination structure, because they don't exist or
are invalid.

---

#### 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 bff1667)

# Conflicts:
#	test/e2e/pkg/testnet.go
#	test/e2e/runner/setup.go
cason pushed a commit that referenced this pull request Oct 20, 2024
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>
cason pushed a commit that referenced this pull request Oct 20, 2024
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>
cason pushed a commit that referenced this pull request Oct 20, 2024
…eys (#4016)

Addresses comments
#3969 (review)
and
#3967 (review)
on previous PRs.

The solution is in fact simple, as it is possible to tell viper to
return an error if one of the configured entries (key/value pairs) were
not applied to the destination structure, because they don't exist or
are invalid.

---

#### 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>
cason pushed a commit that referenced this pull request Oct 20, 2024
…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
cason pushed a commit that referenced this pull request Oct 20, 2024
…eys (backport #4016) (#4313)

Addresses comments
#3969 (review)
and
#3967 (review)
on previous PRs.

The solution is in fact simple, as it is possible to tell viper to
return an error if one of the configured entries (key/value pairs) were
not applied to the destination structure, because they don't exist or
are invalid.

---

This is an manual backport of pull request
#4016.

#### 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Related to our end-to-end tests

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

e2e: allow customizing genesis parameters on the manifest

3 participants