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

remove UseInboxContract and optimize getTxSucceed #59

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

blockchaindevsh
Copy link

@blockchaindevsh blockchaindevsh commented Sep 15, 2024

As disccussed previously, we want to remove the UseInboxContract option and always check tx status.

This PR also optimizes getTxSucceed to return a smaller map by filtering with batch inbox address.

@qizhou qizhou requested a review from qzhodl September 16, 2024 18:00
@qizhou
Copy link

qizhou commented Sep 16, 2024

LGTM. Please wait for @qzhodl 's review before merging.

@qzhodl
Copy link

qzhodl commented Sep 17, 2024

LGTM. Please wait for @qzhodl 's review before merging.

Sorry, but I may not have the full context of this change or the related discussion. Could you clarify the reasoning behind this change? Have there been any assumption changes, such as always assuming that the batch inbox is now a smart contract?

@blockchaindevsh
Copy link
Author

blockchaindevsh commented Sep 17, 2024

LGTM. Please wait for @qzhodl 's review before merging.

Sorry, but I may not have the full context of this change or the related discussion. Could you clarify the reasoning behind this change? Have there been any assumption changes, such as always assuming that the batch inbox is now a smart contract?

There's really no good way to check if it's an EOA, think of this case:

Initially there's no code for an address A, and we think it's an EOA.

But in theory it can be a CREATE/CREATE2 address, and in the next block, there can be a contract deployed at address A.

So instead of checking if there's code at address A every block, we decided to check tx status each time.

@blockchaindevsh
Copy link
Author

@qizhou I made another change to getTxSucceed for optimization in this PR, since the diff is small and to avoid conflict if done in another PR.

@qizhou
Copy link

qizhou commented Sep 17, 2024

@qizhou I made another change to getTxSucceed for optimization in this PR, since the diff is small and to avoid conflict if done in another PR.

Could you please update the title and description accordingly? Current title and description seem to be misleading.

@blockchaindevsh blockchaindevsh changed the title remove UseInboxContract remove UseInboxContract and optimize getTxSucceed Sep 17, 2024
@blockchaindevsh
Copy link
Author

@qizhou I made another change to getTxSucceed for optimization in this PR, since the diff is small and to avoid conflict if done in another PR.

Could you please update the title and description accordingly? Current title and description seem to be misleading.

Done.

@qizhou
Copy link

qizhou commented Sep 17, 2024

LGTM. Please wait for @qzhodl 's review before merging.

Sorry, but I may not have the full context of this change or the related discussion. Could you clarify the reasoning behind this change? Have there been any assumption changes, such as always assuming that the batch inbox is now a smart contract?

There's really no good way to check if it's an EOA, think of this case:

Initially there's no code for an address A, and we think it's an EOA.

But in theory it can be a CREATE/CREATE2 address, and in the next block, there can be a contract deployed at address A.

So instead of checking if there's code at address A every block, we decided to check tx status each time.

I guess you haven't answered Qiang's question directly. My understanding is that the PR simplifies the smart contract inbox support (removing UseInboxContract flag) while still supports EOA if the inbox has no code.

// Don't set GasLimit when UseInboxContract is enabled so that later on `EstimateGas` will be called
if !l.RollupConfig.UseInboxContract {
// Don't set GasLimit when inbox is contract so that later on `EstimateGas` will be called
if !*l.inboxIsEOA {
Copy link

Choose a reason for hiding this comment

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

If the inbox is changed from an EOA to a smart contract, would we need to restart the batch, or is the system able to handle this transition smoothly?

Copy link
Author

@blockchaindevsh blockchaindevsh Sep 18, 2024

Choose a reason for hiding this comment

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

This is a great question!

(Note we don't consider dynamic inbox for this PR, instead we assume it's a fixed address that never changes, but the content can change for the reason here.)

I think in theory we can not reliably cache the result, but in reality the chance it actually happens is small, so maybe it's good enough if we just clear the cache(set inboxIsEOA to nil) when a transaction failure is spotted afterwards?

Copy link
Author

Choose a reason for hiding this comment

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

@qzhodl Please take another look at the latest commit, which applies the above change.

@blockchaindevsh blockchaindevsh merged commit 6758f1e into op-es Sep 24, 2024
2 checks passed
@blockchaindevsh blockchaindevsh deleted the remove_UseInboxContract branch September 24, 2024 00:53
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.

4 participants