Skip to content

Commit

Permalink
* fix: typos in comments and identifiers across codebase (#372)
Browse files Browse the repository at this point in the history
* fix capitalization issues for AST constructions for assignments

* fix(abi): undeflow -> underflow

The reason addresses are changed in snapshots is because
the generated FunC code got changed too because
`get_abi_ipfs` getters are now containing different
IPFS addresses due to changed ABIs:

```
_ get_abi_ipfs() method_id {
    return "ipfs://QmRM77XpqMrANwLE8K3A287jZHvuQSLr76xYM2ea8wZZ89";
//                 ^^^ the hash changes
}
```

* ci: add spell checking with cSpell
  • Loading branch information
anton-trunov authored Jun 3, 2024
1 parent 1590a4c commit 3db4409
Show file tree
Hide file tree
Showing 56 changed files with 1,144 additions and 368 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
run: |
yarn lint:schema
- name: Spellcheck code base
run: |
yarn spell
- name: Show an example .pkg file on Windows
if: runner.os == 'Windows'
run: |
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Tests for recursive functions: PR [#359](https://github.com/tact-lang/tact/pull/359)
- API for AST traversal: PR [#368](https://github.com/tact-lang/tact/pull/368)
- Spell checking for the whole code base: PR [#372](https://github.com/tact-lang/tact/pull/372)

### Changed

Expand All @@ -28,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Built-in function `address()` now handles parse errors correctly: PR [#357](https://github.com/tact-lang/tact/pull/357)
- All identifiers in error messages are now quoted for consistency: PR [#363](https://github.com/tact-lang/tact/pull/363)
- The grammar of the unary operators has been fixed, constant and function declarations are prohibited for contracts and at the top level of Tact modules: PR [#365](https://github.com/tact-lang/tact/pull/365)
- Typos in ABI generation: : PR [#372](https://github.com/tact-lang/tact/pull/372)

## [1.3.0] - 2024-05-03

Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This version would include the following features:
- Typed tuples
- `let` type inference when possible
- Limited external messages support
- Contract automatic optimisations
- Contract automatic optimizations
- Auto-unpacking nullable variables to non-null one

## ✍️ Version v3
Expand Down
2 changes: 1 addition & 1 deletion bin/tact
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ meowModule.then(
? "funcOnly"
: undefined;

// TODO: all flags on the cli should take precendence over flags in the config
// TODO: all flags on the cli should take precedence over flags in the config
// Make a nice model for it in the src/node.ts instead of the current mess
// Consider making overwrites right here or something.

Expand Down
89 changes: 89 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"language": "en",
"words": [
"alnum",
"augmentedassign",
"blockstore",
"bounceable",
"codegen",
"decompile",
"Decompiled",
"decompiler",
"Descr",
"divmod",
"dnsresolve",
"Fift",
"forall",
"funcfiftlib",
"ipfs",
"ipld",
"jettons",
"jsxdev",
"langle",
"lparen",
"lvalue",
"masterchain",
"maxint",
"minmax",
"mintable",
"multiformats",
"Korshakov",
"nocheck",
"noexcept",
"Neovim",
"Offchain",
"Parens",
"POSIX",
"prando",
"rangle",
"rparen",
"rugpull",
"rugpulled",
"sctx",
"seqno",
"shiki",
"Stateinit",
"stdlib",
"struct",
"structs",
"testdata",
"Topup",
"typechecker",
"uintptr",
"uncons",
"unixfs",
"workchain",
"привет",
"PUSHREF",
"PUSHSLICE",
"SETINDEXVARQ"
],
"flagWords": [],
"ignorePaths": [
"**/*/output",
"node_modules",
"dist",
"examples/__snapshots__/multisig-3.spec.ts.snap",
"func",
"grammar/sample.json",
"src/generator/writers/writeStdlib.ts",
"src/generator/writers/__snapshots__/writeSerialization.spec.ts.snap",
"src/grammar/grammar.ohm-bundle.d.ts",
"src/imports/stdlib.ts",
"src/test/__snapshots__/bugs.spec.ts.snap",
"src/test/__snapshots__/feature-constants.spec.ts.snap",
"src/test/__snapshots__/feature-deep.spec.ts.snap",
"src/test/__snapshots__/feature-implicit-init.spec.ts.snap",
"src/test/__snapshots__/feature-masterchain.spec.ts.snap",
"src/test/__snapshots__/feature-try-catch.spec.ts.snap",
"src/test/feature-address.spec.ts",
"src/test/feature-intrinsics.spec.ts",
"src/test/feature-optionals.spec.ts",
"src/test/feature-strings.spec.ts",
"src/test/features/intrinsics.tact",
"src/test/features/strings.tact",
"stdlib/stdlib.fc"
]
}
6 changes: 3 additions & 3 deletions examples/__snapshots__/increment.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports[`increment should deploy 1`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQDeI5IisUF0tSvWxNDeA-Og-_S1nAT8ZdqTvOZ30HeNgzC1",
"to": "kQD6nAKeXIDwsXvmoLzvgplYcBDQIev4lyf1hznCywYBtZwE",
"type": "internal",
"value": "10",
},
Expand All @@ -41,7 +41,7 @@ exports[`increment should deploy 1`] = `
},
},
"bounce": false,
"from": "kQDeI5IisUF0tSvWxNDeA-Og-_S1nAT8ZdqTvOZ30HeNgzC1",
"from": "kQD6nAKeXIDwsXvmoLzvgplYcBDQIev4lyf1hznCywYBtZwE",
"to": "@treasure(treasure)",
"type": "internal",
"value": "9.990313",
Expand Down Expand Up @@ -71,7 +71,7 @@ exports[`increment should deploy 2`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQDeI5IisUF0tSvWxNDeA-Og-_S1nAT8ZdqTvOZ30HeNgzC1",
"to": "kQD6nAKeXIDwsXvmoLzvgplYcBDQIev4lyf1hznCywYBtZwE",
"type": "internal",
"value": "10",
},
Expand Down
4 changes: 2 additions & 2 deletions examples/__snapshots__/multisig-3.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`muiltisig-3 should deploy 1`] = `
exports[`multisig-3 should deploy 1`] = `
[
{
"$seq": 0,
Expand All @@ -17,7 +17,7 @@ exports[`muiltisig-3 should deploy 1`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQA2dtHnP8ywA0dgkHw5rQTXGtbBDktii55xFgnShHpu1XtQ",
"to": "kQBXbQ5TLfxfUX18NuZ6xVRfHett-T_4o8LEea5wStaBGa9n",
"type": "internal",
"value": "10",
},
Expand Down
10 changes: 5 additions & 5 deletions examples/__snapshots__/wallet.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`wallet should deploy 1`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQCjmMHzL6dRv6HCrACYpCe1qJbXqGp_P1ObgRO1orr1RW5j",
"to": "kQCR5iC3JwCwj6f0xBFwvLeYS8sZvKRQbtXJRpajfqVarbq6",
"type": "internal",
"value": "10",
},
Expand Down Expand Up @@ -45,7 +45,7 @@ exports[`wallet should deploy 1`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQCjmMHzL6dRv6HCrACYpCe1qJbXqGp_P1ObgRO1orr1RW5j",
"to": "kQCR5iC3JwCwj6f0xBFwvLeYS8sZvKRQbtXJRpajfqVarbq6",
"type": "internal",
"value": "1",
},
Expand All @@ -62,7 +62,7 @@ exports[`wallet should deploy 1`] = `
"type": "empty",
},
"bounce": true,
"from": "kQCjmMHzL6dRv6HCrACYpCe1qJbXqGp_P1ObgRO1orr1RW5j",
"from": "kQCR5iC3JwCwj6f0xBFwvLeYS8sZvKRQbtXJRpajfqVarbq6",
"to": "@treasure(treasure)",
"type": "internal",
"value": "10",
Expand Down Expand Up @@ -92,7 +92,7 @@ exports[`wallet should deploy 2`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQCjmMHzL6dRv6HCrACYpCe1qJbXqGp_P1ObgRO1orr1RW5j",
"to": "kQCR5iC3JwCwj6f0xBFwvLeYS8sZvKRQbtXJRpajfqVarbq6",
"type": "internal",
"value": "1",
},
Expand Down Expand Up @@ -123,7 +123,7 @@ exports[`wallet should deploy 3`] = `
},
"bounce": true,
"from": "@treasure(treasure)",
"to": "kQCjmMHzL6dRv6HCrACYpCe1qJbXqGp_P1ObgRO1orr1RW5j",
"to": "kQCR5iC3JwCwj6f0xBFwvLeYS8sZvKRQbtXJRpajfqVarbq6",
"type": "internal",
"value": "1",
},
Expand Down
2 changes: 1 addition & 1 deletion examples/multisig-3.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toNano } from "@ton/core";
import { ContractSystem } from "@tact-lang/emulator";
import { MultisigContract } from "./output/multisig-3_MultisigContract";

describe("muiltisig-3", () => {
describe("multisig-3", () => {
it("should deploy", async () => {
// Init contract
const key1 = 1n;
Expand Down
2 changes: 1 addition & 1 deletion examples/multisig.tact
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract MultisigSigner {
require(self.request.timeout > now(), "Timeout");
require(!self.completed, "Completed");

// Load weitght
// Load weight
let sender: Address = sender();
let weight: Int = self.members.get(sender)!!;
self.members.set(sender, null);
Expand Down
2 changes: 1 addition & 1 deletion examples/rugpull.tact
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ contract RugPull with OwnableTransferable, Stoppable {
// Must not be stopped stop
self.requireNotStopped();

// Fowrad everything to owner if rugpulled
// Forward everything to owner if rugpulled
if (self.rugpulled) {
send(SendParameters{value: 0, to: self.owner, mode: SendRemainingBalance });
return;
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lint": "yarn eslint .",
"lint:schema": "ajv validate -s grammar/configSchema.json -d tact.config.json",
"fmt:check": "yarn prettier --check .",
"spell": "cspell \"**\"",
"all": "yarn clean && yarn gen && yarn build && yarn coverage && yarn lint && yarn fmt:check"
},
"files": [
Expand Down Expand Up @@ -64,6 +65,7 @@
"@typescript-eslint/parser": "^7.0.2",
"ajv-cli": "^5.0.0",
"cross-env": "^7.0.3",
"cspell": "^8.8.3",
"eslint": "^8.56.0",
"glob": "^8.1.0",
"jest": "^29.3.1",
Expand Down
56 changes: 28 additions & 28 deletions src/abi/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ export const MapFunctions: Map<string, AbiFunction> = new Map([
kind = "uint";
}
if (self.value === "Int") {
let vbits = 257;
let vkind = "int";
let vBits = 257;
let vKind = "int";
if (self.valueAs && self.valueAs.startsWith("int")) {
vbits = parseInt(self.valueAs.slice(3), 10);
vBits = parseInt(self.valueAs.slice(3), 10);
} else if (
self.valueAs &&
self.valueAs.startsWith("uint")
) {
vbits = parseInt(self.valueAs.slice(4), 10);
vkind = "uint";
vBits = parseInt(self.valueAs.slice(4), 10);
vKind = "uint";
}
ctx.used(`__tact_dict_set_${kind}_${vkind}`);
return `${resolved[0]}~__tact_dict_set_${kind}_${vkind}(${bits}, ${resolved[1]}, ${resolved[2]}, ${vbits})`;
ctx.used(`__tact_dict_set_${kind}_${vKind}`);
return `${resolved[0]}~__tact_dict_set_${kind}_${vKind}(${bits}, ${resolved[1]}, ${resolved[2]}, ${vBits})`;
} else if (self.value === "Bool") {
ctx.used(`__tact_dict_set_${kind}_int`);
return `${resolved[0]}~__tact_dict_set_${kind}_int(${bits}, ${resolved[1]}, ${resolved[2]}, 1)`;
Expand Down Expand Up @@ -131,19 +131,19 @@ export const MapFunctions: Map<string, AbiFunction> = new Map([
// Handle address key
if (self.key === "Address") {
if (self.value === "Int") {
let vbits = 257;
let vkind = "int";
let vBits = 257;
let vKind = "int";
if (self.valueAs && self.valueAs.startsWith("int")) {
vbits = parseInt(self.valueAs.slice(3), 10);
vBits = parseInt(self.valueAs.slice(3), 10);
} else if (
self.valueAs &&
self.valueAs.startsWith("uint")
) {
vbits = parseInt(self.valueAs.slice(4), 10);
vkind = "uint";
vBits = parseInt(self.valueAs.slice(4), 10);
vKind = "uint";
}
ctx.used(`__tact_dict_set_slice_${vkind}`);
return `${resolved[0]}~__tact_dict_set_slice_${vkind}(267, ${resolved[1]}, ${resolved[2]}, ${vbits})`;
ctx.used(`__tact_dict_set_slice_${vKind}`);
return `${resolved[0]}~__tact_dict_set_slice_${vKind}(267, ${resolved[1]}, ${resolved[2]}, ${vBits})`;
} else if (self.value === "Bool") {
ctx.used(`__tact_dict_set_slice_int`);
return `${resolved[0]}~__tact_dict_set_slice_int(267, ${resolved[1]}, ${resolved[2]}, 1)`;
Expand Down Expand Up @@ -234,19 +234,19 @@ export const MapFunctions: Map<string, AbiFunction> = new Map([
kind = "uint";
}
if (self.value === "Int") {
let vbits = 257;
let vkind = "int";
let vBits = 257;
let vKind = "int";
if (self.valueAs && self.valueAs.startsWith("int")) {
vbits = parseInt(self.valueAs.slice(3), 10);
vBits = parseInt(self.valueAs.slice(3), 10);
} else if (
self.valueAs &&
self.valueAs.startsWith("uint")
) {
vbits = parseInt(self.valueAs.slice(4), 10);
vkind = "uint";
vBits = parseInt(self.valueAs.slice(4), 10);
vKind = "uint";
}
ctx.used(`__tact_dict_get_${kind}_${vkind}`);
return `__tact_dict_get_${kind}_${vkind}(${resolved[0]}, ${bits}, ${resolved[1]}, ${vbits})`;
ctx.used(`__tact_dict_get_${kind}_${vKind}`);
return `__tact_dict_get_${kind}_${vKind}(${resolved[0]}, ${bits}, ${resolved[1]}, ${vBits})`;
} else if (self.value === "Bool") {
ctx.used(`__tact_dict_get_${kind}_int`);
return `__tact_dict_get_int_int(${resolved[0]}, ${bits}, ${resolved[1]}, 1)`;
Expand Down Expand Up @@ -279,19 +279,19 @@ export const MapFunctions: Map<string, AbiFunction> = new Map([
// Handle Address key
if (self.key === "Address") {
if (self.value === "Int") {
let vbits = 257;
let vkind = "int";
let vBits = 257;
let vKind = "int";
if (self.valueAs && self.valueAs.startsWith("int")) {
vbits = parseInt(self.valueAs.slice(3), 10);
vBits = parseInt(self.valueAs.slice(3), 10);
} else if (
self.valueAs &&
self.valueAs.startsWith("uint")
) {
vbits = parseInt(self.valueAs.slice(4), 10);
vkind = "uint";
vBits = parseInt(self.valueAs.slice(4), 10);
vKind = "uint";
}
ctx.used(`__tact_dict_get_slice_${vkind}`);
return `__tact_dict_get_slice_${vkind}(${resolved[0]}, 267, ${resolved[1]}, ${vbits})`;
ctx.used(`__tact_dict_get_slice_${vKind}`);
return `__tact_dict_get_slice_${vKind}(${resolved[0]}, 267, ${resolved[1]}, ${vBits})`;
} else if (self.value === "Bool") {
ctx.used(`__tact_dict_get_slice_int`);
return `__tact_dict_get_slice_int(${resolved[0]}, 267, ${resolved[1]}, 1)`;
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/typescript/writeStruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export function writeDictParser(s: ABIType, w: Writer) {
w.write(`
function dictValueParser${s.name}(): DictionaryValue<${s.name}> {
return {
serialize: (src, buidler) => {
buidler.storeRef(beginCell().store(store${s.name}(src)).endCell());
serialize: (src, builder) => {
builder.storeRef(beginCell().store(store${s.name}(src)).endCell());
},
parse: (src) => {
return load${s.name}(src.loadRef().beginParse());
Expand Down
2 changes: 1 addition & 1 deletion src/generator/createABI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export function createABI(ctx: CompilerContext, name: string): ContractABI {

// Errors
const errors: { [key: string]: { message: string } } = {};
errors["2"] = { message: "Stack undeflow" };
errors["2"] = { message: "Stack underflow" };
errors["3"] = { message: "Stack overflow" };
errors["4"] = { message: "Integer overflow" };
errors["5"] = { message: "Integer out of expected range" };
Expand Down
Loading

0 comments on commit 3db4409

Please sign in to comment.