-
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
Merged
Merged
Add TON support #486
Changes from all commits
Commits
Show all changes
145 commits
Select commit
Hold shift + click to select a range
a0650a5
Setup env
krebernisak 2e0bf81
Add TON domain - add configurer
krebernisak 5348276
Encode SetConfig message
krebernisak 2e43396
Add ton.ConfigTransformer
krebernisak 53b4555
Implement transformer.ToConfig
krebernisak f812413
Add sdk/ton/encoder.go
krebernisak 5c0d4b5
Add TON Encoder.HashMetadata
krebernisak 0b765a3
Add sdk/ton/inspector.go
krebernisak eba6aa4
Add sdk.Inspector#GetRootMetadata
krebernisak 80b0d14
Add sdk/ton/timelock_inspector.go
krebernisak 8c376a5
Add sdk/ton/transaction.go
krebernisak 54494cb
Add sdk/ton/timelock_executor.go
krebernisak 0fa9951
Add sdk/ton/timelock_converter.go
krebernisak 249014d
Add sdk/ton/executor.go
krebernisak b055bb3
Add signature and proof encoders
krebernisak 863fb58
Update signatures and proof encoders type
krebernisak 1ddf8b2
Add sdk/ton/decoder.go
krebernisak f10695d
Bump github.com/smartcontractkit/chainlink-ton
krebernisak 49e2dec
Add cselectors.FamilyTon as option
krebernisak 76ce95d
Add changesets and test entrypoints
krebernisak f9c2968
Add TON e2e setup + TimelockInspectionTestSuite stub (evm)
krebernisak 0ae93df
Add Configurer option to not send transactions (NONEVM-2862) - TON
krebernisak 2f167c8
Add sdk/ton/decoded_operation_test.go
krebernisak 617570f
Add sdk/ton/decoder_test.go
krebernisak 47b88d7
Add sdk/ton/encoder_test.go
krebernisak 3acbf48
Add sdk/ton/config_transformer_test.go
krebernisak a052762
Add sdk/ton/timelock_converter_test.go
krebernisak 2f20de1
Configure mockery v2
krebernisak a69d337
Bump chainlink-ton
krebernisak cb64cf7
Add wallet.TonAPI mock
krebernisak aa406d8
Add sdk/ton/configurer_test.go
krebernisak ddb7d0a
Add sdk/ton/executor_test.go
krebernisak 1a16ac5
Add sdk/ton/timelock_executor_test.go
krebernisak 5791987
Add timelock inspector getRoleMembers helper func
krebernisak 93dd466
Add sdk/ton/timelock_inspector_test.go
krebernisak 0625454
Add sdk/ton/timelock_inspector_test.go
krebernisak 765c29c
Reuse common signing test with EVM
krebernisak 27336cc
Apply PR feedback
krebernisak acc4b71
Add e2e/tests/ton/set_config.go
krebernisak 61b8565
Load MCMS (chainlink-ton) contracts
krebernisak 141b14b
Implement e2e/tests/ton/set_config.go
krebernisak dd3be7f
Import code from chainlink-ton
krebernisak f42f10d
Update upstream deps
krebernisak 44fc00a
Fix unit tests
krebernisak a3e876d
Fix e2e test
krebernisak 28fe4ed
Remove unused deployerKey from tests
krebernisak fb6f215
Add SignerKeys slice of keys to types.Config + remap func
krebernisak aa51d15
Revert "Add SignerKeys slice of keys to types.Config + remap func"
krebernisak 2f2bfb1
Fix after commit revert
krebernisak 04e3d00
Refactor TON signers as EVM addr
krebernisak d452c8f
Add e2e/tests/ton/set_root.go (wip)
krebernisak f10e79c
Implement e2e/tests/ton/timelock_inspection.go (wip)
krebernisak d7a0acd
Add tracetracking.WaitForTrace and fix tests
krebernisak 3e07aea
Add 'Build TON contracts' step to CI e2e tests
krebernisak dbacc46
Add e2e/tests/ton/inspection.go (wip)
krebernisak 4c2c5f4
Fix setConfig payload/test
krebernisak fcce744
PR feedback
krebernisak aa14ea9
Remove replace github.com/fbsobreira/gotron-sdk
krebernisak 59352e1
Extract common deploy functionality
krebernisak b903db7
Update smartcontractkit/.github/actions/ci-lint-go to 3.1.0
krebernisak 418497f
Fix lint errors (wip)
krebernisak d68f67d
Fix lint errors #2 (wip)
krebernisak a16cc1a
Fix lint errors #3 - renaming (wip)
krebernisak e22a430
Fix lint errors #4 (wip)
krebernisak 1eb28a9
Fix lint errors #5 (wip)
krebernisak d758d67
Fix lint errors #6 (wip)
krebernisak 814fb09
Fix lint errors #7 (wip)
krebernisak 89c8628
Fix lint errors #8 (wip)
krebernisak ab16668
Fix lint errors #9 (wip)
krebernisak c6437a3
Fix lint errors #10 (wip)
krebernisak cd422ae
Fix lint errors #11 (wip)
krebernisak 8b62ddf
Fix lint errors #12 (wip)
krebernisak f55d98e
Fix lint errors #13 (wip)
krebernisak c176424
Fix lint errors #14 (wip)
krebernisak 434aa2a
Fix lint errors #16 (wip)
krebernisak b8ce18d
Fix lint errors #20 (wip)
krebernisak e43e6ae
Fix lint errors #21 (wip)
krebernisak 9a29dd9
Fix lint errors #22 (wip)
krebernisak ef916a9
Fix lint errors #23 (wip)
krebernisak 86d9c68
Fix lint errors #24 (wip)
krebernisak 95f08a1
Fix lint errors #25 (wip)
krebernisak 03da7af
Fix lint errors #26 (wip)
krebernisak 5b4eaa2
Fix lint errors #27 (wip)
krebernisak b95c3fb
Fix lint errors #28 (wip)
krebernisak 9a7bcb5
Fix lint errors #29 (wip)
krebernisak 0b98838
Fix lint errors #30 (wip)
krebernisak 334410a
Fix lint errors #32 (wip)
krebernisak c7388db
Fix lint errors #33 (wip)
krebernisak ff6eca9
Fix lint errors #34 (wip)
krebernisak e14f592
Add .golangci.yml settings.gomoddirectives.replace-allow-list gogo/pr…
krebernisak cf64fc9
Use .golangci.yml in CI
krebernisak 66b394c
golangci-lint run --fix --config .golangci.yml
krebernisak f7e39b1
Fix lint errors #35 (wip)
krebernisak 064e9ec
TODO(ton) annotation
krebernisak df81f28
fix import
huangzhen1997 6564ee8
Fix merge + reuse code
krebernisak c3b87b4
Fix TimelockCall min value
krebernisak 57f5e4a
Fix import
krebernisak 1a5b94f
Remove ConfigTransformer as inspector arg
krebernisak eaf5893
Apply feedback from Pablo
krebernisak 76954b0
Fix EVM test - error check
krebernisak cb5e087
Add TestIsOperationDone
krebernisak 2f389e8
Fix TestIsOperationDone
krebernisak f020b40
Update to chore/mcms-polish-4 upstream branch - fix EIP191 signing an…
krebernisak 8a4a945
Add shim for GLOBAL_ID issue
krebernisak a557d56
Fix unit test
krebernisak cd2b98a
Rollback style/lint changes
krebernisak 0cf152d
Fix flakes - addr cmp, uint160
krebernisak 43afd26
Update to latest smartcontractkit/chainlink-ton
krebernisak 6b85537
Bump to latest smartcontractkit/chainlink-ton
krebernisak 9d704dd
Revert style/lint changes
krebernisak 6cbe8ab
Import tvm.NewRandomTestWallet fn
krebernisak ab41663
Bump to latest smartcontractkit/chainlink-ton
krebernisak a237414
Bump to latest smartcontractkit/chainlink-ton (main)
krebernisak 7bda361
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak 1ff4769
Bump to latest smartcontractkit/chainlink-ton (mcms-bindings)
krebernisak ecb6d47
Cleanup TLBMap injection
krebernisak 59c1463
Add configurer WithDoNotSendInstructionsOnChain test
krebernisak 48b9ec3
Decoder - Handle message with no body - empty cell
krebernisak 8bec36c
Cleanup sdk/ton/timelock_converter_test.go
krebernisak b29e88c
Add e2e/tests/ton/executable.go (wip)
krebernisak 3809d28
Fix test
krebernisak 090d1da
Fix lint
krebernisak 4dd8e2e
Fix lint
krebernisak f256d77
Bump to latest, test TimelockInspector
krebernisak f67376e
Fix mcmston.NewTimelockConverter(mcmston.DefaultSendAmount)
krebernisak ff0d866
Fix lint
krebernisak b33df29
Docs
krebernisak c099684
Fix timelock test gas issue
krebernisak 39ff3ce
Add GenSimpleTestConfig fn
krebernisak 69b5aeb
Move underlying getters to chainlink-ton
krebernisak d1ac7c5
Add sdk/ton/transaction_test.go
krebernisak cad400e
Extract ParseAddrGetBlock(ctx, client, address) util
krebernisak dd38d3d
Bump to latest
krebernisak 1f391af
Bump to latest, remove duplicated code
krebernisak e2419e1
Extract SendTx util fn
krebernisak 2bd951f
Add coverage, fix deploy bug
krebernisak 0d2f781
Bump to latest
krebernisak 1455ab4
Update to latest chainlink-ton (generic-ops)
krebernisak bc1ed76
Split out Nix CI e2e setup (supports TON)
krebernisak 31559b4
Update to latest chainlink-ton (generic-ops)
krebernisak 0a9f731
Update neodix42/mylocalton-docker:v3.98
krebernisak 655e2e9
Update to latest chainlink-ton (main)
krebernisak 9a198e8
Bump github.com/ethereum/go-ethereum v1.16.8 - security release
krebernisak 2623599
Polish
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| * @smartcontractkit/op-tooling | ||
|
|
||
| # Nix shell setup (supports TON e2e tests) | ||
| /.github/workflows/pull-request-main-nix.yml @smartcontractkit/ccip-ton |
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,56 @@ | ||
| name: pull-request-main-nix | ||
|
|
||
| on: | ||
| merge_group: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| ci-test-e2e: | ||
| name: Tests E2E - Nix setup | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| actions: read | ||
| steps: | ||
| - name: Install Nix | ||
| uses: cachix/install-nix-action@02a151ada4993995686f9ed4f1be7cfbb229e56f # v31 | ||
| with: | ||
| nix_path: nixpkgs=channel:nixos-unstable | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Build TON contracts | ||
| id: ton-contracts-build | ||
| shell: bash | ||
| run: | | ||
| PATH_CONTRACTS_TON_PKG="$(nix build .#chainlink-ton-contracts --print-out-paths)/" | ||
| PATH_CONTRACTS_TON="$PATH_CONTRACTS_TON_PKG/lib/node_modules/@chainlink/contracts-ton/build/" | ||
| echo "path=$PATH_CONTRACTS_TON" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Run e2e tests | ||
| uses: smartcontractkit/.github/actions/ci-test-go@ci-test-go/1.0.0 | ||
| with: | ||
| checkout-repo: false | ||
| use-go-cache: true | ||
| go-test-cmd: | | ||
| set +e | ||
|
|
||
| echo "::group::TON" | ||
| export PATH_CONTRACTS_TON="${{ steps.ton-contracts-build.outputs.path }}" | ||
| CTF_CONFIGS=../config.ton.toml go test -p=1 -tags=e2e -v ./e2e/tests/... -run=TestTONSuite || ton_failure=true | ||
| echo "::endgroup::" | ||
|
|
||
| [[ -n "${ton_failure}" ]] && echo "🚨 TON e2e tests failed." | ||
| [[ -n "${ton_failure}" ]] && { | ||
| exit 1 | ||
| } || { | ||
| echo "Exiting" | ||
| exit 0 | ||
| } | ||
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.98" | ||
|
|
||
| [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.
Uh oh!
There was an error while loading. Please reload this page.