Fake EVM - check if log filters match#21771
Conversation
|
👋 tarcisiozf, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM (test-fake behavior change + potential concurrency hazards around trigger registration/unregistration)
Enhances FakeEVMChain’s manual log trigger behavior so that emitted logs are only delivered to consumers when they match the filter registered for the trigger, aligning test semantics more closely with production log filtering.
Changes:
- Store the
FilterLogTriggerRequestused atRegisterLogTriggertime and consult it duringManualTrigger. - Add
fakeEVMLogMatchesFilterto apply address/topic matching semantics before emitting a manual trigger. - Delete stored trigger state on
UnregisterLogTrigger.
Comments suppressed due to low confidence (1)
core/capabilities/fakes/evm_chain.go:264
- ManualTrigger sends on fc.callbackCh[triggerID] without checking that a trigger was registered (or that it hasn’t been unregistered). If the key is missing, the lookup yields a nil channel and the goroutine will block forever; if Unregister deletes concurrently it can also race/panic. Fetch the channel (and filter) once (ideally under the same lock as Register/Unregister), return an error when triggerID is unknown, and use the captured channel inside the goroutine.
func (fc *FakeEVMChain) ManualTrigger(ctx context.Context, triggerID string, log *evmcappb.Log) error {
fc.eng.Debugf("ManualTrigger: %s", log.String())
if filter, ok := fc.logTriggerFilters[triggerID]; ok && filter != nil {
if !fakeEVMLogMatchesFilter(log, filter) {
return fmt.Errorf("log does not match registered filter for trigger %s: address or topic mismatch", triggerID)
}
}
go func() {
select {
case fc.callbackCh[triggerID] <- fc.createManualTriggerEvent(log):
// Successfully sent trigger response
cc39d49 to
ceb98bc
Compare
ceb98bc to
cbdf764
Compare
|
|
don't. it's not log files. pavel remove the cookie or truncate it. it's
timeouts are not the same as on chain delivery is all. one mountain at a
time guys.
…On Tue, Mar 31, 2026, 2:20 PM Iva Brajer ***@***.***> wrote:
Merged #21771 <#21771>
into develop.
—
Reply to this email directly, view it on GitHub
<#21771?email_source=notifications&email_token=BJR4SAELUXPQV4XGSQQFBFD4TQK63A5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTENBQHA3DGNJVGY4TNJTSMVQXG33OVJZXKYTTMNZGSYTFMSSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#event-24086355696>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BJR4SAG3P2GSMQACY7JY3TL4TQK63AVCNFSM6AAAAACXGB4MS2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRUGA4DMMZVGU3DSNQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***
com>
|
* check if log filters match * changeset * use errors instead of bools * check topic0 * add test cases * fix lint




DEVSVCS-2932
This pull request enhances the
FakeEVMChainin the testing fakes for EVM capabilities by adding support for log trigger filters that closely mirror production log filtering semantics. The main improvements ensure that manual log triggers are only processed if they match the registered filter, providing more realistic and robust test behavior.