Skip to content

smite-scenarios: deduplicate executor variable resolvers - #232

Open
erickcestari wants to merge 1 commit into
lnfuzz:masterfrom
erickcestari:refactor-exec-func
Open

smite-scenarios: deduplicate executor variable resolvers#232
erickcestari wants to merge 1 commit into
lnfuzz:masterfrom
erickcestari:refactor-exec-func

Conversation

@erickcestari

Copy link
Copy Markdown
Contributor

The 17 resolve_* functions differed only in the matched variant, and the two consume_sent_* functions only in the affine type they voided.

Generate the resolvers with a define_resolver! macro that shares one type_mismatch panic, and replace the consumers with a single consume_affine that takes the expected VariableType.

The 17 `resolve_*` functions differed only in the matched variant, and
the two `consume_sent_*` functions only in the affine type they voided.

Generate the resolvers with a `define_resolver!` macro that shares one
`type_mismatch` panic, and replace the consumers with a single
`consume_affine` that takes the expected `VariableType`.

@Chand-ra Chand-ra left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

&FundingTransaction
);

/// Consumes an affine variable, leaving its slot void so it cannot be used

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Rust doesn't have "voids". What we're doing is replacing the used variable with None.

Something like this would perhaps be better?

Consumes an affine variable, replacing it with `None` to prevent double-use.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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