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

holocene: smart contract changes #358

Merged
merged 32 commits into from
Sep 18, 2024
Merged

holocene: smart contract changes #358

merged 32 commits into from
Sep 18, 2024

Conversation

tynes
Copy link
Contributor

@tynes tynes commented Aug 28, 2024

Description

This PR is the spec for:

We are explicitly not scoping #122 because it will result in a large diff to the proofs. In the future we can work on proof optimizations.

@tynes tynes linked an issue Aug 28, 2024 that may be closed by this pull request
@tynes tynes changed the title holocene: standard L2 genesis holocene: static L1 attributes Aug 29, 2024
@tynes tynes changed the title holocene: static L1 attributes holocene: smart contract changes Aug 30, 2024
@tynes
Copy link
Contributor Author

tynes commented Sep 3, 2024

The permit2 predeploy has the L2 chainid embedded in the bytecode. We need a way to handle this, I think we should just wipe the chainid to by 0 so it just uses block.chainid rather than a cached version

@tynes
Copy link
Contributor Author

tynes commented Sep 4, 2024

We need to think about the semantics of the upgrade.

For the L1Block storage part of the upgrade, we either need to:

  • Include a "migration contract" that deterministically migrates the state
  • Have fallbacks in each implementation contract that try to read from L1Block then fall back to state

Both have tradeoffs

The migration contract approach would look like upgrading the L1Block contract to a contract that is able to make a bunch of calls to get the data it needs and then storing it in its storage at the correct locations. So this would be fetching the storage values, for example calling L2CrossDomainMessenger.otherMessenger. We would need to make sure that all of the values can be accessed for this to work. The problem with this approach is that it will use a lot of gas and we need to be mindful of not using too much gas during the upgrade, otherwise it will conflict with user deposits. This is a risk we will always face until we have deposit queue. We could also make the semantics such that the deposit transactions are done over multiple blocks, but this is not flexible with certain configurations of the OP Stack.

The fallback approach will not force the storage migration to ever happen and we will likely be stuck with the fallback forever or at least a good amount of time until we can be sure that a SystemConfig.initialize does send all of the correct information to L2

@roberto-bayardo
Copy link
Contributor

overall this LGTM other than the unresolved comments.

@BlocksOnAChain
Copy link
Contributor

Async reminder:
@protolambda feel free to add your thoughts on any potential risks we might have with this approach.

@protolambda
Copy link
Contributor

@BlocksOnAChain no immediate concerns.

From a purist view, I like if the post-genesis, but pre-user, state changes are immediately after genesis, rather than at any point (there may be gaps, because of the fixed block time). Should not be a concern if deposits are only enabled after the post-genesis system deposits complete.

And the 1559 fee parameters have fun lower/upper bound cases, but won't brick the system as long as they can be modified through L1-initiated deposits.

@tynes
Copy link
Contributor Author

tynes commented Sep 18, 2024

I will rebase this before merge

This scopes out the work for implementing the standard L2 genesis smart
contract changes. The additional diff on top of this smart contract work
is defining the network upgrade transactions, the public interface for
the `SystemConfig` for setting these values and the enum `ConfigType`
definition.
@tynes
Copy link
Contributor Author

tynes commented Sep 18, 2024

We need to think about the semantics of the upgrade.

For the L1Block storage part of the upgrade, we either need to:

  • Include a "migration contract" that deterministically migrates the state
  • Have fallbacks in each implementation contract that try to read from L1Block then fall back to state

Both have tradeoffs

The migration contract approach would look like upgrading the L1Block contract to a contract that is able to make a bunch of calls to get the data it needs and then storing it in its storage at the correct locations. So this would be fetching the storage values, for example calling L2CrossDomainMessenger.otherMessenger. We would need to make sure that all of the values can be accessed for this to work. The problem with this approach is that it will use a lot of gas and we need to be mindful of not using too much gas during the upgrade, otherwise it will conflict with user deposits. This is a risk we will always face until we have deposit queue. We could also make the semantics such that the deposit transactions are done over multiple blocks, but this is not flexible with certain configurations of the OP Stack.

The fallback approach will not force the storage migration to ever happen and we will likely be stuck with the fallback forever or at least a good amount of time until we can be sure that a SystemConfig.initialize does send all of the correct information to L2

I solved this with a setHolocene function on the L1Block contract that does the storage migration

@tynes tynes marked this pull request as ready for review September 18, 2024 16:16
@tynes tynes merged commit fbe5f81 into main Sep 18, 2024
1 check passed
@tynes tynes deleted the feat/standard-l2-genesis branch September 18, 2024 16:17
blmalone pushed a commit that referenced this pull request Sep 26, 2024
* holocene: standard L2 genesis

This scopes out the work for implementing the standard L2 genesis smart
contract changes. The additional diff on top of this smart contract work
is defining the network upgrade transactions, the public interface for
the `SystemConfig` for setting these values and the enum `ConfigType`
definition.

* lint

* lint: escape

* specs: fixup

* specs: fixup

* specs: fixup

* lint: fix

* lint: fix

* specs: update

* specs: lintspecs: lintspecs: lintspecs: lintspecs: lintspecs: lintspecs:
lintspecs: lint

* lint: fix

* specs: cleanup

* specs: toc

* specs: update

* toc: update

* specs: fix

* lint: fix

* lint: fix

* lint: fix

* lint

* specs: update

* lint: specs

* specs: update

* specs: more updates

* specs: toc

* specs: update name

* specs: update

* specs: specify initialize

* specs: toc

* lint: fix

* specs: delete dead spec

* specs: lint fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

L2 Genesis Simplification (L2 MCP)
5 participants