From b71170a890e93c8fa36cbc5f507f616a085a1ca4 Mon Sep 17 00:00:00 2001 From: Philip Su Date: Thu, 13 Apr 2023 08:14:56 -0700 Subject: [PATCH 1/3] Fix seid export flag (#211) ## Describe your changes and provide context Seid export was previously broken b/c it didn't detect the chainID. Refactor the logic for seid start to use in both ## Testing performed to validate your change Verified the following: - seid start - seid start --chain-id - seid export - seid export --chain-id --- server/export.go | 1 + server/start.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/export.go b/server/export.go index d459f20e7..3dc5b8eba 100644 --- a/server/export.go +++ b/server/export.go @@ -112,6 +112,7 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com cmd.Flags().Int64(FlagHeight, -1, "Export state from a particular height (-1 means latest height)") cmd.Flags().Bool(FlagForZeroHeight, false, "Export state to start at height zero (perform preproccessing)") cmd.Flags().StringSlice(FlagJailAllowedAddrs, []string{}, "Comma-separated list of operator addresses of jailed validators to unjail") + cmd.Flags().String(FlagChainID, "", "Chain ID") return cmd } diff --git a/server/start.go b/server/start.go index ac277f25b..c79a133b0 100644 --- a/server/start.go +++ b/server/start.go @@ -5,6 +5,7 @@ package server import ( "context" "fmt" + clientconfig "github.com/cosmos/cosmos-sdk/client/config" "net/http" "os" "runtime/pprof" @@ -25,7 +26,6 @@ import ( _ "net/http/pprof" "github.com/cosmos/cosmos-sdk/client" - clientconfig "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server/api" @@ -157,6 +157,7 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. } chainID = flagChainID } + serverCtx.Viper.Set(flags.FlagChainID, chainID) genesisFile, _ := tmtypes.GenesisDocFromFile(serverCtx.Config.GenesisFile()) From 0132cff709db679b2afd7efcef7c3a643d245edf Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:01:39 -0400 Subject: [PATCH 2/3] [audit] Add handling for error returned (#221) ## Describe your changes and provide context ## Testing performed to validate your change --- x/accesscontrol/handler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x/accesscontrol/handler.go b/x/accesscontrol/handler.go index d434a7946..d950dd1da 100644 --- a/x/accesscontrol/handler.go +++ b/x/accesscontrol/handler.go @@ -11,7 +11,10 @@ import ( func HandleMsgUpdateResourceDependencyMappingProposal(ctx sdk.Context, k *keeper.Keeper, p *types.MsgUpdateResourceDependencyMappingProposal) error { for _, resourceDepMapping := range p.MessageDependencyMapping { - k.SetResourceDependencyMapping(ctx, resourceDepMapping) + err := k.SetResourceDependencyMapping(ctx, resourceDepMapping) + if err != nil { + return err + } } return nil } From f6b5219051791280ce2a77c794807ce0f2c07023 Mon Sep 17 00:00:00 2001 From: Brandon Weng <18161326+BrandonWeng@users.noreply.github.com> Date: Tue, 18 Apr 2023 13:15:30 -0400 Subject: [PATCH 3/3] Disable tracing by default (#222) ## Describe your changes and provide context Complaints from validators that the tracing log is really noisy ## Testing performed to validate your change No tracing by default ![image](https://user-images.githubusercontent.com/18161326/232845301-7b02e44d-21aa-4fee-af67-df5fa1328fe2.png) tracing error if enabeld ![image](https://user-images.githubusercontent.com/18161326/232845338-328448da-4592-4425-b725-0f970b361c60.png) --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++---- server/start.go | 11 ++++++++++- store/rootmulti/store.go | 2 +- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22747e114..bfbc4220d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,8 +24,8 @@ jobs: go-version: 1.19 - name: Create a file with all core Cosmos SDK pkgs run: go list ./... > pkgs.txt - - name: Split pkgs into 4 files - run: split -d -n l/4 pkgs.txt pkgs.txt.part. + - name: Split pkgs into 10 files + run: split -d -n l/10 pkgs.txt pkgs.txt.part. # cache multiple - uses: actions/upload-artifact@v3 with: @@ -43,6 +43,30 @@ jobs: with: name: "${{ github.sha }}-03" path: ./pkgs.txt.part.03 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-04" + path: ./pkgs.txt.part.04 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-05" + path: ./pkgs.txt.part.05 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-06" + path: ./pkgs.txt.part.06 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-07" + path: ./pkgs.txt.part.07 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-08" + path: ./pkgs.txt.part.08 + - uses: actions/upload-artifact@v3 + with: + name: "${{ github.sha }}-09" + path: ./pkgs.txt.part.09 tests: runs-on: ubuntu-latest @@ -50,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - part: ["00", "01", "02", "03"] + part: ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09"] steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 @@ -83,4 +107,4 @@ jobs: - uses: actions/upload-artifact@v3 with: name: "${{ github.sha }}-${{ matrix.part }}-coverage" - path: ./${{ matrix.part }}profile.out \ No newline at end of file + path: ./${{ matrix.part }}profile.out diff --git a/server/start.go b/server/start.go index c79a133b0..67a4e2984 100644 --- a/server/start.go +++ b/server/start.go @@ -5,12 +5,13 @@ package server import ( "context" "fmt" - clientconfig "github.com/cosmos/cosmos-sdk/client/config" "net/http" "os" "runtime/pprof" "time" + clientconfig "github.com/cosmos/cosmos-sdk/client/config" + "github.com/spf13/cobra" abciclient "github.com/tendermint/tendermint/abci/client" "github.com/tendermint/tendermint/abci/server" @@ -50,6 +51,7 @@ const ( FlagInterBlockCache = "inter-block-cache" FlagUnsafeSkipUpgrades = "unsafe-skip-upgrades" FlagTrace = "trace" + FlagTracing = "tracing" FlagProfile = "profile" FlagInvCheckPeriod = "inv-check-period" @@ -165,11 +167,17 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. panic(fmt.Sprintf("genesis file chain-id=%s does not equal config.toml chain-id=%s", genesisFile.ChainID, clientCtx.ChainID)) } + if enableTracing, _ := cmd.Flags().GetBool(FlagTracing); !enableTracing { + serverCtx.Logger.Info("--tracing not passed in, tracing is not enabled") + tracerProviderOptions = []trace.TracerProviderOption{} + } + withTM, _ := cmd.Flags().GetBool(flagWithTendermint) if !withTM { serverCtx.Logger.Info("starting ABCI without Tendermint") return startStandAlone(serverCtx, appCreator) } + // amino is needed here for backwards compatibility of REST routes err = startInProcess(serverCtx, clientCtx, appCreator, tracerProviderOptions) errCode, ok := err.(ErrorCode) @@ -194,6 +202,7 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. cmd.Flags().Bool(FlagInterBlockCache, true, "Enable inter-block caching") cmd.Flags().String(flagCPUProfile, "", "Enable CPU profiling and write to the provided file") cmd.Flags().Bool(FlagTrace, false, "Provide full stack traces for errors in ABCI Log") + cmd.Flags().Bool(FlagTracing, false, "Enable Tracing for the app") cmd.Flags().Bool(FlagProfile, false, "Enable Profiling in the application") cmd.Flags().String(FlagPruning, storetypes.PruningOptionDefault, "Pruning strategy (default|nothing|everything|custom)") cmd.Flags().Uint64(FlagPruningKeepRecent, 0, "Number of recent heights to keep on disk (ignored if pruning is not 'custom')") diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index e2b2e95a4..09ec484a4 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -1020,7 +1020,7 @@ func (rs *Store) flushMetadata(db dbm.DB, version int64, cInfo *types.CommitInfo if err := batch.WriteSync(); err != nil { panic(fmt.Errorf("error on batch write %w", err)) } - fmt.Printf("App State Saved height=%d hash=%X\n", cInfo.CommitID().Version, cInfo.CommitID().Hash) + rs.logger.Info("App State Saved height=%d hash=%X\n", cInfo.CommitID().Version, cInfo.CommitID().Hash) } type storeParams struct {