-
Notifications
You must be signed in to change notification settings - Fork 1
Add TON support #486
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
base: main
Are you sure you want to change the base?
Add TON support #486
Conversation
🦋 Changeset detectedLatest commit: 099a18a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
is nix mandatory for ton?
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.
Hey! Nix is added to support dev environments for devs that use Nix.
Nix is also the way to get chainlink-ton packages, in this case I will need the TON contracts package, which I can easily pull from source with Nix. This is required to deploy contracts.
Same as we import Go bindings from a commit with Go,
we import TON contract artifacts from a commit with Nix.
Nix is an orthogonal add-on - this means that folks can use it or set up things manually.
For TON, some tools like Go need to be in a path and TON compiled contracts need to be available on a path defined with an env var. One can just run a prepared Nix shell to get all of that, or set up things manually.
Once I get everything working, I will also document how to get a TON env running manually as well.
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.
I have a few requests, if you please.
- add a changeset file
- remove the .envrc file. We don't mind if you want to use nix, but we don't want to enforce it by default
- consider adding unit tests; I understand it's just an initial PR, but we do try have good coverage in the library. Ideally, in every PR.
|
I see the PR was marked as draft later... If it's not ready for review yet, please ignore my remarks. |
Thx for a quick review! Yeah, still an early draft trying to move things forward. |
d2cd41a to
0154364
Compare
01797f9 to
3e808a9
Compare
ee5b77b to
bc628b4
Compare
| // TODO: unify and move these definitions to smartcontractkit/chainlink-ton | ||
| var TLBsByContract = map[string]map[uint64]interface{}{ | ||
| // Jetton contract types | ||
| "com.github.ton-blockchain.jetton-contract.contracts.jetton-wallet": wallet.TLBs, | ||
| "com.github.ton-blockchain.jetton-contract.contracts.jetton-minter": minter.TLBs, | ||
| // CCIP contract types | ||
| "com.chainlink.ton.ccip.Router": router.TLBs, | ||
| "com.chainlink.ton.ccip.OnRamp": onramp.TLBs, | ||
| "com.chainlink.ton.ccip.OffRamp": offramp.TLBs, | ||
| "com.chainlink.ton.ccip.FeeQuoter": feequoter.TLBs, | ||
| "com.chainlink.ton.ccip.CCIPSendExecutor": ccipsendexecutor.TLBs, | ||
| // MCMS contract types | ||
| "com.chainlink.ton.lib.access.RBAC": rbac.TLBs, | ||
| "com.chainlink.ton.mcms.MCMS": mcms.TLBs, | ||
| "com.chainlink.ton.mcms.Timelock": timelock.TLBs, | ||
| } |
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 flagging that this probably needs to be moved to chainlink-token as the TODO indicates
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.
Sure! I've left a couple of TODOs re: code structure across the PR.
Once I'm done with e2e tests, I'll these before merging. Some utility code and bindings can be moved and hosted in https://github.com/smartcontractkit/chainlink-ton
| } | ||
|
|
||
| // Extract the input keys and args (tree/map lvl 0) | ||
| keys, err := lib.DecodeTLBStructKeys(v, tlbs) |
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.
might want to handle the err here
|
|
||
| tx, err := executor.ExecuteOperation(ctx, tt.metadata, tt.nonce, tt.proof, tt.op) | ||
|
|
||
| assert.Equal(t, tt.wantTxHash, tx.Hash) |
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.
nit: might want to move this after the error check just to ensure err is nil before asserting
| } | ||
|
|
||
| func TestTONSuite(t *testing.T) { | ||
| suite.Run(t, new(tone2e.TimelockInspectionTestSuite)) |
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.
I'd strongly suggest to add the rest e2e tests before merging this one if possible. In past implementations like EVM/Solana they were super helpful to catch errors early. It saved us a lot of time specially when integrating with CLD. I know its a lot of work, so if not possible in this one at least having a followup before releasing the first TON mcms lib version
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.
Sure! At this point (1) implementation done, (2) unit test done (EVM parity), (3) e2e tests WIP
9e33a9f to
099a18a
Compare
No description provided.