-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: div instruction parsing and add test with mathlib #16
Conversation
@@ -1835,3 +1835,129 @@ exports[`decompileAll should decompile wallet v4 1`] = ` | |||
}> | |||
}END>c" | |||
`; | |||
|
|||
exports[`decompileAll should decompile mathlib.fc 1`] = ` |
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.
It does not look like this covers the whole mathlib.fc
: https://github.com/ton-blockchain/ton/blob/5c392e0f2d946877bb79a09ed35068f7b0bd333a/crypto/smartcont/mathlib.fc, which is almost a thousand lines of code
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.
that's right, it doesn't. I guess it might be enough in context of the original issue, but I can make it to include all of the functions by calling them in main()
.
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.
yeah, let's include the whole thing into the test
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.
Just tried compiling the whole thing with func optimizations turned off so that all of the functions are included into result. Test failed but not because of ton-opcode
but because of @ton/core
boc deserialization:
Invalid magic
222 | let src: Cell;
223 | if (Buffer.isBuffer(args.src)) {
> 224 | src = Cell.fromBoc(args.src)[0];
| ^
225 | } else {
226 | src = args.src;
227 | }
at parseBoc (node_modules/@ton/core/dist/boc/cell/serialization.js:160:15)
at deserializeBoc (node_modules/@ton/core/dist/boc/cell/serialization.js:168:15)
at Function.fromBoc (node_modules/@ton/core/dist/boc/Cell.js:34:51)
at decompileAll (src/decompiler/decompileAll.ts:224:20)
at Object.<anonymous> (src/decompiler/decompileAll.spec.ts:70:31)
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.
oh, wow! let's open an issue in the @ton/core
repo then and link it here
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.
oh, my bad! I forgot that func
writes a fift output by default, not BOC. I'll replace the file.
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.
Cool, thanks! I didn't check the decompiled code is equivalent to the original code, opened an issue for that #17
Closes #15 and also closes tact-lang/tact#396