-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dev/UnderAudit]: Dev<->Master (#4046)
* Kotlin multiplatform leaking memory (#4037) * Add deinit for KMP iOS and JVM targets * Add deinit for JS target * Add deinit for JS target * Fix JVM native name * Reuse one thread on JVM --------- Co-authored-by: satoshiotomakan <[email protected]> * [KMP] Fix issue: memory leak found in Base58.decode in iOS (#4031) * Fix kmp issue: memory leak found in Base58.decode in iOS * Remove unused functions * Fix failed test cases * Revert "Fix failed test cases" This reverts commit 57eee39. * Revert val -> value argument name refactoring * Output better indentation * Revert changes in TWEthereumAbiFunction.h * Fix inconsistent naming --------- Co-authored-by: satoshiotomakan <[email protected]> * [TON]: Add support for TON 24-words mnemonic (#3998) * feat(ton): Add support for TON 24-words mnemonic in Rust * feat(ton): Add tw_ton_wallet FFIs * feat(ton): Add TWTONWallet FFI in C++ * feat(ton): Add tonMnemonic StoredKey type * feat(ton): Add StoredKey TON tests * feat(ton): Add TWStoredKey TON tests * feat(ton): Add TONWallet support in Swift * TODO add iOS tests * feat(ton): Add `KeyStore` iOS tests * feat(ton): Add TONWallet support in JavaScript * Add `KeyStore` TypeScript tests * feat(ton): Remove `TonMnemonic` structure, replace with a `validate_mnemonic_words` function * [CI] Trigger CI * feat(ton): Fix rustfmt * feat(ton): Fix C++ build * feat(ton): Fix C++ build * feat(ton): Fix C++ build * feat(ton): Fix C++ address analyzer * feat(ton): Fix C++ tests * feat(ton): Add Android tests * feat(ton): Bump `actions/upload-artifact` to v4 * Bump `dawidd6/action-download-artifact` to v6 * feat(eth): Fix PR comments * Fix Java JVM leak (#4092) * [Chore]: Fix Android bindings (#4095) * [Chore]: Add GenericPhantomReference.java * [Chore]: Fix unnecessary null assertion in WalletCoreLibLoader.kt * Fix memory lead found in public key in kmp binding (#4097) * Update Callisto explorer (#4131) * Revert "[TON]: Add support for TON 24-words mnemonic (#3998)" (#4148) This reverts commit 0b16771. --------- Co-authored-by: Viacheslav Kulish <[email protected]> Co-authored-by: 10gic <[email protected]>
- Loading branch information
1 parent
7b1bee5
commit 11d320b
Showing
21 changed files
with
310 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<% | ||
method = locals[:method] | ||
more_index = locals[:more_index] || 0 | ||
|
||
method.parameters.each do |param| -%> | ||
<% if param.type.name == :data -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>Data = if (<%= KotlinHelper.fix_name(param.name) %> == null) { | ||
<%= ' ' * more_index %> null | ||
<%= ' ' * more_index %> } else { | ||
<%= ' ' * more_index %> TWDataCreateWithBytes(<%= KotlinHelper.fix_name(param.name) %>.toUByteArray().toCValues(), <%= KotlinHelper.fix_name(param.name) %>.size.toULong()) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>Data = TWDataCreateWithBytes(<%= KotlinHelper.fix_name(param.name) %>.toUByteArray().toCValues(), <%= KotlinHelper.fix_name(param.name) %>.size.toULong()) | ||
<% end -%> | ||
<% elsif param.type.name == :string -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>String = if (<%= KotlinHelper.fix_name(param.name) %> == null) { | ||
<%= ' ' * more_index %> null | ||
<%= ' ' * more_index %> } else { | ||
<%= ' ' * more_index %> TWStringCreateWithUTF8Bytes(<%= KotlinHelper.fix_name(param.name) %>) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> val <%= KotlinHelper.fix_name(param.name) %>String = TWStringCreateWithUTF8Bytes(<%= KotlinHelper.fix_name(param.name) %>) | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% | ||
method = locals[:method] | ||
more_index = locals[:more_index] || 0 | ||
|
||
method.parameters.each do |param| -%> | ||
<% if param.type.name == :data -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> if (<%= KotlinHelper.fix_name(param.name) %>Data != null) { | ||
<%= ' ' * more_index %> TWDataDelete(<%= KotlinHelper.fix_name(param.name) %>Data) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> TWDataDelete(<%= KotlinHelper.fix_name(param.name) %>Data) | ||
<% end -%> | ||
<% elsif param.type.name == :string -%> | ||
<% if param.type.is_nullable -%> | ||
<%= ' ' * more_index %> if (<%= KotlinHelper.fix_name(param.name) %>String != null) { | ||
<%= ' ' * more_index %> TWStringDelete(<%= KotlinHelper.fix_name(param.name) %>String) | ||
<%= ' ' * more_index %> } | ||
<% else -%> | ||
<%= ' ' * more_index %> TWStringDelete(<%= KotlinHelper.fix_name(param.name) %>String) | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package wallet.core.java; | ||
|
||
import java.lang.ref.PhantomReference; | ||
import java.lang.ref.ReferenceQueue; | ||
import java.util.Set; | ||
import java.util.HashSet; | ||
|
||
public class GenericPhantomReference extends PhantomReference<Object> { | ||
private final long nativeHandle; | ||
private final OnDeleteCallback onDeleteCallback; | ||
|
||
private static final Set<GenericPhantomReference> references = new HashSet<>(); | ||
private static final ReferenceQueue<Object> queue = new ReferenceQueue<>(); | ||
|
||
static { | ||
Thread finalizingDaemon = new Thread(() -> { | ||
try { | ||
doDeletes(); | ||
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
}); | ||
finalizingDaemon.setName("WCFinalizingDaemon"); | ||
finalizingDaemon.setDaemon(true); | ||
finalizingDaemon.setPriority(Thread.NORM_PRIORITY); | ||
finalizingDaemon.start(); | ||
} | ||
|
||
private GenericPhantomReference(Object referent, long handle, OnDeleteCallback onDelete) { | ||
super(referent, queue); | ||
this.nativeHandle = handle; | ||
this.onDeleteCallback = onDelete; | ||
} | ||
|
||
public static void register(Object referent, long handle, OnDeleteCallback onDelete) { | ||
references.add(new GenericPhantomReference(referent, handle, onDelete)); | ||
} | ||
|
||
private static void doDeletes() throws InterruptedException { | ||
GenericPhantomReference ref = (GenericPhantomReference) queue.remove(); | ||
for (; ref != null; ref = (GenericPhantomReference) queue.remove()) { | ||
ref.onDeleteCallback.nativeDelete(ref.nativeHandle); | ||
references.remove(ref); | ||
} | ||
} | ||
|
||
@FunctionalInterface | ||
public interface OnDeleteCallback { | ||
void nativeDelete(long handle); | ||
} | ||
} |
Oops, something went wrong.