Skip to content

Commit

Permalink
chore(app): re-add simulation manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Ixo committed Aug 12, 2024
1 parent 8148a05 commit 35f401a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 45 deletions.
5 changes: 2 additions & 3 deletions .infra/dockerfiles/setups/setup-devnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ HOME=/root
# export FROM=\”ixo_did\“: \“\”
# export TO=“\”ixo_did\“: \“$IXO_DID\“”
sed -i 's/"ixo_did" : ""/"ixo_did" : ""/;s/"bond_denom" : "stake"/"bond_denom" : "uixo"/;s/"mint_denom" : "stake"/"mint_denom" : "uixo"/;s/stake/uixo/;s/"Reserved_bond_tokens" : "\[\]"/"Reserved_bond_tokens" : "\[\]"/;s/"minimum-gas-prices" : ""/"minimum-gas-prices" : "0.025uixo"/;s/"enable" : "false"/"enable" : "true"/;s/"swagger" : "false"/"swagger" : "true"/;' $HOME/.ixod/config/genesis.json
MAX_VOTING_PERIOD="30s" # example: "172800s"
MAX_VOTING_PERIOD="30s" # example: "172800s"
FROM="\"voting_period\": \"172800s\""
TO="\"voting_period\": \"$MAX_VOTING_PERIOD\""
sed -i "s/$FROM/$TO/" "$HOME"/.ixod/config/genesis.json
Expand Down Expand Up @@ -76,7 +76,6 @@ sed -i "s/$FROM/$TO/" "$HOME"/.ixod/config/genesis.json
# export FROM=“minimum-gas-prices = \“\”
# export TO=“minimum-gas-prices = \“0.025$FEE_TOKEN\“”
# sed -i '/minimum-gas-prices/c\ \"minimum-gas-prices\" : \"0.025uixo\",' $HOME/.ixod/config/genesis.json
# TODO: config missing from new version (REF: https://github.com/cosmos/cosmos-sdk/issues/8529)
#ixod config chain-id devnet-1
#ixod config output jsonW
#ixod config indent true
Expand All @@ -98,4 +97,4 @@ sed -i "s/$FROM/$TO/" "$HOME"/.ixod/config/genesis.json
# Uncomment the below to set timeouts to 1s for shorter block times
#sed -i ‘s/timeout_commit = “5s”/timeout_commit = “1s”/g’ “$HOME”/.ixod/config/config.toml
#sed -i ‘s/timeout_propose = “3s”/timeout_propose = “1s”/g’ “$HOME”/.ixod/config/config.toml
# ixod start --pruning “nothing”
# ixod start --pruning “nothing”
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ARG BUILD_TAGS="netgo,ledger,muslc"

FROM golang:${GO_VERSION}-alpine3.18 AS builder

# todo: maybe extract below args to where called in cicd?
# TODO: maybe extract below args to where called in cicd?
# git log -1 --format='%H'
ARG GIT_VERSION="2.0.0-rc.0"
ARG GIT_COMMIT="ca9e64cf2f8c29b8bb001281abcdcb942dc9fa01"
Expand Down
38 changes: 34 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
<!-- TODO: make better, check at others for nice example -->
# IXO Security Policy

If there is any security issue with this repository, please contact the following email address(es):
The IXO core team and community takes all security issues and vulnerabilities very seriously.

- [email protected]
- [email protected]
Thanks for improving the security of IXO. We appreciate your efforts. Following these responsible disclosure guidelines will make sure your contribution is acknowledged.

Please report security vulnerabilities to <[email protected]> or <[email protected]>. _Please avoid opening a public Github issue or posting on social media or Discord_.

The IXO team will respond with the next steps following the email. The team will keep you informed on the remediation process and may ask for additional guidance/information.

Please include the following in your report:

- Your name/affiliation (if any)
- Description of the technical details of the vulnerability, including how to reproduce.
- An explanation of who can exploit this vulnerability, including possible attack scenarios.
- Whether this vulnerability is public or known to third parties.

## Vulnerability Disclosure Policy

The core team asks security researchers to keep communications around vulnerabilities private and confidential until a patch is ready.

Additionally, we request:

- Allow a reasonable amount of time to correct and address the issue.
- Avoid exploiting the vulnerability.
- Demonstrate good faith by not disrupting IXO's network, data, or services.

## Vulnerability Disclosure Process

Once a report is received, the following process will be followed:

- The IXO core team will work to verify the issue.
- Work on a patch in a private repository.
- Notify the community and validators that a security update is coming, giving ample time to upgrade and apply the patch.

Every effort will be made to handle disclosures in a timely manner. It's very important to follow the above process for vulnerabilities to be handled quickly and effectively.
8 changes: 2 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,8 @@ func NewIxoApp(
}

// create the simulation manager and define the order of the modules for deterministic simulations
//
// NOTE: this is not required apps that don't use the simulator for fuzz testing
// transactions
// TODO: work in tests, none for now
// app.sm = module.NewSimulationManager(simulationModules(app, encodingConfig, skipGenesisInvariants)...)
// app.sm.RegisterStoreDecoders()
app.sm = module.NewSimulationManager(simulationModules(app, appCodec, skipGenesisInvariants)...)
app.sm.RegisterStoreDecoders()

return app
}
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,11 @@ func NewAppKeepers(
// Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey
appKeepers.GenerateKeys()

// TODO: check into new ParamStore
/*
configure state listening capabilities using AppOptions
we are doing nothing with the returned streamingServices and waitGroup in this case
*/
// load state streaming if enabled

if err := bApp.RegisterStreamingServices(appOpts, appKeepers.keys); err != nil {
panic(err)
}
Expand Down
55 changes: 27 additions & 28 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,34 +163,33 @@ func newBasicManagerFromManager(app *IxoApp) module.BasicManager {
return basicManager
}

// TODO: uncomment while no tests, re-add when tests are added
// // simulationModules returns modules for simulation manager
// // define the order of the modules for deterministic simulationss
// func simulationModules(
// app *IxoApp,
// encodingConfig appparams.EncodingConfig,
// _ bool,
// ) []module.AppModuleSimulation {
// appCodec := encodingConfig.Marshaler

// return []module.AppModuleSimulation{
// auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts),
// bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
// capability.NewAppModule(appCodec, *app.CapabilityKeeper),
// gov.NewAppModule(appCodec, *app.GovKeeper, app.AccountKeeper, app.BankKeeper),
// mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
// staking.NewAppModule(appCodec, *app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
// distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
// slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
// sdkparams.NewAppModule(app.ParamsKeeper),
// wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
// authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
// evidence.NewAppModule(app.EvidenceKeeper),
// ibc.NewAppModule(app.IBCKeeper),
// feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
// transfer.NewAppModule(app.TransferKeeper),
// }
// }
// simulationModules returns modules for simulation manager
// define the order of the modules for deterministic simulations
func simulationModules(
app *IxoApp,
appCodec codec.Codec,
_ bool,
) []module.AppModuleSimulation {
return []module.AppModuleSimulation{
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry),
sdkparams.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
}
}

// OrderBeginBlockers returns the order of BeginBlockers, by module name.
func OrderBeginBlockers() []string {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ixod/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func NewRootCmd() *cobra.Command {
WithHomeDir(app.DefaultNodeHome).
WithViper("IXO")

// TODO consider adding .toml config file functionality for extra params
// consider adding .toml custom config in next cosmos upgrade
// Allows you to add extra params to your client.toml
// gas, gas-price, gas-adjustment, fees, note, etc.
// SetCustomEnvVariablesFromClientToml(initClientCtx)
Expand Down

0 comments on commit 35f401a

Please sign in to comment.