Skip to content

Commit

Permalink
Merge pull request #124 from arik-so/arik/2023/10/118-prep-01
Browse files Browse the repository at this point in the history
Prepare 0.0.118
  • Loading branch information
arik-so authored Oct 27, 2023
2 parents 2abea22 + d6c92fc commit 412de9a
Show file tree
Hide file tree
Showing 264 changed files with 30,209 additions and 11,894 deletions.
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/lightningdevkit/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.118")
```
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.118-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

0 comments on commit 412de9a

Please sign in to comment.