-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
200 changed files
with
5,810 additions
and
2,203 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,10 @@ jobs: | |
override: true | ||
components: llvm-tools-preview | ||
|
||
# Download a pre-compiled wasm-bindgen binary. | ||
- name: Install wasm-bindgen-cli | ||
uses: jetli/wasm-bindgen-action@24ba6f9fff570246106ac3f80f35185600c3f6c9 | ||
|
||
- name: Install cargo-binutils | ||
uses: actions-rs/[email protected] | ||
with: | ||
|
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
2 changes: 1 addition & 1 deletion
2
bindings/stronghold-nodejs/src/account/identity/identity_state.rs
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
12 changes: 6 additions & 6 deletions
12
bindings/stronghold-nodejs/src/account/storage/stronghold.rs
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
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 |
---|---|---|
@@ -1,13 +1,57 @@ | ||
|
||
// Aborts the build process if disallowed occurences are found in identity_wasm.js | ||
/** Aborts the build process if disallowed occurrences are found in identity_wasm.js **/ | ||
function lintBigInt(content) { | ||
if (content.includes("BigInt64Array") || content.includes("BigUint64Array")) { | ||
console.error("Build artifacts should not include BigInt64Array/BigUint64Array imports") | ||
console.error("to ensure React Native/WebKit compatibility.") | ||
console.error("Remove any u64 and i64 occurrence from the public Wasm interface.") | ||
console.error("See: https://github.com/iotaledger/identity.rs/issues/362") | ||
process.exit(1) | ||
throw( | ||
"Build artifacts should not include BigInt64Array/BigUint64Array imports\n" + | ||
"to ensure React Native/WebKit compatibility.\n" + | ||
"Remove any u64 and i64 occurrence from the public Wasm interface.\n" + | ||
"See: https://github.com/iotaledger/identity.rs/issues/362\n" | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Rejects any `<obj>.ptr = 0;` occurrence, excluding `this.ptr = 0;` in `free()` implementations. | ||
* | ||
* Prevents generated code that nulls out Wasm pointers without de-registering the finalizer, since they cause | ||
* runtime errors during automatic garbage collection from WasmRefCell thinking the instance is still borrowed. | ||
* | ||
* Functions which take owned parameters cause this situation; the solution is to borrow and clone the parameter | ||
* instead. | ||
**/ | ||
function lintPtrNullWithoutFree(content) { | ||
// Find line numbers of offending code. | ||
const lines = content.split(/\r?\n/); | ||
const matches = lines.flatMap(function (line, number) { | ||
if (/(?<!this).ptr = 0;/.test(line)) { | ||
return [(number + 1) + " " + line.trim()]; | ||
} else { | ||
return []; | ||
} | ||
}); | ||
if (matches.length > 0) { | ||
throw(`ERROR: generated Javascript should not include 'obj.ptr = 0;'. | ||
When weak references are enabled with '--weak-refs', WasmRefCell in wasm-bindgen causes | ||
runtime errors from automatic garbage collection trying to free objects taken as owned parameters. | ||
Matches: | ||
${matches} | ||
SUGGESTION: change any exported functions which take an owned parameter (excluding flat enums) to use a borrow instead. | ||
See: https://github.com/rustwasm/wasm-bindgen/pull/2677`); | ||
} | ||
} | ||
|
||
/** Runs all custom lints on the generated code. Exits the process immediately with code 1 if any fail. **/ | ||
function lintAll(content) { | ||
try { | ||
lintBigInt(content); | ||
lintPtrNullWithoutFree(content); | ||
} catch (err) { | ||
console.error("Custom lint failed!"); | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
exports.lintBigInt = lintBigInt; | ||
exports.lintAll = lintAll; |
Oops, something went wrong.