-
Notifications
You must be signed in to change notification settings - Fork 11
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
Make vm serializable #33
Conversation
@@ -30,6 +30,7 @@ | |||
"downlevelIteration": true, | |||
"outDir": "dist", | |||
"rootDir": "src", | |||
"skipLibCheck": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://www.typescriptlang.org/tsconfig#skipLibCheck for details.
Rather than doing a full check of all d.ts files, TypeScript will type check the code you specifically refer to in your app’s source code.
Otherwise, we get these two errors due to webpack:
node_modules/@types/eslint/index.d.ts:451:42 - error TS2724: '"/Users/lukewilson/git/terra/cosmwasm-vm-js/node_modules/@types/estree/index"' has no exported member named 'ChainExpression'. Did you mean 'Expression'?
451 ChainExpression?: ((node: ESTree.ChainExpression & NodeParentExtension) => void) | undefined;
~~~~~~~~~~~~~~~
node_modules/@types/eslint/index.d.ts:474:43 - error TS2694: Namespace '"/Users/lukewilson/git/terra/cosmwasm-vm-js/node_modules/@types/estree/index"' has no exported member 'ImportExpression'.
474 ImportExpression?: ((node: ESTree.ImportExpression & NodeParentExtension) => void) | undefined;
|
||
constructor(backend: IBackend) { | ||
this.backend = backend; | ||
this.bech32 = bech32; | ||
this.eddsa = new eddsa('ed25519'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eddsa
is not serialisable, but nor does it (seem to) hold any (mutable) state - its methods appear to be pure functions.
export * from './memory'; | ||
export * from './backend'; | ||
export * from './instance'; | ||
export * from './environment'; | ||
|
||
global.eddsa = () => global._eddsa || (global._eddsa = new eddsa('ed25519')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to store this globally (and lazy-initialise it) because constructing it each time is slow - on my year-old macbook, about 500ms.
No description provided.