Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare 0.0.118 #124

Merged
merged 25 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a0e95f8
Update parser file to handle Double, f64, and types with multiple und…
arik-so Sep 28, 2023
d176200
Update generated Swift files for 117.
arik-so Sep 28, 2023
0020930
Fix framework files for 117.
arik-so Sep 28, 2023
b1581c9
Fix app files for 117.
arik-so Sep 28, 2023
0fe36a1
Update project manifest for 117.
arik-so Sep 28, 2023
2fbdae4
Use Matt's 117 branches for CI.
arik-so Sep 28, 2023
8141bdd
Update comments for the nullability annotation.
arik-so Oct 3, 2023
22a8024
Pin cbindgen version
arik-so Oct 3, 2023
d0d3571
Print lightning.h shasum
arik-so Oct 3, 2023
077fd63
Print environment versions
arik-so Oct 3, 2023
9cd460e
d debug coption types
arik-so Oct 4, 2023
3bf45a4
d debug not formatting the swift files
arik-so Oct 4, 2023
f3f71dd
remove Option_u128Z.swift
arik-so Oct 4, 2023
4440c9f
Add Option_U128Z.swift
arik-so Oct 4, 2023
a139e9f
Use latest upstream.
arik-so Oct 6, 2023
70bcbf2
Fix types for latest 117 change.
arik-so Oct 6, 2023
de21ec3
Fix 117 unit tests.
arik-so Oct 10, 2023
f0a2c32
Update readme.
arik-so Oct 10, 2023
002be67
Update generated files to 118.
arik-so Oct 25, 2023
f266e97
Update included files in Xcode.
arik-so Oct 25, 2023
65ea63c
Extract methods for opening channels.
arik-so Oct 25, 2023
2d9a4be
Update Github actions for experimental 118 branches.
arik-so Oct 25, 2023
1ddfb0f
Fix unit test.
arik-so Oct 26, 2023
e8ea3f1
Temporarily give up on second channel.
arik-so Oct 27, 2023
d6c92fc
Update CI and Readme to use upstream.
arik-so Oct 27, 2023
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
8 changes: 6 additions & 2 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ runs:
run: |
echo `pwd`
mkdir -p ${{ inputs.destination }}/bin
git clone --branch 2023-07-0.0.116-java-bindings https://github.com/TheBlueMatt/rust-lightning ${{ inputs.destination }}/rust-lightning
git clone --branch v0.0.116.0 https://github.com/lightningdevkit/ldk-c-bindings ${{ inputs.destination }}/ldk-c-bindings
git clone --branch 0.0.118-bindings https://github.com/lightningdevkit/rust-lightning ${{ inputs.destination }}/rust-lightning
git clone --branch main https://github.com/thebluematt/ldk-c-bindings ${{ inputs.destination }}/ldk-c-bindings
- name: Install Rust, required targets
if: ${{ inputs.configureRustNightly == 'true' }}
shell: bash
Expand All @@ -42,6 +42,10 @@ runs:
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Pin cbindgen v24
shell: bash
run: |
cargo install --version 0.24.5 cbindgen
- name: Generate C Bindings
shell: bash
run: |
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Print environment versions
run: |
node --version
npm --version
yarn --version
- name: Install native Rust toolchain and build utilities
run: |
# sudo apt-get purge grub\*
Expand All @@ -35,6 +40,10 @@ jobs:
configureRustNightly: false
env:
LDK_SWIFT_GENERATOR_OUTPUT_DIRECTORY_PATH: ci/LDKSwift/Sources/LDKSwift/bindings
- name: Print header file checksum
run: sha256sum $LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH
env:
LDK_SWIFT_GENERATOR_INPUT_HEADER_PATH: ci/ldk-c-bindings/lightning-c-bindings/include/lightning.h
- name: Copy new headers into bindings
run: |
python3 ./scripts/copy_c_files.py
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Automatic Swift bindings generation for [`rust-lightning`](https://github.com/li
### Swift Package Manager
To install using Swift Package Manager, add the following line to the depedencies array of your `Package.swift`:
```
.package(url: "https://github.com/lightningdevkit/ldk-swift/", exact: "0.0.116")
.package(url: "https://github.com/lightningdevkit/ldk-swift/", exact: "0.0.117")
```
Be sure to also include "LightningDevKit" into your packages target like so:

Expand Down Expand Up @@ -58,13 +58,13 @@ In order to generate these bindings from scratch, you will need to clone two dep
**[rust-lightning](https://github.com/lightningdevkit/rust-lightning)**, (a specific branch built for bindings compatibility):

```shell
git clone --branch 2023-07-0.0.116-java-bindings https://github.com/TheBlueMatt/rust-lightning /path/to/rust-lightning
git clone --branch 0.0.117-bindings https://github.com/lightningdevkit/rust-lightning /path/to/rust-lightning
```

**[ldk-c-bindings](https://github.com/lightningdevkit/ldk-c-bindings)**:

```shell
git clone --branch v0.0.116.0 https://github.com/lightningdevkit/ldk-c-bindings /path/to/ldk-c-bindings
git clone --branch main https://github.com/lightningdevkit/ldk-c-bindings /path/to/ldk-c-bindings
```

Take note of where you clone these directories, it's best you save the absolute path somewhere handy for the rest of the remaining steps.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public struct ChannelManagerConstructionParameters {
public var enableP2PGossip: Bool = false
public var scorer: MultiThreadedLockableScore?
public var scoreParams: ProbabilisticScoringFeeParameters?
public var payerRetries: Retry = Retry.initWithAttempts(a: UInt(3))
public var payerRetries: Retry = Retry.initWithAttempts(a: UInt32(3))
public var logger: Logger

public init (config: UserConfig, entropySource: EntropySource, nodeSigner: NodeSigner, signerProvider: SignerProvider, feeEstimator: FeeEstimator, chainMonitor: ChainMonitor, txBroadcaster: BroadcasterInterface, logger: Logger, enableP2PGossip: Bool = false, scorer: MultiThreadedLockableScore? = nil, scoreParams: ProbabilisticScoringFeeParameters? = nil, payerRetries: Retry = Retry.initWithAttempts(a: UInt(3))) {
public init (config: UserConfig, entropySource: EntropySource, nodeSigner: NodeSigner, signerProvider: SignerProvider, feeEstimator: FeeEstimator, chainMonitor: ChainMonitor, txBroadcaster: BroadcasterInterface, logger: Logger, enableP2PGossip: Bool = false, scorer: MultiThreadedLockableScore? = nil, scoreParams: ProbabilisticScoringFeeParameters? = nil, payerRetries: Retry = Retry.initWithAttempts(a: UInt32(3))) {
self.config = config
self.entropySource = entropySource
self.nodeSigner = nodeSigner
Expand Down Expand Up @@ -134,7 +134,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
var monitorFundingSet = Set<String>()

for currentSerializedChannelMonitor in channelMonitorsSerialized {
let channelMonitorResult: Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ = Bindings.readBlockHashChannelMonitor(ser: currentSerializedChannelMonitor, argA: params.entropySource, argB: params.signerProvider)
let channelMonitorResult = Bindings.readThirtyTwoBytesChannelMonitor(ser: currentSerializedChannelMonitor, argA: params.entropySource, argB: params.signerProvider)

guard let (blockHash, channelMonitor) = channelMonitorResult.getValue() else {
throw InvalidSerializedDataError.invalidSerializedChannelMonitor
Expand Down Expand Up @@ -170,8 +170,8 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
// TODO: figure out better way to obtain a router
let router = params.router(networkGraph: self.netGraph)
let channelManagerReadArgs = ChannelManagerReadArgs(entropySource: params.entropySource, nodeSigner: params.nodeSigner, signerProvider: params.signerProvider, feeEstimator: params.feeEstimator, chainMonitor: params.chainMonitor.asWatch(), txBroadcaster: params.txBroadcaster, router: router, logger: params.logger, defaultConfig: params.config, channelMonitors: monitors)

guard let (latestBlockHash, channelManager) = Bindings.readBlockHashChannelManager(ser: channelManagerSerialized, arg: channelManagerReadArgs).getValue() else {
guard let (latestBlockHash, channelManager) = Bindings.readThirtyTwoBytesChannelManager(ser: channelManagerSerialized, arg: channelManagerReadArgs).getValue() else {
throw InvalidSerializedDataError.invalidSerializedChannelManager
}

Expand Down Expand Up @@ -281,7 +281,7 @@ public class ChannelManagerConstructor: NativeTypeWrapper {
let (outPoint, _) = currentChannelMonitor.getFundingTxo()
print("watching channel")
let monitorWatchResult = chainMonitorWatch.watchChannel(fundingTxo: outPoint, monitor: currentChannelMonitor)
if monitorWatchResult != .Completed {
if !monitorWatchResult.isOk() || monitorWatchResult.getValue() != .Completed {
Bindings.print("Some issue occurred with a chainMonitorWatch.watch_channel call: \(monitorWatchResult)", severity: .WARNING)
}
// monitorClone.cType?.is_owned = true
Expand Down Expand Up @@ -360,16 +360,16 @@ fileprivate class CustomChannelManagerPersister: Persister {
self.handler = handler
super.init()
}

override func persistManager(channelManager: Bindings.ChannelManager) -> Bindings.Result_NoneErrorZ {
override func persistManager(channelManager: Bindings.ChannelManager) -> Bindings.Result_NoneIOErrorZ {
return self.handler.persistManager(channelManager: channelManager)
}

override func persistGraph(networkGraph: Bindings.NetworkGraph) -> Bindings.Result_NoneErrorZ {
override func persistGraph(networkGraph: Bindings.NetworkGraph) -> Bindings.Result_NoneIOErrorZ {
return self.handler.persistGraph(networkGraph: networkGraph)
}

override func persistScorer(scorer: Bindings.WriteableScore) -> Bindings.Result_NoneErrorZ {
override func persistScorer(scorer: Bindings.WriteableScore) -> Bindings.Result_NoneIOErrorZ {
return self.handler.persistScorer(scorer: scorer)
}
}
Expand Down
Loading
Loading