From a2de1c3ef227bde09b0b6ebfe272c66f441345f9 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Thu, 21 Nov 2024 17:39:17 +0700 Subject: [PATCH 1/2] fix: Update blob verifier injection pattern --- .../deployCreatorAndCreateRollup.ts | 3 +- scripts/rollupCreation.ts | 38 ++++++------------- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/scripts/local-deployment/deployCreatorAndCreateRollup.ts b/scripts/local-deployment/deployCreatorAndCreateRollup.ts index 1a63b2f7..c814aa27 100644 --- a/scripts/local-deployment/deployCreatorAndCreateRollup.ts +++ b/scripts/local-deployment/deployCreatorAndCreateRollup.ts @@ -74,7 +74,8 @@ async function main() { deployerWallet, true, contracts.rollupCreator.address, - feeToken + feeToken, + contracts.eigenDARollupManager.address, ) if (!result) { diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index e70b82dc..1e4bf3a0 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -4,7 +4,7 @@ import { run } from 'hardhat' import { abi as rollupCreatorAbi } from '../build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json' import { config, maxDataSize } from './config' import { BigNumber, Signer } from 'ethers' -import { ERC20, ERC20__factory, IERC20__factory } from '../build/types' +import { IERC20__factory } from '../build/types' import { sleep } from './testSetup' import { promises as fs } from 'fs' import { _isRunningOnArbitrum } from './deploymentUtils' @@ -61,7 +61,8 @@ export async function createRollup( signer: Signer, isDevDeployment: boolean, rollupCreatorAddress: string, - feeToken: string + feeToken: string, + eigenDARollupManager: string ): Promise<{ rollupCreationResult: RollupCreationResult chainInfo: ChainInfo @@ -101,7 +102,11 @@ export async function createRollup( // Call the createRollup function console.log('Calling createRollup to generate a new rollup ...') const deployParams = isDevDeployment - ? await _getDevRollupConfig(feeToken, validatorWalletCreator) + ? await _getDevRollupConfig( + eigenDARollupManager, + feeToken, + validatorWalletCreator + ) : { config: config.rollupConfig, validators: config.validators, @@ -111,6 +116,7 @@ export async function createRollup( maxFeePerGasForRetryables: MAX_FER_PER_GAS, batchPosters: config.batchPosters, batchPosterManager: config.batchPosterManager, + eigenDARollupManager: eigenDARollupManager, } const createRollupTx = await rollupCreator.createRollup(deployParams, { @@ -229,6 +235,7 @@ export async function createRollup( } async function _getDevRollupConfig( + rollupManager: string, feeToken: string, validatorWalletCreator: string ) { @@ -329,6 +336,7 @@ async function _getDevRollupConfig( maxFeePerGasForRetryables: MAX_FER_PER_GAS, batchPosters: batchPosters, batchPosterManager: batchPosterManager, + eigenDARollupManager: rollupManager, } function _createValidatorAddress( @@ -341,26 +349,4 @@ async function _getDevRollupConfig( nonce: nonceHex, }) } -} - -async function _getPrescaledAmount( - nativeToken: ERC20, - amount: BigNumber -): Promise { - const decimals = BigNumber.from(await nativeToken.decimals()) - if (decimals.lt(BigNumber.from(18))) { - const scalingFactor = BigNumber.from(10).pow( - BigNumber.from(18).sub(decimals) - ) - let prescaledAmount = amount.div(scalingFactor) - // round up if needed - if (prescaledAmount.mul(scalingFactor).lt(amount)) { - prescaledAmount = prescaledAmount.add(BigNumber.from(1)) - } - return prescaledAmount - } else if (decimals.gt(BigNumber.from(18))) { - return amount.mul(BigNumber.from(10).pow(decimals.sub(BigNumber.from(18)))) - } - - return amount -} +} \ No newline at end of file From 2bddc8f3f2874ae62eca53859e552d74af73bc2f Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Thu, 21 Nov 2024 22:10:51 +0700 Subject: [PATCH 2/2] fix: Update blob verifier injection pattern - bring back _getPrescaledAmount function --- scripts/rollupCreation.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scripts/rollupCreation.ts b/scripts/rollupCreation.ts index 1e4bf3a0..1e87c05e 100644 --- a/scripts/rollupCreation.ts +++ b/scripts/rollupCreation.ts @@ -4,7 +4,7 @@ import { run } from 'hardhat' import { abi as rollupCreatorAbi } from '../build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json' import { config, maxDataSize } from './config' import { BigNumber, Signer } from 'ethers' -import { IERC20__factory } from '../build/types' +import { ERC20, ERC20__factory, IERC20__factory } from '../build/types' import { sleep } from './testSetup' import { promises as fs } from 'fs' import { _isRunningOnArbitrum } from './deploymentUtils' @@ -349,4 +349,26 @@ async function _getDevRollupConfig( nonce: nonceHex, }) } +} + +async function _getPrescaledAmount( + nativeToken: ERC20, + amount: BigNumber +): Promise { + const decimals = BigNumber.from(await nativeToken.decimals()) + if (decimals.lt(BigNumber.from(18))) { + const scalingFactor = BigNumber.from(10).pow( + BigNumber.from(18).sub(decimals) + ) + let prescaledAmount = amount.div(scalingFactor) + // round up if needed + if (prescaledAmount.mul(scalingFactor).lt(amount)) { + prescaledAmount = prescaledAmount.add(BigNumber.from(1)) + } + return prescaledAmount + } else if (decimals.gt(BigNumber.from(18))) { + return amount.mul(BigNumber.from(10).pow(decimals.sub(BigNumber.from(18)))) + } + + return amount } \ No newline at end of file