itests: add event matrix tests for realtime eth filters and subscriptions

This commit is contained in:
Ian Davis
2023-01-20 14:01:25 +00:00
parent 1ea57740aa
commit c5ed5dd254
4 changed files with 876 additions and 593 deletions
+9 -4
View File
@@ -1016,6 +1016,8 @@ func (e *EthEvent) EthNewFilter(ctx context.Context, filterSpec *ethtypes.EthFil
return ethtypes.EthFilterID{}, err
}
fmt.Printf("REMOVEME: EthNewFilter.f=%+v\n", f)
return ethtypes.EthFilterID(f.ID()), nil
}
@@ -1140,13 +1142,16 @@ func (e *EthEvent) EthSubscribe(ctx context.Context, eventType string, params *e
keys := map[string][][]byte{}
if params != nil {
for idx, vals := range params.Topics {
if len(vals) == 0 {
continue
}
// Ethereum topics are emitted using `LOG{0..4}` opcodes resulting in topics1..4
key := fmt.Sprintf("topic%d", idx+1)
keyvals := make([][]byte, len(vals))
for i, v := range vals {
keyvals[i] = v[:]
for _, v := range vals {
buf := make([]byte, len(v[:]))
copy(buf, v[:])
keys[key] = append(keys[key], buf)
}
keys[key] = keyvals
}
}