Skip to content

smite-ir: split determinism out of has_side_effects - #198

Open
devvaansh wants to merge 1 commit into
lnfuzz:masterfrom
devvaansh:operation-is-deterministic
Open

smite-ir: split determinism out of has_side_effects#198
devvaansh wants to merge 1 commit into
lnfuzz:masterfrom
devvaansh:operation-is-deterministic

Conversation

@devvaansh

@devvaansh devvaansh commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #155, where we agreed LookupShortChannelId doesn't really have side effects and that CSE wants a separate question answered.

has_side_effects was being asked three different questions by three callers: DCE wants to know whether an instruction can be dropped, CSE wants to know whether two instructions can be merged, and InstructionReorderMutator wants to know whether an instruction's position matters. Those coincide for every operation we had until LookupShortChannelId, which is read-only but nondeterministic, so it was marked as side-effecting to keep CSE away from it.

Add is_deterministic, and is_pure on top of it, so each caller asks what it actually means. DCE keeps using has_side_effects, while CSE and the reorder mutator switch to is_pure. LookupShortChannelId becomes side-effect free and nondeterministic, and CreateFundingTransaction and the Recv operations are marked nondeterministic too since their results come from the wallet and from the target.

The only behavior change is that DCE can now drop a LookupShortChannelId whose result nothing consumes. I checked every operation, and it is the only one where !is_pure() differs from has_side_effects(), so CSE's skip set and the reorder mutator's candidate set are unchanged.

Ref: #155

@devvaansh
devvaansh force-pushed the operation-is-deterministic branch from 6891208 to ef5f24c Compare August 10, 2026 16:13
LookupShortChannelId is a read-only operation, but it was marked as having
side effects to stop CSE from merging two lookups whose results differ.
Add is_deterministic and is_pure so CSE and the reorder mutator can ask
about purity while DCE keeps asking about side effects.
@devvaansh
devvaansh force-pushed the operation-is-deterministic branch from ef5f24c to 9b4dcf2 Compare August 10, 2026 19:34
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.

1 participant