-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into bold-merge
- Loading branch information
Showing
10 changed files
with
240 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
"test:upgrade": "./scripts/testUpgrade.bash", | ||
"test:foundry": "forge test --gas-limit 10000000000", | ||
"test:update": "yarn run test:signatures || yarn run test:storage", | ||
"metadatahash": "yarn build:all && hardhat run scripts/printMetadataHashes.ts", | ||
"upload-4bytes": "forge build && find ./out -type f -name \"*.json\" -exec cast upload-signature {} + | grep -v Duplicated:", | ||
"postinstall": "patch-package", | ||
"deploy-factory": "hardhat run scripts/deployment.ts", | ||
|
@@ -66,8 +67,8 @@ | |
"@arbitrum/nitro-contracts-2.0.0": "npm:@arbitrum/[email protected]", | ||
"@arbitrum/sdk": "^3.4.1", | ||
"@ethersproject/providers": "^5.7.2", | ||
"@nomicfoundation/hardhat-verify": "^2.0.9", | ||
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13", | ||
"@nomiclabs/hardhat-etherscan": "^3.1.0", | ||
"@nomiclabs/hardhat-waffle": "^2.0.1", | ||
"@tovarishfin/hardhat-yul": "^3.0.5", | ||
"@typechain/ethers-v5": "^10.0.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import path from 'path' | ||
import fs from 'fs-extra' | ||
import hre from 'hardhat' | ||
import { execSync } from 'child_process' | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error: Error) => { | ||
console.error(error) | ||
process.exit(1) | ||
}) | ||
|
||
async function main() { | ||
const contracts: string[] = [ | ||
'Inbox', | ||
'Outbox', | ||
'SequencerInbox', | ||
'Bridge', | ||
'ERC20Inbox', | ||
'ERC20Outbox', | ||
'SequencerInbox', | ||
'ERC20Bridge', | ||
'RollupProxy', | ||
'RollupAdminLogic', | ||
'RollupUserLogic', | ||
'ChallengeManager', | ||
] | ||
|
||
// Print the current git tag | ||
const gitTag = execSync('git describe --tags').toString().trim() | ||
console.log(`Current tag: ${gitTag}`) | ||
|
||
// Check if yarn packages match yarn.lock | ||
try { | ||
execSync('yarn install --check-files', { stdio: 'ignore' }) | ||
} catch (e) { | ||
console.error('Yarn packages does not match yarn.lock') | ||
process.exit(1) | ||
} | ||
|
||
// Check if the current working directory is clean | ||
try { | ||
execSync('git update-index --really-refresh', { stdio: 'ignore' }) | ||
if (execSync('git status --porcelain').toString().trim()) { | ||
console.error('The current working directory have staged changes.') | ||
process.exit(1) | ||
} | ||
} catch (e) { | ||
console.error('The current working directory is not clean.') | ||
process.exit(1) | ||
} | ||
|
||
console.log('HARDHAT:') | ||
for (const contract of contracts) { | ||
const hash = await _getHardhatMetadataHash(contract) | ||
console.log(`${contract}: ${hash}`) | ||
} | ||
|
||
console.log('\nFOUNDRY:') | ||
for (const contract of contracts) { | ||
const hash = await _getFoundryMetadataHash(contract) | ||
console.log(`${contract}: ${hash}`) | ||
} | ||
} | ||
|
||
async function _getHardhatMetadataHash(contractName: string): Promise<string> { | ||
const artifact = await hre.artifacts.readArtifact(contractName) | ||
return _extractMetadataHash(artifact.bytecode) | ||
} | ||
|
||
async function _getFoundryMetadataHash(contractName: string): Promise<string> { | ||
const artifactPath = path.join( | ||
'out', | ||
`${contractName}.sol`, | ||
`${contractName}.json` | ||
) | ||
const artifact = await fs.readJson(artifactPath) | ||
return _extractMetadataHash(artifact.bytecode.object) | ||
} | ||
|
||
function _extractMetadataHash(bytecode: string): string { | ||
const metadataPattern = /a264697066735822([a-fA-F0-9]{64})/ | ||
const matches = bytecode.match(metadataPattern) | ||
|
||
if (matches && matches.length > 1) { | ||
return matches[1] | ||
} else { | ||
throw new Error('No metadata hash found in bytecode') | ||
} | ||
} |
Oops, something went wrong.