diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 11d1c0815..d9af8a58b 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -183,7 +183,7 @@ jobs: - name: Set up the local node uses: OffchainLabs/actions/run-nitro-test-node@main with: - nitro-testnode-ref: f5a54d679733c65b81d5106488feb957ec579a46 + nitro-testnode-ref: release l3-node: ${{ matrix.orbit-test == '1' }} args: ${{ matrix.decimals == 16 && '--l3-fee-token --l3-fee-token-decimals 16' || matrix.decimals == 20 && '--l3-fee-token --l3-fee-token-decimals 20' || matrix.decimals == 18 && '--l3-fee-token' || '' }} diff --git a/packages/sdk/scripts/genNetwork.ts b/packages/sdk/scripts/genNetwork.ts index be6b4270b..60ba2c76f 100644 --- a/packages/sdk/scripts/genNetwork.ts +++ b/packages/sdk/scripts/genNetwork.ts @@ -1,14 +1,7 @@ import { loadEnv } from '../src/lib/utils/env' import { execSync } from 'child_process' import * as fs from 'fs' - -import { IERC20Bridge__factory } from '../src/lib/abi/factories/IERC20Bridge__factory' -import { ethers } from 'ethers' -import { - L2Network, - ArbitrumNetwork, - mapL2NetworkToArbitrumNetwork, -} from '../src/lib/dataEntities/networks' +import { ArbitrumNetwork, L2Network } from '../src' loadEnv() @@ -35,66 +28,30 @@ function getLocalNetworksFromContainer(which: 'l1l2' | 'l2l3'): any { throw new Error('nitro-testnode sequencer not found') } -/** - * the container's files are written by the token bridge deployment step of the test node, which runs a script in token-bridge-contracts. - * once the script in token-bridge-contracts repo uses an sdk version with the same types and is updated to populate those fields, - * we can remove this patchwork - */ -async function patchNetworks( - l2Network: L2Network, - l3Network: L2Network | undefined, - l2Provider: ethers.providers.Provider | undefined -): Promise<{ - patchedL2Network: ArbitrumNetwork - patchedL3Network?: ArbitrumNetwork -}> { - const patchedL2Network = mapL2NetworkToArbitrumNetwork(l2Network) - - // native token for l3 - if (l3Network && l2Provider) { - const patchedL3Network = mapL2NetworkToArbitrumNetwork(l3Network) - - try { - patchedL3Network.nativeToken = await IERC20Bridge__factory.connect( - l3Network.ethBridge.bridge, - l2Provider - ).nativeToken() - } catch (e) { - // l3 network doesn't have a native token - } - - return { patchedL2Network, patchedL3Network } - } - - return { patchedL2Network } +function isLegacyNetworkType( + network: L2Network | ArbitrumNetwork +): network is L2Network { + return 'partnerChainID' in network } async function main() { fs.rmSync('localNetwork.json', { force: true }) - let output = getLocalNetworksFromContainer('l1l2') + const output = getLocalNetworksFromContainer('l1l2') if (isTestingOrbitChains) { // When running with L3 active, the container calls the L3 network L2 so we rename it here const { l2Network: l3Network } = getLocalNetworksFromContainer('l2l3') - const { patchedL2Network, patchedL3Network } = await patchNetworks( - output.l2Network, - l3Network, - new ethers.providers.JsonRpcProvider(process.env['ARB_URL']) - ) + output.l3Network = l3Network + } - output = { - l2Network: patchedL2Network, - l3Network: patchedL3Network, - } - } else { - const { patchedL2Network } = await patchNetworks( - output.l2Network, - undefined, - undefined + if ( + isLegacyNetworkType(output.l2Network) || + (output.l3Network && isLegacyNetworkType(output.l3Network)) + ) { + throw new Error( + 'Legacy L2Network type detected. Please use the latest testnode version and token-bridge-contracts version 1.2.5 or above.' ) - - output.l2Network = patchedL2Network } fs.writeFileSync('localNetwork.json', JSON.stringify(output, null, 2)) diff --git a/packages/sdk/tests/integration/standarderc20.test.ts b/packages/sdk/tests/integration/standarderc20.test.ts index c691c4463..67d85f0d8 100644 --- a/packages/sdk/tests/integration/standarderc20.test.ts +++ b/packages/sdk/tests/integration/standarderc20.test.ts @@ -257,7 +257,7 @@ describe('standard ERC20', () => { // force the redeem to fail by submitted just a bit under the required gas // so it is enough to pay for L1 + L2 intrinsic gas costs - await redeemAndTest(waitRes.message, 0, gasComponents.gasEstimate.sub(3000)) + await redeemAndTest(waitRes.message, 0, gasComponents.gasEstimate.sub(9000)) await redeemAndTest(waitRes.message, 1) })