Skip to content

Commit

Permalink
feat: add commit hash to genesis file
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcontracts committed Nov 10, 2021
1 parent d270b45 commit 0272a53
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-tigers-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/contracts': patch
---

Adds a git commit hash to the output of make-genesis.ts
13 changes: 13 additions & 0 deletions packages/contracts/src/make-genesis.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* External Imports */
import { promisify } from 'util'
import { exec } from 'child_process'
import {
computeStorageSlots,
getStorageLayout,
Expand Down Expand Up @@ -127,7 +129,18 @@ export const makeL2GenesisFile = async (
}
}

// Grab the commit hash so we can stick it in the genesis file.
let commit: string
try {
const { stdout } = await promisify(exec)('git rev-parse HEAD')
commit = stdout.replace('\n', '')
} catch {
console.log('unable to get commit hash, using empty hash instead')
commit = '0000000000000000000000000000000000000000'
}

return {
commit,
config: {
chainId: cfg.l2ChainId,
homesteadBlock: 0,
Expand Down

0 comments on commit 0272a53

Please sign in to comment.