Commit 5b23c3d1 authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint(ct): minor contracts script cleanup (#9724)

Just some minor cleanup and reorganization in the script folder.
Wanted to tidy up all the different scripts we have.
parent e74c7d91
......@@ -31,7 +31,7 @@
"release:version": "changeset version && pnpm install --lockfile-only",
"install:foundry": "curl -L https://foundry.paradigm.xyz | bash && pnpm update:foundry",
"update:foundry": "bash ./ops/scripts/install-foundry.sh",
"check:foundry": "bash ./packages/contracts-bedrock/scripts/verify-foundry-install.sh",
"check:foundry": "bash ./packages/contracts-bedrock/scripts/checks/check-foundry-install.sh",
"install:kontrol": "curl -L https://kframework.org/install | bash && pnpm update:kontrol",
"update:kontrol": "kup install kontrol --version v$(jq -r .kontrol < versions.json)",
"install:abigen": "go install github.com/ethereum/go-ethereum/cmd/abigen@$(jq -r .abigen < versions.json)",
......
......@@ -115,7 +115,7 @@ All test contracts and functions should be organized and named according to the
These guidelines are also encoded in a script which can be run with:
```
tsx scripts/forge-test-names.ts
tsx scripts/checks/check-test-names.ts
```
#### Expect Revert with Low Level Calls
......
......@@ -28,7 +28,7 @@ To auto-generate documentation for invariant tests, run `pnpm autogen:invariant-
## Documentation Standard
In order for an invariant test file to be picked up by the [docgen script](../scripts/invariant-doc-gen.ts), it must
In order for an invariant test file to be picked up by the [docgen script](../scripts/autogen/generate-invariant-docs.ts), it must
adhere to the following conventions:
### Forge Invariants
......
......@@ -14,10 +14,10 @@
"bindings:ts": "nx generate @eth-optimism/contracts-ts",
"bindings:go:no-build": "cd ../../op-bindings && make bindings-build",
"bindings:go": "pnpm clean && pnpm build && pnpm bindings:go:no-build",
"prebuild": "./scripts/verify-foundry-install.sh",
"prebuild": "./scripts/checks/check-foundry-install.sh",
"build": "forge build",
"build:go-ffi": "(cd scripts/go-ffi && go build)",
"autogen:invariant-docs": "npx tsx scripts/invariant-doc-gen.ts",
"autogen:invariant-docs": "npx tsx scripts/autogen/generate-invariant-docs.ts",
"test": "pnpm build:go-ffi && forge test",
"test:kontrol": "./test/kontrol/scripts/run-kontrol.sh",
"genesis": "./scripts/generate-l2-genesis.sh",
......@@ -27,11 +27,11 @@
"gas-snapshot:no-build": "forge snapshot --match-contract GasBenchMark",
"statediff": "./scripts/statediff.sh && git diff --exit-code",
"gas-snapshot": "pnpm build:go-ffi && pnpm gas-snapshot:no-build",
"snapshots": "npx tsx scripts/generate-snapshots.ts && ./test/kontrol/scripts/make-summary-deployment.sh",
"snapshots:check": "./scripts/check-snapshots.sh",
"snapshots": "npx tsx scripts/autogen/generate-snapshots.ts && ./test/kontrol/scripts/make-summary-deployment.sh",
"snapshots:check": "./scripts/checks/check-snapshots.sh",
"semver-lock": "forge script scripts/SemverLock.s.sol",
"validate-deploy-configs": "./scripts/check-deploy-configs.sh",
"validate-spacers:no-build": "npx tsx scripts/validate-spacers.ts",
"validate-deploy-configs": "./scripts/checks/check-deploy-configs.sh",
"validate-spacers:no-build": "npx tsx scripts/checks/check-spacers.ts",
"validate-spacers": "pnpm build && pnpm validate-spacers:no-build",
"clean": "rm -rf ./artifacts ./forge-artifacts ./cache ./tsconfig.tsbuildinfo ./tsconfig.build.tsbuildinfo ./scripts/go-ffi/go-ffi ./.testdata ./deployments/hardhat/*",
"preinstall": "npx only-allow pnpm",
......@@ -39,7 +39,7 @@
"pre-pr": "pnpm clean && pnpm build:go-ffi && pnpm build && pnpm pre-pr:no-build",
"pre-pr:full": "pnpm test && pnpm validate-deploy-configs && pnpm validate-spacers && pnpm pre-pr",
"lint:ts:check": "eslint . --max-warnings=0",
"lint:forge-tests:check": "npx tsx scripts/forge-test-names.ts",
"lint:forge-tests:check": "npx tsx scripts/checks/check-test-names.ts",
"lint:contracts:check": "pnpm lint:fix && git diff --exit-code",
"lint:check": "pnpm lint:contracts:check && pnpm lint:ts:check",
"lint:ts:fix": "eslint --fix .",
......
import fs from 'fs'
import path from 'path'
const BASE_INVARIANTS_DIR = path.join(__dirname, '..', 'test', 'invariants')
const BASE_DOCS_DIR = path.join(__dirname, '..', 'invariant-docs')
const ROOT_DIR = path.join(__dirname, '..', '..')
const BASE_INVARIANTS_DIR = path.join(ROOT_DIR, 'test', 'invariants')
const BASE_DOCS_DIR = path.join(ROOT_DIR, 'invariant-docs')
const BASE_INVARIANT_GH_URL = '../test/invariants/'
const NATSPEC_INV = '@custom:invariant'
......
import fs from 'fs'
import path from 'path'
const outdir = process.argv[2] || path.join(__dirname, '..', 'snapshots')
const forgeArtifactsDir = path.join(__dirname, '..', 'forge-artifacts')
const root = path.join(__dirname, '..', '..')
const outdir = process.argv[2] || path.join(root, 'snapshots')
const forgeArtifactsDir = path.join(root, 'forge-artifacts')
const getAllContractsSources = (): Array<string> => {
const paths = []
......@@ -20,7 +21,7 @@ const getAllContractsSources = (): Array<string> => {
}
}
}
readFilesRecursively(path.join(__dirname, '..', 'src'))
readFilesRecursively(path.join(root, 'src'))
return paths
.filter((x) => x.endsWith('.sol'))
......
......@@ -7,7 +7,7 @@
code=0
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONTRACTS_BASE=$(dirname "$SCRIPT_DIR")
CONTRACTS_BASE=$(dirname "$(dirname "$SCRIPT_DIR")")
MONOREPO_BASE=$(dirname "$(dirname "$CONTRACTS_BASE")")
for config in "$CONTRACTS_BASE"/deploy-config/*.json; do
......
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONTRACTS_BASE=$(dirname "$SCRIPT_DIR")
CONTRACTS_BASE=$(dirname "$(dirname "$SCRIPT_DIR")")
MONOREPO_BASE=$(dirname "$(dirname "$CONTRACTS_BASE")")
VERSIONS_FILE="${MONOREPO_BASE}/versions.json"
......
......@@ -7,7 +7,7 @@ import path from 'path'
* defaults to the forge-artifacts directory.
*/
const directoryPath =
process.argv[2] || path.join(__dirname, '..', 'forge-artifacts')
process.argv[2] || path.join(__dirname, '..', '..', 'forge-artifacts')
/**
* Returns true if the contract should be skipped when inspecting its storage layout.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment