Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Jun 17, 2024
1 parent 7bc6ee1 commit 57a2d27
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 0 additions & 3 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 3 additions & 1 deletion server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -318,7 +320,7 @@ func DefaultConfig() *Config {
IAVLFastNodeModuleWhitelist: []string{"lockup"},
IAVLLazyLoading: false,
AppDBBackend: "",
MaxEventSize: 0,
MaxEventSize: 1000000, // 1MB
},
Telemetry: telemetry.Config{
Enabled: false,
Expand Down
3 changes: 2 additions & 1 deletion server/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
###############################################################################
Expand Down

0 comments on commit 57a2d27

Please sign in to comment.