-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codegen): allocator not accounting for extra ref in a cell result…
…ing in cell overflows in some cases (#615) resulting in cell overflows in some cases
- Loading branch information
1 parent
d1abeae
commit 9b003bd
Showing
10 changed files
with
119 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { toNano } from "@ton/core"; | ||
import { ContractSystem } from "@tact-lang/emulator"; | ||
import { Test } from "./contracts/output/allocation_Test"; | ||
|
||
describe("allocation", () => { | ||
it("should deploy correctly and process SetCost message without cell overflow", async () => { | ||
const system = await ContractSystem.create(); | ||
const owner = system.treasure("owner"); | ||
const contract = system.open( | ||
await Test.fromInit(owner.address, { | ||
$$type: "Struct2", | ||
c: "", | ||
d: "", | ||
e: "", | ||
f: "", | ||
}), | ||
); | ||
system.name(contract.address, "main"); | ||
await contract.send( | ||
owner, | ||
{ value: toNano(1) }, | ||
{ $$type: "Deploy", queryId: 0n }, | ||
); | ||
await system.run(); | ||
await contract.send( | ||
owner, | ||
{ value: toNano(1) }, | ||
{ $$type: "SetCost", cost: toNano("0.1") }, | ||
); | ||
await system.run(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import "@stdlib/deploy"; | ||
|
||
message SetCost { | ||
cost: Int? as coins; | ||
} | ||
|
||
struct Struct2 { | ||
c: String; | ||
d: String; | ||
e: String; | ||
f: String; | ||
} | ||
|
||
contract Test with Deployable { | ||
owner: Address; | ||
seqno: Int as uint256 = 0; | ||
a: Int as uint256 = 0; | ||
b: Int as uint256 = 0; | ||
|
||
struct2: Struct2; | ||
|
||
author3: Address?; | ||
|
||
cost: Int? as coins; | ||
address: Address?; | ||
price: Int? as coins; | ||
|
||
init(owner: Address, struct2: Struct2) { | ||
self.owner = owner; | ||
self.struct2 = struct2; | ||
} | ||
|
||
receive(msg: SetCost) { | ||
self.cost = msg.cost; | ||
self.reply("Cost is updated".asComment()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters