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

Memory leak fixes from jucid #4

Open
wants to merge 59 commits into
base: jpg
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9d0d87e
feat: free references in Data.from
yHSJ Nov 1, 2023
ff1f03b
fix: formatting
yHSJ Nov 1, 2023
d9cc706
chore: update freeable types
yHSJ Nov 2, 2023
b947eea
chore: add context to the freeables types
yHSJ Nov 2, 2023
3e89765
feat: free references in Lucid.new
yHSJ Nov 1, 2023
d74544e
feat: free references in Lucid.switchProvider
yHSJ Nov 1, 2023
f3442e4
feat: free references in Lucid.selectWalletFromPrivateKey
yHSJ Nov 1, 2023
fda53f1
feat: free memory in Lucid.selectWallet
yHSJ Nov 1, 2023
953e714
feat: free memory in Lucid.selectWalletFrom
yHSJ Nov 1, 2023
b295d46
feat: free memory in Lucid.selectWalletFromSeed
yHSJ Nov 1, 2023
41c2b09
chore: format
yHSJ Nov 1, 2023
67f6d45
fix: failing tests
yHSJ Nov 1, 2023
58f61d2
remove CML classes from lucid state, add protocol parameters to const…
joacohoyos Nov 1, 2023
5448c26
feat: manage memory in tx
yHSJ Nov 4, 2023
37d4953
fix: don't free null pointers
yHSJ Nov 4, 2023
d5508b7
feat: manage memory in utils.validatorToAddress
yHSJ Nov 4, 2023
c2b4db9
feat: manage memory in utils.credentialToAddress
yHSJ Nov 4, 2023
c811418
feat: manage memory in utils.validatorToRewardAddress
yHSJ Nov 4, 2023
70e4f0a
feat: manage memory in utils.credentialToRewardAddress
yHSJ Nov 4, 2023
716aa07
feat: manage memory in utils.validatorToScriptHash
yHSJ Nov 4, 2023
0134e1e
feat: manage memory in utils.datumToHash
yHSJ Nov 4, 2023
dbd7cc7
feat: manage memory in utils.getAddressDetails
yHSJ Nov 4, 2023
9be2d6a
feat manage memory in utils.generatePrivateKey
yHSJ Nov 4, 2023
b663556
feat: manage memory in utils.valueToAssets
yHSJ Nov 4, 2023
17bfece
feat: manage memory in utils.assetsToValue
yHSJ Nov 4, 2023
3b9e59f
feat: manage memory in utils.fromScriptRef
yHSJ Nov 4, 2023
109ba8b
feat: manage memory in utils.toScriptRef
yHSJ Nov 4, 2023
e47205f
feat: manage memory in utils.coreToUtxo
yHSJ Nov 4, 2023
cf18ff1
feat: manage memory in utils.toPublicKey
yHSJ Nov 4, 2023
3a13927
feat: manage memory in utils.nativeScriptFromJson
yHSJ Nov 4, 2023
c8e93d6
feat: manage memory in utils.applyParamsToScript
yHSJ Nov 4, 2023
51b58ab
feat: manage memory in utils.applyDoubleCborEncoding
yHSJ Nov 4, 2023
fe30d93
feat: fix failing tests
yHSJ Nov 4, 2023
7aef11b
feat: manage memory in data.to
yHSJ Nov 4, 2023
c412b82
feat: manage memory in emulator.submitTx
yHSJ Nov 4, 2023
7746b77
feat: manage memory in maestro.getUtxosInternal
yHSJ Nov 4, 2023
46551df
feat: manage memory in blockfrost.getUtxos
yHSJ Nov 4, 2023
2e7f15d
feat: manage memory in blockfrost.getUtxosWithUnit
yHSJ Nov 4, 2023
78ab324
feat: manage memory in blockfrost.datumJsonToCbor
yHSJ Nov 4, 2023
70197eb
feat: mange memory in tx_signed.toHash
yHSJ Nov 4, 2023
8a212b7
feat: manage memory in message.signWithPrivateKey
yHSJ Nov 4, 2023
9fb26d3
feat: manage memory in TxComplete.constructor
yHSJ Nov 4, 2023
7546a41
feat: manage memory in TxComplete.sign
yHSJ Nov 4, 2023
4b9dd7f
feat: manage memory in TxComplete.signWithPrivateKey
yHSJ Nov 4, 2023
5325911
feat: manage memory in TxComplete.partialSign
yHSJ Nov 4, 2023
8c07f53
feat: manage memory in TxComplete.partialSignWithPrivateKey
yHSJ Nov 4, 2023
362aadb
feat: manage memory in TxComplete.assemble
yHSJ Nov 4, 2023
6013703
feat: manage memory in TxComplete.complete
yHSJ Nov 4, 2023
5941c9a
feat: manage memory in TxComplete.toHash
yHSJ Nov 4, 2023
a2a139e
feat: add free method to TxComplete
yHSJ Nov 4, 2023
1fe8557
feat manage memory in kupmios.kupmiosUtxosToUtxos
yHSJ Nov 4, 2023
0bc5858
feat: add memory management to pool_registration example
yHSJ Nov 4, 2023
62e6b2d
chore: prepare for npm release
yHSJ Nov 4, 2023
8c76fcd
chore: update readme
yHSJ Nov 4, 2023
8e1bc3e
Merge branch 'main' of github.com:yhsj/lucid into jpg-jshy
joacohoyos Nov 29, 2023
9291e0b
Merge branch 'jpg' of github.com:jpg-store/lucid into jpg-jshy
joacohoyos Nov 29, 2023
09c84e1
fix: build
joacohoyos Nov 29, 2023
69f585f
fix: getCollateralCore error
joacohoyos Dec 12, 2023
2cbd22c
tests errors
joacohoyos Dec 12, 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ For details about documentation go to the original repo and check the documentat



