Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/hyperevm/hyperevm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ case $STEP in
forge build >/dev/null || exit 1
# never lose the committed registry if a step fails: work on a backup and restore on any error
cp "$J" "$J.bak" 2>/dev/null || true
trap '[ -f "$J.bak" ] && { echo "registry step failed, restoring $J"; mv "$J.bak" "$J"; }; cp broadcast/Deploy-all.s.sol/'$CHAIN'/run-1*.json /dev/null 2>&1' ERR
trap '[ -f "$J.bak" ] && { echo "registry step failed, restoring $J"; mv "$J.bak" "$J"; }; cp "$(ls broadcast/Deploy-all.s.sol/'$CHAIN'/run-1*.json | sort | tail -1)" broadcast/Deploy-all.s.sol/'$CHAIN'/run-latest.json' ERR
set -e
rm -f "$J"
for b in $(ls broadcast/Deploy-all.s.sol/$CHAIN/run-1*.json | sort); do
Expand Down
15 changes: 8 additions & 7 deletions script/hyperevm/merge_extra_deploys.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,20 @@ def on_main(c):
runs = {}
for x in cfg["extra"]:
addr, tx = x["address"], x["deploymentTxn"]
rc = json.loads(sh("cast", "receipt", tx, "--json", "--rpc-url", rpc))
created = (rc.get("contractAddress") or "").lower()
if not created: # CREATE2 through the deterministic factory: derive keccak(0xff ++ factory ++ salt ++ keccak(initcode))
txj = json.loads(sh("cast", "tx", tx, "--json", "--rpc-url", rpc))
data = txj["input"]
# field accessors print plain values on every cast version; --json output changed shape in cast 1.8
created = sh("cast", "receipt", tx, "contractAddress", "--rpc-url", rpc).lower()
block = int(sh("cast", "receipt", tx, "blockNumber", "--rpc-url", rpc))
if not created.startswith("0x") or len(created) != 42: # CREATE2 through the deterministic factory
data = sh("cast", "tx", tx, "input", "--rpc-url", rpc)
factory = sh("cast", "tx", tx, "to", "--rpc-url", rpc)
salt, initcode = "0x" + data[2:66], "0x" + data[66:]
init_hash = sh("cast", "keccak", initcode)[2:]
created = "0x" + sh("cast", "keccak", "0xff" + txj["to"][2:] + salt[2:] + init_hash)[-40:].lower()
created = "0x" + sh("cast", "keccak", "0xff" + factory[2:] + salt[2:] + init_hash)[-40:].lower()
if created != addr.lower():
sys.exit(f"{x['name']}: tx {tx} created {created}, not {addr}")
if sh("cast", "code", addr, "--rpc-url", rpc) == "0x":
sys.exit(f"{x['name']}: no code at {addr}")
ts = int(sh("cast", "block", str(int(rc["blockNumber"], 16)), "-f", "timestamp", "--rpc-url", rpc)) * 1000
ts = int(sh("cast", "block", str(block), "-f", "timestamp", "--rpc-url", rpc)) * 1000
# chronicles hashes the implementation's creation input for proxies, the contract's own otherwise
hash_tx = x.get("implementationTxn", tx)
h = sh("cast", "keccak", sh("cast", "tx", hash_tx, "input", "--rpc-url", rpc))[2:]
Expand Down
Loading