diff --git a/baseapp/abci.go b/baseapp/abci.go index a8a806a7c6f0..7c2fac102d64 100644 --- a/baseapp/abci.go +++ b/baseapp/abci.go @@ -412,12 +412,9 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv return sdkerrors.ResponseDeliverTxWithEvents(err, gInfo.GasWanted, gInfo.GasUsed, sdk.MarkEventsToIndex(anteEvents, app.indexEvents), app.trace) } - fmt.Println("DeliverTx") if sdk.MaxEventSize > 0 { - fmt.Println("sdk.MaxEventSize > 0", sdk.MaxEventSize) for i, event := range result.Events { for j, attr := range event.Attributes { - fmt.Println("lengths", len([]byte(attr.Key)), len([]byte(attr.Value))) if len([]byte(attr.Key))+len([]byte(attr.Value)) > sdk.MaxEventSize { result.Events[i].Attributes[j].Value = "evt val too large, inc max-event-size in config.toml" } diff --git a/server/config/config.go b/server/config/config.go index b78133179889..a285e7081884 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -109,6 +109,8 @@ type BaseConfig struct { // An empty string indicates that the Tendermint config's DBBackend value should be used. AppDBBackend string `mapstructure:"app-db-backend"` + // MaxEventSize defines the maximum size of an attribute (key + value) of an event that will be stored in the block results. + // If an attribute is larger than this size, it will be replaced with a placeholder in the block results. MaxEventSize int `mapstructure:"max-event-size" json:"max-event-size"` } @@ -318,7 +320,7 @@ func DefaultConfig() *Config { IAVLFastNodeModuleWhitelist: []string{"lockup"}, IAVLLazyLoading: false, AppDBBackend: "", - MaxEventSize: 0, + MaxEventSize: 1000000, // 1MB }, Telemetry: telemetry.Config{ Enabled: false, diff --git a/server/config/toml.go b/server/config/toml.go index 96d02b0ff0b2..e99254381d27 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -96,7 +96,8 @@ iavl-lazy-loading = {{ .BaseConfig.IAVLLazyLoading }} # The fallback is the db_backend value set in Tendermint's config.toml. app-db-backend = "{{ .BaseConfig.AppDBBackend }}" -# Maximum event size in bytes. 0 means no limit +# Maximum event size in bytes that is stored in the block results. 0 means no limit +# If an attribute of an event is larger than the max size, the attribute will be replaced with a placeholder. max-event-size = {{ .BaseConfig.MaxEventSize }} ###############################################################################