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

Adopt transparent upgradeability pattern #864

Merged
merged 24 commits into from
Jul 11, 2024

Conversation

okkothejawa
Copy link
Contributor

@okkothejawa okkothejawa commented Jul 9, 2024

Description

  • Adopts transparent upgradeability pattern instead of UUPS pattern in system contracts, as UUPSUpgradeable contract which needs to be inherited in all implementation contracts have an immutable variable which makes our pre-deployment scheme inconvenient. Instead, we adopt transparent proxies like other rollups such as Optimism and Scroll which doesn't have this issue.
  • Introduces two scripts, GenesisGenerator.s.sol and GenesisToEvmJson.py. The former is a Foundry script that sets the genesis state directly through Solidity testing environment, and this approach has significant advantages over the old method of manually setting genesis files as it is less error-prone and more intuitive to set. The latter takes the generated genesis data and appends it with extra information and formats it to be compatible with our existing evm.json format.
  • Introduces a new make command, make genesis to trigger the scripts above. This command should be run after all changes to the system contracts and any genesis change.
  • Adds upgradeability test with a scenario that upgrades the BitcoinLightClient with an obviously false implementation that returns 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead for any queried block hash. As this is not possible for any actual block, successful confirmation of this shows that the behavior is updated.

Linked Issues

Testing

Existing tests were adapted.

Docs

@okkothejawa okkothejawa changed the title Adopt transparent upgradeability pattern WIP Adopt transparent upgradeability pattern Jul 9, 2024
@okkothejawa okkothejawa changed the title WIP Adopt transparent upgradeability pattern Adopt transparent upgradeability pattern Jul 10, 2024
bin/citrea/tests/evm/ethers_js/test.js Show resolved Hide resolved
bin/citrea/tests/evm/mod.rs Outdated Show resolved Hide resolved
crates/evm/src/evm/system_contracts/Makefile Outdated Show resolved Hide resolved
@eyusufatik
Copy link
Member

evm::test_genesis_contract_call fails on CI

I believe it's not flaky.

Copy link
Member

@eyusufatik eyusufatik left a comment

Choose a reason for hiding this comment

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

see my above comment

@eyusufatik eyusufatik merged commit 2f4cd19 into nightly Jul 11, 2024
9 of 10 checks passed
@eyusufatik eyusufatik deleted the okko/transparent-upgradeable branch July 11, 2024 08:50
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.

E2E bridge contract upgradability tests
2 participants