Skip to content

Commit 102b1e9

Browse files
s2imonoviclumtis
andauthored
feat: implement contract diff check tool (#587) (#589)
Co-authored-by: Lucas Bertrand <[email protected]>
1 parent a4b3731 commit 102b1e9

File tree

11 files changed

+515
-8
lines changed

11 files changed

+515
-8
lines changed

.github/workflows/generated-files.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78
paths:
89
- "**"
910
pull_request:

.github/workflows/lint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78
paths:
89
- '**'
910
pull_request:

.github/workflows/semgrep.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
push:
66
branches:
77
- main
8+
- develop
89
schedule:
910
# random HH:MM to avoid a load spike on GitHub Actions at 00:00
1011
- cron: '56 22 * * *'

.github/workflows/slither.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78
paths:
89
- '**'
910
pull_request:

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78
paths:
89
- '**'
910
pull_request:

hardhat.config.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ task("upgradeProposal", "Create Safe upgrade proposals for GatewayEVM")
4444
}
4545
});
4646

47-
task("protocolChecksum", "Run EVM protocol checksum verification")
48-
.addFlag("testnet", "Run checksum for testnet networks")
49-
.addFlag("mainnet", "Run checksum for mainnet networks")
47+
task("protocolChecksum", "Run EVM protocol checkers verification")
48+
.addFlag("testnet", "Run checkers for testnet networks")
49+
.addFlag("mainnet", "Run checkers for mainnet networks")
5050
.setAction(async (taskArgs, hre) => {
5151
try {
5252
const isMainnet = taskArgs.mainnet;
@@ -55,12 +55,36 @@ task("protocolChecksum", "Run EVM protocol checksum verification")
5555

5656
process.env.NETWORK_TYPE = networkType;
5757

58-
const checksumScript = await import("./scripts/checksum/protocolChecksum");
58+
const checksumScript = await import("./scripts/checkers/protocolChecksum");
5959
await checksumScript.main();
6060
} catch (error) {
61-
console.error("❌ Error running protocol checksum script:", error);
61+
console.error("❌ Error running protocol checkers script:", error);
6262
process.exit(1);
6363
}
6464
});
6565

66+
task("contractDiff", "Fetch and flatten smart contracts for diff analysis")
67+
.addParam("oldAddress", "Address of the old implementation contract")
68+
.addParam("newAddress", "Address of the new implementation contract")
69+
.setAction(async (taskArgs, hre) => {
70+
try {
71+
console.log("🔍 Contract Diff Tool");
72+
console.log("=".repeat(60));
73+
console.log(`Network: ${hre.network.name}`);
74+
console.log(`Old Implementation: ${taskArgs.oldAddress}`);
75+
console.log(`New Implementation: ${taskArgs.newAddress}`);
76+
console.log("=".repeat(60));
77+
78+
const contractDiffTool = await import("./scripts/contractDiff/contractDiffTool");
79+
await contractDiffTool.fetchAndFlattenContract(
80+
taskArgs.oldAddress,
81+
taskArgs.newAddress,
82+
hre.network.name
83+
)
84+
} catch (error) {
85+
console.error("❌ Error running contract diff tool:", error);
86+
process.exit(1);
87+
}
88+
});
89+
6690
export default config;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,4 @@ async function checksumNetworks() {
350350

351351
export async function main() {
352352
await checksumNetworks();
353-
}
353+
}
File renamed without changes.

0 commit comments

Comments
 (0)