Fix CARROT sync regression: early view tag rejection for multi-output txs

Multi-output CARROT transactions store per-output D_e in additional_pubkeys
  (tag 0x04) with no tx_pubkey (tag 0x01), so the single-D_e pre-computation
  path was skipped entirely — every output hit the full _scanCarrotOutput path
  (~40ms each via FFI). Added per-output X25519 + 3-byte view tag rejection
  that restores post-fork sync from ~10 blk/s back to ~900+ blk/s.

  Also fixed parseExtra to handle 0xDE (minergate tag) and gracefully skip
  unknown tags via varint-length instead of aborting all remaining extra bytes.
This commit is contained in:
Matt Hess
2026-02-13 00:01:18 +00:00
parent ddeb249b09
commit 070901f2dd
5 changed files with 1005 additions and 23 deletions
+27 -12
View File
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
# Build libsalvium_crypto.a for iOS (device + simulator)
# Build libsalvium_crypto.a for iOS (device + simulator) as an xcframework.
#
# Prerequisites:
# rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
#
# Produces: prebuilt/ios/libsalvium_crypto.a (universal fat binary via lipo)
# Produces: prebuilt/ios/SalviumCrypto.xcframework
set -euo pipefail
@@ -12,6 +12,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$SCRIPT_DIR/.."
CRATE_DIR="$ROOT_DIR/crates/salvium-crypto"
OUT_DIR="$ROOT_DIR/prebuilt/ios"
WORK_DIR="$OUT_DIR/build"
TARGETS=(
aarch64-apple-ios # Device (arm64)
@@ -26,16 +27,30 @@ for target in "${TARGETS[@]}"; do
cargo build --release --target "$target" --manifest-path "$CRATE_DIR/Cargo.toml"
done
echo "==> Creating universal binary with lipo..."
mkdir -p "$OUT_DIR"
echo "==> Creating xcframework..."
mkdir -p "$WORK_DIR"
# Collect all .a paths
LIBS=()
for target in "${TARGETS[@]}"; do
LIBS+=("$CRATE_DIR/target/$target/release/libsalvium_crypto.a")
done
# Device .a (single arch, no lipo needed)
DEVICE_LIB="$CRATE_DIR/target/aarch64-apple-ios/release/libsalvium_crypto.a"
lipo -create "${LIBS[@]}" -output "$OUT_DIR/libsalvium_crypto.a"
# Merge simulator slices (aarch64-sim + x86_64) into one fat .a
SIM_FAT="$WORK_DIR/libsalvium_crypto-sim.a"
lipo -create \
"$CRATE_DIR/target/aarch64-apple-ios-sim/release/libsalvium_crypto.a" \
"$CRATE_DIR/target/x86_64-apple-ios/release/libsalvium_crypto.a" \
-output "$SIM_FAT"
# Remove old xcframework if present
rm -rf "$OUT_DIR/SalviumCrypto.xcframework"
# Create xcframework from device .a + simulator fat .a
xcodebuild -create-xcframework \
-library "$DEVICE_LIB" \
-library "$SIM_FAT" \
-output "$OUT_DIR/SalviumCrypto.xcframework"
# Clean up work dir
rm -rf "$WORK_DIR"
echo "==> Done: $OUT_DIR/SalviumCrypto.xcframework"
echo "==> Done: $OUT_DIR/libsalvium_crypto.a"
lipo -info "$OUT_DIR/libsalvium_crypto.a"