Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ CONFIG_NETWORK_NAME="custom"
DEPLOYED_CONTRACTS_DIR="./scripts/files/"
DISABLE_VERIFICATION=true

# yarn script:bold-populate-lookup looks for the latest confirmed node's creation event
# these 2 parameters configure log lookup behavior. the script searches backwards in batches
# if the script throws "Could not find latest confirmed node", consider tweaking these values
NODECREATED_LOG_LOOKUP_BATCH_SIZE=10000
NODECREATED_LOG_LOOKUP_BATCH_COUNT=100

# to use the 'custom' hardhat network, set the following variables
CUSTOM_RPC_URL="http://127.0.0.1:8545"
CUSTOM_ETHERSCAN_API_KEY=
Expand Down
10 changes: 7 additions & 3 deletions scripts/boldUpgradeFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,14 @@ export const populateLookup = async (
const latestConfirmed = await oldRollup.latestConfirmed()
let latestConfirmedLog
let toBlock = await wallet.provider!.getBlockNumber()
for (let i = 0; i < 100; i++) {
const numBatches = parseInt(process.env.NODECREATED_LOG_LOOKUP_BATCH_COUNT || '100')
const batchSize = parseInt(
process.env.NODECREATED_LOG_LOOKUP_BATCH_SIZE || '10000'
)
for (let i = 0; i < numBatches; i++) {
latestConfirmedLog = await wallet.provider!.getLogs({
address: rollupAddr,
fromBlock: toBlock >= 1000 ? toBlock - 1000 : 0,
fromBlock: toBlock >= batchSize ? toBlock - batchSize : 0,
toBlock: toBlock,
topics: [
oldRollup.interface.getEventTopic('NodeCreated'),
Expand All @@ -100,7 +104,7 @@ export const populateLookup = async (
if (toBlock == 0) {
throw new Error('Could not find latest confirmed node')
}
toBlock -= 1000
toBlock -= batchSize
if (toBlock < 0) {
toBlock = 0
}
Expand Down
Loading