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

feat: simd runs in-process testnet by default #9246

Merged
merged 38 commits into from
Jun 29, 2021
Merged

Conversation

clevinson
Copy link
Contributor

@clevinson clevinson commented Apr 30, 2021

Description

ref: #9183

After some more recent conversations w/ @aaronc, I decided to go back to his original proposal of setting up a subcommand for running in-process testnets.

This PR splits the simd testnet command into two subcommands:

  • simd testnet start which starts an in-process n-node testnet
  • simd testnet init-files which sets up configuration & genesis files for an n-node testnet to be run as separate processes (one per node, most likely via Docker Compose)

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards. - n/a
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/) - see docs: simd testnet commands #9411
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@clevinson
Copy link
Contributor Author

clevinson commented Apr 30, 2021

I'd like some preliminary feedback on this draft PR, to get validation that others are aligned with this approach, and then i'd proceed with the following updates to clean this up:

  • Allow node0's ports to be set explicitly (defaulting to 26657, 1317, 9090, etc. etc.) as opposed to random free ports
  • add better documentation of new interfaces, functions, cli methods
  • changelog

Also, looking for feedback on naming :)

In a follow-up PR, we should figure out how to expose keys to users for manual testing if we run these testnets in CI (with Heroku Review Apps or similar). Making a full on faucet seems out of scope for this work. Two alternatives I can think of (neither are secure at all, but maybe that's not a concern):

  • storing persistent validator keys in github and explicitly marking them as insecure keys used for validators in CI
    • this would require us to pass in a --keyring-dir flag into simd testnet command
  • outputing the node0 validator's mnemonic to stdout as part of the simd testnets command, so we could grab this mnemonic for testing by looking at github action / heroku logs ?

simapp/simd/cmd/testnet.go Outdated Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Concept ACK.

I feel like this is the software developer's answer ("just code it") to a devops problem. A better solution might be some cloud orchestration config and deployment. But maybe this PR is fine for now, since the maintainers of the SDK are mainly software devs, and this setup is something we know how to debug easily 👍

Makefile Show resolved Hide resolved
testutil/network/network.go Outdated Show resolved Hide resolved
testutil/network/network.go Outdated Show resolved Hide resolved
testutil/network/network.go Outdated Show resolved Hide resolved
@aaronc
Copy link
Member

aaronc commented May 26, 2021

This is just CLI breaking for tests, thus doesn't merit a ! in the title

@aaronc
Copy link
Member

aaronc commented May 26, 2021

Also I think it's feat and not refactor as it changes existing behavior for end users, right?

@ryanchristo ryanchristo changed the title refactor!: simd runs in-process testnet by default feat: simd runs in-process testnet by default May 26, 2021
CHANGELOG.md Outdated
@@ -112,6 +113,7 @@ if input key is empty, or input data contains empty key.
* The `RegisterCustomTypeURL` function and the `cosmos.base.v1beta1.ServiceMsg` interface have been removed from the interface registry.
* (codec) [\#9251](https://github.com/cosmos/cosmos-sdk/pull/9251) Rename `clientCtx.JSONMarshaler` to `clientCtx.JSONCodec` as per #9226.
* (x/bank) [\#9271](https://github.com/cosmos/cosmos-sdk/pull/9271) SendEnabledCoin(s) renamed to IsSendEnabledCoin(s) to better reflect its functionality.
* [\#9246](https://github.com/cosmos/cosmos-sdk/pull/9246) The `New` method for the network package now returns an error.
Copy link
Contributor

Choose a reason for hiding this comment

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

cc @aaronc should this be an API breaking change?

Copy link
Member

Choose a reason for hiding this comment

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

technically yes

@ryanchristo
Copy link
Contributor

ryanchristo commented May 26, 2021

Maybe we could improve the UX a bit down the road. The CLI shows at the end started test network; press the Enter Key to terminate which is a bit confusing unless you know what you're doing. Maybe a link to some docs would be good at some point.

I agree. Maybe simapp readme could be expanded upon or we could add another document to Running a Node. It looks like the testnet command is not documented anywhere at the moment.

#9014 might be relevant here. I've assigned myself to the issue. I'll work on adding some documentation.

@ryanchristo ryanchristo mentioned this pull request May 28, 2021
9 tasks
Copy link
Contributor

@blushi blushi left a comment

Choose a reason for hiding this comment

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

Tested ACK.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

tACK, thanks @ryanchristo

my test:

./build/simd testnet start --v 10
./build/simd q staking validators // make sure there's 10 validators

@amaury1093
Copy link
Contributor

This is just CLI breaking for tests, thus doesn't merit a ! in the title

I believe we actually want the ! in the title, right? because of #9246 (comment). anyways, @ryanchristo i'll let you decide on the title and put automerge on at will

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Oh wait, no, I forgot about #9246 (comment). let's wait

@clevinson clevinson added the S: DO NOT MERGE Status: DO NOT MERGE label Jun 8, 2021
@amaury1093 amaury1093 removed the S: DO NOT MERGE Status: DO NOT MERGE label Jun 28, 2021
@amaury1093
Copy link
Contributor

@clevinson or @ryanchristo can one of you fix the changelog conflicts?

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

tACK: ./build/simd testnet start

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Jun 29, 2021
@mergify mergify bot merged commit aef416f into master Jun 29, 2021
@mergify mergify bot deleted the clevinson/ci-devnets branch June 29, 2021 10:41
mergify bot pushed a commit that referenced this pull request Jul 15, 2021
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review.
-->

This pull request is a follow-up pull request for #9246 that adds documentation for the `simd testnet` command.
 
---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [x] Review `Codecov Report` in the comment section below once CI passes
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v                               ✰  Thanks for creating a PR! ✰
v    Before smashing the submit button please review the checkboxes.
v    If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  -->

## Description

ref: cosmos#9183 

After some more recent conversations w/ @aaronc, I decided to go back to his original proposal of setting up a subcommand for running in-process testnets. 

This PR splits the `simd testnet` command into two subcommands:
- `simd testnet start` which starts an in-process n-node testnet
- `simd testnet init-files` which sets up configuration & genesis files for an n-node testnet to be run as separate processes (one per node, most likely via Docker Compose)


---

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

- [x] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
- [x] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md). - **n/a**
- [ ] Wrote unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [x] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`) - **see cosmos#9411**
- [x] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [x] Added a relevant changelog entry to the `Unreleased` section in `CHANGELOG.md`
- [x] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants