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

System contract for registering external callbacks to be executed at the end of a batch. [WIP] #2135

Merged
merged 20 commits into from
Nov 14, 2024

Conversation

StefanIliev545
Copy link
Contributor

Why this change is needed

In order to implement privacy sensitive games for gas we need a new system contract that enables registering callbacks to be called at the end of a batch from the system

What changes were made as part of this PR

Please provide a high level list of the changes made

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@@ -0,0 +1,19 @@
# Public Callbacks Contract

The PublicCallbacks contract provides a mechanism for registering and executing callbacks in a gas-efficient manner. It is designed to be used by contracts that need to hide their gas cost whenever executing something and make the state change immutable if proxied.
Copy link
Collaborator

Choose a reason for hiding this comment

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

not only hide gas cost. Also make the action impossible to revert if the result is not positive

Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

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

looks good in principle. Nice work!
Left a few minor comments

callbacks[nextCallbackId++] = Callback({target: callback, data: data, value: value, baseFee: block.basefee});
}

function register(bytes calldata callback) external payable {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this for?

contracts/src/system/PublicCallbacks.sol Outdated Show resolved Hide resolved
go/enclave/components/batch_executor.go Show resolved Hide resolved
go/enclave/evm/evm_facade.go Show resolved Hide resolved
contracts/src/system/PublicCallbacks.sol Outdated Show resolved Hide resolved
contracts/src/system/PublicCallbacks.sol Show resolved Hide resolved
contracts/src/system/PublicCallbacks.sol Outdated Show resolved Hide resolved
contracts/src/system/PublicCallbacks.sol Outdated Show resolved Hide resolved
contracts/src/system/PublicCallbacks.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@tudor-malene tudor-malene left a comment

Choose a reason for hiding this comment

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

LGTM.
Nice work!

@StefanIliev545 StefanIliev545 merged commit 7e7533d into main Nov 14, 2024
3 checks passed
@StefanIliev545 StefanIliev545 deleted the siliev/two-step-games branch November 14, 2024 14:02
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