-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[question] custom crypto #202
Comments
If you make it part of the build process, it is quite easy to modify the Gruntfile (in v4, the gulpfile) to put the hooks into the VM at that level. It might be a bit easier on the new v4 (coming out very soon). Does that VM allow synchronous hooks though? That has been one of the bigger problems with trying to hook into the VM, in Ethers Wallet. Since a call to sha2 (for example) is expected to be synchronous, but the VM doesn't actually allow that. Which functions are you trying to hook? For the most part, the cryptographic functions are actually not all that expensive unless you are trying to mine vanity contract addresses or such things. HDNode calculation can be slow (as you can see by running the test cases), so the HMAC and SHA512 could benefit, as well as JSON wallet decrypting/encrypting, since they use scrypt, which would gain the most being done at the native layer. |
Perfect.
Yes. They are synchronous by default.
Everything that will help us to decrease unnecessary memory usage. We plan to run multiple vm instances and would like to keep the executed JS as small as possible.
Thanks. That sounds very good. I will wait for the V4 release :) |
Hi. I just tried to run this in otto vm and sadly this regex and be parsed since the VM (and golang) don't support the regex expression. I guess we have to fork then :/ (we will leave a note to the origin). |
Which part exactly is is having issues with? I don’t mind unrolling the brace, but if it doesn’t support standard regular expressions, might be worth fixing it: https://github.com/robertkrimen/otto/blob/master/type_regexp.go Try adjusting the regex to see what is causing the hiccups... :) It could be the backtracking or forward tracking as well... |
@ricmoo i am not sure if I get what you mean. Lookahead regex is not supported by golang and can't be fixed therefore. So in order to use this library in the VM i need to change this line. However, I don't want you to change ether.js just because it doesn't work in otto VM. So I am curiose what |
Oh yes, that is all it does is “commify” a string. So, add a comma every 3 digits, from the right. In the future I would like to support arbitrary formatting, some countries use comma vs space vs decimal point, some group by 3 vs 4... But this has been an issue in ethers.objc, since parsing becomes ambiguous... I just worry about forking, since it means you will have to merge bug fixes and such manually... I just meant that there is a bridge for regex in the Otto already, and it would make sense for JavaScript compatible regex to be implemented correctly in Otto... Perhaps if the Go regex fails, fallback onto a JavaScript shim. Just an idea. :) |
The new commify operation in v4 no longer uses back-tracking, so should be easier to use in this environment. :) |
Thanks. We switched to another VM since ether.js took four minutes to load in otto. I guess it's a problem related to otto since it only takes three seconds to load ether.js in duktape. |
Hi,
we would like to run ether.js from inside of this vm. Is there a way to override the crypto functions used by ether.js with out own functions? Since we are using golang it's gonna be faster to calculate hashes etc outside of the VM based on given parameters.
Thanks.
The text was updated successfully, but these errors were encountered: