Skip to content

Commit 02115fb

Browse files
ImTeispacesailor24
authored andcommitted
Use engine API that matches hardfork version (#9253)
* Use engine API that matches HF * Simplify engine client code by using EngineAPIVersion * Return full method string from engine api version methods * FCUVersion takes payload attributes * Use a proper method * Handle switch default case explicitly * Return fcuV3 if attrs is nil * Add test cases for engine api version methods
1 parent 1af01ea commit 02115fb

File tree

5 files changed

+32
-21
lines changed

5 files changed

+32
-21
lines changed

.circleci/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,10 @@ workflows:
15081508
name: op-challenger-tests
15091509
module: op-challenger
15101510
requires: ["go-mod-download"]
1511+
- go-test:
1512+
name: op-dispute-mon-tests
1513+
module: op-dispute-mon
1514+
requires: ["go-mod-download"]
15111515
- go-test:
15121516
name: op-conductor-tests
15131517
module: op-conductor
@@ -1635,6 +1639,9 @@ workflows:
16351639
requires:
16361640
- go-mod-download
16371641
- devnet:
1642+
matrix:
1643+
parameters:
1644+
devnet_fpac: ["false", "true"]
16381645
requires:
16391646
- pnpm-monorepo
16401647
- op-batcher-docker-build

op-bindings/bindings/faultdisputegame.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-bindings/bindings/faultdisputegame_more.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

op-chain-ops/cmd/check-ecotone/main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,10 @@ func execTx(ctx context.Context, to *common.Address, data []byte, expectRevert b
335335
if err != nil {
336336
return fmt.Errorf("failed to get chainID: %w", err)
337337
}
338-
tx := types.NewTx(&types.DynamicFeeTx{ChainID: chainID, Nonce: nonce,
339-
GasTipCap: tip, GasFeeCap: maxFee, Gas: 500000, To: to, Data: data})
338+
tx := types.NewTx(&types.DynamicFeeTx{
339+
ChainID: chainID, Nonce: nonce,
340+
GasTipCap: tip, GasFeeCap: maxFee, Gas: 500000, To: to, Data: data,
341+
})
340342
signer := types.NewCancunSigner(chainID)
341343
signedTx, err := types.SignTx(tx, signer, env.key)
342344
if err != nil {
@@ -657,8 +659,9 @@ func checkL1Fees(ctx context.Context, env *actionEnv) error {
657659
return fmt.Errorf("failed to retrieve matching L1 block %s: %w", headRef, err)
658660
}
659661
gasTip := big.NewInt(2 * params.GWei)
662+
baseFee := (*uint256.Int)(&payload.ExecutionPayload.BaseFeePerGas).ToBig()
660663
gasMaxFee := new(big.Int).Add(
661-
new(big.Int).Mul(big.NewInt(2), payload.ExecutionPayload.BaseFeePerGas.ToBig()), gasTip)
664+
new(big.Int).Mul(big.NewInt(2), baseFee), gasTip)
662665
to := common.Address{1, 2, 3, 5}
663666
txData := &types.DynamicFeeTx{
664667
ChainID: rollupCfg.L2ChainID,

packages/contracts-bedrock/scripts/L2Genesis.s.sol

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,24 @@ interface IInitializable {
2323
}
2424

2525
/// @dev The general flow of adding a predeploy is:
26-
/// 1. _setProxies uses vm.etch to set the Proxy.sol deployed bytecode for proxy address `0x420...000` to `0x420...000 + PROXY_COUNT - 1`.
26+
/// 1. _setPredeployProxies uses vm.etch to set the Proxy.sol deployed bytecode for proxy address `0x420...000` to `0x420...000 + PROXY_COUNT - 1`.
2727
/// Additionally, the PROXY_ADMIN_ADDRESS and PROXY_IMPLEMENTATION_ADDRESS storage slots are set for the proxy
2828
/// address.
29-
/// 2. vm.etch sets the deployed bytecode for each predeploy at the implementation address (i.e. `0xc0d3` namespace).
30-
/// 3. The `initialize` method is called at the implementation address with zero/dummy vaules if it exists.
31-
/// 4. The `initialize` method is called at the proxy address with actual vaules if it exists.
29+
/// 2. `vm.etch` sets the deployed bytecode for each predeploy at the implementation address (i.e. `0xc0d3` namespace).
30+
/// 3. The `initialize` method is called at the implementation address with zero/dummy vaules if the method exists.
31+
/// 4. The `initialize` method is called at the proxy address with actual vaules if the method exists.
3232
/// 5. A `require` check to verify the expected implementation address is set for the proxy.
3333
/// @notice The following safety invariants are used when setting state:
3434
/// 1. `vm.getDeployedBytecode` can only be used with `vm.etch` when there are no side
3535
/// effects in the constructor and no immutables in the bytecode.
3636
/// 2. A contract must be deployed using the `new` syntax if there are immutables in the code.
3737
/// Any other side effects from the init code besides setting the immutables must be cleaned up afterwards.
38-
/// 3. A contract is deployed using the `new` syntax because it's not proxied, but still needs to be set
39-
/// at a specific address. Because just deploying a new instance doesn't give us the contract at our desired
40-
/// address,
41-
/// we must use `vm.etch` to set the deployed bytecode, and `vm.store` to set any storage slots. Lastly, we reset
42-
/// the account the contract was initially deployed by so it's not included in the `vm.dumpState`.
38+
/// 3. A contract is deployed using the `new` syntax, however it's not proxied and is still expected to exist at a
39+
/// specific implementation address (i.e. `0xc0d3` namespace). In this case we deploy an instance of the contract
40+
/// using `new` syntax, use `contract.code` to retrieve it's deployed bytecode, `vm.etch` the bytecode at the
41+
/// expected implementation address, and `vm.store` to set any storage slots that are
42+
/// expected to be set after a new deployment. Lastly, we reset the account code and storage slots the contract
43+
/// was initially deployed to so it's not included in the `vm.dumpState`.
4344
contract L2Genesis is Script, Artifacts {
4445
uint256 constant PROXY_COUNT = 2048;
4546
uint256 constant PRECOMPILE_COUNT = 256;
@@ -77,9 +78,9 @@ contract L2Genesis is Script, Artifacts {
7778
/// to generate a L2 genesis alloc.
7879
/// @notice The alloc object is sorted numerically by address.
7980
function run() public {
80-
_setPrecompiles();
81-
_setProxies();
82-
_setImplementations();
81+
_dealEthToPrecompiles();
82+
_setPredeployProxies();
83+
_setPredeployImplementations();
8384

8485
/// Reset so its not included state dump
8586
vm.etch(address(cfg), "");
@@ -90,7 +91,7 @@ contract L2Genesis is Script, Artifacts {
9091

9192
/// @notice Give all of the precompiles 1 wei so that they are
9293
/// not considered empty accounts.
93-
function _setPrecompiles() internal {
94+
function _dealEthToPrecompiles() internal {
9495
for (uint256 i; i < PRECOMPILE_COUNT; i++) {
9596
vm.deal(address(uint160(i)), 1);
9697
}
@@ -100,7 +101,7 @@ contract L2Genesis is Script, Artifacts {
100101
/// The Proxy bytecode should be set. All proxied predeploys should have
101102
/// the 1967 admin slot set to the ProxyAdmin predeploy. All defined predeploys
102103
/// should have their implementations set.
103-
function _setProxies() internal {
104+
function _setPredeployProxies() internal {
104105
bytes memory code = vm.getDeployedCode("Proxy.sol:Proxy");
105106
uint160 prefix = uint160(0x420) << 148;
106107

@@ -129,7 +130,7 @@ contract L2Genesis is Script, Artifacts {
129130
/// @notice LEGACY_ERC20_ETH is not being predeployed since it's been deprecated.
130131
/// @dev Sets all the implementations for the predeploy proxies. For contracts without proxies,
131132
/// sets the deployed bytecode at their expected predeploy address.
132-
function _setImplementations() internal {
133+
function _setPredeployImplementations() internal {
133134
_setLegacyMessagePasser();
134135
_setDeployerWhitelist();
135136
_setWETH9();
@@ -350,7 +351,7 @@ contract L2Genesis is Script, Artifacts {
350351
/// @notice There isn't a good way to know if the resulting revering is due to abi mismatch
351352
/// or because it's already been initialized
352353
function _verifyCantReinitialize(address _contract, address _arg) internal {
353-
vm.expectRevert();
354+
vm.expectRevert("Initializable: contract is already initialized");
354355
IInitializable(_contract).initialize(_arg);
355356
}
356357

0 commit comments

Comments
 (0)