Skip to content
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

chore: update @tact-lang/opcode to v0.2 #1922

Merged
merged 3 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dev-docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Check map types for `deepEquals` method: PR [#1718](https://github.com/tact-lang/tact/pull/1718)
- Remove "remainder" from error messages: PR [#1699](https://github.com/tact-lang/tact/pull/1699)
- Check map types for `deepEquals` method: PR [#1718](https://github.com/tact-lang/tact/pull/1718)
- Bump used `@tact-lang/opcode` version to `0.2` which fixes many issues in CI runs: PR [#1922](https://github.com/tact-lang/tact/pull/1922)

### Docs

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"unboc": "bin/unboc.js"
},
"dependencies": {
"@tact-lang/opcode": "^0.0.18",
"@tact-lang/opcode": "^0.2.0",
"@ton/core": "0.60.0",
"@ton/crypto": "^3.2.0",
"@tonstudio/parser-runtime": "^0.0.1",
Expand Down
297 changes: 297 additions & 0 deletions src/cli/unboc/__snapshots__/e2e.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`unboc foo.boc Default run 1`] = `
{
"code": 0,
"kind": "exited",
"stderr": "",
"stdout": ""Asm.fif" include
PROGRAM{
DECLPROC recv_internal
78250 DECLMETHOD ?fun_78250
DECLPROC ?fun_ref_0cd12ec96bb24bd7
DECLPROC ?fun_ref_272cf0193c781008
DECLPROC ?fun_ref_92183b49329bb4e4
recv_internal PROC:<{
SWAP
CTOS
4 LDU
SWAP
ONE
AND
NEGATE
SWAP
LDMSGADDR
s1 s2 s(-2) PU2XC
s1 s3 XCHG
s1 s6 XCHG
4 TUPLE
1 SETGLOB
s0 s2 XCHG
2 SETGLOB
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT
s0 s2 XCHG
?fun_ref_272cf0193c781008 INLINECALLDICT
130 THROWIFNOT
DROP
NEWC
-1 PUSHINT
SWAP
1 STI
ENDC
POPROOT
}>
?fun_78250 PROC:<{
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT
?fun_ref_92183b49329bb4e4 INLINECALLDICT
NIP
}>
?fun_ref_0cd12ec96bb24bd7 PROCREF:<{
PUSHROOT
CTOS
1 LDI
DROP
<{
NULL
}> PUSHCONT
IFJMP
NULL
}>
?fun_ref_272cf0193c781008 PROCREF:<{
NIP
<{
-1 PUSHINT
}> PUSHCONT
IFJMP
ZERO
}>
?fun_ref_92183b49329bb4e4 PROCREF:<{
x{68656C6C6F20776F726C64} PUSHSLICE
}>
}END>c
",
}
`;

exports[`unboc foo.boc With bitcode 1`] = `
{
"code": 0,
"kind": "exited",
"stderr": "",
"stdout": ""Asm.fif" include
PROGRAM{
DECLPROC recv_internal
78250 DECLMETHOD ?fun_78250
DECLPROC ?fun_ref_0cd12ec96bb24bd7
DECLPROC ?fun_ref_272cf0193c781008
DECLPROC ?fun_ref_92183b49329bb4e4
recv_internal PROC:<{
SWAP // 0x0 1
CTOS // 0xD0
4 LDU // 0xD3 03
SWAP // 0x0 1
ONE // 0x7 1
AND // 0xB0
NEGATE // 0xA3
SWAP // 0x0 1
LDMSGADDR // 0xFA40
s1 s2 s(-2) PU2XC // 0x546 1 3 0
s1 s3 XCHG // 0x1 3
s1 s6 XCHG // 0x1 6
4 TUPLE // 0x6F0 4
1 SETGLOB // 0xF87_ 0C_
s0 s2 XCHG // 0x0 2
2 SETGLOB // 0xF87_ 14_
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT // 0x
s0 s2 XCHG // 0x0 2
?fun_ref_272cf0193c781008 INLINECALLDICT // 0x
130 THROWIFNOT // 0xF2E4_ 105_
DROP // 0x3 0
NEWC // 0xC8
-1 PUSHINT // 0x7 F
SWAP // 0x0 1
1 STI // 0xCA 00
ENDC // 0xC9
POPROOT // 0xED5 4
}>
?fun_78250 PROC:<{
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT // 0x
?fun_ref_92183b49329bb4e4 INLINECALLDICT // 0x
NIP // 0x3 1
}>
?fun_ref_0cd12ec96bb24bd7 PROCREF:<{
PUSHROOT // 0xED4 4
CTOS // 0xD0
1 LDI // 0xD2 00
DROP // 0x3 0
<{
NULL // 0x6D
}> PUSHCONT // 0x9 6D
IFJMP // 0xE0
NULL // 0x6D
}>
?fun_ref_272cf0193c781008 PROCREF:<{
NIP // 0x3 1
<{
-1 PUSHINT // 0x7 F
}> PUSHCONT // 0x9 7F
IFJMP // 0xE0
ZERO // 0x7 0
}>
?fun_ref_92183b49329bb4e4 PROCREF:<{
x{68656C6C6F20776F726C64} PUSHSLICE // 0x8B 68656C6C6F20776F726C64
}>
}END>c
",
}
`;

exports[`unboc foo.boc Without aliases 1`] = `
{
"code": 0,
"kind": "exited",
"stderr": "",
"stdout": ""Asm.fif" include
PROGRAM{
DECLPROC recv_internal
78250 DECLMETHOD ?fun_78250
DECLPROC ?fun_ref_0cd12ec96bb24bd7
DECLPROC ?fun_ref_272cf0193c781008
DECLPROC ?fun_ref_92183b49329bb4e4
recv_internal PROC:<{
s0 s1 XCHG
CTOS
4 LDU
s0 s1 XCHG
1 PUSHINT
AND
NEGATE
s0 s1 XCHG
LDMSGADDR
s1 s2 s(-2) PU2XC
s1 s3 XCHG
s1 s6 XCHG
4 TUPLE
1 SETGLOB
s0 s2 XCHG
2 SETGLOB
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT
s0 s2 XCHG
?fun_ref_272cf0193c781008 INLINECALLDICT
130 THROWIFNOT
s0 POP
NEWC
-1 PUSHINT
s0 s1 XCHG
1 STI
ENDC
c4 POPCTR
}>
?fun_78250 PROC:<{
?fun_ref_0cd12ec96bb24bd7 INLINECALLDICT
?fun_ref_92183b49329bb4e4 INLINECALLDICT
s1 POP
}>
?fun_ref_0cd12ec96bb24bd7 PROCREF:<{
c4 PUSHCTR
CTOS
1 LDI
s0 POP
<{
NULL
}> PUSHCONT
IFJMP
NULL
}>
?fun_ref_272cf0193c781008 PROCREF:<{
s1 POP
<{
-1 PUSHINT
}> PUSHCONT
IFJMP
0 PUSHINT
}>
?fun_ref_92183b49329bb4e4 PROCREF:<{
x{68656C6C6F20776F726C64} PUSHSLICE
}>
}END>c
",
}
`;

exports[`unboc foo.boc Without refs 1`] = `
{
"code": 0,
"kind": "exited",
"stderr": "",
"stdout": ""Asm.fif" include
PROGRAM{
DECLPROC recv_internal
78250 DECLMETHOD ?fun_78250
recv_internal PROC:<{
SWAP
CTOS
4 LDU
SWAP
ONE
AND
NEGATE
SWAP
LDMSGADDR
s1 s2 s(-2) PU2XC
s1 s3 XCHG
s1 s6 XCHG
4 TUPLE
1 SETGLOB
s0 s2 XCHG
2 SETGLOB
<{
PUSHROOT
CTOS
1 LDI
DROP
<{
NULL
}> PUSHCONT
IFJMP
NULL
}>c CALLREF
s0 s2 XCHG
<{
NIP
<{
-1 PUSHINT
}> PUSHCONT
IFJMP
ZERO
}>c CALLREF
130 THROWIFNOT
DROP
NEWC
-1 PUSHINT
SWAP
1 STI
ENDC
POPROOT
}>
?fun_78250 PROC:<{
<{
PUSHROOT
CTOS
1 LDI
DROP
<{
NULL
}> PUSHCONT
IFJMP
NULL
}>c CALLREF
<{
x{68656C6C6F20776F726C64} PUSHSLICE
}>c CALLREF
NIP
}>
}END>c
",
}
`;
35 changes: 33 additions & 2 deletions src/cli/unboc/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ const tact = (args: string) => {
const command = `node ${tactPath} ${args}`;
return runCommand(command);
};
const unboc = (args: string) => {
const unboc = (...args: string[]) => {
const unbocPath = normalize(
join(__dirname, "..", "..", "..", "bin", "unboc.js"),
);
const command = `node ${unbocPath} ${args}`;
const command = `node ${unbocPath} ${args.join(" ")}`;
return runCommand(command);
};

Expand All @@ -37,4 +37,35 @@ describe("unboc foo.boc", () => {
const result = await unboc(r.outputPath("code.boc"));
expect(result).toMatchObject({ kind: "exited", code: 0 });
});

testWin("Default run", async () => {
const r = await codegen.config(`unboc`, goodContract, {});
await tact(`-c ${r.config}`);
const result = await unboc(r.outputPath("code.boc"));
expect(result).toMatchSnapshot();
});

testWin("Without aliases", async () => {
const r = await codegen.config(`unboc`, goodContract, {});
await tact(`-c ${r.config}`);
const result = await unboc("--no-aliases", r.outputPath("code.boc"));
expect(result).toMatchSnapshot();
});

testWin("Without refs", async () => {
const r = await codegen.config(`unboc`, goodContract, {});
await tact(`-c ${r.config}`);
const result = await unboc(
"--no-compute-refs",
r.outputPath("code.boc"),
);
expect(result).toMatchSnapshot();
});

testWin("With bitcode", async () => {
const r = await codegen.config(`unboc`, goodContract, {});
await tact(`-c ${r.config}`);
const result = await unboc("--show-bitcode", r.outputPath("code.boc"));
expect(result).toMatchSnapshot();
});
});
Loading
Loading