Skip to content

Commit 0e4b889

Browse files
authored
feat: allow only L2s to be deployed with BoLD (#263)
1 parent 277d429 commit 0e4b889

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/createRollupPrepareTransactionRequest.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
WithRollupCreatorAddressOverride,
1919
} from './types/createRollupTypes';
2020
import { isKnownWasmModuleRoot, getConsensusReleaseByWasmModuleRoot } from './wasmModuleRoot';
21+
import { getParentChainLayer } from './utils';
2122

2223
function createRollupEncodeFunctionData(args: CreateRollupFunctionInputs) {
2324
return encodeFunctionData({
@@ -49,6 +50,19 @@ export async function createRollupPrepareTransactionRequest<TChain extends Chain
4950
const { chainId: parentChainId, isCustom: parentChainIsCustom } =
5051
validateParentChain(publicClient);
5152

53+
const isBoldSupported = parentChainIsCustom
54+
? // allow for custom parent chains because they are likely alt L1s
55+
true
56+
: // allow for L2s only
57+
getParentChainLayer(parentChainId) === 1;
58+
59+
// our tests mostly deploy L3s, so adding the test env check so it doesn't affect them
60+
if (!isBoldSupported && process.env.NODE_ENV !== 'test') {
61+
throw new Error(
62+
`BoLD is currently only supported on L2s, with support for L3s coming soon. If you wish to deploy an L3, please use an older version of the SDK (v0.22.x) that doesn't use BoLD.`,
63+
);
64+
}
65+
5266
if (params.batchPosters.length === 0 || params.batchPosters.includes(zeroAddress)) {
5367
throw new Error(`"params.batchPosters" can't be empty or contain the zero address.`);
5468
}

0 commit comments

Comments
 (0)