Commit 6242e48b authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Remove cancun activation time in `PreimageOracle` (#9754)

* Remove cancun activation config

* Fix `enableFaultProofs`
parent 3d48d2dd
This diff is collapsed.
This diff is collapsed.
......@@ -219,8 +219,6 @@ type DeployConfig struct {
PreimageOracleMinProposalSize uint64 `json:"preimageOracleMinProposalSize"`
// PreimageOracleChallengePeriod is the number of seconds that challengers have to challenge a large preimage proposal.
PreimageOracleChallengePeriod uint64 `json:"preimageOracleChallengePeriod"`
// PreimageOracleCancunActivationTimestamp is the timestamp at which blob preimages are able to be loaded into the preimage oracle.
PreimageOracleCancunActivationTimestamp uint64 `json:"preimageOracleCancunActivationTimestamp"`
// FundDevAccounts configures whether or not to fund the dev accounts. Should only be used
// during devnet deployments.
FundDevAccounts bool `json:"fundDevAccounts"`
......
......@@ -74,7 +74,6 @@
"faultGameWithdrawalDelay": 604800,
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 0,
"systemConfigStartBlock": 0,
"requiredProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
"recommendedProtocolVersion": "0x0000000000000000000000000000000000000000000000000000000000000000",
......
......@@ -58,7 +58,6 @@
"faultGameWithdrawalDelay": 604800,
"preimageOracleMinProposalSize": 10000,
"preimageOracleChallengePeriod": 120,
"preimageOracleCancunActivationTimestamp": 0,
"proofMaturityDelaySeconds": 12,
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 0,
......
......@@ -52,7 +52,6 @@
"faultGameWithdrawalDelay": 604800,
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 1705473120,
"proofMaturityDelaySeconds": 604800,
"disputeGameFinalityDelaySeconds": 302400,
"respectedGameType": 0,
......
......@@ -52,7 +52,6 @@
"faultGameWithdrawalDelay": 604800,
"preimageOracleMinProposalSize": 10000,
"preimageOracleChallengePeriod": 120,
"preimageOracleCancunActivationTimestamp": 0,
"proofMaturityDelaySeconds": 12,
"disputeGameFinalityDelaySeconds": 6,
"respectedGameType": 0,
......
......@@ -52,7 +52,6 @@
"faultGameWithdrawalDelay": 604800,
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 1706655072,
"proofMaturityDelaySeconds": 604800,
"disputeGameFinalityDelaySeconds": 302400,
"respectedGameType": 0,
......
......@@ -714,8 +714,7 @@ contract Deploy is Deployer {
console.log("Deploying PreimageOracle implementation");
PreimageOracle preimageOracle = new PreimageOracle{ salt: _implSalt() }({
_minProposalSize: cfg.preimageOracleMinProposalSize(),
_challengePeriod: cfg.preimageOracleChallengePeriod(),
_cancunActivation: cfg.preimageOracleCancunActivationTimestamp()
_challengePeriod: cfg.preimageOracleChallengePeriod()
});
save("PreimageOracle", address(preimageOracle));
console.log("PreimageOracle deployed at %s", address(preimageOracle));
......
......@@ -9,7 +9,7 @@ import { Chains } from "scripts/Chains.sol";
// Global constant for the `useFaultProofs` slot in the DeployConfig contract, which can be overridden in the testing
// environment.
bytes32 constant USE_FAULT_PROOFS_SLOT = bytes32(uint256(64));
bytes32 constant USE_FAULT_PROOFS_SLOT = bytes32(uint256(63));
/// @title DeployConfig
/// @notice Represents the configuration required to deploy the system. It is expected
......@@ -63,7 +63,6 @@ contract DeployConfig is Script {
uint256 public faultGameWithdrawalDelay;
uint256 public preimageOracleMinProposalSize;
uint256 public preimageOracleChallengePeriod;
uint256 public preimageOracleCancunActivationTimestamp;
uint256 public systemConfigStartBlock;
uint256 public requiredProtocolVersion;
uint256 public recommendedProtocolVersion;
......@@ -140,7 +139,6 @@ contract DeployConfig is Script {
preimageOracleMinProposalSize = stdJson.readUint(_json, "$.preimageOracleMinProposalSize");
preimageOracleChallengePeriod = stdJson.readUint(_json, "$.preimageOracleChallengePeriod");
preimageOracleCancunActivationTimestamp = stdJson.readUint(_json, "$.preimageOracleCancunActivationTimestamp");
usePlasma = _readOr(_json, "$.usePlasma", false);
daChallengeWindow = _readOr(_json, "$.daChallengeWindow", 1000);
......
......@@ -165,8 +165,5 @@ contract FPACOPS is Deploy, StdAssertions {
console.log(" 9. Respected Game Type: ", cfg.respectedGameType());
console.log(" 10. Preimage Oracle Min Proposal Size (bytes): ", cfg.preimageOracleMinProposalSize());
console.log(" 11. Preimage Oracle Challenge Period (seconds): ", cfg.preimageOracleChallengePeriod());
console.log(
" 12. Preimage Oracle Cancun Activation Timestamp: ", cfg.preimageOracleCancunActivationTimestamp()
);
}
}
......@@ -98,7 +98,6 @@ config=$(cat << EOL
"preimageOracleMinProposalSize": 1800000,
"preimageOracleChallengePeriod": 86400,
"preimageOracleCancunActivationTimestamp": 0
}
EOL
)
......
......@@ -100,8 +100,8 @@
"sourceCodeHash": "0x6ab593a4b87007c000c254b2c4ff0507683600f48b60e453148e44bee30030f6"
},
"src/cannon/PreimageOracle.sol": {
"initCodeHash": "0x7998712f9dd5848f33184ede984c0843917cc176562006479e1dbb26b0be0ff6",
"sourceCodeHash": "0x2f5d84ed4a807cb7e7354514f53445995fc2f0836abd1ca7cfa34599d9031d9a"
"initCodeHash": "0x9e0d25588d96934044c6f20b62b21444d734c85fe86b305efd8d226024e92725",
"sourceCodeHash": "0xa2d7d5a1de4159a41ff99c2f05d33b9b472c2d00ea62f817b372988f56650153"
},
"src/dispute/DisputeGameFactory.sol": {
"initCodeHash": "0x80d749a56c1776930fe0deb5c3c646217716e5875ace99c4d036af0452236476",
......
......@@ -10,11 +10,6 @@
"internalType": "uint256",
"name": "_challengePeriod",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "_cancunActivation",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
......@@ -848,11 +843,6 @@
"name": "BondTransferFailed",
"type": "error"
},
{
"inputs": [],
"name": "CancunNotActive",
"type": "error"
},
{
"inputs": [],
"name": "InsufficientBond",
......
......@@ -1954,7 +1954,7 @@
"newValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"reverted": false,
"slot": "0x000000000000000000000000000000000000000000000000000000000000003b"
"slot": "0x000000000000000000000000000000000000000000000000000000000000003a"
}
],
"value": 0
......@@ -1980,7 +1980,7 @@
"newValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"reverted": false,
"slot": "0x000000000000000000000000000000000000000000000000000000000000003c"
"slot": "0x000000000000000000000000000000000000000000000000000000000000003b"
}
],
"value": 0
......@@ -2441,7 +2441,7 @@
"newValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"reverted": false,
"slot": "0x000000000000000000000000000000000000000000000000000000000000003b"
"slot": "0x000000000000000000000000000000000000000000000000000000000000003a"
}
],
"value": 0
......@@ -2519,7 +2519,7 @@
"newValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"reverted": false,
"slot": "0x000000000000000000000000000000000000000000000000000000000000003c"
"slot": "0x000000000000000000000000000000000000000000000000000000000000003b"
}
],
"value": 0
......@@ -7162,7 +7162,7 @@
"newValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"previousValue": "0x0000000000000000000000000000000000000000000000000000000000000000",
"reverted": false,
"slot": "0x000000000000000000000000000000000000000000000000000000000000003a"
"slot": "0x0000000000000000000000000000000000000000000000000000000000000039"
}
],
"value": 0
......
......@@ -17,9 +17,6 @@ contract PreimageOracle is IPreimageOracle, ISemver {
// Constants & Immutables //
////////////////////////////////////////////////////////////////
/// @notice The timestamp of Cancun activation on the current chain.
/// @custom:network-specific
uint256 internal immutable CANCUN_ACTIVATION;
/// @notice The duration of the large preimage proposal challenge period.
uint256 internal immutable CHALLENGE_PERIOD;
/// @notice The minimum size of a preimage that can be proposed in the large preimage path.
......@@ -89,10 +86,9 @@ contract PreimageOracle is IPreimageOracle, ISemver {
// Constructor //
////////////////////////////////////////////////////////////////
constructor(uint256 _minProposalSize, uint256 _challengePeriod, uint256 _cancunActivation) {
constructor(uint256 _minProposalSize, uint256 _challengePeriod) {
MIN_LPP_SIZE_BYTES = _minProposalSize;
CHALLENGE_PERIOD = _challengePeriod;
CANCUN_ACTIVATION = _cancunActivation;
// Compute hashes in empty sparse Merkle tree. The first hash is not set, and kept as zero as the identity.
for (uint256 height = 0; height < KECCAK_TREE_DEPTH - 1; height++) {
......@@ -254,9 +250,6 @@ contract PreimageOracle is IPreimageOracle, ISemver {
)
external
{
// Prior to Cancun activation, the blob preimage precompile is not available.
if (block.timestamp < CANCUN_ACTIVATION) revert CancunNotActive();
bytes32 key;
bytes32 part;
assembly {
......@@ -340,9 +333,6 @@ contract PreimageOracle is IPreimageOracle, ISemver {
/// @inheritdoc IPreimageOracle
function loadPrecompilePreimagePart(uint256 _partOffset, address _precompile, bytes calldata _input) external {
// Prior to Cancun activation, the blob preimage precompile is not available.
if (block.timestamp < CANCUN_ACTIVATION) revert CancunNotActive();
bytes32 res;
bytes32 key;
bytes32 part;
......
......@@ -40,9 +40,6 @@ error NotInitialized();
/// @notice Thrown when the caller of a function is not an EOA.
error NotEOA();
/// @notice Thrown when a function that requires Cancun EVM features is called on at a time where Cancun is not enabled.
error CancunNotActive();
/// @notice Thrown when an insufficient bond is provided for a large preimage proposal.
error InsufficientBond();
......
......@@ -12,7 +12,7 @@ contract MIPS_Test is CommonTest {
function setUp() public virtual override {
super.setUp();
oracle = new PreimageOracle(0, 0, 0);
oracle = new PreimageOracle(0, 0);
mips = new MIPS(oracle);
vm.store(address(mips), 0x0, bytes32(abi.encode(address(oracle))));
vm.label(address(oracle), "PreimageOracle");
......
......@@ -15,7 +15,7 @@ contract PreimageOracle_Test is Test {
/// @notice Sets up the testing suite.
function setUp() public {
oracle = new PreimageOracle(0, 0, 0);
oracle = new PreimageOracle(0, 0);
vm.label(address(oracle), "PreimageOracle");
}
......@@ -271,11 +271,7 @@ contract PreimageOracle_LargePreimageProposals_Test is Test {
/// @notice Sets up the testing suite.
function setUp() public {
oracle = new PreimageOracle({
_minProposalSize: MIN_SIZE_BYTES,
_challengePeriod: CHALLENGE_PERIOD,
_cancunActivation: 0
});
oracle = new PreimageOracle({ _minProposalSize: MIN_SIZE_BYTES, _challengePeriod: CHALLENGE_PERIOD });
vm.label(address(oracle), "PreimageOracle");
// Set `tx.origin` and `msg.sender` to `address(this)` so that it may behave like an EOA for `addLeavesLPP`.
......@@ -301,8 +297,7 @@ contract PreimageOracle_LargePreimageProposals_Test is Test {
/// @notice Tests that the `initLPP` function reverts when the part offset is out of bounds of the full preimage.
function test_initLPP_sizeTooSmall_reverts() public {
oracle =
new PreimageOracle({ _minProposalSize: 1000, _challengePeriod: CHALLENGE_PERIOD, _cancunActivation: 0 });
oracle = new PreimageOracle({ _minProposalSize: 1000, _challengePeriod: CHALLENGE_PERIOD });
// Allocate the preimage data.
bytes memory data = new bytes(136);
......
......@@ -47,7 +47,7 @@ contract FaultDisputeGame_Init is DisputeGameFactory_Init {
// Set the extra data for the game creation
extraData = abi.encode(l2BlockNumber);
AlphabetVM _vm = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0, 0));
AlphabetVM _vm = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0));
// Deploy an implementation of the fault game
gameImpl = new FaultDisputeGame({
......@@ -119,7 +119,7 @@ contract FaultDisputeGame_Test is FaultDisputeGame_Init {
/// @dev Tests that the constructor of the `FaultDisputeGame` reverts when the `_splitDepth`
/// parameter is greater than or equal to the `MAX_GAME_DEPTH`
function test_constructor_wrongArgs_reverts(uint256 _splitDepth) public {
AlphabetVM alphabetVM = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0, 0));
AlphabetVM alphabetVM = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0));
// Test that the constructor reverts when the `_splitDepth` parameter is greater than or equal
// to the `MAX_GAME_DEPTH` parameter.
......
......@@ -54,7 +54,7 @@ contract PermissionedDisputeGame_Init is DisputeGameFactory_Init {
// Set the extra data for the game creation
extraData = abi.encode(l2BlockNumber);
AlphabetVM _vm = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0, 0));
AlphabetVM _vm = new AlphabetVM(absolutePrestate, new PreimageOracle(0, 0));
// Use a 7 day delayed WETH to simulate withdrawals.
DelayedWETH _weth = new DelayedWETH(7 days);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment