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

feat: robust deployment script #16

Merged
merged 2 commits into from
Jul 29, 2024

Conversation

yiweichi
Copy link
Member

Problem:
The deployment script is not reliable with a public endpoint, due to gas price spike and other errors.
Solution:
To address this, we enable resume when deployment fails. Basically there are four types of transactions:

  1. deploy contracts: check if contracts already deployed, if so skip it.
  2. upgrade contracts: check the implementation of the contracts is already the right contract, if so skip it.
  3. initialize contracts: check if contracts already initialized, if so skip it.
  4. Other transactions: check corresponding state of contracts see if should skip.
    BTW, although seems the problem only happens in L1, still we no sure if there are potential problem in L2, besides we deploy both L1/L2 in one shell script now. If we think it's redundant, we can revert commit "feat: l2 robust deployment script".

Copy link

@dghelm dghelm left a comment

Choose a reason for hiding this comment

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

LGTM -- marked some questions, but nothing blocking on my end.


ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).addSequencer(L1_COMMIT_SENDER_ADDR);
ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).addProver(L1_FINALIZE_SENDER_ADDR);
if (!ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).isSequencer(L1_COMMIT_SENDER_ADDR)) {
Copy link

Choose a reason for hiding this comment

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

Follow-up: We should consider logging existing Sequencers and Provers if this function adds new ones and there is already one defined. This could be a risky security oversight if people re-run a script not realizing they've enabled multiple commit senders.

Copy link
Member Author

@yiweichi yiweichi Jul 26, 2024

Choose a reason for hiding this comment

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

Sequencers in contract are saving in a mapping, this makes it hard to log existing sequencers.
We can try to save all sequencers address in a local file, but this seems don't prevent people add sequencers in another environment different from the local file.

if (!ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).isSequencer(L1_COMMIT_SENDER_ADDR)) {
ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).addSequencer(L1_COMMIT_SENDER_ADDR);
}
if (!ScrollChain(L1_SCROLL_CHAIN_PROXY_ADDR).isProver(L1_FINALIZE_SENDER_ADDR)) {
Copy link

Choose a reason for hiding this comment

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

Same follow-up as above.

scripts/deterministic/DeployScroll.s.sol Show resolved Hide resolved
scripts/deterministic/DeployScroll.s.sol Show resolved Hide resolved
@yiweichi
Copy link
Member Author

Let's merge this branch since this feature required urgently. And follow up logging existing Sequencers and Provers in other PRs.

@yiweichi yiweichi merged commit f18a59a into feat-deterministic-deployment Jul 29, 2024
3 checks passed
@yiweichi yiweichi deleted the feat-robust-deployment branch July 29, 2024 10:32
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