Skip to content

internal/libhive: anchor --sim regex matching at end of simulator name#1406

Merged
fjl merged 1 commit into
ethereum:masterfrom
danceratopz:add-sim-end-anchor
Mar 16, 2026
Merged

internal/libhive: anchor --sim regex matching at end of simulator name#1406
fjl merged 1 commit into
ethereum:masterfrom
danceratopz:add-sim-end-anchor

Conversation

@danceratopz

Copy link
Copy Markdown
Member

Summary

The --sim flag uses unanchored regex matching (MatchString), so a pattern like engine matches all of:

  • ethereum/engine
  • eth2/engine
  • ethereum/eels/consume-engine

because it appears as a substring of all three names.

This makes it impossible to select a specific simulator when another simulator's name is a superstring.

This concretely affects the addition of consume-enginex (#1403); adding this new simulator means that running ./hive --sim consume-engine changes existing behavior; 2 simulators now get run instead of 1.

Another example candidate in the future would be a new sync2 simulator; it would be impossible to run sync2 without also running sync.

This one-line fix appends $ to the user-supplied regex so patterns must match to the end of the simulator name.

Before

# Runs BOTH consume-engine and consume-enginex
./hive --sim ethereum/eels/consume-engine

After

# Runs only consume-engine
./hive --sim ethereum/eels/consume-engine

# Wildcards still work as expected
./hive --sim 'ethereum/eels/consume-.*'

Note

This is a minor behavior change: bare prefix patterns (e.g., --sim consume-) that previously matched via substring will no longer match unless a wildcard is added (--sim 'consume-.*'). Patterns that ended with a full simulator name (the common case) are unaffected.

@danceratopz danceratopz requested a review from fjl March 16, 2026 13:45
@fjl

fjl commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

I get the idea, but the user can also manually append $ to the regular expression. We have the matching like it is because that's how go test also works.

That said, I am not against making the matching more strict.

@danceratopz

Copy link
Copy Markdown
Member Author

but the user can also manually append $ to the regular expression.

To have this as default was motivated by the fact that if we merge #1403 (consume-enginex), users will have to suddenly start appending $ (because a new simulator got added). I.e., an existing hive command ./hive --sim consume-engine changes behavior because a new simulator was added. Also, I really like the name enginex and I'd prefer not to change it :)

@fjl

fjl commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

it could also be called xengine

@fjl

fjl commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

I'm just kidding

@fjl fjl merged commit bca75d8 into ethereum:master Mar 16, 2026
6 checks passed
@fjl fjl changed the title libhive: anchor --sim regex matching at end of simulator name internal/libhive: anchor --sim regex matching at end of simulator name Mar 16, 2026
Soubhik-10 added a commit to Soubhik-10/hive that referenced this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants