Skip to content

Commit f723230

Browse files
committed
feat: add bytecode verification
1 parent 2f56586 commit f723230

File tree

3 files changed

+46
-1
lines changed

3 files changed

+46
-1
lines changed

foundry.toml

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ out = "out"
44
libs = ["lib"]
55
optimizer = true
66
optimizer_runs = 999999
7+
via_ir = true
78
solc_version = "0.8.25"
9+
evm_version = "cancun"
810

911
[profile.intense.fuzz]
1012
max_test_rejects = 999999

script/Verify.sol

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// VerificationTester.sol
2+
// SPDX-License-Identifier: MIT
3+
pragma solidity ^0.8.25;
4+
5+
import "forge-std/Script.sol";
6+
import "forge-std/console.sol";
7+
8+
contract VerificationTester is Script {
9+
function run() public {
10+
// Load environment variables;
11+
address CONTRACT_ADDRESS = 0xEaf1db02ad660f832AAa6F84F2Cb639c0F1cB5C6;
12+
13+
// Get deployed bytecode
14+
bytes memory deployedBytecode =
15+
vm.getDeployedCode(string.concat(vm.projectRoot(), "/src/AvailWormhole.sol:AvailWormhole"));
16+
17+
// Get on-chain bytecode
18+
bytes memory onchainBytecode;
19+
assembly {
20+
let size := extcodesize(CONTRACT_ADDRESS)
21+
onchainBytecode := mload(0x40)
22+
mstore(0x40, add(onchainBytecode, add(size, 0x20)))
23+
mstore(onchainBytecode, size)
24+
extcodecopy(CONTRACT_ADDRESS, add(onchainBytecode, 0x20), 0, size)
25+
}
26+
27+
// Compare bytecode lengths
28+
console.log("Deployed bytecode length:", deployedBytecode.length);
29+
console.log("On-chain bytecode length:", onchainBytecode.length);
30+
31+
// Compare bytecode (first 100 bytes for quick check)
32+
bytes memory deployedPrefix = new bytes(14613);
33+
bytes memory onchainPrefix = new bytes(14613);
34+
for (uint256 i = 0; i < 14613; i++) {
35+
if (i < deployedBytecode.length) deployedPrefix[i] = deployedBytecode[i];
36+
if (i < onchainBytecode.length) onchainPrefix[i] = onchainBytecode[i];
37+
}
38+
39+
console.logBytes(deployedPrefix);
40+
console.log(" ############## ");
41+
console.logBytes(onchainPrefix);
42+
}
43+
}

src/interfaces/INttToken.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-License-Identifier: Apache 2
1+
// SPDX-License-Identifier: Apache-2.0
22
pragma solidity ^0.8.25;
33

44
interface INttToken {

0 commit comments

Comments
 (0)