### Lucid Fork

Jucid is JSHy's fork of Lucid (Jshy + Lucid = Jucid). Lucid accidentally introduces memory leaks into applications due to incorrect memory management of WASM objects. Jucid handles internal memory correctly, exposes new interfaces to allow you to management objects you use correclty, and is a drop-in replacement for Lucid. Once this fork is merged into Lucid, it is unlikely it will be maintained.

### Get started

#### NPM
Expand Down
58 changes: 32 additions & 26 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ await dnt.build({
dependencies: {
"node-fetch": "^3.2.3",
"@peculiar/webcrypto": "^1.4.0",
"ws": "^8.10.0",
ws: "^8.10.0",
},
main: "./esm/mod.js",
type: "module",
Expand All @@ -47,26 +47,30 @@ Deno.copyFileSync(
const importPathPlugin = {
name: "core-import-path",
setup(build: any) {
build.onResolve({
filter:
/^\.\/libs\/cardano_multiplatform_lib\/cardano_multiplatform_lib.generated.js$/,
}, (args: any) => {
return {
path:
"../esm/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js",
external: true,
};
});
build.onResolve({
filter:
/^\.\/libs\/cardano_message_signing\/cardano_message_signing.generated.js$/,
}, (args: any) => {
return {
path:
"../esm/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js",
external: true,
};
});
build.onResolve(
{
filter:
/^\.\/libs\/cardano_multiplatform_lib\/cardano_multiplatform_lib.generated.js$/,
},
(args: any) => {
return {
path: "../esm/src/core/libs/cardano_multiplatform_lib/cardano_multiplatform_lib.generated.js",
external: true,
};
},
);
build.onResolve(
{
filter:
/^\.\/libs\/cardano_message_signing\/cardano_message_signing.generated.js$/,
},
(args: any) => {
return {
path: "../esm/src/core/libs/cardano_message_signing/cardano_message_signing.generated.js",
external: true,
};
},
);
},
};

Expand All @@ -76,9 +80,7 @@ await esbuild.build({
entryPoints: ["./dist/esm/mod.js"],
outfile: "./dist/web/mod.js",
minify: true,
plugins: [
importPathPlugin,
],
plugins: [importPathPlugin],
});
esbuild.stop();

Expand Down Expand Up @@ -146,8 +148,12 @@ export { C, M };
`;
Deno.writeTextFileSync("dist/esm/src/core/core.js", coreFile);

Deno.mkdirSync("dist/esm/src/core/libs/cardano_message_signing/nodejs");
Deno.mkdirSync("dist/esm/src/core/libs/cardano_multiplatform_lib/nodejs");
Deno.mkdirSync("dist/esm/src/core/libs/cardano_message_signing/nodejs", {
recursive: true,
});
Deno.mkdirSync("dist/esm/src/core/libs/cardano_multiplatform_lib/nodejs", {
recursive: true,
});

Deno.copyFileSync(
"src/core/libs/cardano_message_signing/nodejs/cardano_message_signing.generated.js",
Expand Down
4 changes: 4 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ For details about documentation go to the original repo and check the documentat



### Lucid Fork

Jucid is JSHy's fork of Lucid (Jshy + Lucid = Jucid). Lucid accidentally introduces memory leaks into applications due to incorrect memory management of WASM objects. Jucid handles internal memory correctly, exposes new interfaces to allow you to management objects you use correclty, and is a drop-in replacement for Lucid. Once this fork is merged into Lucid, it is unlikely it will be maintained.

### Get started

#### NPM
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
"name": "@jpg-store/lucid-cardano",
"version": "0.10.12",
"version": "0.11.0",
"license": "MIT",
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
"repository": "https://github.com/jpg-store/lucid",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ export class COSEEncrypt {
ciphertext() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -1692,7 +1692,7 @@ export class COSESign {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -1801,7 +1801,7 @@ export class COSESign1 {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -2076,7 +2076,7 @@ export class COSESignature {
signature() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.cosesignature_signature(retptr, this.ptr);
wasm.cosesign1_signature(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ class COSEEncrypt {
ciphertext() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -1768,7 +1768,7 @@ class COSESign {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -1880,7 +1880,7 @@ class COSESign1 {
payload() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.coseencrypt0_ciphertext(retptr, this.ptr);
wasm.coseencrypt_ciphertext(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
let v0;
Expand Down Expand Up @@ -2181,7 +2181,7 @@ class COSESignature {
signature() {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.cosesignature_signature(retptr, this.ptr);
wasm.cosesign1_signature(retptr, this.ptr);
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
var v0 = getArrayU8FromWasm0(r0, r1).slice();
Expand Down
Loading
Loading