Commit 7759fe6e authored by ben-chain's avatar ben-chain Committed by GitHub

Final Parameterization of Constants (#176)

* update force inclusion period

* update gas discount divisor

* update MIN_ROLLUP_TX_GAS

* bump MAX_TRANSACTION_GAS_LIMIT

* update chainId to 422

* update chainId in dump taker

* fix up tests

* update force inclusion to work with js math
parent 54086830
#!/usr/bin/env node
const contracts = require('../build/src/contract-deployment/deploy');
const { providers, Wallet, utils } = require('ethers');
const { providers, Wallet, utils, ethers } = require('ethers');
const { LedgerSigner } = require('@ethersproject/hardware-wallets');
const { JsonRpcProvider } = providers;
......@@ -11,15 +11,15 @@ const sequencerKey = env.SEQUENCER_PRIVATE_KEY;
let SEQUENCER_ADDRESS = env.SEQUENCER_ADDRESS;
const web3Url = env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545';
const MIN_TRANSACTION_GAS_LIMIT = env.MIN_TRANSACTION_GAS_LIMIT || 50000;
const MAX_TRANSACTION_GAS_LIMIT = env.MAX_TRANSACTION_GAS_LIMIT || Math.floor(9000000 * 63/64 - 100000); // = 8_759_375, Default max for Kovan
const MAX_TRANSACTION_GAS_LIMIT = env.MAX_TRANSACTION_GAS_LIMIT || 9000000;
const MAX_GAS_PER_QUEUE_PER_EPOCH = env.MAX_GAS_PER_QUEUE_PER_EPOCH || 250000000;
const SECONDS_PER_EPOCH = env.SECONDS_PER_EPOCH || 0;
let WHITELIST_OWNER = env.WHITELIST_OWNER;
const WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT = env.WHITELIST_ALLOW_ARBITRARY_CONTRACT_DEPLOYMENT || true;
const FORCE_INCLUSION_PERIOD_SECONDS = env.FORCE_INCLUSION_PERIOD_SECONDS || (60 * 300000); // 30 min
const FORCE_INCLUSION_PERIOD_SECONDS = env.FORCE_INCLUSION_PERIOD_SECONDS || 2592000; // 30 days
const FRAUD_PROOF_WINDOW_SECONDS = env.FRAUD_PROOF_WINDOW_SECONDS || (60 * 60 * 24 * 7); // 7 days
const SEQUENCER_PUBLISH_WINDOW_SECONDS = env.SEQUENCER_PUBLISH_WINDOW_SECONDS || (60 * 30); // 30 min
const CHAIN_ID = env.CHAIN_ID || 420; // layer 2 chainid
const CHAIN_ID = env.CHAIN_ID || 422; // layer 2 chainid
const USE_LEDGER = env.USE_LEDGER || false;
const HD_PATH = env.HD_PATH || utils.defaultPath;
const BLOCK_TIME_SECONDS = env.BLOCK_TIME_SECONDS || 15;
......
......@@ -5,7 +5,7 @@ import * as mkdirp from 'mkdirp'
const env = process.env
const CHAIN_ID = env.CHAIN_ID || '420'
const CHAIN_ID = env.CHAIN_ID || '422'
/* Internal Imports */
import { makeStateDump } from '../src/contract-dumps'
......
......@@ -26,9 +26,9 @@ contract OVM_CanonicalTransactionChain is iOVM_CanonicalTransactionChain, Lib_Ad
*************/
// L2 tx gas-related
uint256 constant public MIN_ROLLUP_TX_GAS = 20000;
uint256 constant public MIN_ROLLUP_TX_GAS = 100000;
uint256 constant public MAX_ROLLUP_TX_SIZE = 10000;
uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 10;
uint256 constant public L2_GAS_DISCOUNT_DIVISOR = 32;
// Encoding-related (all in bytes)
uint256 constant internal BATCH_CONTEXT_SIZE = 16;
......
......@@ -114,12 +114,12 @@ export const makeStateDump = async (cfg: RollupDeployConfig): Promise<any> => {
deploymentSigner: signer,
ovmGasMeteringConfig: {
minTransactionGasLimit: 0,
maxTransactionGasLimit: 1_000_000_000,
maxTransactionGasLimit: 9_000_000,
maxGasPerQueuePerEpoch: 1_000_000_000_000,
secondsPerEpoch: 0,
},
ovmGlobalContext: {
ovmCHAINID: 420,
ovmCHAINID: 422,
L2CrossDomainMessengerAddress:
'0x4200000000000000000000000000000000000007',
},
......
......@@ -73,7 +73,7 @@ describe('OVM_ECDSAContractAccount', () => {
Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with(
await wallet.getAddress()
)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(420)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(422)
Mock__OVM_ExecutionManager.smocked.ovmGETNONCE.will.return.with(100)
Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with([true, '0x'])
Mock__OVM_ExecutionManager.smocked.ovmCREATE.will.return.with(
......
......@@ -282,7 +282,7 @@ describe('OVM_CanonicalTransactionChain', () => {
await expect(
OVM_CanonicalTransactionChain.enqueue(target, gasLimit, data, {
gasLimit: gasLimit / L2_GAS_DISCOUNT_DIVISOR - 1,
gasLimit: gasLimit / L2_GAS_DISCOUNT_DIVISOR + 30_000, // offset constant overhead
})
).to.be.revertedWith('Insufficient gas for L2 rate limiting burn.')
})
......
......@@ -7,7 +7,7 @@ import {
} from '../../../../helpers'
const globalContext = {
ovmCHAINID: 420,
ovmCHAINID: 422,
}
const transactionContext = {
......
......@@ -53,7 +53,7 @@ describe('OVM_ProxySequencerEntrypoint', () => {
)
Mock__OVM_ExecutionManager.smocked.ovmEXTCODESIZE.will.return.with(0)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(420)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(422)
Helper_PrecompileCaller = await (
await ethers.getContractFactory('Helper_PrecompileCaller')
......
......@@ -32,7 +32,7 @@ describe('OVM_SequencerEntrypoint', () => {
await ethers.getContractFactory('OVM_ExecutionManager')
)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(420)
Mock__OVM_ExecutionManager.smocked.ovmCHAINID.will.return.with(422)
Mock__OVM_ExecutionManager.smocked.ovmCALL.will.return.with([true, '0x'])
Helper_PrecompileCaller = await (
......
......@@ -13,7 +13,7 @@
"0x1212121212121212121212121212121212121212",
0,
"0x99999999999999999999",
420
422
]
]
}
......
......@@ -32,7 +32,7 @@ export const DEFAULT_EIP155_TX: EIP155Transaction = {
gasLimit: 1000000,
gasPrice: 100000000,
data: `0x${'99'.repeat(10)}`,
chainId: 420,
chainId: 422,
}
export const getRawSignedComponents = (signed: string): any[] => {
......
......@@ -213,7 +213,7 @@ export class ExecutionManagerTestRunner {
secondsPerEpoch: 600,
},
{
ovmCHAINID: 420,
ovmCHAINID: 422,
}
)
......
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