Skip to content

Commit

Permalink
ongoing
Browse files Browse the repository at this point in the history
  • Loading branch information
invocamanman committed Jan 25, 2023
1 parent b7c439b commit 744ac34
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 26 deletions.
11 changes: 5 additions & 6 deletions contracts/PolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
.accInputHash;

// Store in a temporal variable, for avoid access again the storage slot
uint64 orgLastForceBatchSequenced = currentLastForceBatchSequenced;
uint64 initLastForceBatchSequenced = currentLastForceBatchSequenced;

for (uint256 i = 0; i < batchesNum; i++) {
// Load current sequence
Expand Down Expand Up @@ -531,7 +531,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
"PolygonZkEVM::sequenceBatches: Force batches overflow"
);

uint256 nonForcedBatchesSequenced = batchesNum - (currentLastForceBatchSequenced - orgLastForceBatchSequenced);
uint256 nonForcedBatchesSequenced = batchesNum - (currentLastForceBatchSequenced - initLastForceBatchSequenced);

// Update sequencedBatches mapping
sequencedBatches[currentBatchSequenced] = SequencedBatchData({
Expand All @@ -544,7 +544,7 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
lastTimestamp = currentTimestamp;
lastBatchSequenced = currentBatchSequenced;

if (currentLastForceBatchSequenced != orgLastForceBatchSequenced)
if (currentLastForceBatchSequenced != initLastForceBatchSequenced)
lastForceBatchSequenced = currentLastForceBatchSequenced;

// Pay collateral for every non-forced batch submitted
Expand Down Expand Up @@ -1072,10 +1072,9 @@ contract PolygonZkEVM is OwnableUpgradeable, EmergencyManager {
msg.sender
)
);

// Update currentBatchSequenced
currentBatchSequenced++;
}
// Update currentBatchSequenced
currentBatchSequenced += uint64(batchesNum);

lastTimestamp = uint64(block.timestamp);

Expand Down
2 changes: 1 addition & 1 deletion contracts/PolygonZkEVMBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ contract PolygonZkEVMBridge is
}

/**
* @notice Function decode a index into a wordPos and bitPos
* @notice Function decode an index into a wordPos and bitPos
* @param index Index
*/
function _bitmapPositions(uint256 index) private pure returns (uint256 wordPos, uint256 bitPos) {
Expand Down
10 changes: 5 additions & 5 deletions contracts/PolygonZkEVMGlobalExitRoot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ contract PolygonZkEVMGlobalExitRoot is
mapping(bytes32 => uint256) public globalExitRootMap;

// PolygonZkEVMBridge address
address public bridgeAddress;
address public immutable bridgeAddress;

// Rollup contract address
address public rollupAddress;
address public immutable rollupAddress;

/**
* @dev Emitted when the the global exit root is updated
Expand All @@ -39,14 +39,14 @@ contract PolygonZkEVMGlobalExitRoot is
* @param _rollupAddress Rollup contract address
* @param _bridgeAddress PolygonZkEVMBridge contract address
*/
function initialize(
constructor(
address _rollupAddress,
address _bridgeAddress
) public initializer {
) {
rollupAddress = _rollupAddress;
bridgeAddress = _bridgeAddress;
}

/**
* @notice Update the exit root of one of the networks and the global exit root
* @param newRoot new exit tree root
Expand Down
2 changes: 1 addition & 1 deletion contracts/PolygonZkEVMTimelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "./PolygonZkEVM.sol";
*/
contract PolygonZkEVMTimelock is TimelockController {
// Polygon ZK-EVM address. Will be used to check if it's on emergency state.
PolygonZkEVM public polygonZkEVM;
PolygonZkEVM public immutable polygonZkEVM;

/**
* @notice Constructor of timelock
Expand Down
6 changes: 2 additions & 4 deletions contracts/lib/TokenWrapped.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ contract TokenWrapped is ERC20 {
bytes32 private immutable _DEPLOYMENT_DOMAIN_SEPARATOR;

// PolygonZkEVM Bridge address
address public bridgeAddress;
address public immutable bridgeAddress;

// Decimals
uint8 private _decimals;
uint8 private immutable _decimals;

// Permit nonces
mapping(address => uint256) public nonces;
Expand All @@ -49,8 +49,6 @@ contract TokenWrapped is ERC20 {
) ERC20(name, symbol) {
bridgeAddress = msg.sender;
_decimals = __decimals;

// initialize immutable variables
deploymentChainId = block.chainid;
_DEPLOYMENT_DOMAIN_SEPARATOR = _calculateDomainSeparator(block.chainid);
}
Expand Down
7 changes: 0 additions & 7 deletions contracts/mocks/PolygonZkEVMGlobalExitRootMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import "../PolygonZkEVMGlobalExitRoot.sol";
*/
contract PolygonZkEVMGlobalExitRootMock is PolygonZkEVMGlobalExitRoot {
/**
* @param _rollupAddress Rollup contract address
* @param _bridgeAddress PolygonZkEVM Bridge contract address
*/
constructor(address _rollupAddress, address _bridgeAddress) {
initialize(_rollupAddress, _bridgeAddress);
}

/**
* @notice Set last global exit root
Expand Down
4 changes: 2 additions & 2 deletions docs/PolygonZkEVMGlobalExitRoot.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Contract responsible for managing the exit roots across multiple networks


## Functions
### initialize
### constructor
```solidity
function initialize(
function constructor(
address _rollupAddress,
address _bridgeAddress
) public
Expand Down

0 comments on commit 744ac34

Please sign in to comment.