-
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
Open
krebernisak
wants to merge
147
commits into
main
Choose a base branch
from
feat/ton-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,829
−52
Open
Add TON support #486
Changes from all commits
Commits
Show all changes
147 commits
Select commit
Hold shift + click to select a range
dadee6c
Setup env
krebernisak 0b6c1aa
Add TON domain - add configurer
krebernisak bce0349
Encode SetConfig message
krebernisak e5cb725
Add ton.ConfigTransformer
krebernisak d801b7a
Implement transformer.ToConfig
krebernisak d1b8e19
Add sdk/ton/encoder.go
krebernisak d045e7b
Add TON Encoder.HashMetadata
krebernisak 31235d4
Add sdk/ton/inspector.go
krebernisak 13b2123
Add sdk.Inspector#GetRootMetadata
krebernisak b1a90ec
Add sdk/ton/timelock_inspector.go
krebernisak 4c1aad7
Add sdk/ton/transaction.go
krebernisak 78321f0
Add sdk/ton/timelock_executor.go
krebernisak 613e14f
Add sdk/ton/timelock_converter.go
krebernisak b8ec853
Add sdk/ton/executor.go
krebernisak d32ef0a
Add signature and proof encoders
krebernisak 46b1b72
Update signatures and proof encoders type
krebernisak 2abd3a2
Add sdk/ton/decoder.go
krebernisak dd0203e
Bump github.com/smartcontractkit/chainlink-ton
krebernisak 7fd021f
Add cselectors.FamilyTon as option
krebernisak 326ca59
Add changesets and test entrypoints
krebernisak 63a9711
Add TON e2e setup + TimelockInspectionTestSuite stub (evm)
krebernisak f1899ba
Add Configurer option to not send transactions (NONEVM-2862) - TON
krebernisak e30648e
Add sdk/ton/decoded_operation_test.go
krebernisak 67690a3
Add sdk/ton/decoder_test.go
krebernisak 9fd3682
Add sdk/ton/encoder_test.go
krebernisak 3b112bc
Add sdk/ton/config_transformer_test.go
krebernisak 66730c3
Add sdk/ton/timelock_converter_test.go
krebernisak c5964f6
Configure mockery v2
krebernisak 04f7da4
Bump chainlink-ton
krebernisak f805749
Add wallet.TonAPI mock
krebernisak 0875eac
Add sdk/ton/configurer_test.go
krebernisak 6bf69cd
Add sdk/ton/executor_test.go
krebernisak 09acecd
Add sdk/ton/timelock_executor_test.go
krebernisak 0f8631e
Add timelock inspector getRoleMembers helper func
krebernisak ee4b46f
Add sdk/ton/timelock_inspector_test.go
krebernisak c4b0450
Add sdk/ton/timelock_inspector_test.go
krebernisak f13419c
Reuse common signing test with EVM
krebernisak c61c279
Apply PR feedback
krebernisak ec4494f
Add e2e/tests/ton/set_config.go
krebernisak daf7c2e
Load MCMS (chainlink-ton) contracts
krebernisak e06ed5f
Implement e2e/tests/ton/set_config.go
krebernisak 9eafc33
Import code from chainlink-ton
krebernisak 15ffd4f
Update upstream deps
krebernisak 3744493
Fix unit tests
krebernisak 0da4b9e
Fix e2e test
krebernisak 4dca120
Remove unused deployerKey from tests
krebernisak f987b9b
Add SignerKeys slice of keys to types.Config + remap func
krebernisak e5e84fc
Revert "Add SignerKeys slice of keys to types.Config + remap func"
krebernisak 0ea69e8
Fix after commit revert
krebernisak 103437b
Refactor TON signers as EVM addr
krebernisak dbf56de
Add e2e/tests/ton/set_root.go (wip)
krebernisak 53e6429
Implement e2e/tests/ton/timelock_inspection.go (wip)
krebernisak b4b6172
Add tracetracking.WaitForTrace and fix tests
krebernisak 658e984
Add 'Build TON contracts' step to CI e2e tests
krebernisak 3c9d219
Add e2e/tests/ton/inspection.go (wip)
krebernisak f79fcd3
Fix setConfig payload/test
krebernisak dd82b5f
PR feedback
krebernisak 60971bd
Remove replace github.com/fbsobreira/gotron-sdk
krebernisak 72fa87d
Extract common deploy functionality
krebernisak 0234945
Update smartcontractkit/.github/actions/ci-lint-go to 3.1.0
krebernisak 1177963
Bump golangci-lint-version: v2.6.2
krebernisak 9b51ba4
Fix lint errors (wip)
krebernisak af6a74b
Fix lint errors #2 (wip)
krebernisak da77616
Fix lint errors #3 - renaming (wip)
krebernisak f1050eb
Fix lint errors #4 (wip)
krebernisak 6635601
Fix lint errors #5 (wip)
krebernisak 08a3368
Fix lint errors #6 (wip)
krebernisak 9db8a3f
Fix lint errors #7 (wip)
krebernisak 648d813
Fix lint errors #8 (wip)
krebernisak 5bd3fd6
Fix lint errors #9 (wip)
krebernisak 67fdc34
Fix lint errors #10 (wip)
krebernisak 7faa57d
Fix lint errors #11 (wip)
krebernisak 9e32578
Fix lint errors #12 (wip)
krebernisak 5d1d2bd
Fix lint errors #13 (wip)
krebernisak b483dc1
Fix lint errors #14 (wip)
krebernisak 5172cea
Fix lint errors #15 (wip)
krebernisak dfba8b7
Fix lint errors #16 (wip)
krebernisak e676dca
Fix lint errors #17 (wip)
krebernisak fa99902
Fix lint errors #18 (wip)
krebernisak 7a46f9e
Fix s.Run func
krebernisak d559024
Fix lint errors #19 (wip)
krebernisak 5b6b3d9
Fix lint errors #20 (wip)
krebernisak 8168758
Fix lint errors #21 (wip)
krebernisak 10be31a
Fix lint errors #22 (wip)
krebernisak ba4aec6
Fix lint errors #23 (wip)
krebernisak 231f2fc
Fix lint errors #24 (wip)
krebernisak d70a6f6
Fix lint errors #25 (wip)
krebernisak cc812ed
Fix lint errors #26 (wip)
krebernisak 6f60982
Fix lint errors #27 (wip)
krebernisak 805f5f8
Fix lint errors #28 (wip)
krebernisak 8dce922
Fix lint errors #29 (wip)
krebernisak d2ce4dd
Fix lint errors #30 (wip)
krebernisak 85580b3
Fix lint errors #31 (wip)
krebernisak 0e396db
Fix lint errors #32 (wip)
krebernisak cae301f
Fix lint errors #33 (wip)
krebernisak 96c1200
Fix lint errors #34 (wip)
krebernisak a2ff9da
Add .golangci.yml settings.gomoddirectives.replace-allow-list gogo/pr…
krebernisak e92726b
Use .golangci.yml in CI
krebernisak 71681d6
golangci-lint run --fix --config .golangci.yml
krebernisak 2f3aff8
Fix lint errors #35 (wip)
krebernisak 7d882da
TODO(ton) annotation
krebernisak b6f401b
Merge branch 'main' into feat/ton-support
krebernisak cf4948e
fix import
huangzhen1997 0579b4c
Fix merge + reuse code
krebernisak f079f52
Fix TimelockCall min value
krebernisak 69c162a
Fix import
krebernisak d7136b9
Remove ConfigTransformer as inspector arg
krebernisak e96490b
Apply feedback from Pablo
krebernisak 5431a6a
Fix EVM test - error check
krebernisak a879bac
Add TestIsOperationDone
krebernisak 9517329
Fix TestIsOperationDone
krebernisak c52a686
Update to chore/mcms-polish-4 upstream branch - fix EIP191 signing an…
krebernisak 123dc48
Add shim for GLOBAL_ID issue
krebernisak 30ad9a9
Fix unit test
krebernisak a0e7628
Rollback style/lint changes
krebernisak 6687331
Fix flakes - addr cmp, uint160
krebernisak 7b6d4e2
Update to latest smartcontractkit/chainlink-ton
krebernisak f8f530e
Bump to latest smartcontractkit/chainlink-ton
krebernisak 11fe398
Revert style/lint changes
krebernisak a82b15f
Import tvm.NewRandomTestWallet fn
krebernisak b0a4e27
Bump to latest smartcontractkit/chainlink-ton
krebernisak 217ff57
Bump to latest smartcontractkit/chainlink-ton (main)
krebernisak 24a92b3
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak bcdc4eb
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak 05a6893
Cleanup TLBMap injection
krebernisak 924e72b
Add configurer WithDoNotSendInstructionsOnChain test
krebernisak 34ad98f
Decoder - Handle message with no body - empty cell
krebernisak 2ebd436
Cleanup sdk/ton/timelock_converter_test.go
krebernisak 86ec5e3
Add e2e/tests/ton/executable.go (wip)
krebernisak 3c32706
Fix test
krebernisak cf9de69
Fix lint
krebernisak 3a8c127
Fix lint
krebernisak c2ca592
Bump to latest, test TimelockInspector
krebernisak fd43ba7
Fix mcmston.NewTimelockConverter(mcmston.DefaultSendAmount)
krebernisak 447799e
Fix lint
krebernisak 1907ec4
Docs
krebernisak 2da298b
Fix timelock test gas issue
krebernisak af713b0
Add GenSimpleTestConfig fn
krebernisak d1013f7
Move underlying getters to chainlink-ton
krebernisak 2032363
Add sdk/ton/transaction_test.go
krebernisak 8771cdb
Extract ParseAddrGetBlock(ctx, client, address) util
krebernisak 8065364
Bump to latest
krebernisak 87dfcb6
Bump to latest, remove duplicated code
krebernisak 70cbb32
Extract SendTx util fn
krebernisak 5c04a63
Add coverage, fix deploy bug
krebernisak 60de5d1
Bump to latest
krebernisak cfba89d
Update to latest chainlink-ton (generic-ops)
krebernisak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| "@smartcontractkit/mcms": minor | ||
| --- | ||
|
|
||
| Add TON implementation and unit/e2e tests |
This file contains hidden or 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 hidden or 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 hidden or 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,18 @@ | ||
| [settings] | ||
| private_keys = [ | ||
| "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", | ||
| "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d", | ||
| "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a" | ||
| ] | ||
|
|
||
| [ton_config] | ||
| chain_id = "-217" | ||
| type = "ton" | ||
| image = "ghcr.io/neodix42/mylocalton-docker:v3.97" | ||
|
|
||
| [ton_config.out] | ||
| family = "ton" | ||
|
|
||
| [ton_config.custom_env] | ||
| NEXT_BLOCK_GENERATION_DELAY = "0.5" | ||
| VERSION_CAPABILITIES = "12" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,122 @@ | ||
| //go:build e2e | ||
|
|
||
| package tone2e | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| "github.com/ethereum/go-ethereum/common" | ||
|
|
||
| "github.com/xssnick/tonutils-go/address" | ||
| "github.com/xssnick/tonutils-go/tlb" | ||
| "github.com/xssnick/tonutils-go/ton" | ||
| "github.com/xssnick/tonutils-go/ton/wallet" | ||
| "github.com/xssnick/tonutils-go/tvm/cell" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-ton/pkg/bindings/mcms/mcms" | ||
| "github.com/smartcontractkit/chainlink-ton/pkg/bindings/mcms/timelock" | ||
| "github.com/smartcontractkit/chainlink-ton/pkg/ton/tracetracking" | ||
| "github.com/smartcontractkit/chainlink-ton/pkg/ton/wrappers" | ||
|
|
||
| "github.com/smartcontractkit/mcms/internal/testutils" | ||
| "github.com/smartcontractkit/mcms/types" | ||
| ) | ||
|
|
||
| const ( | ||
| EnvPathContracts = "PATH_CONTRACTS_TON" | ||
|
|
||
| PathContractsMCMS = "mcms.MCMS.compiled.json" | ||
| PathContractsTimelock = "mcms.RBACTimelock.compiled.json" | ||
| ) | ||
|
|
||
| func must[E any](out E, err error) E { | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
|
|
||
| return out | ||
| } | ||
|
|
||
| type DeployOpts struct { | ||
| // Connection | ||
| Client *ton.APIClient | ||
| Wallet *wallet.Wallet | ||
|
|
||
| // Deployment info | ||
| ContractPath string | ||
|
|
||
| Amount tlb.Coins | ||
| Data any | ||
| Body any | ||
| } | ||
|
|
||
| func DeployContract(ctx context.Context, opts DeployOpts) (*address.Address, error) { | ||
| contractCode, err := wrappers.ParseCompiledContract(opts.ContractPath) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to parse compiled contract: %w", err) | ||
| } | ||
|
|
||
| contractData, ok := opts.Data.(*cell.Cell) // Cell or we try to decode | ||
| if !ok { | ||
| contractData, err = tlb.ToCell(opts.Data) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create contract data cell: %w", err) | ||
| } | ||
| } | ||
|
|
||
| bodyCell, ok := opts.Body.(*cell.Cell) // Cell or we try to decode | ||
| if !ok { | ||
| bodyCell, err = tlb.ToCell(opts.Body) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create contract body cell: %w", err) | ||
| } | ||
| } | ||
|
|
||
| _client := tracetracking.NewSignedAPIClient(opts.Client, *opts.Wallet) | ||
| contract, _, err := wrappers.Deploy(ctx, &_client, contractCode, contractData, opts.Amount, bodyCell) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to deploy contract: %w", err) | ||
| } | ||
|
|
||
| return contract.Address, nil | ||
| } | ||
|
|
||
| func DeployMCMSContract(ctx context.Context, client *ton.APIClient, w *wallet.Wallet, amount tlb.Coins, data mcms.Data) (*address.Address, error) { | ||
| return DeployContract(ctx, DeployOpts{ | ||
| Client: client, | ||
| Wallet: w, | ||
| ContractPath: filepath.Join(os.Getenv(EnvPathContracts), PathContractsMCMS), | ||
| Amount: amount, | ||
| Data: data, | ||
| Body: cell.BeginCell().EndCell(), // empty cell, top up | ||
| }) | ||
| } | ||
|
|
||
| func DeployTimelockContract(ctx context.Context, client *ton.APIClient, w *wallet.Wallet, amount tlb.Coins, data timelock.Data, body timelock.Init) (*address.Address, error) { | ||
| return DeployContract(ctx, DeployOpts{ | ||
| Client: client, | ||
| Wallet: w, | ||
| ContractPath: filepath.Join(os.Getenv(EnvPathContracts), PathContractsTimelock), | ||
| Amount: amount, | ||
| Data: data, | ||
| Body: body, | ||
| }) | ||
| } | ||
|
|
||
| // GenSimpleTestMCMSConfig generates a simple test configuration that's used in e2e tests. | ||
| func GenSimpleTestMCMSConfig(signers []testutils.ECDSASigner) *types.Config { | ||
| return &types.Config{ | ||
| Quorum: 1, | ||
| Signers: []common.Address{signers[0].Address()}, | ||
| GroupSigners: []types.Config{ | ||
| { | ||
| Quorum: 1, | ||
| Signers: []common.Address{signers[1].Address()}, | ||
| GroupSigners: []types.Config{}, | ||
| }, | ||
| }, | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 prefer to leave out nix on CI and keep just for dev purposes as optional tool, since a lot of devs here are not familiar with the nix ecosystem. I see a couple options:
cc @gustavogama-cll and @jkongie as you also had some thoughts on this topic.