mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 04:08:01 -05:00
Refactor/deprecated solidity variables (#755)
* quick wins done * doc changes * deprecate mappings in LineaRollup * add doc * more deprecation * fix * fix linearollup version * fix * fix
This commit is contained in:
@@ -40,7 +40,8 @@ uint8 OUTBOX_STATUS_RECEIVED
|
||||
mapping(bytes32 => uint256) outboxL1L2MessageStatus
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the rollingHashes mapping on the L1MessageManager for L1 to L2 messaging._
|
||||
_DEPRECATED in favor of the rollingHashes mapping on the L1MessageManager for L1 to L2 messaging.
|
||||
Cannot be made private because there may be unclaimed messages stored in this data structure._
|
||||
|
||||
### inboxL2L1MessageStatus
|
||||
|
||||
|
||||
@@ -6,14 +6,6 @@
|
||||
uint256 nextMessageNumber
|
||||
```
|
||||
|
||||
### _messageSender
|
||||
|
||||
```solidity
|
||||
address _messageSender
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of new transient storage with `MESSAGE_SENDER_TRANSIENT_KEY` key._
|
||||
|
||||
### REFUND_OVERHEAD_IN_GAS
|
||||
|
||||
```solidity
|
||||
|
||||
@@ -80,62 +80,6 @@ uint256 SIX_MONTHS_IN_SECONDS
|
||||
|
||||
_In practice, when used, this is expected to be a close approximation to 6 months, and is intentional._
|
||||
|
||||
### dataFinalStateRootHashes
|
||||
|
||||
```solidity
|
||||
mapping(bytes32 => bytes32) dataFinalStateRootHashes
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the single blobShnarfExists mapping._
|
||||
|
||||
### dataParents
|
||||
|
||||
```solidity
|
||||
mapping(bytes32 => bytes32) dataParents
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the single blobShnarfExists mapping._
|
||||
|
||||
### dataShnarfHashes
|
||||
|
||||
```solidity
|
||||
mapping(bytes32 => bytes32) dataShnarfHashes
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the single blobShnarfExists mapping._
|
||||
|
||||
### dataStartingBlock
|
||||
|
||||
```solidity
|
||||
mapping(bytes32 => uint256) dataStartingBlock
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the single blobShnarfExists mapping._
|
||||
|
||||
### dataEndingBlock
|
||||
|
||||
```solidity
|
||||
mapping(bytes32 => uint256) dataEndingBlock
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of the single blobShnarfExists mapping._
|
||||
|
||||
### currentL2StoredL1MessageNumber
|
||||
|
||||
```solidity
|
||||
uint256 currentL2StoredL1MessageNumber
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of currentFinalizedState hash._
|
||||
|
||||
### currentL2StoredL1RollingHash
|
||||
|
||||
```solidity
|
||||
bytes32 currentL2StoredL1RollingHash
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of currentFinalizedState hash._
|
||||
|
||||
### currentFinalizedShnarf
|
||||
|
||||
```solidity
|
||||
|
||||
@@ -12,14 +12,6 @@ uint256 MODULO_R
|
||||
bytes32 OPERATOR_ROLE
|
||||
```
|
||||
|
||||
### currentTimestamp
|
||||
|
||||
```solidity
|
||||
uint256 currentTimestamp
|
||||
```
|
||||
|
||||
_DEPRECATED in favor of currentFinalizedState hash._
|
||||
|
||||
### currentL2BlockNumber
|
||||
|
||||
```solidity
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
import { ethers } from "hardhat";
|
||||
import { LineaRollup } from "../../typechain-types";
|
||||
|
||||
async function main() {
|
||||
// TESTING ON L1
|
||||
|
||||
const factory = await ethers.getContractFactory("LineaRollup");
|
||||
const proxyContract = factory.attach("0x41B186Dc7C46f08ADFdCe21Da1b07f605819E9Ab") as LineaRollup;
|
||||
|
||||
const verifier0 = await proxyContract.verifiers(0);
|
||||
const verifier1 = await proxyContract.verifiers(1);
|
||||
const verifier2 = await proxyContract.verifiers(2);
|
||||
|
||||
console.log({ verifier0, verifier1, verifier2 });
|
||||
|
||||
const limitInWei = await proxyContract.limitInWei();
|
||||
const systemMigrationBlock = await proxyContract.systemMigrationBlock();
|
||||
|
||||
console.log({ "systemMigrationBlock:": systemMigrationBlock, "limitInWei:": limitInWei });
|
||||
|
||||
const outboxL1L2Mapping = await proxyContract.outboxL1L2MessageStatus(
|
||||
"0x0706629f2d6735d342c62fda7484482f77d9c2f53133e5b391d55b81a820ce27",
|
||||
);
|
||||
console.log("outboxL1L2Mapping :", outboxL1L2Mapping);
|
||||
|
||||
const dataStartingBlock = await proxyContract.dataStartingBlock(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001",
|
||||
);
|
||||
const dataEndingBlock = await proxyContract.dataEndingBlock(
|
||||
"0x0000000000000000000000000000000000000000000000000000000000000001",
|
||||
);
|
||||
|
||||
console.log("dataStartingBlock :", dataStartingBlock);
|
||||
console.log("dataEndingBlock :", dataEndingBlock);
|
||||
console.log("L1 Test done");
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -13,10 +13,6 @@ contract TestLineaRollup is LineaRollup {
|
||||
rollingHashes[_messageNumber] = _rollingHash;
|
||||
}
|
||||
|
||||
function setLastTimeStamp(uint256 _timestamp) external {
|
||||
currentTimestamp = _timestamp;
|
||||
}
|
||||
|
||||
function validateL2ComputedRollingHash(uint256 _rollingHashMessageNumber, bytes32 _rollingHash) external view {
|
||||
_validateL2ComputedRollingHash(_rollingHashMessageNumber, _rollingHash);
|
||||
}
|
||||
@@ -29,22 +25,10 @@ contract TestLineaRollup is LineaRollup {
|
||||
blobShnarfExists[_shnarf] = 1;
|
||||
}
|
||||
|
||||
function setupParentDataShnarf(bytes32 _parentDataHash, bytes32 _shnarf) external {
|
||||
dataShnarfHashes[_parentDataHash] = _shnarf;
|
||||
}
|
||||
|
||||
function setLastFinalizedBlock(uint256 _blockNumber) external {
|
||||
currentL2BlockNumber = _blockNumber;
|
||||
}
|
||||
|
||||
function setupParentFinalizedStateRoot(bytes32 _parentDataHash, bytes32 _blockStateRoot) external {
|
||||
dataFinalStateRootHashes[_parentDataHash] = _blockStateRoot;
|
||||
}
|
||||
|
||||
function setupStartingBlockForDataHash(bytes32 _dataHash, uint256 _blockNumber) external {
|
||||
dataStartingBlock[_dataHash] = _blockNumber;
|
||||
}
|
||||
|
||||
function setLastFinalizedShnarf(bytes32 _lastFinalizedShnarf) external {
|
||||
currentFinalizedShnarf = _lastFinalizedShnarf;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ abstract contract L1MessageManagerV1 is IL1MessageManagerV1 {
|
||||
uint8 public constant OUTBOX_STATUS_RECEIVED = 2;
|
||||
|
||||
/// @dev DEPRECATED in favor of the rollingHashes mapping on the L1MessageManager for L1 to L2 messaging.
|
||||
/// @dev Cannot be made private because there may be unclaimed messages stored in this data structure.
|
||||
mapping(bytes32 messageHash => uint256 messageStatus) public outboxL1L2MessageStatus;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ abstract contract L1MessageServiceV1 is
|
||||
uint256 public nextMessageNumber;
|
||||
|
||||
/// @dev DEPRECATED in favor of new transient storage with `MESSAGE_SENDER_TRANSIENT_KEY` key.
|
||||
address internal _messageSender;
|
||||
address private _messageSender_DEPRECATED;
|
||||
|
||||
/// @dev Total contract storage is 52 slots including the gap below.
|
||||
/// @dev Keep 50 free storage slots for future implementation updates to avoid storage collision.
|
||||
|
||||
@@ -17,7 +17,7 @@ contract LineaRollup is AccessControlUpgradeable, ZkEvmV2, L1MessageService, Per
|
||||
using EfficientLeftRightKeccak for *;
|
||||
|
||||
/// @notice This is the ABI version and not the reinitialize version.
|
||||
string public constant CONTRACT_VERSION = "6.0";
|
||||
string public constant CONTRACT_VERSION = "7.0";
|
||||
|
||||
/// @notice The role required to set/add proof verifiers by type.
|
||||
bytes32 public constant VERIFIER_SETTER_ROLE = keccak256("VERIFIER_SETTER_ROLE");
|
||||
@@ -48,20 +48,20 @@ contract LineaRollup is AccessControlUpgradeable, ZkEvmV2, L1MessageService, Per
|
||||
uint256 internal constant SIX_MONTHS_IN_SECONDS = (365 / 2) * 24 * 60 * 60;
|
||||
|
||||
/// @dev DEPRECATED in favor of the single blobShnarfExists mapping.
|
||||
mapping(bytes32 dataHash => bytes32 finalStateRootHash) public dataFinalStateRootHashes;
|
||||
mapping(bytes32 dataHash => bytes32 finalStateRootHash) private dataFinalStateRootHashes_DEPRECATED;
|
||||
/// @dev DEPRECATED in favor of the single blobShnarfExists mapping.
|
||||
mapping(bytes32 dataHash => bytes32 parentHash) public dataParents;
|
||||
mapping(bytes32 dataHash => bytes32 parentHash) private dataParents_DEPRECATED;
|
||||
/// @dev DEPRECATED in favor of the single blobShnarfExists mapping.
|
||||
mapping(bytes32 dataHash => bytes32 shnarfHash) public dataShnarfHashes;
|
||||
mapping(bytes32 dataHash => bytes32 shnarfHash) private dataShnarfHashes_DEPRECATED;
|
||||
/// @dev DEPRECATED in favor of the single blobShnarfExists mapping.
|
||||
mapping(bytes32 dataHash => uint256 startingBlock) public dataStartingBlock;
|
||||
mapping(bytes32 dataHash => uint256 startingBlock) private dataStartingBlock_DEPRECATED;
|
||||
/// @dev DEPRECATED in favor of the single blobShnarfExists mapping.
|
||||
mapping(bytes32 dataHash => uint256 endingBlock) public dataEndingBlock;
|
||||
mapping(bytes32 dataHash => uint256 endingBlock) private dataEndingBlock_DEPRECATED;
|
||||
|
||||
/// @dev DEPRECATED in favor of currentFinalizedState hash.
|
||||
uint256 public currentL2StoredL1MessageNumber;
|
||||
uint256 private currentL2StoredL1MessageNumber_DEPRECATED;
|
||||
/// @dev DEPRECATED in favor of currentFinalizedState hash.
|
||||
bytes32 public currentL2StoredL1RollingHash;
|
||||
bytes32 private currentL2StoredL1RollingHash_DEPRECATED;
|
||||
|
||||
/// @notice Contains the most recent finalized shnarf.
|
||||
bytes32 public currentFinalizedShnarf;
|
||||
|
||||
@@ -15,7 +15,7 @@ abstract contract ZkEvmV2 is AccessControlUpgradeable, L1MessageServiceV1, IZkEv
|
||||
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
|
||||
|
||||
/// @dev DEPRECATED in favor of currentFinalizedState hash.
|
||||
uint256 public currentTimestamp;
|
||||
uint256 private currentTimestamp_DEPRECATED;
|
||||
|
||||
/// @notice The most recent finalized L2 block number.
|
||||
uint256 public currentL2BlockNumber;
|
||||
|
||||
@@ -28,7 +28,7 @@ abstract contract PauseManager is IPauseManager, AccessControlUpgradeable {
|
||||
uint256 public constant COOLDOWN_DURATION = 24 hours;
|
||||
|
||||
// @dev DEPRECATED. USE _pauseTypeStatusesBitMap INSTEAD
|
||||
mapping(bytes32 pauseType => bool pauseStatus) private pauseTypeStatuses;
|
||||
mapping(bytes32 pauseType => bool pauseStatus) private pauseTypeStatuses_DEPRECATED;
|
||||
|
||||
/// @dev The bitmap containing the pause statuses mapped by type.
|
||||
uint256 private _pauseTypeStatusesBitMap;
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("Linea Rollup contract: EIP-4844 Blob submission tests", () => {
|
||||
let operator: SignerWithAddress;
|
||||
let nonAuthorizedAccount: SignerWithAddress;
|
||||
|
||||
const { prevShnarf, parentDataHash, parentStateRootHash } = firstCompressedDataContent;
|
||||
const { prevShnarf } = firstCompressedDataContent;
|
||||
|
||||
before(async () => {
|
||||
({ securityCouncil, operator, nonAuthorizedAccount } = await loadFixture(getAccountsFixture));
|
||||
@@ -57,8 +57,6 @@ describe("Linea Rollup contract: EIP-4844 Blob submission tests", () => {
|
||||
({ lineaRollup } = await loadFixture(deployLineaRollupFixture));
|
||||
await lineaRollup.setLastFinalizedBlock(0);
|
||||
await lineaRollup.setupParentShnarf(prevShnarf);
|
||||
await lineaRollup.setupParentDataShnarf(parentDataHash, prevShnarf);
|
||||
await lineaRollup.setupParentFinalizedStateRoot(parentDataHash, parentStateRootHash);
|
||||
});
|
||||
|
||||
it("Should successfully submit blobs", async () => {
|
||||
|
||||
Reference in New Issue
Block a user