-
Notifications
You must be signed in to change notification settings - Fork 0
Fallback Inbox contract changes #278
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
base: celo-integration-rebase-14.1
Are you sure you want to change the base?
Fallback Inbox contract changes #278
Conversation
b09bfab to
62d96d3
Compare
fcd5832 to
9af9291
Compare
| if allocType == AllocTypeEspressoWithoutEnclave { | ||
| batcherPk, err := crypto.HexToECDSA(ESPRESSO_PRE_APPROVED_BATCHER_PRIVATE_KEY) | ||
| // Configure Espresso allocation types | ||
| if allocType == AllocTypeEspresso || allocType == AllocTypeEspressoWithoutEnclave || allocType == AllocTypeEspressoWithEnclave { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have AllocTypeEspresso when we also have *WithEnclave and *WithoutEnclave?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think this is merge shenanigans... Non-prefixed type shouldn't exist.
f08d28d to
33f240a
Compare
shenkeyao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| } | ||
|
|
||
| /// @notice Toggles the active batcher between the TEE and non-TEE batcher. | ||
| function switchBatcher() external onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters that much, but I'd put this function and the new variables into batch authenticator contract to keep BatchInbox surface area minimal, as it's part of the original OP's derivation pipeline.
| if (!batchAuthenticator.validBatchInfo(hash)) { | ||
| revert("Invalid calldata batch"); | ||
| // Non TEE batcher require batcher address authentication | ||
| if (msg.sender != nonTeeBatcher) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this works unfortunately, as derivation pipeline checks that transaction is from one specific batcherAddress that is defined by RollupConfig, let's call it Batch Sender Address for clarity.
I think what we need to do is either keep this as-is and either
- make a similar change to batch authenticator and require fallback batcher to authenticate the batch with the batch inbox before posting
- skip any sort of authentication when
activeIsTeeis false
Both approaches require both TEE and fallback batcher sharing Batch Sender Address, which is... not great.
The first one will at least cleanly separate who can post batches at any given moment - when non-TEE batcher is active, only its batches will be approved. However, this comes at cost of fallback batcher needing to be a modified batcher (essentially our batcher in non-TEE mode)
The second approach will allow through both batchers when activeIsTee is false, but the fallback batcher can be an unmodified OP batcher.
As an alternative, we can make yet another change to the derivation pipeline and introduce a second batcher address there, this would allow us to have our cake and eat it too in terms of batcher modifications (the code as written in this PR would just work and batchers won't need to share Batch Sender Address), but at the cost of yet another change to the derivation pipeline, which I imagine would become even harder to upstream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great catch. I think the better alternative is to modify the derivation pipeline, because it reflects the introduction of a new batcher in the design and at some point we want to be able to support permissionless batching, so why not start moving in that direction anyways. Also IIRC, during the technical meetings we discussed that it would be undesirable to have the two batchers share the same key / identity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point we want to be able to support permissionless batching
Oh, right, I failed to considered that. Yeah, then "don't make more changes to the pipeline" ship has already sailed and we can just as well do it.
…e pass to the constructor.
… the inbox contract.
f5587dc to
e8f100b
Compare
Closes https://app.asana.com/1/1208976916964769/project/1209423958092927/task/1211849813289225?focus=true
This PR:
This PR does not:
Key places to review:
packages/contracts-bedrock/test/L1/BatchInbox.t.sol.How to test this PR:
Things tested
packages/contracts-bedrock/test/L1/BatchInbox.t.sol.