File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 4343// The maximum number of topic criteria allowed, vm.LOG4 - vm.LOG0
4444const maxTopics = 4
4545
46+ // The maximum number of allowed topics within a topic criteria
47+ const maxSubTopics = 1000
48+
4649// filter is a helper struct that holds meta information over the filter type
4750// and associated subscription in the event system.
4851type filter struct {
@@ -539,6 +542,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
539542 return errors .New ("invalid addresses in query" )
540543 }
541544 }
545+ if len (raw .Topics ) > maxTopics {
546+ return errExceedMaxTopics
547+ }
542548
543549 // topics is an array consisting of strings and/or arrays of strings.
544550 // JSON null values are converted to common.Hash{} and ignored by the filter manager.
@@ -559,6 +565,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
559565
560566 case []interface {}:
561567 // or case e.g. [null, "topic0", "topic1"]
568+ if len (topic ) > maxSubTopics {
569+ return errExceedMaxTopics
570+ }
562571 for _ , rawTopic := range topic {
563572 if rawTopic == nil {
564573 // null component, match all
You can’t perform that action at this time.
0 commit comments