Skip to content

Commit

Permalink
move: blocks_per_day to network fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
amytsang committed Jun 7, 2024
1 parent 76cc551 commit 7fa36b6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions tests/cypress/fixtures/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@
"name": "Ethereum",
"infura_rpc": "https://mainnet.infura.io/v3/INFURA_PROJECT_ID",
"alchemy_rpc": "https://eth-mainnet.g.alchemy.com/v2/MAINNET_ALCHEMY_API_KEY",
"fork_block": 19992100
"fork_block": 19992100,
"blocks_per_day": 7000
},
"137": {
"id": 137,
"alias": "polygon",
"name": "Polygon",
"infura_rpc": "https://polygon-mainnet.infura.io/v3/INFURA_PROJECT_ID",
"alchemy_rpc": "https://polygon-mainnet.g.alchemy.com/v2/POLYGON_ALCHEMY_API_KEY",
"fork_block": 56968100
"fork_block": 56968100,
"blocks_per_day": 40000
},
"42161": {
"id": 42161,
"alias": "arbitrum",
"name": "Arbitrum",
"infura_rpc": "https://arbitrum-mainnet.infura.io/v3/INFURA_PROJECT_ID",
"alchemy_rpc": "https://arb-mainnet.g.alchemy.com/v2/ARBITRUM_ALCHEMY_API_KEY",
"fork_block": 215601500
"fork_block": 215601500,
"blocks_per_day": 350000
}
}
1 change: 1 addition & 0 deletions tests/cypress/types/fixtures.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ declare module '@/fixtures/networks.json' {
infura_rpc: string
alchemy_rpc: string
fork_block: number
blocks_per_day: number
}

export interface Networks {
Expand Down
4 changes: 2 additions & 2 deletions tests/runHardhatNodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const getBlockNumber = async (network) => {

const hexBlockNumber = (await resp.json()).result
const blockNumber = parseInt(hexBlockNumber, 16)
// user BLOCKS_PER_DAY to prevent maxing forked network quota
return Math.floor(blockNumber / BLOCKS_PER_DAY) * BLOCKS_PER_DAY
// use blocks_per_day to prevent maxing forked network quota
return Math.floor(blockNumber / network.blocks_per_day) * network.blocks_per_day
}

const startNode = (network) => {
Expand Down

0 comments on commit 7fa36b6

Please sign in to comment.