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 {
@@ -545,6 +548,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
545548 return errors .New ("invalid addresses in query" )
546549 }
547550 }
551+ if len (raw .Topics ) > maxTopics {
552+ return errExceedMaxTopics
553+ }
548554
549555 // topics is an array consisting of strings and/or arrays of strings.
550556 // JSON null values are converted to common.Hash{} and ignored by the filter manager.
@@ -565,6 +571,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
565571
566572 case []interface {}:
567573 // or case e.g. [null, "topic0", "topic1"]
574+ if len (topic ) > maxSubTopics {
575+ return errExceedMaxTopics
576+ }
568577 for _ , rawTopic := range topic {
569578 if rawTopic == nil {
570579 // null component, match all
You can’t perform that action at this time.
0 commit comments