From 9be8666f487b6b3220d5574f3186cce0585e8a57 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Mon, 13 Nov 2023 17:16:39 +0300 Subject: [PATCH] contracts-bedrock: cleanup scripts --- packages/contracts-bedrock/package.json | 2 +- .../scripts/generate-l2-genesis.sh | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/contracts-bedrock/package.json b/packages/contracts-bedrock/package.json index 9da53b0ff295..b1334d15b702 100644 --- a/packages/contracts-bedrock/package.json +++ b/packages/contracts-bedrock/package.json @@ -29,7 +29,7 @@ "validate-spacers": "pnpm build && pnpm validate-spacers:no-build", "slither": "./scripts/slither.sh", "slither:triage": "TRIAGE_MODE=1 ./scripts/slither.sh", - "clean": "rm -rf ./artifacts ./forge-artifacts ./cache ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo ./scripts/go-ffi/go-ffi", + "clean": "rm -rf ./artifacts ./forge-artifacts ./cache ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo ./scripts/go-ffi/go-ffi ./.testdata", "preinstall": "npx only-allow pnpm", "pre-pr:no-build": "pnpm gas-snapshot:no-build && pnpm storage-snapshot && pnpm semver-lock && pnpm autogen:invariant-docs && pnpm lint && pnpm bindings:go", "pre-pr": "pnpm clean && pnpm build:go-ffi && pnpm build && pnpm pre-pr:no-build", diff --git a/packages/contracts-bedrock/scripts/generate-l2-genesis.sh b/packages/contracts-bedrock/scripts/generate-l2-genesis.sh index 231aade16fbd..ccc5c91b8a36 100755 --- a/packages/contracts-bedrock/scripts/generate-l2-genesis.sh +++ b/packages/contracts-bedrock/scripts/generate-l2-genesis.sh @@ -18,21 +18,17 @@ OUTFILE_L2="$TESTDATA_DIR/genesis.json" OUTFILE_ROLLUP="$TESTDATA_DIR/rollup.json" OUTFILE_ALLOC="$TESTDATA_DIR/alloc.json" -mkdir -p "$TESTDATA_DIR" - if [ ! -f "$DEPLOY_ARTIFACT" ]; then forge script $CONTRACTS_DIR/scripts/Deploy.s.sol:Deploy 2>&1 /dev/null fi -# TODO: -# if the testdata dir doesn't exist, run the command -# add a clean command to the package.json - -go run $OP_NODE genesis l2 \ - --deploy-config "$CONTRACTS_DIR/deploy-config/hardhat.json" \ - --l1-deployments "$DEPLOY_ARTIFACT" \ - --l1-starting-block "$L1_STARTING_BLOCK_PATH" \ - --outfile.l2 "$OUTFILE_L2" \ - --outfile.rollup "$OUTFILE_ROLLUP" >/dev/null 2>&1 +if [ ! -d "$TESTDATA_DIR" ]; then + mkdir -p "$TESTDATA_DIR" -jq .alloc < "$OUTFILE_L2" > "$OUTFILE_ALLOC" + go run $OP_NODE genesis l2 \ + --deploy-config "$CONTRACTS_DIR/deploy-config/hardhat.json" \ + --l1-deployments "$DEPLOY_ARTIFACT" \ + --l1-starting-block "$L1_STARTING_BLOCK_PATH" \ + --outfile.l2 "$OUTFILE_L2" \ + --outfile.rollup "$OUTFILE_ROLLUP" >/dev/null 2>&1 +fi