Skip to content

Commit 3b0ca95

Browse files
peachbitsclaude
andcommitted
Bump SDK to 2.6.0-alpha.6; ship deps as a real link input
Bumps the vendored ZcashLightClientKit to 2.6.0-alpha.6 (the first hardfork-era prerelease: new Voting/PIR module, expanded libzcashlc FFI, updated checkpoints). The bridge needs no changes - the SDK's bridge-facing API surface is source-compatible with 2.5.2, and the dependency graph pins are identical. Packaging fix: the previous pod_target_xcconfig OTHER_LDFLAGS -force_load flags never reached any link step (a static-framework pod's Libtool step ignores OTHER_LDFLAGS, and pod-target settings don't propagate to the app link). Builds only succeeded because react-native-piratechain's gRPC-Swift 1.8 pods happened to satisfy zcash's grpc/NIO references at the app link - a silent version mix (compiled against 1.27 modules, linked against 1.8 definitions) that Release-mode optimization finally exposed via DequeModule internals. The deps now ship as ios/vendored/libZcashDeps.xcframework via vendored_frameworks, which CocoaPods places on the app link line as a real input. Validated in isolation: with piratechain's iOS pods removed from the host app, a Release build links with zero undefined symbols and the app binary carries the 1.27 GRPC/NIO/Deque definitions and the alpha.6 voting FFI. Also: buildVendoredDeps cleans DerivedData per run (stale precompiled modules of the libzcashlc header poison version bumps), builds Release config, and the pod floor returns to iOS 13.0 (the SDK's own minimum) so the package works on Edge develop (15.6) and the RN 0.85 branch (16.4) alike. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 128a823 commit 3b0ca95

3 files changed

Lines changed: 57 additions & 18 deletions

File tree

react-native-zcash.podspec

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Pod::Spec.new do |s|
4444
s.license = package['license']
4545
s.authors = package['author']
4646

47-
s.platform = :ios, "16.0"
47+
s.platform = :ios, "13.0"
4848
s.source = {
4949
:git => "https://github.com/EdgeApp/react-native-zcash.git",
5050
:tag => "v#{s.version}"
@@ -67,8 +67,13 @@ Pod::Spec.new do |s|
6767
s.dependency "MnemonicSwift", "~> 2.2"
6868
s.dependency "React-Core"
6969

70-
# The Rust core (a binaryTarget on the SDK's GitHub release):
71-
s.vendored_frameworks = "ios/libzcashlc.xcframework"
70+
# The Rust core (a binaryTarget on the SDK's GitHub release) plus the
71+
# pre-built SwiftPM deps (see below). Vendored frameworks are real link
72+
# inputs: CocoaPods adds them to the app link, where the linker pulls
73+
# members on demand to satisfy the in-pod SDK source's references.
74+
s.vendored_frameworks =
75+
"ios/libzcashlc.xcframework",
76+
"ios/vendored/libZcashDeps.xcframework"
7277

7378
# ---------------------------------------------------------------------------
7479
# The SDK's SwiftPM-only dependencies (grpc-swift, SwiftNIO, SwiftProtobuf,
@@ -92,12 +97,6 @@ Pod::Spec.new do |s|
9297
s.preserve_paths = "ios/vendored/**/*"
9398
s.pod_target_xcconfig = {
9499
"SWIFT_INCLUDE_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ios/vendored/modules\"",
95-
"OTHER_SWIFT_FLAGS" => cmodule_flags,
96-
# force_load the matching slice so the deps' Swift type metadata / protocol
97-
# conformances (referenced by the SDK source) aren't dead-stripped:
98-
"OTHER_LDFLAGS[sdk=iphoneos*]" =>
99-
"-force_load \"$(PODS_TARGET_SRCROOT)/ios/vendored/libZcashDeps-ios-arm64.a\"",
100-
"OTHER_LDFLAGS[sdk=iphonesimulator*]" =>
101-
"-force_load \"$(PODS_TARGET_SRCROOT)/ios/vendored/libZcashDeps-ios-arm64-simulator.a\""
100+
"OTHER_SWIFT_FLAGS" => cmodule_flags
102101
}
103102
end

scripts/buildVendoredDeps.ts

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ export function buildVendoredDeps(): void {
9191
for (const platform of PLATFORMS) {
9292
console.log(` Compiling deps for ${platform.dir}...`)
9393
const dd = join(tmp, `deps-dd-${platform.dir}`)
94+
// Always start from clean DerivedData: reusing it across SDK version bumps
95+
// poisons the build with stale precompiled modules of the libzcashlc
96+
// binary-target header ("zcashlc.h has been modified since the module file
97+
// was built"), surfacing as bogus cannot-find-FFI-symbol errors.
98+
rm(dd)
9499
loud(wrapper, [
95100
'xcodebuild',
96101
'-scheme',
@@ -115,6 +120,38 @@ export function buildVendoredDeps(): void {
115120
harvestModules(dd)
116121
}
117122

123+
// Package the per-platform archives as ONE xcframework: vendored_frameworks
124+
// is a real link input (CocoaPods puts it on the app link line, unlike
125+
// pod_target_xcconfig OTHER_LDFLAGS, which a static-framework pod's Libtool
126+
// step silently ignores).
127+
console.log(' Creating libZcashDeps.xcframework...')
128+
const xcframework = join(vendored, 'libZcashDeps.xcframework')
129+
rm(xcframework)
130+
const libArgs: string[] = []
131+
for (const platform of PLATFORMS) {
132+
// CocoaPods requires a UNIFORM library basename across xcframework slices
133+
// (mirroring libzcashlc.xcframework); stage each platform's lib under the
134+
// same name in its own directory:
135+
const stage = join(tmp, `xcfw-${platform.dir}`)
136+
rm(stage)
137+
mkdirSync(stage, { recursive: true })
138+
cp(
139+
join(vendored, `libZcashDeps-${platform.dir}.a`),
140+
join(stage, 'libZcashDeps.a')
141+
)
142+
libArgs.push('-library', join(stage, 'libZcashDeps.a'))
143+
}
144+
loud(tmp, [
145+
'xcodebuild',
146+
'-create-xcframework',
147+
...libArgs,
148+
'-output',
149+
xcframework
150+
])
151+
for (const platform of PLATFORMS) {
152+
rm(join(vendored, `libZcashDeps-${platform.dir}.a`))
153+
}
154+
118155
writeCompilerStamp()
119156
assertHarvestComplete()
120157
console.log('Vendored deps built.')
@@ -133,7 +170,9 @@ function writeWrapperPackage(): void {
133170
import PackageDescription
134171
let package = Package(
135172
name: "ZcashDepsWrapper",
136-
platforms: [.iOS(.v16)],
173+
// Match the SDK's own floor (iOS 13) so the prebuilt deps import cleanly
174+
// from any host at or above it (Edge develop pins 15.6):
175+
platforms: [.iOS(.v13)],
137176
products: [.library(name: "ZcashDepsWrapper", type: .static, targets: ["ZcashDepsWrapper"])],
138177
dependencies: [.package(path: ${JSON.stringify(sdkClone)})],
139178
targets: [.target(name: "ZcashDepsWrapper", dependencies: [
@@ -288,9 +327,9 @@ function assertHarvestComplete(): void {
288327
name.endsWith('.swiftmodule')
289328
).length
290329
const cmoduleCount = readdirSync(join(vendored, 'cmodules')).length
291-
for (const platform of PLATFORMS) {
292-
const lib = join(vendored, `libZcashDeps-${platform.dir}.a`)
293-
if (!existsSync(lib)) throw new Error(`Missing ${lib}`)
330+
const xcframework = join(vendored, 'libZcashDeps.xcframework')
331+
if (!existsSync(join(xcframework, 'Info.plist'))) {
332+
throw new Error(`Missing or incomplete ${xcframework}`)
294333
}
295334
if (moduleCount < 10 || cmoduleCount < 5) {
296335
throw new Error(

scripts/updateSources.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,23 @@ async function main(): Promise<void> {
2929

3030
// The Swift SDK version to vendor. The matching libzcashlc.xcframework is
3131
// downloaded from this release's assets (see rebuildXcframework).
32-
const ZCASH_SWIFT_SDK_VERSION = '2.5.2'
32+
const ZCASH_SWIFT_SDK_VERSION = '2.6.0-alpha.6'
3333

3434
// SHA-256 of the libzcashlc.xcframework.zip release asset for the version
3535
// above. The download is verified against this pin before it is unpacked, so a
3636
// tampered or swapped upstream asset fails the build instead of injecting
3737
// attacker-controlled native code. Update this whenever the SDK version bumps:
3838
// curl -fL https://github.com/zcash/zcash-swift-wallet-sdk/releases/download/<ver>/libzcashlc.xcframework.zip | shasum -a 256
39+
// (matches the `checksum:` in the SDK tag's own Package.swift binaryTarget)
3940
const LIBZCASHLC_XCFRAMEWORK_SHA256 =
40-
'27089796e15eacd0e5a90e7ea01884ea5c40806cf25a6fa9a6aca933dad65813'
41+
'c58c1714440f8fd40bed33eefa3be325896e58eb568ed8747c05a27dae3a74b2'
4142

4243
function downloadSources(): void {
4344
getRepo(
4445
'ZcashLightClientKit',
4546
'https://github.com/zcash/zcash-swift-wallet-sdk.git',
46-
// 2.5.2:
47-
'e725a2482dced83afda91bcebe881bd0791aa359'
47+
// 2.6.0-alpha.6:
48+
'4303068e9282bb8b03bd94807b7d8ad268de75bf'
4849
)
4950
// libzcashlc is no longer a separate package as of SDK 2.5.x — it ships as a
5051
// binaryTarget zip on the SDK's GitHub release, downloaded in rebuildXcframework().

0 commit comments

Comments
 (0)