diff --git a/.circleci/config.yml b/.circleci/config.yml index 01162f0e8194c..aa9936313987b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1516,6 +1516,10 @@ workflows: name: op-challenger-tests module: op-challenger requires: ["go-mod-download"] + - go-test: + name: op-dispute-mon-tests + module: op-dispute-mon + requires: ["go-mod-download"] - go-test: name: op-conductor-tests module: op-conductor diff --git a/op-chain-ops/cmd/check-ecotone/main.go b/op-chain-ops/cmd/check-ecotone/main.go index 1b88bb13be2d7..447ae30a365db 100644 --- a/op-chain-ops/cmd/check-ecotone/main.go +++ b/op-chain-ops/cmd/check-ecotone/main.go @@ -335,8 +335,10 @@ func execTx(ctx context.Context, to *common.Address, data []byte, expectRevert b if err != nil { return fmt.Errorf("failed to get chainID: %w", err) } - tx := types.NewTx(&types.DynamicFeeTx{ChainID: chainID, Nonce: nonce, - GasTipCap: tip, GasFeeCap: maxFee, Gas: 500000, To: to, Data: data}) + tx := types.NewTx(&types.DynamicFeeTx{ + ChainID: chainID, Nonce: nonce, + GasTipCap: tip, GasFeeCap: maxFee, Gas: 500000, To: to, Data: data, + }) signer := types.NewCancunSigner(chainID) signedTx, err := types.SignTx(tx, signer, env.key) if err != nil { @@ -657,8 +659,9 @@ func checkL1Fees(ctx context.Context, env *actionEnv) error { return fmt.Errorf("failed to retrieve matching L1 block %s: %w", headRef, err) } gasTip := big.NewInt(2 * params.GWei) + baseFee := (*uint256.Int)(&payload.ExecutionPayload.BaseFeePerGas).ToBig() gasMaxFee := new(big.Int).Add( - new(big.Int).Mul(big.NewInt(2), payload.ExecutionPayload.BaseFeePerGas.ToBig()), gasTip) + new(big.Int).Mul(big.NewInt(2), baseFee), gasTip) to := common.Address{1, 2, 3, 5} txData := &types.DynamicFeeTx{ ChainID: rollupCfg.L2ChainID, diff --git a/op-chain-ops/cmd/receipt-reference-builder/main.go b/op-chain-ops/cmd/receipt-reference-builder/main.go index e4459d881650f..0418e92193e71 100644 --- a/op-chain-ops/cmd/receipt-reference-builder/main.go +++ b/op-chain-ops/cmd/receipt-reference-builder/main.go @@ -6,11 +6,13 @@ import ( "github.com/mattn/go-isatty" "github.com/urfave/cli/v2" + "golang.org/x/exp/slog" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" opservice "github.com/ethereum-optimism/optimism/op-service" + oplog "github.com/ethereum-optimism/optimism/op-service/log" ) const EnvPrefix = "OP_CHAIN_OPS_RECEIPT_REFERENCE_BUILDER" @@ -75,7 +77,8 @@ var ( ) func main() { - log.Root().SetHandler(log.StreamHandler(os.Stderr, log.TerminalFormat(isatty.IsTerminal(os.Stderr.Fd())))) + color := isatty.IsTerminal(os.Stderr.Fd()) + oplog.SetGlobalLogHandler(log.NewTerminalHandlerWithLevel(os.Stdout, slog.LevelDebug, color)) app := &cli.App{ Name: "receipt-reference-builder", diff --git a/op-e2e/faultproofs/output_cannon_test.go b/op-e2e/faultproofs/output_cannon_test.go index 69573a829e589..364bcab66b984 100644 --- a/op-e2e/faultproofs/output_cannon_test.go +++ b/op-e2e/faultproofs/output_cannon_test.go @@ -213,9 +213,6 @@ func TestOutputCannonDefendStep(t *testing.T) { } func TestOutputCannonStepWithLargePreimage(t *testing.T) { - // TODO(client-pod#525): Investigate and fix flakiness - t.Skip("Skipping until the flakiness can be resolved") - op_e2e.InitParallel(t, op_e2e.UsesCannon) ctx := context.Background() diff --git a/op-e2e/faultproofs/util.go b/op-e2e/faultproofs/util.go index 3f5a9fe143198..1099fb87c7bda 100644 --- a/op-e2e/faultproofs/util.go +++ b/op-e2e/faultproofs/util.go @@ -12,11 +12,7 @@ type faultDisputeConfigOpts func(cfg *op_e2e.SystemConfig) func withBatcherStopped() faultDisputeConfigOpts { return func(cfg *op_e2e.SystemConfig) { - maxTxDataSize := uint64(131072) // As per the Ethereum spec. - // Allow the batcher to produce really huge calldata transactions. - // Make the max deliberately bigger than the target but still with some padding below the actual limit - cfg.BatcherTargetL1TxSizeBytes = maxTxDataSize - 5000 - cfg.BatcherMaxL1TxSizeBytes = maxTxDataSize - 1000 + cfg.DisableBatcher = true } } diff --git a/packages/contracts-bedrock/deploy-config/devnetL1-template.json b/packages/contracts-bedrock/deploy-config/devnetL1-template.json index 0a159d575d021..0d1c979245e28 100644 --- a/packages/contracts-bedrock/deploy-config/devnetL1-template.json +++ b/packages/contracts-bedrock/deploy-config/devnetL1-template.json @@ -24,9 +24,9 @@ "baseFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "l1FeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", "sequencerFeeVaultMinimumWithdrawalAmount": "0x8ac7230489e80000", - "baseFeeVaultWithdrawalNetwork": "remote", - "l1FeeVaultWithdrawalNetwork": "remote", - "sequencerFeeVaultWithdrawalNetwork": "remote", + "baseFeeVaultWithdrawalNetwork": 0, + "l1FeeVaultWithdrawalNetwork": 0, + "sequencerFeeVaultWithdrawalNetwork": 0, "proxyAdminOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", "finalSystemOwner": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", "superchainConfigGuardian": "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720", diff --git a/packages/contracts-bedrock/deploy-config/hardhat.json b/packages/contracts-bedrock/deploy-config/hardhat.json index b08ab7765e533..26f08d4fee2ca 100644 --- a/packages/contracts-bedrock/deploy-config/hardhat.json +++ b/packages/contracts-bedrock/deploy-config/hardhat.json @@ -55,5 +55,6 @@ "proofMaturityDelaySeconds": 12, "disputeGameFinalityDelaySeconds": 6, "respectedGameType": 0, - "useFaultProofs": false + "useFaultProofs": false, + "fundDevAccounts": true } diff --git a/packages/contracts-bedrock/scripts/DeployConfig.s.sol b/packages/contracts-bedrock/scripts/DeployConfig.s.sol index cfc35e3ea615b..5155a8ee7fc8a 100644 --- a/packages/contracts-bedrock/scripts/DeployConfig.s.sol +++ b/packages/contracts-bedrock/scripts/DeployConfig.s.sol @@ -35,6 +35,7 @@ contract DeployConfig is Script { address public l2OutputOracleProposer; address public l2OutputOracleChallenger; uint256 public finalizationPeriodSeconds; + bool public fundDevAccounts; address public proxyAdminOwner; address public baseFeeVaultRecipient; uint256 public baseFeeVaultMinimumWithdrawalAmount; @@ -42,6 +43,7 @@ contract DeployConfig is Script { uint256 public l1FeeVaultMinimumWithdrawalAmount; address public sequencerFeeVaultRecipient; uint256 public sequencerFeeVaultMinimumWithdrawalAmount; + uint256 public sequencerFeeVaultWithdrawalNetwork; string public governanceTokenName; string public governanceTokenSymbol; address public governanceTokenOwner; @@ -95,6 +97,7 @@ contract DeployConfig is Script { l2OutputOracleProposer = stdJson.readAddress(_json, "$.l2OutputOracleProposer"); l2OutputOracleChallenger = stdJson.readAddress(_json, "$.l2OutputOracleChallenger"); finalizationPeriodSeconds = stdJson.readUint(_json, "$.finalizationPeriodSeconds"); + fundDevAccounts = stdJson.readBool(_json, "$.fundDevAccounts"); proxyAdminOwner = stdJson.readAddress(_json, "$.proxyAdminOwner"); baseFeeVaultRecipient = stdJson.readAddress(_json, "$.baseFeeVaultRecipient"); baseFeeVaultMinimumWithdrawalAmount = stdJson.readUint(_json, "$.baseFeeVaultMinimumWithdrawalAmount"); @@ -102,6 +105,7 @@ contract DeployConfig is Script { l1FeeVaultMinimumWithdrawalAmount = stdJson.readUint(_json, "$.l1FeeVaultMinimumWithdrawalAmount"); sequencerFeeVaultRecipient = stdJson.readAddress(_json, "$.sequencerFeeVaultRecipient"); sequencerFeeVaultMinimumWithdrawalAmount = stdJson.readUint(_json, "$.sequencerFeeVaultMinimumWithdrawalAmount"); + sequencerFeeVaultWithdrawalNetwork = stdJson.readUint(_json, "$.sequencerFeeVaultWithdrawalNetwork"); governanceTokenName = stdJson.readString(_json, "$.governanceTokenName"); governanceTokenSymbol = stdJson.readString(_json, "$.governanceTokenSymbol"); governanceTokenOwner = stdJson.readAddress(_json, "$.governanceTokenOwner"); diff --git a/packages/contracts-bedrock/scripts/L2Genesis.s.sol b/packages/contracts-bedrock/scripts/L2Genesis.s.sol index 4af0b7cf45bf2..9561e03b9137d 100644 --- a/packages/contracts-bedrock/scripts/L2Genesis.s.sol +++ b/packages/contracts-bedrock/scripts/L2Genesis.s.sol @@ -17,29 +17,35 @@ import { OptimismMintableERC20Factory } from "src/universal/OptimismMintableERC2 import { L1Block } from "src/L2/L1Block.sol"; import { GovernanceToken } from "src/governance/GovernanceToken.sol"; import { EIP1967Helper } from "test/mocks/EIP1967Helper.sol"; +import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; interface IInitializable { function initialize(address _addr) external; } /// @dev The general flow of adding a predeploy is: -/// 1. _setProxies uses vm.etch to set the Proxy.sol deployed bytecode for proxy address `0x420...000` to `0x420...000 + PROXY_COUNT - 1`. +/// 1. _setPredeployProxies uses vm.etch to set the Proxy.sol deployed bytecode for proxy address `0x420...000` to +/// `0x420...000 + PROXY_COUNT - 1`. /// Additionally, the PROXY_ADMIN_ADDRESS and PROXY_IMPLEMENTATION_ADDRESS storage slots are set for the proxy /// address. -/// 2. vm.etch sets the deployed bytecode for each predeploy at the implementation address (i.e. `0xc0d3` namespace). -/// 3. The `initialize` method is called at the implementation address with zero/dummy vaules if it exists. -/// 4. The `initialize` method is called at the proxy address with actual vaules if it exists. +/// 2. `vm.etch` sets the deployed bytecode for each predeploy at the implementation address (i.e. `0xc0d3` +/// namespace). +/// 3. The `initialize` method is called at the implementation address with zero/dummy vaules if the method exists. +/// 4. The `initialize` method is called at the proxy address with actual vaules if the method exists. /// 5. A `require` check to verify the expected implementation address is set for the proxy. /// @notice The following safety invariants are used when setting state: /// 1. `vm.getDeployedBytecode` can only be used with `vm.etch` when there are no side /// effects in the constructor and no immutables in the bytecode. /// 2. A contract must be deployed using the `new` syntax if there are immutables in the code. /// Any other side effects from the init code besides setting the immutables must be cleaned up afterwards. -/// 3. A contract is deployed using the `new` syntax because it's not proxied, but still needs to be set -/// at a specific address. Because just deploying a new instance doesn't give us the contract at our desired -/// address, -/// we must use `vm.etch` to set the deployed bytecode, and `vm.store` to set any storage slots. Lastly, we reset -/// the account the contract was initially deployed by so it's not included in the `vm.dumpState`. +/// 3. A contract is deployed using the `new` syntax, however it's not proxied and is still expected to exist at +/// a +/// specific implementation address (i.e. `0xc0d3` namespace). In this case we deploy an instance of the +/// contract +/// using `new` syntax, use `contract.code` to retrieve it's deployed bytecode, `vm.etch` the bytecode at the +/// expected implementation address, and `vm.store` to set any storage slots that are +/// expected to be set after a new deployment. Lastly, we reset the account code and storage slots the contract +/// was initially deployed to so it's not included in the `vm.dumpState`. contract L2Genesis is Script, Artifacts { uint256 constant PROXY_COUNT = 2048; uint256 constant PRECOMPILE_COUNT = 256; @@ -54,6 +60,20 @@ contract L2Genesis is Script, Artifacts { /// @notice The storage slot that holds the address of the owner. /// @dev `bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)` bytes32 internal constant PROXY_ADMIN_ADDRESS = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + uint80 internal constant DEV_ACCOUNT_FUND_AMT = 10_000 ether; + /// @notice Default Anvil dev accounts. Only funded if `cfg.fundDevAccounts == true`. + address[10] internal devAccounts = [ + 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, + 0x70997970C51812dc3A010C7d01b50e0d17dc79C8, + 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC, + 0x90F79bf6EB2c4f870365E785982E1f101E93b906, + 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65, + 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc, + 0x976EA74026E726554dB657fA54763abd0C3a0aa9, + 0x14dC79964da2C08b23698B3D3cc7Ca32193d9955, + 0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f, + 0xa0Ee7A142d267C1f36714E4a8F75612F20a79720 + ]; string internal outfile; @@ -77,9 +97,13 @@ contract L2Genesis is Script, Artifacts { /// to generate a L2 genesis alloc. /// @notice The alloc object is sorted numerically by address. function run() public { - _setPrecompiles(); - _setProxies(); - _setImplementations(); + _dealEthToPrecompiles(); + _setPredeployProxies(); + _setPredeployImplementations(); + + if (cfg.fundDevAccounts()) { + _fundDevAccounts(); + } /// Reset so its not included state dump vm.etch(address(cfg), ""); @@ -90,7 +114,7 @@ contract L2Genesis is Script, Artifacts { /// @notice Give all of the precompiles 1 wei so that they are /// not considered empty accounts. - function _setPrecompiles() internal { + function _dealEthToPrecompiles() internal { for (uint256 i; i < PRECOMPILE_COUNT; i++) { vm.deal(address(uint160(i)), 1); } @@ -100,7 +124,7 @@ contract L2Genesis is Script, Artifacts { /// The Proxy bytecode should be set. All proxied predeploys should have /// the 1967 admin slot set to the ProxyAdmin predeploy. All defined predeploys /// should have their implementations set. - function _setProxies() internal { + function _setPredeployProxies() internal { bytes memory code = vm.getDeployedCode("Proxy.sol:Proxy"); uint160 prefix = uint160(0x420) << 148; @@ -129,7 +153,7 @@ contract L2Genesis is Script, Artifacts { /// @notice LEGACY_ERC20_ETH is not being predeployed since it's been deprecated. /// @dev Sets all the implementations for the predeploy proxies. For contracts without proxies, /// sets the deployed bytecode at their expected predeploy address. - function _setImplementations() internal { + function _setPredeployImplementations() internal { _setLegacyMessagePasser(); _setDeployerWhitelist(); _setWETH9(); @@ -228,7 +252,7 @@ contract L2Genesis is Script, Artifacts { SequencerFeeVault vault = new SequencerFeeVault({ _recipient: cfg.sequencerFeeVaultRecipient(), _minWithdrawalAmount: cfg.sequencerFeeVaultMinimumWithdrawalAmount(), - _withdrawalNetwork: FeeVault.WithdrawalNetwork.L1 + _withdrawalNetwork: FeeVault.WithdrawalNetwork(cfg.sequencerFeeVaultWithdrawalNetwork()) }); address impl = _predeployToCodeNamespace(Predeploys.SEQUENCER_FEE_WALLET); @@ -350,7 +374,7 @@ contract L2Genesis is Script, Artifacts { /// @notice There isn't a good way to know if the resulting revering is due to abi mismatch /// or because it's already been initialized function _verifyCantReinitialize(address _contract, address _arg) internal { - vm.expectRevert(); + vm.expectRevert("Initializable: contract is already initialized"); IInitializable(_contract).initialize(_arg); } @@ -363,6 +387,15 @@ contract L2Genesis is Script, Artifacts { vm.ffi(commands); } + function _fundDevAccounts() internal { + for (uint256 i; i < devAccounts.length; i++) { + console.log("Funding dev account %s with %s ETH", devAccounts[i], DEV_ACCOUNT_FUND_AMT / 1e18); + vm.deal(devAccounts[i], DEV_ACCOUNT_FUND_AMT); + } + + _checkDevAccountsFunded(); + } + ////////////////////////////////////////////////////// /// Post Checks ////////////////////////////////////////////////////// @@ -384,4 +417,16 @@ contract L2Genesis is Script, Artifacts { _verifyCantReinitialize(_impl, address(0)); _verifyCantReinitialize(Predeploys.OPTIMISM_MINTABLE_ERC20_FACTORY, Predeploys.L2_STANDARD_BRIDGE); } + + function _checkDevAccountsFunded() internal view { + for (uint256 i; i < devAccounts.length; i++) { + if (devAccounts[i].balance != DEV_ACCOUNT_FUND_AMT) { + revert( + string.concat( + "Dev account not funded with expected amount of ETH: ", Strings.toHexString(devAccounts[i]) + ) + ); + } + } + } } diff --git a/packages/contracts-bedrock/snapshots/state-diff/Kontrol-Deploy.json b/packages/contracts-bedrock/snapshots/state-diff/Kontrol-Deploy.json index 36daff8bda8b1..1185fce2f3704 100644 --- a/packages/contracts-bedrock/snapshots/state-diff/Kontrol-Deploy.json +++ b/packages/contracts-bedrock/snapshots/state-diff/Kontrol-Deploy.json @@ -1954,7 +1954,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "reverted": false, - "slot": "0x0000000000000000000000000000000000000000000000000000000000000039" + "slot": "0x000000000000000000000000000000000000000000000000000000000000003a" } ], "value": 0 @@ -1980,7 +1980,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000003a" + "slot": "0x000000000000000000000000000000000000000000000000000000000000003b" } ], "value": 0 @@ -2441,7 +2441,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "reverted": false, - "slot": "0x0000000000000000000000000000000000000000000000000000000000000039" + "slot": "0x000000000000000000000000000000000000000000000000000000000000003a" } ], "value": 0 @@ -2519,7 +2519,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000003a" + "slot": "0x000000000000000000000000000000000000000000000000000000000000003b" } ], "value": 0 @@ -6011,7 +6011,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000834", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000834", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000002a" + "slot": "0x000000000000000000000000000000000000000000000000000000000000002b" } ], "value": 0 @@ -6037,7 +6037,7 @@ "newValue": "0x00000000000000000000000000000000000000000000000000000000000f4240", "previousValue": "0x00000000000000000000000000000000000000000000000000000000000f4240", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000002b" + "slot": "0x000000000000000000000000000000000000000000000000000000000000002c" } ], "value": 0 @@ -6063,7 +6063,7 @@ "newValue": "0x00000000000000000000000000000000000000000000000000000000017d7840", "previousValue": "0x00000000000000000000000000000000000000000000000000000000017d7840", "reverted": false, - "slot": "0x0000000000000000000000000000000000000000000000000000000000000028" + "slot": "0x0000000000000000000000000000000000000000000000000000000000000029" } ], "value": 0 @@ -6772,7 +6772,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000834", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000834", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000002a" + "slot": "0x000000000000000000000000000000000000000000000000000000000000002b" } ], "value": 0 @@ -6850,7 +6850,7 @@ "newValue": "0x00000000000000000000000000000000000000000000000000000000000f4240", "previousValue": "0x00000000000000000000000000000000000000000000000000000000000f4240", "reverted": false, - "slot": "0x000000000000000000000000000000000000000000000000000000000000002b" + "slot": "0x000000000000000000000000000000000000000000000000000000000000002c" } ], "value": 0 @@ -7006,7 +7006,7 @@ "newValue": "0x00000000000000000000000000000000000000000000000000000000017d7840", "previousValue": "0x00000000000000000000000000000000000000000000000000000000017d7840", "reverted": false, - "slot": "0x0000000000000000000000000000000000000000000000000000000000000028" + "slot": "0x0000000000000000000000000000000000000000000000000000000000000029" } ], "value": 0 @@ -7162,7 +7162,7 @@ "newValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000", "reverted": false, - "slot": "0x0000000000000000000000000000000000000000000000000000000000000038" + "slot": "0x0000000000000000000000000000000000000000000000000000000000000039" } ], "value": 0