-
Notifications
You must be signed in to change notification settings - Fork 639
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(simapp): move simapp binary into its own go.mod #6710
Merged
gjermundgaraba
merged 19 commits into
main
from
gjermund/3968-move-simapp-binary-into-own-gomod-or-e2e
Jul 9, 2024
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
871ea13
move simapp to a separate go module
gjermundgaraba d7589a8
remove unecessary modules from testing/simapp
gjermundgaraba 6221eda
Fix tests
gjermundgaraba 138fff4
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba d308819
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba 01e341d
refactor: trim out unnecessary files/code of new simapp go.mod
colin-axner d6b8bff
refactor: remove unnecessary code in testing simapp package
colin-axner d293128
remove: upgrade logic and crisis module from testing simapp
colin-axner b39e7b4
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
colin-axner 8e1ae9f
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba cd4359c
Update simapp go.mod
gjermundgaraba 7c72478
Fix compile issue with new simapp
gjermundgaraba 6221687
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba 82bca13
lint
gjermundgaraba b2df398
go mod tidy e2e
colin-axner b258687
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba 0a4d12e
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
gjermundgaraba c3bc711
Fix fail after merge
gjermundgaraba da7ce7c
Merge branch 'main' into gjermund/3968-move-simapp-binary-into-own-go…
colin-axner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,6 @@ require ( | |
cosmossdk.io/log v1.3.1 | ||
cosmossdk.io/math v1.3.0 | ||
cosmossdk.io/store v1.1.0 | ||
cosmossdk.io/tools/confix v0.1.1 | ||
cosmossdk.io/x/circuit v0.1.1 | ||
cosmossdk.io/x/evidence v0.1.1 | ||
cosmossdk.io/x/feegrant v0.1.1 | ||
Comment on lines
-15
to
-18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wahooo!!! 🎉 |
||
cosmossdk.io/x/tx v0.13.3 | ||
cosmossdk.io/x/upgrade v0.1.3 | ||
github.com/cometbft/cometbft v0.38.7 | ||
|
@@ -30,7 +26,6 @@ require ( | |
github.com/hashicorp/go-metrics v0.5.3 | ||
github.com/spf13/cast v1.6.0 | ||
github.com/spf13/cobra v1.8.1 | ||
github.com/spf13/viper v1.19.0 | ||
github.com/stretchr/testify v1.9.0 | ||
google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237 | ||
google.golang.org/grpc v1.64.0 | ||
|
@@ -73,8 +68,6 @@ require ( | |
github.com/cosmos/gogogateway v1.2.0 // indirect | ||
github.com/cosmos/iavl v1.1.2 // indirect | ||
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect | ||
github.com/creachadair/atomicfile v0.3.1 // indirect | ||
github.com/creachadair/tomledit v0.0.24 // indirect | ||
github.com/danieljoos/wincred v1.1.2 // indirect | ||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect | ||
|
@@ -165,6 +158,7 @@ require ( | |
github.com/sourcegraph/conc v0.3.0 // indirect | ||
github.com/spf13/afero v1.11.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/spf13/viper v1.19.0 // indirect | ||
github.com/subosito/gotenv v1.6.0 // indirect | ||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect | ||
github.com/tendermint/go-amino v0.16.0 // indirect | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# simapp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will go through this document and open a PR if it needs to be updated. |
||
|
||
simapp is an application built using the Cosmos SDK for testing and educational purposes. | ||
|
||
## Running testnets with `simd` | ||
|
||
If you want to spin up a quick testnet with your friends, you can follow these steps. | ||
Unless otherwise noted, every step must be done by everyone who wants to participate | ||
in this testnet. | ||
|
||
1. `$ make build`. This will build the `simd` binary and install it in your Cosmos SDK repo, | ||
inside a new `build` directory. The following instructions are run from inside | ||
that directory. | ||
2. If you've run `simd` before, you may need to reset your database before starting a new | ||
testnet: `$ ./simd unsafe-reset-all` | ||
3. `$ ./simd init [moniker]`. This will initialize a new working directory, by default at | ||
`~/.simapp`. You need a provide a "moniker," but it doesn't matter what it is. | ||
4. `$ ./simd keys add [key_name]`. This will create a new key, with a name of your choosing. | ||
Save the output of this command somewhere; you'll need the address generated here later. | ||
5. `$ ./simd add-genesis-account $(simd keys show [key_name] -a) [amount]`, where `key_name` | ||
is the same key name as before; and `amount` is something like `10000000000000000000000000stake`. | ||
6. `$ ./simd gentx [key_name] [amount] --chain-id [chain-id]`. This will create the | ||
genesis transaction for your new chain. | ||
7. Now, one person needs to create the genesis file `genesis.json` using the genesis transactions | ||
from every participant, by gathering all the genesis transactions under `config/gentx` and then | ||
calling `./simd collect-gentxs`. This will create a new `genesis.json` file that includes data | ||
from all the validators (we sometimes call it the "super genesis file" to distinguish it from | ||
single-validator genesis files). | ||
8. Once you've received the super genesis file, overwrite your original `genesis.json` file with | ||
the new super `genesis.json`. | ||
9. Modify your `config/config.toml` (in the simapp working directory) to include the other participants as | ||
persistent peers: | ||
|
||
```text | ||
# Comma separated list of nodes to keep persistent connections to | ||
persistent_peers = "[validator address]@[ip address]:[port],[validator address]@[ip address]:[port]" | ||
``` | ||
|
||
You can find `validator address` by running `./simd tendermint show-node-id`. (It will be hex-encoded.) | ||
By default, `port` is 26656. | ||
10. Now you can start your nodes: `$ ./simd start`. | ||
|
||
Now you have a small testnet that you can use to try out changes to the Cosmos SDK or Tendermint! | ||
|
||
NOTE: Sometimes creating the network through the `collect-gentxs` will fail, and validators will start | ||
in a funny state (and then panic). If this happens, you can try to create and start the network first | ||
with a single validator and then add additional validators using a `create-validator` transaction. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package simapp | ||
|
||
import ( | ||
"errors" | ||
|
||
circuitante "cosmossdk.io/x/circuit/ante" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
|
||
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" | ||
"github.com/cosmos/ibc-go/v8/modules/core/keeper" | ||
) | ||
|
||
// HandlerOptions are the options required for constructing a default SDK AnteHandler. | ||
type HandlerOptions struct { | ||
ante.HandlerOptions | ||
CircuitKeeper circuitante.CircuitBreaker | ||
IBCKeeper *keeper.Keeper | ||
} | ||
|
||
// NewAnteHandler returns an AnteHandler that checks and increments sequence | ||
// numbers, checks signatures & account numbers, and deducts fees from the first | ||
// signer. | ||
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { | ||
if options.AccountKeeper == nil { | ||
return nil, errors.New("account keeper is required for ante builder") | ||
} | ||
|
||
if options.BankKeeper == nil { | ||
return nil, errors.New("bank keeper is required for ante builder") | ||
} | ||
|
||
if options.SignModeHandler == nil { | ||
return nil, errors.New("sign mode handler is required for ante builder") | ||
} | ||
|
||
anteDecorators := []sdk.AnteDecorator{ | ||
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first | ||
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper), | ||
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), | ||
ante.NewValidateBasicDecorator(), | ||
ante.NewTxTimeoutHeightDecorator(), | ||
ante.NewValidateMemoDecorator(options.AccountKeeper), | ||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), | ||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), | ||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators | ||
ante.NewValidateSigCountDecorator(options.AccountKeeper), | ||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), | ||
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), | ||
ante.NewIncrementSequenceDecorator(options.AccountKeeper), | ||
ibcante.NewRedundantRelayDecorator(options.IBCKeeper), | ||
} | ||
|
||
return sdk.ChainAnteDecorators(anteDecorators...), nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love how few changes are needed here!