Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Set console caller and signer when executing closures. #2525

Draft
wants to merge 4 commits into
base: staging
Choose a base branch
from

Conversation

d0cd
Copy link
Contributor

@d0cd d0cd commented Aug 2, 2024

This PR ensures that the console caller and signer registers are appropriately set when executing a closure.

The CI run is here.

use circuit::Eject;

// Set the transaction signer.
registers.set_signer(signer.eject_value());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you wrap the two new sets with if let CallStack::Execute(..) = registers.call_stack() just like we do below? Then we can keep the use Eject to just within the Execute blocks. I hope the tests still pass then O:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we actually want to do that? In the corresponding logic in execute_function we set in all modes, not just CallStack::Execute.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm good call out. I guess we can leave the PR as is then.

I appended a diff to test if wrapping all of the console sets in Execute mode would work, and indeed the tests still pass (modulo requiring new expectations because I changed a test). Maybe this can inform a hypothetical future refactor of execute_{function, closure}.

diff.txt

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