This causes Yoroi to crash running out of stack space after some time.
To solve this, I introduce a new function called is_valid that instead returns a boolean.
You can tell this fix works based on the following:
let err = null;
for (let j = 0; j < 100000; j++) {
try {
// uncommenting will not cause a crash
console.log(Wallet.Address.is_valid("asdf"));
// uncommenting this will cause a crash due to lack of stack space
// console.log(Wallet.Address.from_base58("a"));
} catch (e) {
if (err == null) {
err = e;
continue;
}
if (e === err) {
continue;
}
console.log('iteration', j);
throw e;
}
}
In Shelley, we often have to do
Why we need a special function
The problem is that due to https://github.com/rustwasm/wasm-bindgen/issues/1963 returning a Result that represents an error on the Rust side actually causes stack space to be permanently lost.
This causes Yoroi to crash running out of stack space after some time.
To solve this, I introduce a new function called
is_valid
that instead returns a boolean.You can tell this fix works based on the following:
How to use this function