igneum/tools/upstream/sync-upstream.sh
igneum-labs 228f9cf2a8 Provenance: credit every borrowed component, upstream merge procedure, prover customer brief
docs/provenance.md: table of every component Igneum uses (origin, licence, what changed, why, how measured), what is new, what to adopt from upstream, own-code licence pending the project lead's decision. Licences verified on disk: rusty-kaspa ISC, chiavdf Apache-2.0, igneum-pow MIT, blake2b_simd MIT, blake3 CC0 or Apache-2.0, sha2 MIT or Apache-2.0, secp256k1 CC0, keccak Apache-2.0 or MIT. RandomX, SP1, revm, blst, ProgPoW, LWMA, Monero, GMP, sha3: approximate, not cloned.
site: litepaper gains the Built on the shoulders section and nav entry; index gains the two-line mention and footer link near the RandomX comparison; the block rate reads one block a second at launch, rising, where it read as permanent (litepaper diagram, index live section).
tools/upstream: README with the exact merge commands, expected conflict files from fork-divergence, the test list and the consensus-review rule; sync-upstream.sh fetches and opens the merge on a branch without committing. Not run against the fork.
docs/commercial/prover-customer-brief.md: one-page brief for a first proving customer at testnet, timeline from journey.json, risks, 10 candidates labelled approximate.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-03 20:02:16 +00:00

104 lines
3.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Fetch a rusty-kaspa release tag into the Igneum node fork and open the merge on a branch.
# Commits nothing. A person reads the conflicts, runs the tests in tools/upstream/README.md,
# does the consensus review against docs/spec, and commits.
#
# Usage:
# tools/upstream/sync-upstream.sh <tag> [fork-dir] [upstream-url]
# tag a rusty-kaspa release tag, for example v2.2.0
# fork-dir default: vendor/igneum-node (relative to the repository root)
# upstream-url used only if the fork has no remote named "upstream";
# default: https://github.com/kaspanet/rusty-kaspa.git
#
# Refuses: a dirty working tree, a merge already in progress, a missing tag,
# an existing merge branch. Never touches master and never runs the devnet.
set -euo pipefail
tag="${1:-}"
if [[ -z "$tag" ]]; then
echo "usage: $0 <tag> [fork-dir] [upstream-url]" >&2
exit 2
fi
root="$(cd "$(dirname "$0")/../.." && pwd)"
fork="${2:-$root/vendor/igneum-node}"
url="${3:-https://github.com/kaspanet/rusty-kaspa.git}"
branch="merge/upstream-$tag"
base="master"
if [[ ! -d "$fork/.git" ]]; then
echo "no git repository at $fork" >&2
exit 1
fi
cd "$fork"
if [[ -n "$(git status --porcelain)" ]]; then
echo "refusing: working tree is not clean in $fork" >&2
git status --short >&2
exit 1
fi
if [[ -f .git/MERGE_HEAD ]]; then
echo "refusing: a merge is already in progress in $fork" >&2
exit 1
fi
if git show-ref --verify --quiet "refs/heads/$branch"; then
echo "refusing: branch $branch already exists" >&2
exit 1
fi
if ! git show-ref --verify --quiet "refs/heads/$base"; then
echo "refusing: no local branch $base" >&2
exit 1
fi
if ! git remote get-url upstream >/dev/null 2>&1; then
echo "adding remote upstream -> $url"
git remote add upstream "$url"
fi
echo "upstream is $(git remote get-url upstream)"
echo "fetching tags from upstream"
git fetch upstream --tags --prune
if ! git rev-parse --verify --quiet "refs/tags/$tag^{commit}" >/dev/null; then
echo "refusing: tag $tag not found after fetch. Known release tags:" >&2
git tag --list 'v*' | sort -V | tail -10 >&2
exit 1
fi
echo
echo "upstream changes in the consensus directories since the fork base (01b532e8):"
git log --oneline "01b532e8..$tag" -- consensus crypto/hashes crypto/txscript crypto/addresses protocol/p2p/proto mining || true
echo
git checkout -q -b "$branch" "$base"
echo "on branch $branch (from $base)"
set +e
git merge --no-commit --no-ff "$tag"
status=$?
set -e
echo
conflicts="$(git diff --name-only --diff-filter=U)"
if [[ -n "$conflicts" ]]; then
echo "merge opened with conflicts in:"
echo "$conflicts" | sed 's/^/ /'
echo
echo "expected conflict files and how to resolve each: tools/upstream/README.md"
elif [[ $status -eq 0 ]]; then
echo "merge opened cleanly, nothing committed"
else
echo "git merge exited $status without conflict markers; read the output above" >&2
exit $status
fi
cat <<EOF
Nothing has been committed. Next:
1. Resolve the conflicts, keeping every Igneum change (tools/upstream/README.md, "Where conflicts are expected").
2. Review every upstream change under consensus/, crypto/hashes, crypto/txscript, crypto/addresses,
protocol/p2p/proto and mining/ against docs/spec. A consensus-rule change needs a spec change first.
3. Run the tests listed in tools/upstream/README.md.
4. Commit on $branch with the tag, the conflicted files and the review result in the message.
To abandon: git merge --abort && git checkout $base && git branch -D $branch
EOF