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 43
43
// The maximum number of topic criteria allowed, vm.LOG4 - vm.LOG0
44
44
const maxTopics = 4
45
45
46
+ // The maximum number of allowed topics within a topic criteria
47
+ const maxSubTopics = 1000
48
+
46
49
// filter is a helper struct that holds meta information over the filter type
47
50
// and associated subscription in the event system.
48
51
type filter struct {
@@ -539,6 +542,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
539
542
return errors .New ("invalid addresses in query" )
540
543
}
541
544
}
545
+ if len (raw .Topics ) > maxTopics {
546
+ return errExceedMaxTopics
547
+ }
542
548
543
549
// topics is an array consisting of strings and/or arrays of strings.
544
550
// 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 {
559
565
560
566
case []interface {}:
561
567
// or case e.g. [null, "topic0", "topic1"]
568
+ if len (topic ) > maxSubTopics {
569
+ return errExceedMaxTopics
570
+ }
562
571
for _ , rawTopic := range topic {
563
572
if rawTopic == nil {
564
573
// null component, match all
You can’t perform that action at this time.
0 commit comments