Skip to content
Draft
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
6 changes: 5 additions & 1 deletion .github/workflows/bytecode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
- "artifacts/native_runtime.hex"
- "artifacts/erc20_deployment.hex"
- "artifacts/erc20_runtime.hex"
- "artifacts/erc20_batch_deployment.hex"
- "artifacts/erc20_batch_runtime.hex"
push:
paths:
- "src/**"
- "artifacts/native_deployment.hex"
- "artifacts/native_runtime.hex"
- "artifacts/erc20_deployment.hex"
- "artifacts/erc20_runtime.hex"
- "artifacts/erc20_batch_deployment.hex"
- "artifacts/erc20_batch_runtime.hex"
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -71,7 +75,7 @@ jobs:
if echo "$CHANGED_FILES" | grep -qE '^src/'; then
echo "Detected changes in src/."
MISSING=()
for f in native_deployment native_runtime erc20_deployment erc20_runtime; do
for f in native_deployment native_runtime erc20_deployment erc20_runtime erc20_batch_deployment erc20_batch_runtime; do
if echo "$CHANGED_FILES" | grep -qE "^artifacts/${f}\\.hex$"; then
echo "artifacts/${f}.hex changed as expected."
else
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: artifacts

artifacts:
@./scripts/update_artifacts.sh
1 change: 1 addition & 0 deletions artifacts/erc20_batch_deployment.hex

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions artifacts/erc20_batch_runtime.hex

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/EscrowERC20.sol/EscrowERC20.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion out/EscrowNative.sol/EscrowNative.json

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions scripts/update_artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Regenerate the pinned bytecode hex files in artifacts/ from the Forge build.
# Run after any change to src/ that affects compiled output. CI's bytecode
# guard requires these files to be updated in the same PR as src/ changes.
#
# Usage:
# make artifacts # from repo root (recommended)
# ./scripts/update_artifacts.sh # from repo root
# bash scripts/update_artifacts.sh # if not executable
#
# Requires: foundry (forge) and jq on PATH.

set -euo pipefail

cd "$(dirname "$0")/.."

forge build --silent

extract() {
local contract="$1"
local prefix="$2"
local json="out/${contract}.sol/${contract}.json"

if [[ ! -f "$json" ]]; then
echo "error: $json not found — did 'forge build' succeed?" >&2
exit 1
fi

jq -r '.bytecode.object' "$json" > "artifacts/${prefix}_deployment.hex"
jq -r '.deployedBytecode.object' "$json" > "artifacts/${prefix}_runtime.hex"
echo " artifacts/${prefix}_{deployment,runtime}.hex"
}

echo "Updating bytecode artifacts:"
extract EscrowERC20 erc20
extract EscrowNative native
extract EscrowBatch erc20_batch
Loading
Loading