Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure initialBatchNumber #31

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/inheritedMainContracts/PolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ contract PolygonZkEVM is
admin = initializePackedParameters.admin;
trustedSequencer = initializePackedParameters.trustedSequencer;
trustedAggregator = initializePackedParameters.trustedAggregator;
batchNumToStateRoot[0] = genesisRoot;
batchNumToStateRoot[lastBatchSequenced] = genesisRoot;
trustedSequencerURL = _trustedSequencerURL;
networkName = _networkName;
lastBatchSequenced = initializePackedParameters.lastVerifiedBatch;
lastVerifiedBatch = initializePackedParameters.lastVerifiedBatch;

// Check initialize parameters
if (
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/IPolygonZkEVM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface IPolygonZkEVM {
* @param trustedAggregatorTimeout Trusted aggregator timeout
* @param _chainID L2 chainID
* @param _forkID Fork Id
* @param _lastVerifiedBatch Last verified batch
*/
struct InitializePackedParameters {
address admin;
Expand All @@ -24,6 +25,7 @@ interface IPolygonZkEVM {
uint64 trustedAggregatorTimeout;
uint64 chainID;
uint64 forkID;
uint64 lastVerifiedBatch;
}

function chainID() external view returns (uint64);
Expand Down
6 changes: 4 additions & 2 deletions test/contracts/emergencyManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('Emergency mode test', () => {
firstDeployment = false;
}

const nonceProxyBridge = Number((await ethers.provider.getTransactionCount(deployer.address))) + (firstDeployment ? 2 : 1);
const nonceProxyBridge = Number((await ethers.provider.getTransactionCount(deployer.address))) + (firstDeployment ? 2 : 2);
const nonceProxyZkevm = nonceProxyBridge + 2; // Always have to redeploy impl since the polygonZkEVMGlobalExitRoot address changes

const precalculateBridgeAddress = ethers.utils.getContractAddress({ from: deployer.address, nonce: nonceProxyBridge });
Expand All @@ -97,7 +97,8 @@ describe('Emergency mode test', () => {
// deploy PolygonZkEVMBridge
const polygonZkEVMBridgeFactory = await ethers.getContractFactory('PolygonZkEVMBridgeWrapper');
polygonZkEVMBridgeContract = await upgrades.deployProxy(polygonZkEVMBridgeFactory, [], { initializer: false });

// console.log(polygonZkEVMBridgeContract.deployTransaction.nonce);
// console.log(nonceProxyBridge);
// deploy PolygonZkEVMMock
const PolygonZkEVMFactory = await ethers.getContractFactory('PolygonZkEVMMock');
polygonZkEVMContract = await upgrades.deployProxy(PolygonZkEVMFactory, [], {
Expand Down Expand Up @@ -127,6 +128,7 @@ describe('Emergency mode test', () => {
trustedAggregatorTimeout: trustedAggregatorTimeoutDefault,
chainID,
forkID: 0,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand Down
4 changes: 4 additions & 0 deletions test/contracts/polygonZkEVM.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe('Polygon ZK-EVM', () => {
trustedAggregatorTimeout: trustedAggregatorTimeoutDefault,
chainID,
forkID,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand Down Expand Up @@ -197,6 +198,7 @@ describe('Polygon ZK-EVM', () => {
trustedAggregatorTimeout: trustedAggregatorTimeoutDefault,
chainID,
forkID,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand All @@ -218,6 +220,7 @@ describe('Polygon ZK-EVM', () => {
trustedAggregatorTimeout: HALT_AGGREGATION_TIMEOUT + 1,
chainID,
forkID,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand All @@ -240,6 +243,7 @@ describe('Polygon ZK-EVM', () => {
trustedAggregatorTimeout: trustedAggregatorTimeoutDefault,
chainID,
forkID,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand Down
1 change: 1 addition & 0 deletions test/contracts/polygonZkEVMTestnetV2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ describe('Polygon ZK-EVM TestnetV2', () => {
trustedAggregatorTimeout: trustedAggregatorTimeoutDefault,
chainID,
forkID,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand Down
1 change: 1 addition & 0 deletions test/contracts/snark_stark_input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('Polygon ZK-EVM snark stark input test', () => {
trustedAggregatorTimeout: 0,
chainID,
forkID: 0,
lastVerifiedBatch: 0,
},
genesisRoot,
urlSequencer,
Expand Down
Loading