]>
git.bitcoin.ninja Git - ldk-java/log
Matt Corallo [Sat, 15 Jan 2022 05:35:12 +0000 (05:35 +0000)]
[TS] Fix HTML test runner to properly await and fully check result
Matt Corallo [Fri, 14 Jan 2022 19:12:15 +0000 (19:12 +0000)]
Merge pull request #78 from arik-so/typescript_fixes
Make npm publication generate node-compatible modules.
Arik Sosman [Wed, 12 Jan 2022 20:30:37 +0000 (12:30 -0800)]
Include type declaration files and remove typically unnecessary dependencies.
Update files to include *.mjs files and remove npmignore.
Update .gitignore
Update .npmignore
Update .gitignore
Make publication generate node-compatible modules.
Matt Corallo [Mon, 10 Jan 2022 21:38:45 +0000 (21:38 +0000)]
Merge pull request #74 from TheBlueMatt/2022-01-ts-hu-files
[TypeScript] Make Basic "Human" Object Construction Work
Matt Corallo [Mon, 10 Jan 2022 03:29:25 +0000 (03:29 +0000)]
Update auto-generated TypeScript Bindings
Matt Corallo [Mon, 10 Jan 2022 03:25:47 +0000 (03:25 +0000)]
Update auto-generated Java bindings (all functionally equivalent)
Matt Corallo [Mon, 10 Jan 2022 03:12:58 +0000 (03:12 +0000)]
Split Java CI runs into tests and binary determinism checks
Matt Corallo [Mon, 10 Jan 2022 06:29:47 +0000 (06:29 +0000)]
[TS] Add package.json for public release
Matt Corallo [Sat, 8 Jan 2022 17:48:28 +0000 (17:48 +0000)]
[TS] Update README to describe TS as "early alpha" 🚀
Matt Corallo [Mon, 10 Jan 2022 05:41:44 +0000 (05:41 +0000)]
[TS] Change paths to liblightningjs.wasm to be in ts/
Matt Corallo [Sat, 8 Jan 2022 07:43:36 +0000 (07:43 +0000)]
[TS] Add a basic functional tests of human types
Matt Corallo [Mon, 10 Jan 2022 05:35:54 +0000 (05:35 +0000)]
[TS] Drop InternalUtils as they are now called via bindings.
Matt Corallo [Mon, 10 Jan 2022 00:56:18 +0000 (00:56 +0000)]
[TS] Swap BigInt (the class/constructor) for bigint (the primitive)
Matt Corallo [Mon, 10 Jan 2022 00:55:04 +0000 (00:55 +0000)]
Support mapping primitive arrays as non-arrays (eg numbers)
TypeScript can't pass an array through to C, so we have to pass a
pointer to a constructed array. This adds support in the relevant
type-conversion logic to enable this (and uses it in TS).
Matt Corallo [Mon, 10 Jan 2022 00:50:23 +0000 (00:50 +0000)]
Ensure `TypeInfo` always has `subty` set if its an array
Matt Corallo [Sun, 9 Jan 2022 06:24:30 +0000 (06:24 +0000)]
Make String types language-specific and fix TS string conversion
Matt Corallo [Mon, 10 Jan 2022 05:25:29 +0000 (05:25 +0000)]
Skip reference-holding in static methods in a (kinda-)cleaner way
Matt Corallo [Sun, 9 Jan 2022 00:01:15 +0000 (00:01 +0000)]
[TS] Clean up wasm environment exports
Matt Corallo [Sat, 8 Jan 2022 23:57:00 +0000 (23:57 +0000)]
[TS] Configure memory setup in linker to not insta-OOM
Matt Corallo [Sun, 9 Jan 2022 00:01:35 +0000 (00:01 +0000)]
[TS] Rewrite complex enum creation
We cannot create bindings objects from C in TS, so instead have to
query for individual fields on construction.
Matt Corallo [Sat, 8 Jan 2022 19:44:08 +0000 (19:44 +0000)]
[TS] Use export_/import_name to filter exposed symbols
Matt Corallo [Mon, 10 Jan 2022 03:07:49 +0000 (03:07 +0000)]
[TS] Correct pointer arithmetic on array construction
Matt Corallo [Mon, 10 Jan 2022 01:17:46 +0000 (01:17 +0000)]
[TS] Correctly pass u64s from TS to C, using BigInts
Matt Corallo [Mon, 10 Jan 2022 03:57:50 +0000 (03:57 +0000)]
Fix LDKRecoverableSignature variable parsing
Matt Corallo [Mon, 10 Jan 2022 01:16:27 +0000 (01:16 +0000)]
Use uintptr_t for the return value of `clone_ptr` to match reality
Matt Corallo [Sat, 8 Jan 2022 07:04:58 +0000 (07:04 +0000)]
[TS] Implement Rust -> TS calls and TS Trait instance construction
Matt Corallo [Sat, 8 Jan 2022 06:38:48 +0000 (06:38 +0000)]
[TS] Make compiler checks a bit more aggressive, fix indentation
Matt Corallo [Sat, 8 Jan 2022 19:45:29 +0000 (19:45 +0000)]
[TS] Fix indentation of bindings.mts somewhat
Matt Corallo [Mon, 10 Jan 2022 04:30:00 +0000 (04:30 +0000)]
Fix double free introduced in
9b9e4369d34e24a9dc7f3f1494865a026ca4
This requires correctly setting `holds_ref` as well as handling
`holds_ref` on pointed-to objects in the general-case ret_conv in
`gen_type_mapping.py`.
Matt Corallo [Sat, 8 Jan 2022 05:03:48 +0000 (05:03 +0000)]
Merge pull request #73 from TheBlueMatt/main
Make all TypeScript "Human" mappings compile
Matt Corallo [Sat, 8 Jan 2022 04:13:50 +0000 (04:13 +0000)]
Update auto-generated TypeScript files
Matt Corallo [Sat, 8 Jan 2022 04:10:54 +0000 (04:10 +0000)]
Add a warning for Locked human objects as they are not usable yet
Matt Corallo [Fri, 7 Jan 2022 02:12:18 +0000 (02:12 +0000)]
Update tests to test human structs from TypeScript
Matt Corallo [Sat, 8 Jan 2022 02:16:37 +0000 (02:16 +0000)]
Make array human construction language-specific
Matt Corallo [Sat, 8 Jan 2022 01:26:12 +0000 (01:26 +0000)]
[TS] Correct syntax in human interface files
Matt Corallo [Sat, 8 Jan 2022 03:55:05 +0000 (03:55 +0000)]
[TS] Drop references to `this` in static `UtilMethods` functions
Matt Corallo [Fri, 7 Jan 2022 23:02:42 +0000 (23:02 +0000)]
Make TxOut language-specific, fix typescript UtilMethods compilation
Matt Corallo [Fri, 7 Jan 2022 22:32:50 +0000 (22:32 +0000)]
[TS] Fix syntax errors in human trait definitions
Matt Corallo [Fri, 7 Jan 2022 22:20:06 +0000 (22:20 +0000)]
Make array range iteration language-specific
Matt Corallo [Fri, 7 Jan 2022 20:59:42 +0000 (20:59 +0000)]
Make human -> C array mapping language-specific
Matt Corallo [Fri, 7 Jan 2022 18:25:43 +0000 (18:25 +0000)]
Use wasm's default memory instead of creating/accessing an (unused) one
Matt Corallo [Fri, 7 Jan 2022 06:27:54 +0000 (06:27 +0000)]
Make struct pointer loading language-specific and reliable for TS
Matt Corallo [Fri, 7 Jan 2022 06:03:37 +0000 (06:03 +0000)]
Make Result mapping language-specific and implement it for TS
Matt Corallo [Fri, 7 Jan 2022 03:24:00 +0000 (03:24 +0000)]
Add InternalUtils for array length checking to match Java
Matt Corallo [Fri, 7 Jan 2022 18:36:54 +0000 (18:36 +0000)]
[TS] Resolve locally-defined structs in other structs, create index.mts
Matt Corallo [Thu, 6 Jan 2022 23:31:59 +0000 (23:31 +0000)]
Make the call for `ptrs_to.add()` swappable per language
Matt Corallo [Thu, 6 Jan 2022 23:33:48 +0000 (23:33 +0000)]
[TS] Fix finalization syntax, drop "default" on class exports, minor tweaks
Matt Corallo [Fri, 7 Jan 2022 18:58:53 +0000 (18:58 +0000)]
Make variable declaration statements language-specific
Matt Corallo [Fri, 7 Jan 2022 18:58:40 +0000 (18:58 +0000)]
[TS] Minor syntax fixes in human struct files, mostly complex enums
Matt Corallo [Fri, 7 Jan 2022 18:38:22 +0000 (18:38 +0000)]
Pass output directory throuh to consts and call a cleanup function
Matt Corallo [Fri, 7 Jan 2022 17:31:08 +0000 (17:31 +0000)]
Merge pull request #72 from TheBlueMatt/main
Get TypeScript compiling warning-free and properly test wasm loading+calling in CI
Matt Corallo [Wed, 5 Jan 2022 06:49:44 +0000 (06:49 +0000)]
Update auto-generated mts files (without structs)
Matt Corallo [Wed, 5 Jan 2022 06:32:04 +0000 (06:32 +0000)]
Make genbindings.sh only build one of java/wasm, test wasm in CI
Matt Corallo [Wed, 5 Jan 2022 06:20:42 +0000 (06:20 +0000)]
Drop ts/util* which are no longer used/generated
Matt Corallo [Wed, 5 Jan 2022 06:18:33 +0000 (06:18 +0000)]
Switch to .mts files and build typescript bindings in genbindings.sh
Matt Corallo [Wed, 5 Jan 2022 06:17:44 +0000 (06:17 +0000)]
Fix method reference errors and make bindings.ts generation work again
Matt Corallo [Tue, 4 Jan 2022 23:56:21 +0000 (23:56 +0000)]
Fix syntax errors in bindings.ts in option handling
Matt Corallo [Tue, 4 Jan 2022 22:52:11 +0000 (22:52 +0000)]
Update tests and batteries to new result API
Matt Corallo [Tue, 4 Jan 2022 22:50:47 +0000 (22:50 +0000)]
Unify tuple and result field getters and push them through map_fn
Matt Corallo [Tue, 4 Jan 2022 21:23:23 +0000 (21:23 +0000)]
Update typescript test to latest API
Matt Corallo [Tue, 4 Jan 2022 06:48:40 +0000 (06:48 +0000)]
Clean up TS arrays and make TS compile warning-free again
Matt Corallo [Thu, 23 Dec 2021 00:33:08 +0000 (00:33 +0000)]
Merge pull request #71 from TheBlueMatt/main
Update readme noting that the bindings are beta, not alpha
Matt Corallo [Thu, 23 Dec 2021 00:29:52 +0000 (00:29 +0000)]
Update readme noting that the bindings are beta, not alpha
... and there are no known memory leaks 🎉.
Fixes #70.
Matt Corallo [Tue, 21 Dec 2021 17:45:34 +0000 (17:45 +0000)]
Merge pull request #69 from TheBlueMatt/main
v0.0.104.0
Matt Corallo [Tue, 21 Dec 2021 02:02:57 +0000 (02:02 +0000)]
Fix Java path setting in OSX builds
Matt Corallo [Tue, 21 Dec 2021 01:27:24 +0000 (01:27 +0000)]
Use LC_ALL instead of LANG to correct zip file ordering
Matt Corallo [Mon, 20 Dec 2021 09:04:37 +0000 (09:04 +0000)]
Update CI branches to 0.0.104
Matt Corallo [Sun, 5 Dec 2021 23:39:42 +0000 (23:39 +0000)]
Update auto-updated Java files
Matt Corallo [Mon, 20 Dec 2021 07:18:32 +0000 (07:18 +0000)]
Update tests and batteries for new 0.0.104 API, fix Java 18 build
As of this commit, leaks in the full test suite are:
20 allocations remained for
1115206 bytes.
Matt Corallo [Mon, 20 Dec 2021 07:06:04 +0000 (07:06 +0000)]
Handle the new LDKTwelveBytes instead of LDKTenBytes
Matt Corallo [Tue, 14 Dec 2021 22:55:00 +0000 (22:55 +0000)]
Update HumanObjectPeerTest to exercise undefined JVM JIT behavior
Matt Corallo [Tue, 14 Dec 2021 22:38:49 +0000 (22:38 +0000)]
Work around Java's insane lack of finalization guarantees
Matt Corallo [Sun, 12 Dec 2021 18:44:34 +0000 (18:44 +0000)]
Use the same FindClass argument for Android and regular Java
Its unclear whether the android variant (no L prefix, ; suffix) was
ever tested on normal Java or not, but the existing code generates
a large volumes of warnings on OpenJDK 11 like:
WARNING in native method: JNI FindClass received a bad class descriptor "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;". A correct class descriptor has no leading "L" or trailing ";". Incorrect descriptors will not be accepted in future releases.
Matt Corallo [Sun, 12 Dec 2021 18:35:18 +0000 (18:35 +0000)]
Check exceptions after calling Enum.ordinal() from Rust
This generally shouldn't ever fire, but otherwise Java says, e.g.
WARNING in native method: JNI call made without checking exceptions when required to from CallIntMethod
at org.ldk.impl.bindings.create_invoice_from_channelmanager(Native Method)
Matt Corallo [Sun, 5 Dec 2021 23:29:37 +0000 (23:29 +0000)]
throw InvalidSerializedDataException on duplicate ChannelMonitors
Matt Corallo [Sun, 5 Dec 2021 23:28:18 +0000 (23:28 +0000)]
Override hashCode and equals for Rust objects that impl the equivalent
Matt Corallo [Fri, 3 Dec 2021 16:21:47 +0000 (16:21 +0000)]
Merge pull request #56 from TheBlueMatt/main
v0.0.103.1
Matt Corallo [Thu, 2 Dec 2021 23:09:20 +0000 (23:09 +0000)]
Make maven a bit quieter during CI runs
Matt Corallo [Wed, 1 Dec 2021 15:47:11 +0000 (15:47 +0000)]
Update to Maven 3.8.4 on OSX CI builds
Matt Corallo [Thu, 11 Nov 2021 17:38:10 +0000 (17:38 +0000)]
Update auto-generated bindings
Matt Corallo [Thu, 25 Nov 2021 02:32:57 +0000 (02:32 +0000)]
Update tests to new logger API
As of this commit, leaks for a full run are down to:
17 allocations remained for
1115062 bytes.
Matt Corallo [Wed, 1 Dec 2021 01:14:45 +0000 (01:14 +0000)]
Replace unicode … with ... as java complains about non-ASCII docs
Matt Corallo [Thu, 2 Dec 2021 19:43:51 +0000 (19:43 +0000)]
Update PeerTest for new trait-object-return call semantics
Matt Corallo [Thu, 2 Dec 2021 18:24:05 +0000 (18:24 +0000)]
Clone objects being returned from trait methods before return from Java
When we return an object from a trait method called from Rust, we
often return complex Java "Human" objects. Because the underlying
object is owned by Java, we clone them before passing the objects
back to Rust, if possible. However, the clone call happens after
the Java method returns, at which point Java does not have any
references to the original "Human" object, which upon free will
free the underlying object.
While the time between when the Java method returns and the C FFI
code clones the object is incredibly short, CI did manage to find
the race here in ASAN, where the original object may be freed
before being accessed again for the clone in C.
Here we fix this by simply cloneing the object being returned
directly from Java.
Matt Corallo [Thu, 2 Dec 2021 15:57:15 +0000 (15:57 +0000)]
Construct a method to clone returning a pointerand not a human object
Matt Corallo [Thu, 2 Dec 2021 17:11:16 +0000 (17:11 +0000)]
Drop unused Vec constructor functions
Matt Corallo [Thu, 2 Dec 2021 15:31:16 +0000 (15:31 +0000)]
Map functions on 3-tuples
Matt Corallo [Mon, 29 Nov 2021 01:05:05 +0000 (01:05 +0000)]
Use new is_ok functions for Result checks in hand-written code
Matt Corallo [Sun, 28 Nov 2021 23:17:59 +0000 (23:17 +0000)]
Update Result mapping to use new `_is_ok` function in the C bindings
Matt Corallo [Tue, 30 Nov 2021 01:38:04 +0000 (01:38 +0000)]
Check array lengths before passing them to C
When users pass a static-length array to C we currently CHECK its
length, asserting only if we are built in debug mode. In
production, we happily call JNI's `GetByteArrayRegion` with the
expected length, ignoring any errors. `GetByteArrayRegion`,
however, "THROWS ArrayIndexOutOfBoundsException: if one of the
indexes in the region is not valid.". While its somewhat unclear
what "THROWS" means in the context of a C API, it seems safe to
assume accessing return values after a "THROWS" condition is
undefined. Thus, we should ensure we check array lengths before
calling into C.
We do this here with a simple wrapper function added to
`org.ldk.util.InternalUtils` which checks an array is the correct
length before returning it.
Matt Corallo [Mon, 29 Nov 2021 01:03:22 +0000 (01:03 +0000)]
CHECK_ACCESS inner pointers using the new __unmangle_inner_ptr meth
Matt Corallo [Sun, 28 Nov 2021 23:17:52 +0000 (23:17 +0000)]
Add Variant-Level docs on complex and unitary enums.
Fixes #60.
Matt Corallo [Thu, 11 Nov 2021 17:43:44 +0000 (17:43 +0000)]
Allow users to specify a `UserConfig` when de-ser'ing a ChanManager
Fixes #55.
Matt Corallo [Thu, 11 Nov 2021 17:34:41 +0000 (17:34 +0000)]
Hold a reference when we pass Option<Trait> to rust
This resolves a NPE when calling trait methods if the user doesn't
hold their own reference to the underlying trait, which is quite
possible for, eg, the `Filter` object.
We also adapt `HumanObjectPeerTest` to test this with a `Filter`.
Matt Corallo [Thu, 11 Nov 2021 17:34:21 +0000 (17:34 +0000)]
Make enum-contains-trait detection more robust
Matt Corallo [Thu, 4 Nov 2021 06:07:54 +0000 (06:07 +0000)]
Merge pull request #54 from TheBlueMatt/main
v0.0.103.0
Matt Corallo [Wed, 3 Nov 2021 20:18:44 +0000 (20:18 +0000)]
Update Github Actions branch reference to 0.0.103
Matt Corallo [Tue, 2 Nov 2021 17:51:11 +0000 (17:51 +0000)]
Add support for InvoicePayer to ChannelManagerConstructor and test
Note that this adds an additional bit of runs in the
HumanObjectPeerTest, bringing leaks for a full run to:
149 allocations remained for
1157302 bytes.
Matt Corallo [Tue, 2 Nov 2021 15:30:34 +0000 (15:30 +0000)]
Update tests for latest upstream API
Leaks in a full test run is now
89 allocations remained for
1138102 bytes.
Matt Corallo [Tue, 2 Nov 2021 20:22:09 +0000 (20:22 +0000)]
Update auto-generated bindings to 0.0.103