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

Improved genesis predeploy, allowing initializing immutables and accessing chainID from constructor. #1838

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

ohijiho
Copy link
Contributor

@ohijiho ohijiho commented Aug 21, 2023

Description

Genesis deploy has restriction that the contract may not use immutable. This restriction can be eliminated by applying a simple fix.

The returndata of contract creation call is the deployed code of the contract, which has initialized immutable values, so instead of the deployedCode from artifact file, using this returndata will allow using immutable in pre-deployed contract.

Additionally, by initializing the EVM context's chainID with the value from the genesis.json file, the constructor can access chainID.

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

Manual tests

Ran predeploy with contract inheriting EIP712, which uses immutables. Checked that it works correctly.

…ss chainID from constructor.

* Instead of using the deployedCode of the artifact file, extract the code from the deployment result.
* Respect the genesis file's chainID when preparing the EVM context.
@github-actions
Copy link

github-actions bot commented Aug 21, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ohijiho
Copy link
Contributor Author

ohijiho commented Aug 21, 2023

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Aug 21, 2023
@igorcrevar igorcrevar self-requested a review August 21, 2023 14:30
Copy link
Contributor

@igorcrevar igorcrevar left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@vcastellm vcastellm left a comment

Choose a reason for hiding this comment

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

LGTM

@vcastellm vcastellm merged commit 49216ad into 0xPolygon:develop Aug 22, 2023
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants