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 {
@@ -545,6 +548,9 @@ func (args *FilterCriteria) UnmarshalJSON(data []byte) error {
545
548
return errors .New ("invalid addresses in query" )
546
549
}
547
550
}
551
+ if len (raw .Topics ) > maxTopics {
552
+ return errExceedMaxTopics
553
+ }
548
554
549
555
// topics is an array consisting of strings and/or arrays of strings.
550
556
// 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 {
565
571
566
572
case []interface {}:
567
573
// or case e.g. [null, "topic0", "topic1"]
574
+ if len (topic ) > maxSubTopics {
575
+ return errExceedMaxTopics
576
+ }
568
577
for _ , rawTopic := range topic {
569
578
if rawTopic == nil {
570
579
// null component, match all
You can’t perform that action at this time.
0 commit comments