Skip to content

Commit

Permalink
feat: Return startingAnchorInputs as bytes
Browse files Browse the repository at this point in the history
The op-deployer tooling does not support structs, therefore we need to
return a more generic type for compatibility.
  • Loading branch information
maurelian committed Sep 19, 2024
1 parent 733b7b8 commit b187867
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions op-chain-ops/deployer/opsm/opchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ type DeployOPChainInput struct {
Proposer common.Address
Challenger common.Address

BasefeeScalar uint32
BlobBaseFeeScalar uint32
L2ChainId *big.Int
Opsm common.Address
BasefeeScalar uint32
BlobBaseFeeScalar uint32
L2ChainId *big.Int
StartingAnchorRoots []byte
Opsm common.Address
}

func (input *DeployOPChainInput) InputSet() bool {
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/deployer/pipeline/opchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func DeployOPChain(ctx context.Context, env *Env, intent *state.Intent, st *stat
BasefeeScalar: 1368,
BlobBaseFeeScalar: 801949,
L2ChainId: chainID.Big(),
StartingAnchorRoots: []byte{},
Opsm: st.ImplementationsDeployment.OpsmAddress,
},
)
Expand Down
6 changes: 4 additions & 2 deletions packages/contracts-bedrock/scripts/DeployOPChain.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ contract DeployOPChainInput is BaseDeployIO {
return _l2ChainId;
}

function startingAnchorRoots() public view returns (AnchorStateRegistry.StartingAnchorRoot[] memory) {
function startingAnchorRoots() public view returns (bytes memory) {
// TODO: figure out how to assert this properly.
// Per mofi: It may make sense to not set any startingAnchor roots if you're running permissioned games for a
// new chain and you don't yet have a genesis state available for the initial anchor.
// And provided it'll remain permissioned unless the anchor state is fixed.
require(_startingAnchorRoots.length > 0, "DeployOPChainInput: not set");
return _startingAnchorRoots;
// The op-deployer tooling does not support structs, therefore we need to
// return a more generic type for compatibility.
return abi.encode(_startingAnchorRoots);
}

// TODO: Check that opsm is proxied and it has an implementation.
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/src/L1/OPStackManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract OPStackManager is ISemver, Initializable {
uint32 basefeeScalar;
uint32 blobBasefeeScalar;
uint256 l2ChainId;
AnchorStateRegistry.StartingAnchorRoot[] startingAnchorRoots;
bytes startingAnchorRoots;
}

/// @notice The full set of outputs from deploying a new OP Stack chain.
Expand Down

0 comments on commit b187867

Please sign in to comment.