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

Add opcm upgrades spec #468

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Add opcm upgrades spec #468

wants to merge 21 commits into from

Conversation

maurelian
Copy link
Contributor

Description

  1. Updates the spec to match the current implementation.
  2. Adds specs for upgrade() based on the design doc.

Note that I have included the addGameType() method discussed in the design doc, but serious questions have come up around its feasibility. That content is included for discussion, but can be reverted with this commit: 115c61e

@mds1 mds1 requested a review from blmalone December 2, 2024 22:53
Copy link
Contributor

@blmalone blmalone left a comment

Choose a reason for hiding this comment

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

I'm about 50% the way through this, I'll finish it off soon.

specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Show resolved Hide resolved
Copy link
Contributor

@blmalone blmalone left a comment

Choose a reason for hiding this comment

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

This is looking good so far. Have some comments and questions.

specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Show resolved Hide resolved
specs/experimental/op-contracts-manager.md Outdated Show resolved Hide resolved
Copy link
Contributor

@blmalone blmalone left a comment

Choose a reason for hiding this comment

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

LGTM

value to `true`. The `upgrade` function body should be empty unless it is used to set a new state
variable added to that contract since the last upgrade.

#### `NewChainConfig` struct
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the following content below:


By way of example, if an upgrade is adding a new variable address foo to the SystemConfig contract, for
an upgrade named Example, the struct could have the following definition:

struct NewChainConfigForExampleUpgrade {
  address systemConfigFoo;
}

We could create a structure in this document wherein each upgrade is expected to document the specific struct required, but I think this is sufficient instruction for an implementer, and I'm hesitant to add that overhead to each upgrade.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or more chains.

```solidity
struct NewGameConfig {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should define the game types and the definitions per game type. This spec is not clear enough to enable a second implementation or a reviewer to know that an impl is correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having just learned that the Proofs contracts refactor has been deprioritized, I will need to rewrite this section. Will let you know when that's done.

Copy link
Contributor Author

@maurelian maurelian Dec 11, 2024

Choose a reason for hiding this comment

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

This commit should address your comment:
7703c51

uint32 blobBasefeeScalar;
uint256 l2ChainId;
// The correct type is AnchorStateRegistry.StartingAnchorRoot[] memory,
// but OP Deployer does not yet support structs.
Copy link
Contributor

Choose a reason for hiding this comment

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

support arrays? Roles is a struct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The limitation is that neither the setters, nor getters on the Input/Output contracts that op-deployer uses be a complex/reference type, because those I/O contracts are simulated as predeploys in go code, and that simulation does not have the ability to handle the more complicated encodings.

That however is an implementation detail specific to the monorepo, which would not be required for another implementer to know, so I've removed these comments which had been copied from the impl source.

I've also removed the monorepo specific type wrappers from the DeployInput and replaced them with their simple type definitions (ie. Duration -> uint64, Claim -> bytes32).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -379,7 +379,7 @@ Address:

**Description:** Account authorized to change values in the SystemConfig contract. All configuration is stored on L1 and
picked up by L2 as part of the [derivation](./derivation.md) of the L2 chain.<br/>
**Administrator:** <br/>
**Administrator:** [L1 Proxy Admin](#admin-roles)<br/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

noticed this was missing. Other changes in this file are either from linting or my IDE's formatting, but are purely cosmetic.

/// format `op-contracts/vX.Y.Z`.
function l1ContractsRelease() external view returns (string memory);
/// @notice Represents the interface version so consumers know how to decode the DeployOutput struct
function OUTPUT_VERSION() external view returns (uint256);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we mixing snake case and camel case in the interface? We generally agreed on not doing that because it introduces tech debt if we move from something being an immutable to not. This couples the implementation details to the interface

Copy link
Contributor

@blmalone blmalone left a comment

Choose a reason for hiding this comment

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

one comment about how salts are computed

struct Implementation {
address logic; // Address containing the deployed logic contract.
bytes4 initializer; // Function selector for the initializer.
keccak256(abi.encode(l2ChainId, saltMixer))
Copy link
Contributor

@blmalone blmalone Dec 11, 2024

Choose a reason for hiding this comment

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

The implementation of salts have now been simplied as per this pr: ethereum-optimism/optimism#13273

Now all salts are computed the same way. So both proxied and non-proxied contracts have their salts computed as:

keccak256(abi.encode(_l2ChainId, _saltMixer, _contractName));

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.

5 participants