Skip to content

Commit

Permalink
introduce monorepoBuildCommand artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
geoknee committed Aug 22, 2024
1 parent 0516b9e commit f5de7e7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
15 changes: 3 additions & 12 deletions validation/genesis/genesis-predeploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,9 @@ func testGenesisPredeploys(t *testing.T, chain *ChainConfig) {
// blow away any leftover files from the previous run
executeCommandInDir(t, monorepoDir, exec.Command("git", "reset", "--hard", monorepoCommit))

// TODO unskip these, I am skipping to save time in development since we
// are not validating multiple chains yet
if false {
executeCommandInDir(t, monorepoDir, exec.Command("rm", "-rf", "node_modules"))
executeCommandInDir(t, contractsDir, exec.Command("rm", "-rf", "node_modules"))
}
executeCommandInDir(t, monorepoDir, exec.Command("rm", "-rf", "node_modules"))
executeCommandInDir(t, contractsDir, exec.Command("rm", "-rf", "node_modules"))

// install dependencies
// TODO we expect this step to vary as we scan through the monorepo history
// so we will need some branching logic here
// executeCommandInDir(t, contractsDir, exec.Command("pnpm", "install", "--no-frozen-lockfile"))
executeCommandInDir(t, contractsDir, exec.Command("yarn", "install", "--no-frozen-lockfile"))

if monorepoCommit == "d80c145e0acf23a49c6a6588524f57e32e33b91" {
// apply a patch to get things working
Expand Down Expand Up @@ -101,7 +92,7 @@ func testGenesisPredeploys(t *testing.T, chain *ChainConfig) {

// regenerate genesis.json at this monorepo commit.
executeCommandInDir(t, thisDir, exec.Command("cp", "./monorepo-outputs.sh", monorepoDir))
executeCommandInDir(t, monorepoDir, exec.Command("sh", "./monorepo-outputs.sh", vis.GenesisCreationCommand))
executeCommandInDir(t, monorepoDir, exec.Command("sh", "./monorepo-outputs.sh", vis.MonorepoBuildCommand, vis.GenesisCreationCommand))

expectedData, err := os.ReadFile(path.Join(monorepoDir, "expected-genesis.json"))
require.NoError(t, err)
Expand Down
1 change: 1 addition & 0 deletions validation/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ func init() {

type ValidationMetadata struct {
GenesisCreationCommit string `toml:"genesis_creation_commit"` // in https://github.com/ethereum-optimism/optimism/
MonorepoBuildCommand string `toml:"monorepo_build_command"`
GenesisCreationCommand string `toml:"genesis_creation_command"`
}
14 changes: 9 additions & 5 deletions validation/genesis/monorepo-outputs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
set -e

echo "Inferring and selecting correct Node version"
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm use

echo "Running install command"
eval $1

echo "Inferring and selecting correct go version"

go_version=$(grep -m 1 '^go ' go.mod | awk '{print $2}')
Expand All @@ -11,11 +19,7 @@ gvm install go${go_version} || exit 1
gvm use go${go_version} || exit 1
set -e

echo "Inferring and selecting correct Node version"
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm use

echo "Running op-node genesis l2 command"

eval "$1"
eval "$2"
1 change: 1 addition & 0 deletions validation/genesis/validation-inputs/34443/meta.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
genesis_creation_commit = "3eda4cd594ba6409584eb6ef95c341d98419e392"
monorepo_build_command = "yarn install --no-frozen-lockfile"
genesis_creation_command = """\
go \
run \
Expand Down
1 change: 1 addition & 0 deletions validation/genesis/validation-inputs/480/meta.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
genesis_creation_commit = "4a3d3fb444f50bed6a6991785ea5634e0efa07a4"
monorepo_build_command = "pnpm install --no-frozen-lockfile"
genesis_creation_command = """\
go \
run \
Expand Down
1 change: 1 addition & 0 deletions validation/genesis/validation-inputs/4801/meta.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
genesis_creation_commit = "4a3d3fb444f50bed6a6991785ea5634e0efa07a4"
monorepo_build_command = "pnpm install --no-frozen-lockfile"
genesis_creation_command = """\
go \
run \
Expand Down

0 comments on commit f5de7e7

Please sign in to comment.