Skip to content

feat(zetaclient): integrate TON HTTP-RPC#3958

Merged
swift1337 merged 25 commits intodevelopfrom
feat/ton-rpc-integration
Jun 11, 2025
Merged

feat(zetaclient): integrate TON HTTP-RPC#3958
swift1337 merged 25 commits intodevelopfrom
feat/ton-rpc-integration

Conversation

@swift1337
Copy link
Contributor

@swift1337 swift1337 commented Jun 5, 2025

This PR drops Lite-Client support in favor of HTTP-RPC based on https://toncenter.com/api/v2/#/

  • Integrate toncenter http-api v2 into zetaclient. Fully compatible with our needs and existing binding to Tongo!
  • Breaking: voteInbound for TON now reports block_height=0. Should not be an issue
  • Fix e2e tests
  • Update ton-docker image
  • Simplify ensureLastScannedTx
  • Update & simplify configs
  • Add http mock for ton rpc
  • Add prom metrics to rpc
  • Use the new ton-docker image

Close #3928

Summary by CodeRabbit

  • New Features

    • Integrated TON http-rpc, replacing previous lite-client-based connectivity for improved blockchain interaction and configuration.
  • Refactor

    • Migrated all TON blockchain operations from lite-client to http-rpc, including observer, signer, orchestrator, and test utilities.
    • Updated configuration files and environment defaults to use TON Center v2 RPC endpoints.
    • Simplified client initialization and improved error handling for TON network operations.
  • Bug Fixes

    • Enhanced transaction polling and status checks for more reliable TON network synchronization.
  • Tests

    • Updated and expanded test suites to support the new TON http-rpc interface, including new test utilities for RPC server mocking and account parsing.
  • Chores

    • Removed deprecated lite-client code, configuration support, and related test files to streamline the codebase.

@swift1337 swift1337 self-assigned this Jun 5, 2025
@swift1337 swift1337 requested a review from a team as a code owner June 5, 2025 13:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 5, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This update migrates TON blockchain integration from a lite-client/lite-api architecture to a full HTTP-RPC client implementation throughout the codebase. It refactors all relevant configuration, client, observer, signer, and test logic to utilize the new RPC interface, removes legacy liteapi code, introduces new RPC utilities, and updates mocks and test infrastructure accordingly.

Changes

File(s) / Group Change Summary
zetaclient/chains/ton/liteapi/*, zetaclient/chains/ton/config/* Removed all liteapi-based TON client and configuration code, including client implementations, configuration loaders, and related tests.
zetaclient/chains/ton/rpc/client.go, zetaclient/chains/ton/rpc/types.go, zetaclient/chains/ton/rpc/config.go, zetaclient/chains/ton/rpc/tlbstack.go, zetaclient/chains/ton/rpc/types_test.go Introduced and expanded the TON RPC client, including account parsing, config fetching, VM stack marshalling, transaction hash utilities, and comprehensive tests.
zetaclient/chains/ton/observer/*, zetaclient/chains/ton/signer/* Refactored observer and signer logic to use the new RPC interface, updated method signatures, removed liteapi-specific logic, and revised error handling.
zetaclient/testutils/mocks/ton_gen.go, zetaclient/testutils/mocks/ton_rpc.go Updated mocks to match the new RPC interface, renamed types, and adjusted method signatures for all TON-related mocks.
zetaclient/testutils/testrpc/rpc.go, zetaclient/testutils/testrpc/rpc_btc.go, zetaclient/testutils/testrpc/rpc_evm.go Changed test RPC server parameter handling from slices to maps, updated handler signatures, and improved request parsing logic.
zetaclient/testutils/testrpc/rpc_ton.go Added a TON-specific test RPC server for integration testing.
zetaclient/orchestrator/bootstrap.go, zetaclient/orchestrator/bootstrap_test.go, zetaclient/orchestrator/orchestrator_test.go, zetaclient/orchestrator/preflight_metrics_reporter.go Replaced liteapi client usage with RPC client in orchestrator bootstrapping, preflight metrics, and associated tests.
zetaclient/config/types.go, zetaclient/config/config_chain.go Replaced LiteClientConfigURL with Endpoint in TON config, updated comments, and masked sensitive fields.
cmd/zetae2e/config/clients.go, cmd/zetae2e/config/local.yml, cmd/zetae2e/config/localnet.yml, cmd/zetae2e/init.go Updated E2E client initialization and configuration to use TON RPC endpoints instead of lite-client configs.
contrib/localnet/docker-compose.yml, contrib/localnet/scripts/wait-for-ton.sh Updated Docker and wait scripts to use TON Center v2 RPC, changed ports, image tags, and health checks.
e2e/config/config.go, e2e/runner/ton.go, e2e/runner/ton/accounts.go, e2e/runner/ton/client.go, e2e/runner/ton/deployer.go, e2e/e2etests/test_ton_deposit_restricted_address.go, e2e/e2etests/test_ton_withdrawal.go, e2e/e2etests/test_ton_withdrawal_concurrent.go Migrated all E2E TON test logic and utilities to use the new RPC client and interfaces.
zetaclient/chains/ton/observer/inbound_test.go, zetaclient/chains/ton/observer/observer_test.go, zetaclient/chains/ton/observer/outbound_test.go, zetaclient/chains/ton/signer/signer_test.go Updated all observer and signer tests to use the new RPC mocks and interfaces, removed liteapi-specific test logic, and revised assertions.
changelog.md Added a new feature entry referencing the TON HTTP-RPC integration.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application/Orchestrator
    participant TONRPC as TON RPC Client
    participant TONNode as TON Node (HTTP-RPC)

    App->>TONRPC: Initialize with Endpoint URL
    App->>TONRPC: Fetch Account State / Transactions / Config
    TONRPC->>TONNode: JSON-RPC Request (e.g., getAddressInformation)
    TONNode-->>TONRPC: JSON-RPC Response
    TONRPC-->>App: Parsed Data (Account, Tx, Config, etc.)
    App->>TONRPC: Send Transaction / Run Smart Contract Method
    TONRPC->>TONNode: JSON-RPC Request (e.g., sendMessage, runGetMethod)
    TONNode-->>TONRPC: JSON-RPC Response
    TONRPC-->>App: Result / Status
Loading

Possibly related PRs

  • zeta-chain/node#3075: Adds inbound tracker observation and concurrent withdrawal E2E tests for TON, directly related to the refactoring and extension of TON transaction observation and testing in this PR.

Suggested reviewers

  • swift1337
  • skosito
  • lumtis

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

!!!WARNING!!!
nosec detected in the following files: zetaclient/chains/ton/rpc/tlbstack.go, zetaclient/chains/ton/rpc/client.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Jun 5, 2025
@swift1337 swift1337 added chain:ton TON_TESTS Runs TON E2E tests labels Jun 5, 2025
@codecov
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

Attention: Patch coverage is 29.46429% with 237 lines in your changes missing coverage. Please review.

Project coverage is 64.35%. Comparing base (d17c8b3) to head (2c81997).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/ton/rpc/client.go 0.00% 64 Missing ⚠️
zetaclient/chains/ton/rpc/types.go 54.38% 47 Missing and 5 partials ⚠️
zetaclient/chains/ton/rpc/tlbstack.go 0.00% 43 Missing ⚠️
zetaclient/chains/ton/rpc/config.go 0.00% 39 Missing ⚠️
zetaclient/chains/ton/observer/inbound.go 45.00% 22 Missing ⚠️
zetaclient/chains/ton/observer/observer.go 20.00% 8 Missing ⚠️
zetaclient/orchestrator/bootstrap.go 55.55% 3 Missing and 1 partial ⚠️
zetaclient/chains/ton/observer/outbound.go 60.00% 2 Missing ⚠️
...aclient/orchestrator/preflight_metrics_reporter.go 0.00% 2 Missing ⚠️
zetaclient/chains/ton/signer/signer.go 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3958      +/-   ##
===========================================
+ Coverage    64.13%   64.35%   +0.21%     
===========================================
  Files          474      474              
  Lines        34863    34778      -85     
===========================================
+ Hits         22358    22380      +22     
+ Misses       11479    11373     -106     
+ Partials      1026     1025       -1     
Files with missing lines Coverage Δ
zetaclient/chains/ton/signer/signer_tracker.go 62.26% <100.00%> (ø)
zetaclient/config/config_chain.go 100.00% <100.00%> (ø)
zetaclient/config/types.go 47.56% <ø> (ø)
zetaclient/chains/ton/signer/signer.go 46.40% <80.00%> (+3.04%) ⬆️
zetaclient/chains/ton/observer/outbound.go 28.96% <60.00%> (ø)
...aclient/orchestrator/preflight_metrics_reporter.go 10.40% <0.00%> (+0.16%) ⬆️
zetaclient/orchestrator/bootstrap.go 61.16% <55.55%> (-3.04%) ⬇️
zetaclient/chains/ton/observer/observer.go 22.03% <20.00%> (+2.03%) ⬆️
zetaclient/chains/ton/observer/inbound.go 61.92% <45.00%> (-7.29%) ⬇️
zetaclient/chains/ton/rpc/config.go 0.00% <0.00%> (ø)
... and 3 more

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🔭 Outside diff range comments (1)
zetaclient/testutils/mocks/ton_rpc.go (1)

1-294: 💡 Verification agent

🧩 Analysis chain

Verify interface consistency across the codebase.

The comprehensive migration from lite client to RPC client appears well-executed. Ensure that all consumers of this mock have been updated to use the new TONRPC interface and method signatures.


🏁 Script executed:

#!/bin/bash
# Description: Verify that all references to the old TONLiteClient have been updated
# Expected: No remaining references to TONLiteClient or old method signatures

echo "Checking for any remaining TONLiteClient references:"
rg -i "tonliteclient" --type go

echo -e "\nChecking for old method signatures that might have been missed:"
rg "GetConfigParams|GetFirstTransaction" --type go

echo -e "\nVerifying new TONRPC usage in test files:"
rg "NewTONRPC|TONRPC" --type go -A 2

Length of output: 5486


Action Required: Update Remaining GetFirstTransaction References

A residual OnGetFirstTransaction stub in observer_test.go still targets the old GetFirstTransaction method, which no longer exists on TONRPC. Please update this to use the new RPC method signature (e.g. GetTransaction) and adjust the stub helper accordingly.

• File: zetaclient/chains/ton/observer/observer_test.go
– Replace calls to OnGetFirstTransaction(acc, tx, scanned, err)OnGetTransaction(acc, lt, hash, response, err) (or appropriate parameters for your new signature).
– Rename the helper from OnGetFirstTransactionOnGetTransaction (and update the mock expectation string from "GetFirstTransaction""GetTransaction").

Once updated, rerun mocks regeneration to ensure NewTONRPC and all method signatures align.

♻️ Duplicate comments (2)
zetaclient/chains/ton/rpc/tlbstack.go (1)

73-74: ⚠️ Potential issue

Address the integer conversion security issue.

The conversion from int64 to uint32 without bounds checking could cause unexpected behavior if exitCode is negative or exceeds uint32 range.

-	// #nosec G115 always in range
-	return uint32(exitCode), stack, nil
+	if exitCode < 0 || exitCode > math.MaxUint32 {
+		return 0, tlb.VmStack{}, errors.Errorf("exit code %d out of uint32 range", exitCode)
+	}
+	return uint32(exitCode), stack, nil

Don't forget to add the import:

+	"math"
zetaclient/chains/ton/rpc/client.go (1)

122-138: ⚠️ Potential issue

Add bounds check for seqno conversion.

The conversion from int64 to uint32 could overflow if the value exceeds uint32 max.

Add bounds check before conversion:

 case stack[0].SumType != "VmStkTinyInt":
     return 0, errors.Errorf("invalid seqno type: %s", stack[0].SumType)
 default:
-    // #nosec G115 always in range
-    return uint32(stack[0].VmStkTinyInt), nil
+    seqno := stack[0].VmStkTinyInt
+    if seqno < 0 || seqno > math.MaxUint32 {
+        return 0, errors.Errorf("seqno %d out of uint32 range", seqno)
+    }
+    return uint32(seqno), nil
 }
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 122-136: zetaclient/chains/ton/rpc/client.go#L122-L136
Added lines #L122 - L136 were not covered by tests

🧹 Nitpick comments (8)
e2e/e2etests/test_ton_withdrawal_concurrent.go (1)

64-66: Consider more robust state synchronization approach.

While the hardcoded sleep addresses RPC state lag, consider implementing a polling mechanism with timeout for more reliable test execution.

-// rpc might lag a bit from the real state, let's wait a bit
-time.Sleep(time.Second)
+// Wait for RPC state to sync with retries
+const maxRetries = 5
+var balance math.Uint
+for retry := 0; retry < maxRetries; retry++ {
+	balance, err = r.Clients.TON.GetBalanceOf(r.Ctx, recipient, false)
+	if err == nil && balance.Uint64() == amount.Uint64() {
+		break
+	}
+	if retry < maxRetries-1 {
+		time.Sleep(time.Second)
+	}
+}
contrib/localnet/scripts/wait-for-ton.sh (1)

4-4: Consider if reduced polling interval is appropriate.

The polling interval was reduced from 5 to 2 seconds, which may be more aggressive than necessary and could increase system load during startup.

zetaclient/chains/ton/rpc/config.go (1)

64-67: Consider adding validation for recursive depth.

While the recursive call is appropriate for handling nested structures, consider adding a depth limit to prevent potential stack overflow in case of malformed data.

-func ParseGasPrice(cfg tlb.GasLimitsPrices) (uint64, error) {
+func ParseGasPrice(cfg tlb.GasLimitsPrices) (uint64, error) {
+	return parseGasPriceWithDepth(cfg, 0)
+}
+
+func parseGasPriceWithDepth(cfg tlb.GasLimitsPrices, depth int) (uint64, error) {
+	const maxDepth = 10
+	if depth > maxDepth {
+		return 0, errors.New("exceeded maximum recursion depth")
+	}

And update line 67:

-		return ParseGasPrice(*cfg.GasFlatPfx.Other)
+		return parseGasPriceWithDepth(*cfg.GasFlatPfx.Other, depth+1)
zetaclient/orchestrator/bootstrap_test.go (1)

320-322: Consider documenting the placeholder mock functions.

While the empty implementations are appropriate for now, consider adding comments to indicate these are intentional placeholders for future implementation.

-// might be useful
-func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {}
-func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer)       {}
-func mockTONCalls(_ *testSuite, _ *testrpc.TONServer)       {}
+// mockSolanaCalls is a placeholder for future Solana-specific test setup
+func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {}
+
+// mockSuiCalls is a placeholder for future Sui-specific test setup
+func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer) {}
+
+// mockTONCalls is a placeholder for future TON-specific test setup
+func mockTONCalls(_ *testSuite, _ *testrpc.TONServer) {}
zetaclient/chains/ton/signer/signer.go (1)

177-177: Consider making duplicate detection more specific.

While the simplified check works, consider being more specific to avoid false positives with other errors containing "duplicate".

-		if strings.Contains(err.Error(), "duplicate") {
+		if strings.Contains(strings.ToLower(err.Error()), "duplicate message") ||
+		   strings.Contains(strings.ToLower(err.Error()), "already exists") {
zetaclient/testutils/testrpc/rpc.go (1)

92-116: Consider validating params type to prevent silent failures.

The current implementation silently ignores params if it's not an object or array (e.g., if params is a string or number). Consider explicitly validating the params type to provide clearer error messages.

 	// .params is optional
 	if !items[1].Exists() {
 		return req, nil
 	}
 
+	// Validate params is an object or array
+	if items[1].Type != gjson.JSON {
+		return rpcRequest{}, errors.New("params must be an object or array")
+	}
+
 	items[1].ForEach(func(key, value gjson.Result) bool {
 		req.Params[key.String()] = value.Value()
 
 		return true
 	})
zetaclient/chains/ton/observer/observer.go (1)

77-105: Consider adding error context and validation in PostGasPrice.

The method correctly uses the new RPC interface, but could benefit from additional validation and error context.

Consider adding gas price validation before posting:

 gasPrice, err := rpc.ParseGasPrice(cfg)
 if err != nil {
     return errors.Wrap(err, "failed to parse gas price")
 }
+
+// Validate gas price is within reasonable bounds
+const maxGasPrice = 1000000000 // 1 gwei in nanotons
+if gasPrice == 0 || gasPrice > maxGasPrice {
+    return errors.Errorf("gas price %d is out of bounds (0, %d]", gasPrice, maxGasPrice)
+}

Also consider adding more context to the masterchain info error:

 info, err := ob.rpc.GetMasterchainInfo(ctx)
 if err != nil {
-    return errors.Wrap(err, "failed to get masterchain info")
+    return errors.Wrapf(err, "failed to get masterchain info for gas price posting")
 }
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 77-77: zetaclient/chains/ton/observer/observer.go#L77
Added line #L77 was not covered by tests


[warning] 82-82: zetaclient/chains/ton/observer/observer.go#L82
Added line #L82 was not covered by tests


[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests

zetaclient/chains/ton/rpc/client.go (1)

324-348: Add validation for RunSmcMethod parameters.

The method implementation is solid, but could benefit from parameter validation.

Consider validating the method name:

 func (c *Client) RunSmcMethod(
     ctx context.Context,
     acc ton.AccountID,
     method string,
     stack tlb.VmStack,
 ) (uint32, tlb.VmStack, error) {
+    if method == "" {
+        return 0, tlb.VmStack{}, errors.New("method name cannot be empty")
+    }
+
     stackEncoded, err := marshalStack(stack)
     if err != nil {
         return 0, tlb.VmStack{}, errors.Wrapf(err, "unable to marshal stack")
     }
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2c403a and 7908b68.

📒 Files selected for processing (48)
  • changelog.md (1 hunks)
  • cmd/zetae2e/config/clients.go (1 hunks)
  • cmd/zetae2e/config/local.yml (1 hunks)
  • cmd/zetae2e/config/localnet.yml (1 hunks)
  • cmd/zetae2e/init.go (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • contrib/localnet/docker-compose.yml (1 hunks)
  • contrib/localnet/scripts/wait-for-ton.sh (1 hunks)
  • e2e/config/config.go (1 hunks)
  • e2e/e2etests/test_ton_deposit_restricted_address.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal_concurrent.go (2 hunks)
  • e2e/runner/ton.go (6 hunks)
  • e2e/runner/ton/accounts.go (1 hunks)
  • e2e/runner/ton/client.go (4 hunks)
  • e2e/runner/ton/deployer.go (1 hunks)
  • zetaclient/chains/ton/config/config.go (0 hunks)
  • zetaclient/chains/ton/config/config_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_live_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_test.go (0 hunks)
  • zetaclient/chains/ton/observer/inbound.go (11 hunks)
  • zetaclient/chains/ton/observer/inbound_test.go (12 hunks)
  • zetaclient/chains/ton/observer/observer.go (4 hunks)
  • zetaclient/chains/ton/observer/observer_test.go (9 hunks)
  • zetaclient/chains/ton/observer/outbound.go (4 hunks)
  • zetaclient/chains/ton/observer/outbound_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/client.go (3 hunks)
  • zetaclient/chains/ton/rpc/client_live_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/config.go (1 hunks)
  • zetaclient/chains/ton/rpc/tlbstack.go (1 hunks)
  • zetaclient/chains/ton/rpc/types.go (4 hunks)
  • zetaclient/chains/ton/rpc/types_test.go (1 hunks)
  • zetaclient/chains/ton/signer/signer.go (5 hunks)
  • zetaclient/chains/ton/signer/signer_test.go (9 hunks)
  • zetaclient/chains/ton/signer/signer_tracker.go (4 hunks)
  • zetaclient/config/config_chain.go (1 hunks)
  • zetaclient/config/types.go (1 hunks)
  • zetaclient/orchestrator/bootstrap.go (2 hunks)
  • zetaclient/orchestrator/bootstrap_test.go (3 hunks)
  • zetaclient/orchestrator/orchestrator_test.go (1 hunks)
  • zetaclient/orchestrator/preflight_metrics_reporter.go (2 hunks)
  • zetaclient/testutils/mocks/ton_gen.go (1 hunks)
  • zetaclient/testutils/mocks/ton_rpc.go (7 hunks)
  • zetaclient/testutils/testrpc/rpc.go (4 hunks)
  • zetaclient/testutils/testrpc/rpc_btc.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_evm.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_ton.go (1 hunks)
💤 Files with no reviewable changes (5)
  • zetaclient/chains/ton/config/config_test.go
  • zetaclient/chains/ton/liteapi/client_test.go
  • zetaclient/chains/ton/config/config.go
  • zetaclient/chains/ton/liteapi/client_live_test.go
  • zetaclient/chains/ton/liteapi/client.go
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • zetaclient/config/types.go
  • cmd/zetae2e/init.go
  • zetaclient/chains/ton/rpc/config.go
  • zetaclient/config/config_chain.go
  • zetaclient/orchestrator/orchestrator_test.go
  • e2e/runner/ton/accounts.go
  • e2e/runner/ton/deployer.go
  • e2e/e2etests/test_ton_withdrawal_concurrent.go
  • cmd/zetae2e/config/clients.go
  • e2e/e2etests/test_ton_deposit_restricted_address.go
  • zetaclient/testutils/testrpc/rpc_evm.go
  • zetaclient/orchestrator/preflight_metrics_reporter.go
  • zetaclient/testutils/testrpc/rpc_btc.go
  • e2e/config/config.go
  • e2e/runner/ton.go
  • zetaclient/testutils/testrpc/rpc_ton.go
  • zetaclient/chains/ton/rpc/types_test.go
  • zetaclient/chains/ton/observer/outbound_test.go
  • zetaclient/chains/ton/observer/observer_test.go
  • zetaclient/orchestrator/bootstrap.go
  • zetaclient/chains/ton/signer/signer.go
  • zetaclient/chains/ton/observer/inbound_test.go
  • zetaclient/chains/ton/signer/signer_tracker.go
  • zetaclient/orchestrator/bootstrap_test.go
  • zetaclient/chains/ton/rpc/client_live_test.go
  • zetaclient/testutils/testrpc/rpc.go
  • zetaclient/chains/ton/observer/outbound.go
  • zetaclient/chains/ton/rpc/tlbstack.go
  • zetaclient/chains/ton/observer/inbound.go
  • e2e/e2etests/test_ton_withdrawal.go
  • zetaclient/chains/ton/rpc/types.go
  • cmd/zetae2e/local/local.go
  • zetaclient/chains/ton/signer/signer_test.go
  • zetaclient/testutils/mocks/ton_gen.go
  • zetaclient/chains/ton/rpc/client.go
  • zetaclient/chains/ton/observer/observer.go
  • e2e/runner/ton/client.go
  • zetaclient/testutils/mocks/ton_rpc.go
`**/*.sh`: Review the shell scripts, point out issues relative to security, performance, and maintainability.

**/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

  • contrib/localnet/scripts/wait-for-ton.sh
🧠 Learnings (1)
zetaclient/chains/ton/signer/signer_test.go (1)
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The `GetUpdatedSigner` method in `zetaclient/orchestrator/orchestrator.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go` and `zetaclient/orchestrator/orchestrator_test.go`.
🧬 Code Graph Analysis (11)
cmd/zetae2e/init.go (1)
e2e/config/config.go (2)
  • RPCs (105-117)
  • TON (143-145)
zetaclient/orchestrator/orchestrator_test.go (1)
zetaclient/config/types.go (1)
  • TONConfig (64-67)
cmd/zetae2e/config/clients.go (2)
e2e/runner/ton/client.go (1)
  • NewClient (20-25)
e2e/config/config.go (2)
  • RPCs (105-117)
  • TON (143-145)
e2e/e2etests/test_ton_deposit_restricted_address.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
e2e/runner/ton.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
zetaclient/chains/ton/observer/outbound_test.go (2)
zetaclient/chains/ton/observer/observer.go (1)
  • New (50-73)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
zetaclient/chains/ton/observer/observer_test.go (3)
pkg/contracts/ton/gateway.go (1)
  • Gateway (25-27)
zetaclient/testutils/mocks/ton_rpc.go (2)
  • TONRPC (20-22)
  • NewTONRPC (284-294)
zetaclient/chains/ton/rpc/types.go (3)
  • TransactionHashToString (206-208)
  • BlockHeader (31-35)
  • TransactionToHashString (201-203)
zetaclient/chains/ton/signer/signer_tracker.go (1)
zetaclient/chains/ton/rpc/types.go (2)
  • Account (36-46)
  • TransactionToHashString (201-203)
e2e/e2etests/test_ton_withdrawal.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionHashFromString (211-229)
cmd/zetae2e/local/local.go (1)
testutil/sample/observer.go (1)
  • Keygen (63-72)
e2e/runner/ton/client.go (2)
zetaclient/chains/ton/rpc/client.go (2)
  • Client (27-31)
  • New (45-68)
zetaclient/config/config_chain.go (1)
  • New (15-32)
🪛 GitHub Check: codecov/patch
zetaclient/chains/ton/observer/outbound.go

[warning] 221-221: zetaclient/chains/ton/observer/outbound.go#L221
Added line #L221 was not covered by tests

zetaclient/chains/ton/observer/inbound.go

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests


[warning] 339-346: zetaclient/chains/ton/observer/inbound.go#L339-L346
Added lines #L339 - L346 were not covered by tests


[warning] 349-349: zetaclient/chains/ton/observer/inbound.go#L349
Added line #L349 was not covered by tests


[warning] 351-354: zetaclient/chains/ton/observer/inbound.go#L351-L354
Added lines #L351 - L354 were not covered by tests


[warning] 394-401: zetaclient/chains/ton/observer/inbound.go#L394-L401
Added lines #L394 - L401 were not covered by tests

zetaclient/chains/ton/rpc/client.go

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


[warning] 122-136: zetaclient/chains/ton/rpc/client.go#L122-L136
Added lines #L122 - L136 were not covered by tests


[warning] 255-258: zetaclient/chains/ton/rpc/client.go#L255-L258
Added lines #L255 - L258 were not covered by tests


[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests


[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

zetaclient/chains/ton/observer/observer.go

[warning] 54-55: zetaclient/chains/ton/observer/observer.go#L54-L55
Added lines #L54 - L55 were not covered by tests


[warning] 77-77: zetaclient/chains/ton/observer/observer.go#L77
Added line #L77 was not covered by tests


[warning] 82-82: zetaclient/chains/ton/observer/observer.go#L82
Added line #L82 was not covered by tests


[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests


[warning] 109-109: zetaclient/chains/ton/observer/observer.go#L109
Added line #L109 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: start-ton-test / e2e
  • GitHub Check: start-e2e-test / e2e
  • GitHub Check: analyze (go)
🔇 Additional comments (96)
changelog.md (1)

8-8: LGTM: Changelog entry follows established format.

The changelog entry accurately documents the TON HTTP-RPC integration feature and follows the existing format conventions.

e2e/config/config.go (1)

216-216: LGTM: TON endpoint migration is correctly implemented.

The endpoint change from lite-client JSON URL to HTTP RPC endpoint aligns with the migration strategy described in the PR objectives.

cmd/zetae2e/init.go (1)

34-34: LGTM: Flag default maintains consistency with configuration changes.

The updated default value for the tonURL flag correctly aligns with the endpoint migration in the configuration files.

e2e/e2etests/test_ton_deposit_restricted_address.go (2)

12-12: LGTM: Import path correctly updated for RPC migration.

The import change from liteapi to rpc package aligns with the broader TON client migration strategy.


45-45: LGTM: Function call correctly updated to use RPC package.

The function call update maintains the same API signature while using the new RPC-based implementation.

e2e/runner/ton/accounts.go (1)

59-59: LGTM: Adapter pattern correctly implemented for tongo compatibility.

The change to use client.tongoAdapter() maintains compatibility with the tongo wallet library while using the new RPC-based client implementation.

cmd/zetae2e/config/local.yml (1)

120-121:

Details

✅ Verification successful

LGTM! Configuration migration from lite-client to RPC endpoint.

The endpoint update correctly reflects the migration to TON Center v2 RPC. Ensure this endpoint configuration is consistent across all related configuration files and environments.


🏁 Script executed:

#!/bin/bash
# Description: Verify TON endpoint consistency across configuration files

# Search for TON endpoint configurations to ensure consistency
rg -A 2 -B 2 "ton.*8081|8111.*ton" --type yaml
rg -A 2 -B 2 "ton.*center|lite.*client" --type yaml

Length of output: 1655


RPC endpoint consistency confirmed
I’ve verified that both cmd/zetae2e/config/local.yml and cmd/zetae2e/config/localnet.yml now point to http://ton:8081, and the Docker Compose mapping exposes port 8081 for the TON Center v2 RPC. No discrepancies found—this change can be merged as is.

e2e/runner/ton/deployer.go (1)

40-40:

Details

❓ Verification inconclusive

Adapter pattern integration looks correct.

The use of client.tongoAdapter() properly bridges the new RPC client with the existing wallet interface. This maintains backward compatibility while enabling the RPC migration.


🏁 Script executed:

#!/bin/bash
# Description: Verify the tongoAdapter implementation and interface compliance

# Find the tongoAdapter implementation
ast-grep --pattern 'func ($client *Client) tongoAdapter() $_ {
  $$$
}'

# Check for GetAccountState method implementation in adapter
rg -A 10 "GetAccountState.*ShardAccount" --type go

Length of output: 587


Adapter integration looks solid—please confirm full interface compliance

  • Verify that tongoAdapter implements all methods expected by wallet.New, not just GetAccountState (e.g., send-message, subscribe, etc.).
  • Add a compile-time assertion in e2e/runner/ton/client.go to ensure tongoAdapter satisfies the wallet constructor’s interface. For example:
    // replace WalletProvider with the actual interface name used by wallet.New
    var _ wallet.WalletProvider = (*tongoAdapter)(nil)
  • Add unit tests covering each adapter method to validate correct data conversion and error handling.
e2e/e2etests/test_ton_withdrawal.go (2)

13-13: Import path updated correctly for RPC migration.

The import change from liteapi to rpc package aligns with the codebase migration strategy.


79-79: Function call properly migrated to RPC package.

The rpc.TransactionHashFromString function maintains the same signature and functionality as the previous liteapi version, ensuring test behavior consistency.

zetaclient/orchestrator/orchestrator_test.go (1)

282-282: Configuration field correctly updated for RPC migration.

The change from LiteClientConfigURL to Endpoint aligns with the updated TONConfig struct definition and maintains consistency with other chain configuration patterns in the test suite.

cmd/zetae2e/config/localnet.yml (1)

116-117: Configuration update aligns with RPC migration.

The endpoint change from lite-client JSON configuration to the TON Center v2 RPC endpoint is correctly implemented. The port change from 8000 to 8081 and updated comment are consistent with the migration strategy.

zetaclient/config/config_chain.go (1)

61-61: Endpoint configuration correctly updated for RPC migration.

The endpoint change from lite-client configuration URL to the RPC endpoint is properly implemented and consistent with the corresponding configuration file changes.

e2e/e2etests/test_ton_withdrawal_concurrent.go (2)

6-6: Import addition supports test timing adjustment.

The time import is correctly added to support the sleep functionality introduced for RPC state synchronization.


70-70: Enhanced error reporting improves debugging capability.

The addition of recipient's raw address to the assertion message provides better context for debugging failed balance checks.

zetaclient/orchestrator/preflight_metrics_reporter.go (3)

16-16: Import correctly updated for RPC client migration.

The import change from liteapi to tonrpc properly reflects the transition to the new RPC-based client architecture.


162-162: Client instantiation correctly migrated to RPC implementation.

The client creation is properly updated to use the new RPC client constructor with endpoint and chain ID parameters, replacing the previous lite-client configuration approach.


164-168: Health check implementation maintains consistent interface.

The health check call and error handling remain unchanged, indicating good interface compatibility between the old and new client implementations.

cmd/zetae2e/local/local.go (1)

748-750: Logical improvement for successful keygen handling.

The explicit case for KeygenStatus_KeyGenSuccess correctly returns early when keygen is already complete, avoiding unnecessary waiting. This is a clean and efficient approach.

zetaclient/testutils/testrpc/rpc_evm.go (1)

22-22: Parameter type standardization enhances consistency.

The transition from []any to map[string]any for callback parameters aligns with standard JSON-RPC parameter handling patterns and improves consistency across the test RPC infrastructure.

Also applies to: 28-28, 34-34, 40-40, 46-46

zetaclient/config/types.go (1)

65-66: Configuration field correctly reflects architectural change.

The transition from LiteClientConfigURL to Endpoint clearly represents the migration from lite-client to RPC-based TON integration. The updated field documentation and masking are appropriate for endpoint configuration.

cmd/zetae2e/config/clients.go (1)

45-45: Client instantiation simplified effectively.

The direct use of tonrunner.NewClient(conf.RPCs.TON) eliminates unnecessary complexity while maintaining the required functionality. This simplification aligns well with the migration to RPC-based TON client architecture.

zetaclient/testutils/testrpc/rpc_btc.go (1)

38-40: LGTM: Parameter type standardization aligns with JSON-RPC 2.0 specification.

The transition from []any to map[string]any for RPC method handler parameters is consistent with the broader refactor and better aligns with JSON-RPC 2.0 specification that supports both positional and named parameters.

Also applies to: 46-48

zetaclient/chains/ton/observer/outbound_test.go (3)

14-14: LGTM: Import correctly updated for RPC migration.

The import change from liteapi to rpc package aligns with the broader refactor to transition TON integration from lite-client to HTTP RPC interface.


27-27: LGTM: Observer instantiation updated for RPC client.

The change from ts.liteClient to ts.rpc is consistent with the migration to the new RPC-based client interface.


50-50: LGTM: Function call updated for RPC package.

The transition from liteapi.TransactionToHashString to rpc.TransactionToHashString maintains the same functionality while using the new RPC client interface.

zetaclient/chains/ton/observer/outbound.go (3)

15-15: LGTM: Import updated for RPC migration.

The import change from liteapi to rpc package is consistent with the broader refactor to transition TON integration to HTTP RPC interface.


107-107: LGTM: Function call updated for RPC package.

The transition from liteapi.TransactionHashFromString to rpc.TransactionHashFromString maintains equivalent functionality with the new RPC client interface.


112-112: LGTM: Client method call updated for RPC interface.

The change from ob.client.GetTransaction to ob.rpc.GetTransaction correctly reflects the migration to the new RPC-based client interface.

contrib/localnet/docker-compose.yml (2)

270-270: LGTM: Docker image updated for RPC support.

The image version update from a69ea0f to 1040871 aligns with the migration to toncenter v2 RPC API.


278-278: LGTM: Port configuration updated for RPC endpoint.

The port mapping change from 4443:4443 (lite client) to 8081:8081 (toncenter v2 RPC) correctly reflects the migration to the HTTP RPC interface.

zetaclient/testutils/testrpc/rpc_ton.go (1)

9-21: Well-structured test server implementation.

The TONServer struct properly embeds the generic Server and provides appropriate configuration. The constructor follows established patterns for test utilities.

e2e/runner/ton.go (3)

20-20: Import migration from liteapi to rpc is correct.

The import change aligns with the broader migration from lite-client to RPC client architecture.


73-74: Field name updates improve consistency.

The changes from LastTransHash/LastTransLt to LastTxHash/LastTxLT follow better naming conventions and align with the new RPC client structure.

Also applies to: 167-168


121-121: Transaction hash conversion correctly updated.

All usages of TransactionToHashString have been properly migrated to use the rpc package implementation, maintaining consistency across the codebase.

Also applies to: 203-203, 289-289

contrib/localnet/scripts/wait-for-ton.sh (1)

9-11: JSON-RPC implementation correctly follows protocol.

The request structure properly implements JSON-RPC 2.0 specification with appropriate headers and method call.

zetaclient/chains/ton/rpc/types_test.go (2)

12-99: Excellent test coverage with proper table-driven structure.

The test comprehensively covers different account states and properly validates JSON unmarshaling behavior. The table-driven approach makes it easy to add new test cases and maintain clarity.


45-52: Thorough validation of account state fields.

The assertions properly verify critical fields including account status, transaction details, balance, and code/data presence. The use of both direct field checks and derived method validation adds robustness.

Also applies to: 80-83

zetaclient/chains/ton/observer/observer_test.go (5)

21-21: LGTM: Clean import migration from liteapi to rpc.

The import change correctly reflects the architectural shift to the RPC client.


36-37: LGTM: Consistent struct field updates.

The testSuite struct properly reflects the new RPC client architecture while maintaining clear field naming.


66-66: LGTM: Proper mock instantiation.

The mock creation correctly uses the new TONRPC mock type.


126-126: LGTM: Correct transaction hash utility usage.

The migration to rpc.TransactionHashToString maintains the same functionality with the new package structure.


171-181: LGTM: Well-implemented MockGetBlockHeader refactor.

The method correctly handles the type conversion and creates the appropriate rpc.BlockHeader struct. The casting via castBlockID and the field mapping are properly implemented.

zetaclient/chains/ton/observer/inbound_test.go (4)

14-14: LGTM: Consistent import migration.

The import update properly aligns with the RPC client refactor.


22-31: LGTM: Consistent observer instantiation updates.

All test cases correctly use the new RPC client mock for observer creation, maintaining test coverage.

Also applies to: 67-67, 123-123


56-56: LGTM: Proper transaction hash utility migration.

The consistent use of rpc.TransactionHashFromString and rpc.TransactionHashToString maintains functionality while using the new package structure.

Also applies to: 113-113, 173-173


115-115: LGTM: Simplified block height handling.

The change to expect block height 0 reflects the simplified block header handling in the new RPC client implementation, which is consistent with the architectural changes.

Also applies to: 175-175

zetaclient/chains/ton/signer/signer_tracker.go (4)

12-12: LGTM: Proper import migration.

The import change correctly reflects the shift to the RPC client package.


27-27: LGTM: Correct type signature update.

The parameter type change to rpc.Account properly aligns with the new RPC client interface.


42-43: LGTM: Accurate field access updates.

The field name changes from LastTransLt/LastTransHash to LastTxLT/LastTxHash correctly match the new rpc.Account struct definition as shown in the relevant code snippets.


50-50: LGTM: Consistent RPC client method usage.

The method calls properly use the new RPC client interface while maintaining the same functionality.

Also applies to: 62-62

zetaclient/orchestrator/bootstrap.go (5)

33-33: LGTM: Appropriate import updates.

The import changes correctly bring in the new RPC client package and metrics for instrumentation.

Also applies to: 38-38


252-254: LGTM: Essential URL validation.

The endpoint validation prevents runtime errors and provides clear feedback for configuration issues.


256-259: LGTM: Professional HTTP client instrumentation.

The instrumented HTTP client creation enables proper monitoring and observability for RPC calls.


261-261: LGTM: Clean RPC client instantiation.

The RPC client creation with endpoint, chain ID, and HTTP client follows a clean and extensible pattern.


268-268: LGTM: Consistent component initialization.

The observer and signer creation properly uses the new RPC client interface while maintaining the same architectural patterns.

Also applies to: 273-273

zetaclient/chains/ton/rpc/client_live_test.go (5)

55-57: Good addition of comprehensive account state validation.

The added assertions for Code and Data fields and the conversion to ShardAccount provide thorough validation of the account state.

Also applies to: 63-64


74-74: Correct status expectation for uninitialized accounts.

The change from tlb.AccountNone to tlb.AccountUninit properly reflects the expected state for non-existing accounts in TON.

Also applies to: 81-82


86-92: Well-structured test for sequence number retrieval.

The test properly validates that the gateway account has a non-zero sequence number.


94-101: Appropriate integration test for smart contract method execution.

The test correctly instantiates a gateway contract and verifies transaction fee retrieval.


105-105: Clean migration to new gas configuration API.

The refactoring to use FetchGasConfigRPC and ParseGasPrice functions provides better separation of concerns.

Also applies to: 109-109

zetaclient/chains/ton/rpc/config.go (3)

11-13: Well-defined interface for configuration retrieval.

The ConfigGetter interface provides a clean abstraction for fetching blockchain configuration parameters.


15-31: Robust implementation of gas configuration fetching.

The function properly handles errors and includes helpful documentation references.


59-62: Correct gas price conversion with bit-shifting.

The right shift by 16 bits properly converts from nano tons per 65536 gas units to tons per gas unit, as documented in the TON specification.

zetaclient/orchestrator/bootstrap_test.go (2)

200-201: Clean migration to RPC test server.

The transition from lite-client mocks to testrpc.TONServer simplifies the test setup and aligns with the new RPC architecture.

Also applies to: 206-206, 214-214


297-297: Consistent configuration field update.

The change from LiteClientConfigURL to Endpoint properly reflects the new RPC-based configuration structure.

zetaclient/chains/ton/signer/signer.go (3)

18-22: Well-structured RPC interface definition.

The interface clearly defines the required methods for TON blockchain interaction with appropriate return types.


47-47: Clean constructor update for RPC integration.

The constructor properly accepts and assigns the RPC client instance.

Also applies to: 50-50


127-127: Proper usage of the new RPC interface methods.

The calls to GetAccountState and SendExternalMessage correctly utilize the new RPC interface.

Also applies to: 137-137

e2e/runner/ton/client.go (1)

117-135: Well-designed adapter pattern for tongo compatibility.

The adapter implementation cleanly bridges the gap between the RPC client and tongo library expectations. The comments clearly explain the rationale, making the code maintainable.

zetaclient/chains/ton/rpc/tlbstack.go (1)

22-40: Clean implementation of stack marshaling.

The function correctly handles both integer types with appropriate formatting (decimal for TinyInt, hex for Int). Good use of big.Int for large integer support.

zetaclient/chains/ton/observer/inbound.go (6)

16-16: Import migration looks correct.

The transition from liteapi to rpc package aligns with the PR's objective to integrate TON HTTP-RPC.


37-40: Method refactoring improves clarity.

The renamed method ensureLastScannedTx with explicit return values (lt, hashBits) enhances readability and testability. The error wrapping is also more descriptive.

Note that line 39 lacks test coverage according to static analysis.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests


42-42: RPC client usage is correct.

The migration to ob.rpc.GetTransactionsSince properly utilizes the new RPC client interface.


77-79: Consistent transaction hash conversion throughout.

The uniform usage of rpc.TransactionToHashString across all transaction hash conversions ensures consistency in transaction identification.

Also applies to: 272-272, 315-315, 358-358, 386-386


208-211: Appropriate handling of TON's sharded architecture.

The hardcoded seqno = 0 correctly acknowledges TON's sharded blockchain architecture where transactions across different shards cannot be sequentially numbered. The explanatory comment provides valuable context.


331-355: Robust initialization logic for transaction scanning.

The refactored method properly handles the case where no previous transaction has been scanned by fetching recent transactions and using the oldest as a starting point. This prevents missing transactions during initialization.

Critical functionality lacks test coverage (lines 339-354). Consider adding unit tests to verify:

  • Successful retrieval of transactions when no last scanned tx exists
  • Error handling when RPC calls fail
  • Edge case when no transactions are found
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 339-346: zetaclient/chains/ton/observer/inbound.go#L339-L346
Added lines #L339 - L346 were not covered by tests


[warning] 349-349: zetaclient/chains/ton/observer/inbound.go#L349
Added line #L349 was not covered by tests


[warning] 351-354: zetaclient/chains/ton/observer/inbound.go#L351-L354
Added lines #L351 - L354 were not covered by tests

zetaclient/chains/ton/signer/signer_test.go (2)

22-22: Test migration to RPC client is correct.

The import update and signer initialization properly use the new RPC client interface.

Also applies to: 33-33


68-68: Comprehensive test suite migration completed successfully.

All mock setups, type assertions, and method calls have been properly updated to use the new RPC interface while maintaining test integrity:

  • Account state mocking uses rpc.Account
  • Transaction hash comparison uses rpc.TransactionToHashString
  • Test suite structure properly references TONRPC mock
  • Mock setup methods correctly handle new signatures

Also applies to: 85-85, 95-95, 118-118, 136-136, 153-171

zetaclient/testutils/mocks/ton_gen.go (2)

7-15: Interface migration properly defined.

The interface rename to tonRPC and updated imports correctly establish the new mock generation contract.


16-38: Method signatures correctly reflect RPC client interface.

All method signatures have been properly updated to use RPC types:

  • GetAccountState returns rpc.Account
  • GetBlockHeader returns rpc.BlockHeader
  • New GetConfigParam method added for configuration retrieval
  • GetTransactions signature enhanced with count parameter
  • Type assertion ensures interface compatibility with rpc.Client
zetaclient/chains/ton/observer/observer.go (1)

33-47: Well-structured RPC interface definition.

The interface properly abstracts the RPC operations with clear method signatures. The separation of concerns between different RPC operations is appropriate.

zetaclient/chains/ton/rpc/client.go (3)

115-120: Initialize Account with ID for better data consistency.

Good practice to initialize the Account struct with the provided ID before the RPC call.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


249-304: Excellent refactoring of GetTransactionsSince with clear documentation.

The pagination logic is now well-documented with clear examples. The explicit reversal at the end makes the ordering behavior transparent.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 255-258: zetaclient/chains/ton/rpc/client.go#L255-L258
Added lines #L255 - L258 were not covered by tests


[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


306-322: Clean simplification of SendMessage method.

The error handling with switch statement is more readable than the previous implementation.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests

zetaclient/chains/ton/rpc/types.go (3)

36-46: Well-structured Account enhancements.

The addition of Code and Data fields as optional cells properly represents the on-chain account state.


48-107: Robust JSON unmarshaling with comprehensive error handling.

The implementation properly handles all account states and includes appropriate error wrapping for debugging.


255-264: Elegant helper function for optional cell wrapping.

The implementation correctly handles nil cells and creates proper TLB Maybe types.

zetaclient/testutils/mocks/ton_rpc.go (8)

8-17: Import migration aligns with RPC architecture transition.

The import changes properly reflect the shift from lite client to RPC client architecture. The addition of boc, internal rpc package, and time package indicates comprehensive interface updates.


19-22: Type rename successfully reflects architectural change.

The mock type has been properly renamed from TONLiteClient to TONRPC, maintaining consistency with the new RPC-based architecture.


24-50: GetAccountState method properly migrated to RPC types.

The method signature correctly uses rpc.Account return type and maintains proper mock implementation patterns. All type assertions and function signatures are appropriately updated.


52-78: GetBlockHeader method correctly implements RPC interface.

The method properly uses rpc.BlockIDExt parameter and rpc.BlockHeader return type, demonstrating consistent migration to the new RPC architecture.


80-108: GetConfigParam method introduces clean single-parameter interface.

The method replacement from GetConfigParams to GetConfigParam with *boc.Cell return type suggests a more focused API design, which is a positive architectural change.


166-194: GetTransactions method adds beneficial count parameter.

The new method signature with explicit count parameter provides better control over transaction retrieval, enhancing the API's flexibility and performance characteristics.


196-224: Parameter naming improvements enhance code readability.

The updated parameter names (oldestLT, oldestHash) are more descriptive than their predecessors, improving code maintainability and developer experience.


282-294: Constructor function correctly renamed for consistency.

The NewTONRPC constructor maintains proper testing interface registration and cleanup patterns while reflecting the architectural migration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

♻️ Duplicate comments (1)
zetaclient/chains/ton/rpc/tlbstack.go (1)

73-74: ⚠️ Potential issue

Add bounds checking for exit code conversion.

The conversion from int64 to uint32 can cause data loss if the exit code exceeds uint32 range. The comment claims it's "always in range" but this isn't validated.

+	if exitCode < 0 || exitCode > math.MaxUint32 {
+		return 0, tlb.VmStack{}, errors.Errorf("exit code %d out of uint32 range", exitCode)
+	}
+	
 	// #nosec G115 always in range
 	return uint32(exitCode), stack, nil
🧰 Tools
🪛 GitHub Check: CodeQL

[failure] 74-74: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

🧹 Nitpick comments (11)
changelog.md (1)

7-9: Enhance changelog entry for PR #3958
The entry notes TON HTTP-RPC integration. Consider also mentioning the fixed e2e tests and the closure of issue #3928 to provide full context in the changelog.

zetaclient/testutils/testrpc/rpc_ton.go (1)

15-15: Fix incorrect function comment.

The comment refers to "SuiServer" instead of "TONServer".

-// NewSuiServer creates a new SuiServer.
+// NewTONServer creates a new TONServer.
zetaclient/orchestrator/bootstrap_test.go (1)

319-322: Consider implementing or documenting the mock functions.

The empty mock functions have a vague comment "might be useful". Either implement these functions with appropriate mock behavior or provide clearer documentation about when and how they should be implemented.

Consider updating the comment to be more specific:

-// might be useful
+// TODO: Implement mock behavior when needed for specific test scenarios
 func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {}
 func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer)       {}
 func mockTONCalls(_ *testSuite, _ *testrpc.TONServer)       {}
zetaclient/chains/ton/signer/signer.go (1)

173-181: Consider more robust error handling.

The string-based error checking with strings.Contains(err.Error(), "duplicate") is fragile and may break if error messages change. Consider implementing typed errors or error codes from the RPC client for more reliable error handling.

zetaclient/chains/ton/observer/observer.go (1)

87-92: Error message could be more specific.

The error wrap at line 89 uses a generic message. Consider specifying that it's the masterchain info retrieval that failed, consistent with the method name.

-		return errors.Wrap(err, "failed to get masterchain info")
+		return errors.Wrap(err, "failed to get masterchain info for gas price posting")
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests

zetaclient/testutils/testrpc/rpc.go (1)

109-113: Consider documenting the array-to-map conversion behavior.

When array parameters are converted to a map, indices become string keys. This behavior should be documented for test writers.

Add a comment above the ForEach loop:

+	// Convert array elements to map with string indices: [1,2,3] -> {"0":1, "1":2, "2":3}
 	items[1].ForEach(func(key, value gjson.Result) bool {
zetaclient/chains/ton/rpc/tlbstack.go (1)

77-81: Consider using strconv.ParseUint for hex parsing.

Since the function is used to parse values that will be converted to unsigned types (like exit codes), using ParseUint with appropriate bit size would be more semantically correct.

-func hexToInt(s string) (int64, error) {
+func hexToUint(s string, bitSize int) (uint64, error) {
 	s = strings.TrimPrefix(s, "0x")
 
-	return strconv.ParseInt(s, 16, 64)
+	return strconv.ParseUint(s, 16, bitSize)
 }
zetaclient/chains/ton/observer/inbound.go (1)

37-40: Method rename looks good, but error wrapping needs improvement.

The rename from ensureLastScannedTX to ensureLastScannedTx improves consistency. However, the error message should be more specific about what failed.

Consider this improvement:

-		return errors.Wrapf(err, "unable to get last scanned tx")
+		return errors.Wrap(err, "unable to ensure last scanned transaction")
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests

zetaclient/chains/ton/rpc/client.go (1)

324-348: RunSmcMethod provides essential smart contract interaction capability.

The new method enables arbitrary smart contract method execution, which is crucial for the RPC client functionality. The error handling for stack marshaling and method execution is comprehensive.

Consider adding a comment explaining the purpose of this method:

+// RunSmcMethod executes a get-method on a smart contract and returns the exit code and result stack.
+// This is used for reading contract state without modifying it.
 func (c *Client) RunSmcMethod(
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

zetaclient/chains/ton/rpc/types.go (2)

87-96: Enhance account status parsing for clarity and robustness.

The current status determination relies on string contains check and could be more explicit. Consider a more structured approach to handle all possible states.

 switch {
 case frozenHash != "":
     acc.Status = tlb.AccountFrozen
-case strings.Contains(state, "uninit"):
+case state == "uninit" || state == "uninitialized":
     acc.Status = tlb.AccountUninit
 case state == "active":
     acc.Status = tlb.AccountActive
+case state == "frozen":
+    acc.Status = tlb.AccountFrozen
 default:
-    return errors.New("unable to parse account status")
+    return errors.Errorf("unknown account status: %q", state)
 }

199-229: Consider adding format validation and constants for transaction hash encoding.

While the implementation is functional, consider these improvements for robustness:

  1. Define a constant for the separator
  2. Add validation for hex string format
  3. Document the encoding format choice
+const transactionHashSeparator = ":"
+
 // TransactionToHashString converts transaction's logicalTime and hash to string
-// This string is used to store the last scanned hash (e.g. "123:0x123...")
+// Format: "<logical_time>:<hex_hash>" (e.g. "123:0xabc123...")
 func TransactionToHashString(tx ton.Transaction) string {
     return TransactionHashToString(tx.Lt, ton.Bits256(tx.Hash()))
 }

 // TransactionHashToString converts logicalTime and hash to string
 func TransactionHashToString(lt uint64, hash ton.Bits256) string {
-    return fmt.Sprintf("%d:%s", lt, hash.Hex())
+    return fmt.Sprintf("%d%s%s", lt, transactionHashSeparator, hash.Hex())
 }

 // TransactionHashFromString parses encoded string into logicalTime and hash
 func TransactionHashFromString(encoded string) (uint64, ton.Bits256, error) {
-    parts := strings.Split(encoded, ":")
+    if encoded == "" {
+        return 0, ton.Bits256{}, fmt.Errorf("empty encoded string")
+    }
+    
+    parts := strings.Split(encoded, transactionHashSeparator)
     if len(parts) != 2 {
         return 0, ton.Bits256{}, fmt.Errorf("invalid encoded string format")
     }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2c403a and 7908b68.

📒 Files selected for processing (48)
  • changelog.md (1 hunks)
  • cmd/zetae2e/config/clients.go (1 hunks)
  • cmd/zetae2e/config/local.yml (1 hunks)
  • cmd/zetae2e/config/localnet.yml (1 hunks)
  • cmd/zetae2e/init.go (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • contrib/localnet/docker-compose.yml (1 hunks)
  • contrib/localnet/scripts/wait-for-ton.sh (1 hunks)
  • e2e/config/config.go (1 hunks)
  • e2e/e2etests/test_ton_deposit_restricted_address.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal_concurrent.go (2 hunks)
  • e2e/runner/ton.go (6 hunks)
  • e2e/runner/ton/accounts.go (1 hunks)
  • e2e/runner/ton/client.go (4 hunks)
  • e2e/runner/ton/deployer.go (1 hunks)
  • zetaclient/chains/ton/config/config.go (0 hunks)
  • zetaclient/chains/ton/config/config_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_live_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_test.go (0 hunks)
  • zetaclient/chains/ton/observer/inbound.go (11 hunks)
  • zetaclient/chains/ton/observer/inbound_test.go (12 hunks)
  • zetaclient/chains/ton/observer/observer.go (4 hunks)
  • zetaclient/chains/ton/observer/observer_test.go (9 hunks)
  • zetaclient/chains/ton/observer/outbound.go (4 hunks)
  • zetaclient/chains/ton/observer/outbound_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/client.go (3 hunks)
  • zetaclient/chains/ton/rpc/client_live_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/config.go (1 hunks)
  • zetaclient/chains/ton/rpc/tlbstack.go (1 hunks)
  • zetaclient/chains/ton/rpc/types.go (4 hunks)
  • zetaclient/chains/ton/rpc/types_test.go (1 hunks)
  • zetaclient/chains/ton/signer/signer.go (5 hunks)
  • zetaclient/chains/ton/signer/signer_test.go (9 hunks)
  • zetaclient/chains/ton/signer/signer_tracker.go (4 hunks)
  • zetaclient/config/config_chain.go (1 hunks)
  • zetaclient/config/types.go (1 hunks)
  • zetaclient/orchestrator/bootstrap.go (2 hunks)
  • zetaclient/orchestrator/bootstrap_test.go (3 hunks)
  • zetaclient/orchestrator/orchestrator_test.go (1 hunks)
  • zetaclient/orchestrator/preflight_metrics_reporter.go (2 hunks)
  • zetaclient/testutils/mocks/ton_gen.go (1 hunks)
  • zetaclient/testutils/mocks/ton_rpc.go (7 hunks)
  • zetaclient/testutils/testrpc/rpc.go (4 hunks)
  • zetaclient/testutils/testrpc/rpc_btc.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_evm.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_ton.go (1 hunks)
💤 Files with no reviewable changes (5)
  • zetaclient/chains/ton/config/config_test.go
  • zetaclient/chains/ton/liteapi/client_test.go
  • zetaclient/chains/ton/liteapi/client_live_test.go
  • zetaclient/chains/ton/config/config.go
  • zetaclient/chains/ton/liteapi/client.go
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • e2e/config/config.go
  • e2e/e2etests/test_ton_withdrawal.go
  • cmd/zetae2e/init.go
  • e2e/e2etests/test_ton_deposit_restricted_address.go
  • zetaclient/config/config_chain.go
  • zetaclient/orchestrator/orchestrator_test.go
  • e2e/runner/ton/deployer.go
  • e2e/e2etests/test_ton_withdrawal_concurrent.go
  • zetaclient/orchestrator/preflight_metrics_reporter.go
  • zetaclient/testutils/testrpc/rpc_btc.go
  • zetaclient/chains/ton/observer/outbound_test.go
  • e2e/runner/ton/accounts.go
  • zetaclient/testutils/testrpc/rpc_evm.go
  • cmd/zetae2e/config/clients.go
  • cmd/zetae2e/local/local.go
  • zetaclient/config/types.go
  • e2e/runner/ton.go
  • zetaclient/chains/ton/signer/signer_tracker.go
  • zetaclient/chains/ton/observer/outbound.go
  • zetaclient/testutils/testrpc/rpc_ton.go
  • zetaclient/chains/ton/rpc/types_test.go
  • zetaclient/orchestrator/bootstrap_test.go
  • zetaclient/orchestrator/bootstrap.go
  • zetaclient/chains/ton/signer/signer.go
  • zetaclient/chains/ton/observer/inbound_test.go
  • zetaclient/chains/ton/rpc/client_live_test.go
  • e2e/runner/ton/client.go
  • zetaclient/testutils/testrpc/rpc.go
  • zetaclient/chains/ton/rpc/config.go
  • zetaclient/chains/ton/observer/observer.go
  • zetaclient/chains/ton/rpc/tlbstack.go
  • zetaclient/chains/ton/observer/observer_test.go
  • zetaclient/testutils/mocks/ton_gen.go
  • zetaclient/chains/ton/observer/inbound.go
  • zetaclient/chains/ton/rpc/client.go
  • zetaclient/chains/ton/rpc/types.go
  • zetaclient/testutils/mocks/ton_rpc.go
  • zetaclient/chains/ton/signer/signer_test.go
`**/*.sh`: Review the shell scripts, point out issues relative to security, performance, and maintainability.

**/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

  • contrib/localnet/scripts/wait-for-ton.sh
🧬 Code Graph Analysis (11)
e2e/e2etests/test_ton_withdrawal.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionHashFromString (211-229)
cmd/zetae2e/init.go (1)
e2e/config/config.go (2)
  • RPCs (105-117)
  • TON (143-145)
e2e/e2etests/test_ton_deposit_restricted_address.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
zetaclient/orchestrator/orchestrator_test.go (1)
zetaclient/config/types.go (1)
  • TONConfig (64-67)
zetaclient/chains/ton/observer/outbound_test.go (2)
zetaclient/chains/ton/observer/observer.go (1)
  • New (50-73)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
e2e/runner/ton.go (1)
zetaclient/chains/ton/rpc/types.go (1)
  • TransactionToHashString (201-203)
zetaclient/chains/ton/signer/signer_tracker.go (2)
zetaclient/chains/ton/rpc/types.go (2)
  • Account (36-46)
  • TransactionToHashString (201-203)
pkg/contracts/ton/gateway_tx.go (1)
  • Transaction (10-17)
zetaclient/testutils/testrpc/rpc_ton.go (2)
zetaclient/testutils/testrpc/rpc.go (2)
  • Server (16-20)
  • New (23-33)
zetaclient/config/types.go (1)
  • TONConfig (64-67)
zetaclient/orchestrator/bootstrap_test.go (2)
zetaclient/testutils/testrpc/rpc_ton.go (2)
  • NewTONServer (16-21)
  • TONServer (10-13)
zetaclient/config/types.go (2)
  • Config (79-113)
  • TONConfig (64-67)
zetaclient/chains/ton/rpc/client_live_test.go (3)
zetaclient/chains/ton/rpc/types.go (1)
  • Account (36-46)
pkg/contracts/ton/gateway_msg.go (1)
  • OpDepositAndCall (22-22)
zetaclient/chains/ton/rpc/config.go (2)
  • FetchGasConfigRPC (15-31)
  • ParseGasPrice (45-71)
zetaclient/chains/ton/observer/observer_test.go (3)
pkg/contracts/ton/gateway.go (1)
  • Gateway (25-27)
zetaclient/testutils/mocks/ton_rpc.go (2)
  • TONRPC (20-22)
  • NewTONRPC (284-294)
zetaclient/chains/ton/rpc/types.go (3)
  • TransactionHashToString (206-208)
  • BlockHeader (31-35)
  • TransactionToHashString (201-203)
🪛 GitHub Check: codecov/patch
zetaclient/chains/ton/observer/outbound.go

[warning] 221-221: zetaclient/chains/ton/observer/outbound.go#L221
Added line #L221 was not covered by tests

zetaclient/chains/ton/observer/observer.go

[warning] 54-55: zetaclient/chains/ton/observer/observer.go#L54-L55
Added lines #L54 - L55 were not covered by tests


[warning] 77-77: zetaclient/chains/ton/observer/observer.go#L77
Added line #L77 was not covered by tests


[warning] 82-82: zetaclient/chains/ton/observer/observer.go#L82
Added line #L82 was not covered by tests


[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests


[warning] 109-109: zetaclient/chains/ton/observer/observer.go#L109
Added line #L109 was not covered by tests

zetaclient/chains/ton/observer/inbound.go

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests


[warning] 339-346: zetaclient/chains/ton/observer/inbound.go#L339-L346
Added lines #L339 - L346 were not covered by tests


[warning] 349-349: zetaclient/chains/ton/observer/inbound.go#L349
Added line #L349 was not covered by tests


[warning] 351-354: zetaclient/chains/ton/observer/inbound.go#L351-L354
Added lines #L351 - L354 were not covered by tests


[warning] 394-401: zetaclient/chains/ton/observer/inbound.go#L394-L401
Added lines #L394 - L401 were not covered by tests

zetaclient/chains/ton/rpc/client.go

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


[warning] 122-136: zetaclient/chains/ton/rpc/client.go#L122-L136
Added lines #L122 - L136 were not covered by tests


[warning] 255-258: zetaclient/chains/ton/rpc/client.go#L255-L258
Added lines #L255 - L258 were not covered by tests


[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests


[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

🪛 GitHub Check: CodeQL
zetaclient/chains/ton/rpc/tlbstack.go

[failure] 74-74: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

zetaclient/chains/ton/rpc/client.go

[failure] 136-136: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: start-ton-test / e2e
  • GitHub Check: start-e2e-test / e2e
🔇 Additional comments (80)
e2e/config/config.go (1)

216-216: Update default TON RPC endpoint
The default TON endpoint was updated to http://ton:8081. Ensure dependent components (health checks, faucet URLs, clients) reference the new port and remove any lingering references to the old 8000 endpoint.

cmd/zetae2e/init.go (1)

34-34: Update default --tonURL flag
The tonURL flag default has been changed to http://ton:8081, aligning the CLI with the new RPC endpoint. Usage text has been updated accordingly.

e2e/e2etests/test_ton_deposit_restricted_address.go (1)

45-45: Use new RPC transaction hash utility
Replaced legacy liteapi.TransactionToHashString with rpc.TransactionToHashString. Confirm that the rpc package path and signature match the updated client interface.

cmd/zetae2e/config/localnet.yml (1)

116-118: Update localnet.yml TON RPC endpoint
The ton field was updated to http://ton:8081. Verify that the localnet environment exposes the RPC service on this port and adjust any related scripts or compose files that reference the old port.

e2e/e2etests/test_ton_withdrawal.go (2)

13-13: Import path successfully updated for RPC migration.

The import path change from liteapi to rpc aligns with the broader migration to HTTP-RPC client.


79-79:

Details

✅ Verification successful

Function call correctly updated to use RPC client.

The function call has been properly updated to use rpc.TransactionHashFromString. Based on the relevant code snippet, the function signature remains consistent, returning (uint64, ton.Bits256, error).

Verify that the RPC implementation provides equivalent functionality to the previous lite-client implementation:


🏁 Script executed:

#!/bin/bash
# Search for other usages of TransactionHashFromString to ensure consistency
rg "TransactionHashFromString" --type go -A 3 -B 1

Length of output: 2974


RPC TransactionHashFromString implementation validated

  • Located in zetaclient/chains/ton/rpc/types.go with signature (uint64, ton.Bits256, error).
  • Parses <logicalTime>:<hash> via strings.Split, strconv.ParseUint, and ton.Bits256 conversion.
  • Consistently used in inbound/outbound code and covered by existing tests in observer/inbound_test.go and observer/outbound.go.

No discrepancies from the previous lite-client parsing behavior were found—no further changes required.

cmd/zetae2e/config/local.yml (1)

120-121:

Details

✅ Verification successful

Configuration correctly updated for Ton Center v2 RPC.

The endpoint has been properly migrated from lite-client JSON configuration to the Ton Center v2 RPC endpoint. The port change from 8000 to 8081 reflects the new service architecture.

Verify that the port 8081 is consistently used across all configuration files and Docker setup:


🏁 Script executed:

#!/bin/bash
# Search for TON port references to ensure consistency
rg "8081|8000.*ton|ton.*8000" --type yml --type yaml -A 2 -B 2

# Check Docker compose files for port mappings
fd "docker-compose" -e yml -e yaml -x cat {} \; | rg "ton.*8081|8081.*ton"

Length of output: 211


Configuration migration verified and consistent

The migration from the lite-client JSON endpoint to Ton Center v2 RPC at port 8081 is applied uniformly:

  • cmd/zetae2e/config/local.yml: updated to "http://ton:8081"
  • Docker Compose mapping shows 8081:8081 for the ton service
  • No remaining references to port 8000 detected in YAML configs

All configurations align with the new service architecture.

zetaclient/orchestrator/orchestrator_test.go (1)

282-282: Test configuration correctly updated for new TON config structure.

The change from LiteClientConfigURL to Endpoint aligns with the updated TONConfig structure shown in the relevant code snippet from zetaclient/config/types.go. Using "localhost" is appropriate for the test environment.

zetaclient/config/config_chain.go (1)

61-61: Localnet configuration successfully migrated to RPC endpoint.

The endpoint change from "http://ton:8000/lite-client.json" to "http://ton:8081" is consistent with the migration from lite-client configuration to HTTP-RPC. This matches the port change observed in the local.yml configuration file.

e2e/runner/ton/accounts.go (1)

59-59: LGTM: Clean adapter pattern implementation.

The migration to use client.tongoAdapter() properly abstracts the underlying RPC client changes while maintaining compatibility with the tongo library interface.

e2e/e2etests/test_ton_withdrawal_concurrent.go (2)

6-6: LGTM: Import addition supports the timing logic.

The time package import is correctly added to support the sleep functionality.


70-70: LGTM: Enhanced error context.

Adding the recipient address to the assertion message improves debugging when balance checks fail.

zetaclient/orchestrator/preflight_metrics_reporter.go (2)

16-16: LGTM: Correct import migration.

The import change from liteapi to tonrpc aligns with the broader RPC client migration strategy.


162-164: LGTM: Clean RPC client migration.

The client instantiation has been properly updated to use the new RPC interface. The direct parameter passing (cfg.Endpoint, chain.ChainId) is more explicit than the previous config-based approach.

cmd/zetae2e/local/local.go (1)

748-750: LGTM: Improved keygen status handling.

Adding explicit handling for KeyGenSuccess status prevents unnecessary waiting when key generation is already complete, improving test efficiency and logic completeness.

contrib/localnet/docker-compose.yml (1)

270-270: Infrastructure changes align with TON RPC migration.

The image tag update and port mapping changes properly reflect the migration from TON lite-client to RPC client infrastructure. The new port 8081 corresponds to the toncenter v2 RPC endpoint as documented in the broader codebase changes.

Also applies to: 278-278

e2e/runner/ton/deployer.go (1)

40-40: Adapter pattern correctly implements RPC client compatibility.

The use of tongoAdapter() properly abstracts the RPC client to maintain compatibility with the tongo library's expected interface. This change aligns with the broader migration from lite-api to RPC client while preserving existing wallet functionality.

zetaclient/testutils/testrpc/rpc_evm.go (1)

22-22: Parameter type standardization improves RPC interface consistency.

The migration from []any to map[string]any for callback function parameters enhances the RPC interface by enabling named parameter access rather than positional access. This change aligns with JSON-RPC standards and provides better type safety and readability.

Also applies to: 28-28, 34-34, 40-40, 46-46

zetaclient/config/types.go (1)

65-66: Configuration migration properly implements RPC endpoint structure.

The replacement of LiteClientConfigURL with Endpoint creates a cleaner, more focused configuration structure for the RPC client. The field documentation clearly specifies the toncenter V2 API usage, and the mask tag ensures proper handling of sensitive endpoint information in logs.

e2e/runner/ton.go (3)

20-20: LGTM: Clean migration from liteapi to rpc package.

The import change aligns with the broader migration from TON lite-client to HTTP-RPC client.


121-121: LGTM: Correct function migration to RPC package.

The migration from liteapi.TransactionToHashString to rpc.TransactionToHashString is consistent and correct based on the function implementation in the rpc package.

Also applies to: 203-203, 289-289


73-74:

Details

❓ Verification inconclusive

Verify field name changes in gateway state structure.

The field names have been changed from LastTransHash/LastTransLt to LastTxHash/LastTxLT. Ensure these field names match the actual struct fields in the new RPC client's gateway state response.

Also applies to: 167-168


🏁 Script executed:

#!/bin/bash
# Description: Verify the correct field names in the TON RPC client gateway state structure
# Expected: Find LastTxHash and LastTxLT fields in the RPC client structures

# Search for the gateway state struct definition and field names
ast-grep --pattern $'type $_ struct {
  $$$
  LastTxHash $$$
  $$$
}'

ast-grep --pattern $'type $_ struct {
  $$$
  LastTxLT $$$
  $$$
}'

# Also search for any references to the old field names that might need updating
rg "LastTransHash|LastTransLt" --type go

Length of output: 1553


🏁 Script executed:

#!/bin/bash
# Search for GatewayState struct definitions
rg "type .*GatewayState" -n --type go

# Find all references to gwState to identify its type
rg "gwState" -n --type go

Length of output: 695


🏁 Script executed:

#!/bin/bash
# Locate the GetAccountState method signature to confirm its return type
rg -n "func .*GetAccountState" --type go
rg -n "GetAccountState(" --type go

Length of output: 712


🏁 Script executed:

#!/bin/bash
# Inspect tongoAdapter GetAccountState implementation to verify ShardAccount fields
rg -n -C5 "func \(a .*tongoAdapter\) GetAccountState" e2e/runner/ton/client.go

Length of output: 432


🏁 Script executed:

#!/bin/bash
# Display the full body of tongoAdapter.GetAccountState to verify field mapping
sed -n '128,180p' e2e/runner/ton/client.go

Length of output: 303


🏁 Script executed:

#!/bin/bash
# Locate ShardAccount struct and verify LastTxHash and LastTxLT fields
FILE=$(rg -l "type ShardAccount" --type go)
echo "Found in $FILE"
sed -n '1,200p' "$FILE"

Length of output: 138


Verify tlb.ShardAccount field names

The E2E runner now does:

lastTxHash = gwState.LastTxHash
lastLt     = gwState.LastTxLT

but gwState is a tlb.ShardAccount returned by GetAccountState. Please confirm that the external tlb.ShardAccount type actually declares these two fields—otherwise the code will fail to compile. If the names differ, update the references or adjust the mapping.

• File: e2e/runner/ton.go
– Lines 73–74
– Lines 167–168

zetaclient/testutils/testrpc/rpc_btc.go (1)

38-40:

Details

✅ Verification successful

LGTM: RPC parameter handling standardization.

The migration from []any to map[string]any standardizes parameter handling across RPC handlers. Ensure this change is consistent with the broader RPC refactoring.

Also applies to: 46-48


🏁 Script executed:

#!/bin/bash
# Description: Verify consistency of RPC parameter handling across the testrpc package
# Expected: All RPC handlers should use map[string]any consistently

# Search for any remaining []any parameter usage in RPC handlers
rg "func.*\[\]any.*\)" zetaclient/testutils/testrpc/

# Search for the new map[string]any pattern to ensure consistency
rg "func.*map\[string\]any.*\)" zetaclient/testutils/testrpc/

Length of output: 1164


RPC parameter handling consistency verified

All RPC handlers in zetaclient/testutils/testrpc now uniformly use map[string]any for their parameters; no remaining []any signatures were found.

  • No instances of func(... []any ...) remain.
  • Every handler follows func(params map[string]any) (any, error).

LGTM.

zetaclient/chains/ton/observer/outbound_test.go (3)

14-14: LGTM: Consistent import migration to RPC package.

The import change from liteapi to rpc package aligns with the broader migration effort.


27-27: LGTM: Observer instantiation updated for RPC client.

The change from ts.liteClient to ts.rpc correctly updates the observer to use the new RPC client interface.


50-50: LGTM: Transaction hash function migration.

The migration from liteapi.TransactionToHashString to rpc.TransactionToHashString is consistent with the package migration and maintains the same functionality.

cmd/zetae2e/config/clients.go (1)

45-45:

Details

✅ Verification successful

LGTM: Simplified TON client creation.

The direct call to tonrunner.NewClient without error handling simplifies the code. Verify that the new constructor indeed doesn't return an error.


🏁 Script executed:

#!/bin/bash
# Description: Verify the signature of tonrunner.NewClient to confirm it doesn't return an error
# Expected: Function should not return an error type

# Search for the NewClient function definition in the tonrunner package
ast-grep --pattern $'func NewClient($$$) $$$'

# Also search for any NewClient function that might return an error
rg "func NewClient.*error" e2e/runner/ton/

Length of output: 5640


tonrunner.NewClient signature confirmed: no error return
The NewClient in e2e/runner/ton/client.go is defined as

func NewClient(url string) *Client

and does not return an error, so omitting error handling here is safe.

zetaclient/chains/ton/signer/signer_tracker.go (5)

12-12: Import migration aligns with PR objectives.

The change from liteapi to rpc package import correctly reflects the broader migration to TON HTTP-RPC client integration.


42-43: Field access updated correctly for new struct.

The field access changes from LastTransLt/LastTransHash to LastTxLT/LastTxHash correctly match the new rpc.Account struct fields as shown in the relevant code snippets.


50-50: RPC client method call properly updated.

The method call has been correctly updated to use the RPC client interface instead of the liteapi client.


62-62: Utility function call correctly migrated.

The transaction hash conversion has been properly updated to use the rpc.TransactionToHashString utility function, maintaining the same functionality with the new client.


27-27:

Details

❓ Verification inconclusive

Parameter type change requires verification.

The parameter type changed from tlb.ShardAccount to rpc.Account. This change should be consistent with all callers of this method.


🏁 Script executed:

#!/bin/bash
# Search for all callers of trackOutbound method to ensure they pass rpc.Account
ast-grep --pattern 'trackOutbound($_, $_, $_, $_)'

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Locate all invocations of trackOutbound in the Go codebase to ensure callers pass rpc.Account
rg --with-filename --line-number '\btrackOutbound\(' .

Length of output: 363


#!/bin/bash
# 1. Inspect the updated signature of trackOutbound
rg -n -A3 'func (s .*trackOutbound' zetaclient/chains/ton/signer/signer_tracker.go

# 2. Show call site context in signer.go
rg -n -C5 'trackOutbound\(' zetaclient/chains/ton/signer/signer.go

# 3. Locate gwState assignment to confirm its type
rg -n -C3 'gwState' zetaclient/chains/ton/signer/signer.go

#!/bin/bash
# 1. Inspect the updated signature of trackOutbound in signer_tracker.go
rg -n -A3 'func \(s .*trackOutbound' zetaclient/chains/ton/signer/signer_tracker.go

# 2. Show call site context in signer.go to see what is passed as gwState
rg -n -C5 'trackOutbound\(' zetaclient/chains/ton/signer/signer.go

# 3. Locate where gwState is defined or assigned to confirm its type
rg -n -C3 'gwState' zetaclient/chains/ton/signer/signer.go

Verify trackOutbound parameter types across callers

The signature of trackOutbound in signer_tracker.go was updated to accept prevState rpc.Account instead of tlb.ShardAccount. This change must be reflected at every call site:

  • zetaclient/chains/ton/signer/signer.go:144s.trackOutbound(ctx, zetacore, withdrawal, gwState)
  • zetaclient/chains/ton/observer/outbound.go:152 – referenced in comments

Please confirm that gwState (and any other argument passed as the former ShardAccount) is now of type rpc.Account, and update or cast these variables as needed to maintain type safety and avoid compilation errors.

zetaclient/chains/ton/rpc/types_test.go (4)

1-11: Well-structured test package setup.

The package declaration, imports, and test framework setup are properly organized and follow Go testing conventions.


12-53: Comprehensive test case for active account.

The test case validates JSON unmarshaling for an active wallet account with proper assertions for all critical fields including account status, transaction data, balance, and state cells.


54-84: Good coverage for uninitialized account state.

The test case properly covers the uninitialized account scenario, ensuring the parsing logic handles different account states correctly.


86-99: Robust test execution with proper error handling.

The test execution logic includes proper error handling for expected failures and uses require/assert appropriately for different assertion types.

zetaclient/testutils/testrpc/rpc_ton.go (2)

9-13: Clean struct definition following established patterns.

The TONServer struct properly embeds the generic Server and includes the endpoint field for TON-specific configuration.


16-21: Constructor function correctly implemented.

The constructor properly creates the RPC server instance, configures the TON-specific settings, and returns both the server and configuration as expected by the testing framework.

contrib/localnet/scripts/wait-for-ton.sh (3)

4-4: Poll interval reduction improves responsiveness.

Reducing the poll interval from 5 to 2 seconds provides better responsiveness during local development without being overly aggressive.


6-6: Endpoint correctly updated for RPC interface.

The URL change from /status to /jsonRPC at port 8081 correctly reflects the migration to the TON HTTP-RPC interface.


27-27: Echo message properly updated.

The status message correctly reflects the new JSON-RPC endpoint being checked.

zetaclient/chains/ton/observer/outbound.go (1)

221-221:

Details

✅ Verification successful

Add test coverage for transaction hash conversion.

The static analysis indicates that this line converting transaction to hash string is not covered by tests. Consider adding test coverage to ensure the RPC-based hash conversion works correctly.


🏁 Script executed:

#!/bin/bash
# Description: Check test coverage for TransactionToHashString usage in outbound code

# Search for test files that might test the postVoteOutbound function
fd -e go -g "*test.go" | xargs rg -l "postVoteOutbound|TransactionToHashString" -A 5

Length of output: 321


🏁 Script executed:

#!/bin/bash
# Inspect test coverage for TransactionToHashString in TON outbound tests
rg -n -C3 "TransactionToHashString" zetaclient/chains/ton/observer/outbound_test.go

Length of output: 332


Transaction hash conversion is already covered by existing tests

The outbound_test.go file invokes rpc.TransactionToHashString(withdrawalTX) (see line 50), exercising the same conversion logic used in outbound.go. No additional test is needed for this code path.

  • Covered in:
    • zetaclient/chains/ton/observer/outbound_test.go:50
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 221-221: zetaclient/chains/ton/observer/outbound.go#L221
Added line #L221 was not covered by tests

zetaclient/orchestrator/bootstrap.go (1)

224-276: Well-structured migration to RPC client.

The refactoring from liteapi to RPC client is clean and follows best practices:

  • Proper validation of the endpoint configuration
  • Use of instrumented HTTP client for metrics collection
  • Consistent error handling and messaging
  • Clear separation of concerns between RPC client creation and observer/signer initialization
zetaclient/chains/ton/rpc/client_live_test.go (6)

1-33: LGTM!

The imports are well-organized and the test setup properly handles environment configuration with sensible defaults.


55-64: Well-structured test enhancements!

The additional assertions for Code, Data fields and ToShardAccount conversion improve test coverage and validate the new RPC account structure comprehensively.


74-82: Consistent account status handling for non-existent accounts.

The change from AccountNone to AccountUninit for non-existent accounts aligns with the new RPC client's representation.


86-92: Clean implementation of GetSeqno test!

The test effectively validates sequence number retrieval for the gateway account.


94-101: Effective test for smart contract method execution!

The test properly validates the RunSmcMethod functionality by testing transaction fee retrieval through the gateway contract.


103-113: Excellent refactoring using helper functions!

The test now leverages FetchGasConfigRPC and ParseGasPrice helpers, improving code modularity and maintainability.

zetaclient/chains/ton/signer/signer.go (2)

18-30: Clean interface migration to RPC!

The interface rename and type updates properly reflect the transition from lite-api to the new RPC client, with consistent naming throughout.


127-137: Consistent field usage throughout ProcessOutbound!

The method properly uses the renamed rpc field for all client operations.

e2e/runner/ton/client.go (4)

20-25: Appropriate simplification for e2e testing!

The constructor correctly simplifies client creation for e2e purposes. The hardcoded chainID = 0 is acceptable in this context as indicated by the comment.


42-48: Cleaner balance retrieval!

The direct access to state.Balance simplifies the code by leveraging the new RPC client's flatter account structure.


86-88: Consistent status checking with new RPC structure!

The direct status comparison maintains the same logic while adapting to the new account state structure.


118-135: Elegant adapter pattern for tongo compatibility!

The tongoAdapter provides a clean abstraction layer to maintain compatibility with the tongo library's expected interface. The implementation correctly converts the RPC client's account state to tlb.ShardAccount, and the explanatory comment clearly documents the purpose.

zetaclient/chains/ton/observer/observer.go (1)

33-46: Interface definition looks appropriate for the RPC migration.

The new RPC interface properly encapsulates the required methods for TON chain interaction with clear parameter types and return values.

zetaclient/testutils/testrpc/rpc.go (1)

92-116: Robust JSON-RPC request parsing implementation.

The parseRequest function properly handles both object and array parameter formats, with appropriate validation for the method field. The use of gjson for parsing is efficient and the conversion of array indices to string keys maintains compatibility.

zetaclient/chains/ton/rpc/tlbstack.go (1)

22-36:

Details

✅ Verification successful

Document the limitation on supported stack value types.

The marshalStack function only supports VmStkTinyInt and VmStkInt types. This limitation should be documented more prominently, especially if other types might be encountered in production.


🏁 Script executed:

#!/bin/bash
# Check if there are other VmStk types in the codebase that might need support
ast-grep --pattern 'VmStk$_' | grep -v "VmStkTinyInt\|VmStkInt" | head -20

# Check usage of marshalStack to understand if limitation is acceptable
rg -A 5 -B 5 "marshalStack"

Length of output: 1795


Limitation Already Documented in marshalStack

The existing comment in zetaclient/chains/ton/rpc/tlbstack.go (above marshalStack) explicitly states that only numeric inputs (“num”) are supported, i.e. VmStkTinyInt and VmStkInt. No other SumType cases are handled, and this limitation is already called out in code.

• File: zetaclient/chains/ton/rpc/tlbstack.go (comment lines above marshalStack)
• No further documentation changes needed.

zetaclient/chains/ton/rpc/config.go (3)

11-13: Well-designed interface follows single responsibility principle.

The ConfigGetter interface is focused and minimal, providing exactly what's needed for configuration parameter retrieval.


15-31: Excellent error handling and documentation.

The function properly handles errors with wrapped context and includes valuable documentation references to TON blockchain specifications. The constant naming and error wrapping follow Go best practices.


45-71: Robust handling of TON's sum type system.

The implementation correctly handles all three gas price configuration variants according to TON specifications. The recursive call for GasFlatPfx is appropriate as per the blockchain's nested configuration structure, and proper nil checking prevents potential panics.

zetaclient/chains/ton/observer/inbound_test.go (3)

14-14: Clean migration to RPC package.

The import change from liteapi to rpc package aligns with the architectural improvement.


22-22: Consistent observer initialization with RPC client.

All observer constructor calls have been systematically updated to use the new RPC client interface, maintaining test coverage while improving the underlying implementation.

Also applies to: 31-31, 67-67, 123-123, 194-194, 231-231, 279-279, 374-374


115-115: Block height handling simplified.

The assertion change to uint64(0) suggests the RPC client handles block height information differently than the previous lite-client implementation. This appears to be an intentional architectural change.

Also applies to: 175-175

zetaclient/chains/ton/observer/observer_test.go (3)

21-21: Import aligned with RPC migration.

The package import change supports the systematic migration to the RPC client interface.


66-66: Test suite properly updated for RPC client.

The mock initialization and field references have been correctly updated to use the new TONRPC interface, maintaining test functionality with the improved client implementation.

Also applies to: 100-101


171-182: Block header mocking adapted to RPC types.

The mock setup properly handles the type conversion from ton.BlockIDExt to rpc.BlockIDExt and returns appropriate rpc.BlockHeader structure, ensuring compatibility with the new RPC client interface.

zetaclient/chains/ton/signer/signer_test.go (3)

22-22: Signer integration updated for RPC client.

The import change and signer constructor update properly integrate with the new RPC client interface, maintaining functionality while improving the underlying architecture.

Also applies to: 33-33


68-68: Account state handling modernized.

The transition from tlb.ShardAccount to rpc.Account represents a cleaner abstraction for account state management, with the mock setup properly supporting the new type structure.

Also applies to: 153-155


85-85: Comprehensive test infrastructure migration.

The test suite has been systematically updated to use RPC mocks and functions, ensuring consistent test coverage with the improved client implementation.

Also applies to: 95-95, 118-118, 136-136

zetaclient/chains/ton/observer/inbound.go (1)

208-210: Good architectural documentation for TON's sharding model.

The comment clearly explains why a constant zero is used for seqno in TON's sharded architecture. This is an important architectural detail that helps future maintainers understand the design decision.

zetaclient/testutils/mocks/ton_gen.go (1)

15-36: Interface migration looks complete and well-structured.

The interface rename from tonClient to tonRPC and the method signature updates properly reflect the migration from lite-api to RPC-based implementation. The removal of GetFirstTransaction and addition of new methods align with the architectural changes.

zetaclient/chains/ton/rpc/client.go (3)

115-117: GetAccountState initialization is more explicit.

The change to initialize the Account struct with the ID before unmarshaling ensures the account ID is always set, even if the RPC response doesn't include it. This is a good defensive programming practice.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


267-302: Excellent refactoring of GetTransactionsSince with clear documentation.

The improved comments clearly explain TON RPC's reverse chronological order, making the pagination logic much easier to understand. The removal of deferred reversal in favor of explicit reversal at return points improves code clarity.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


306-321: SendMessage error handling is cleaner with the switch statement.

The refactored error handling using a switch statement improves readability and makes the different error cases more explicit.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests

zetaclient/chains/ton/rpc/types.go (4)

37-46: Account struct enhancement is well-designed.

The addition of Code and Data fields as *boc.Cell pointers appropriately models TON account state, allowing nil values for accounts without deployed contracts.


109-135: ToShardAccount conversion is correctly implemented.

The method properly handles all account states and constructs the complex nested tlb.ShardAccount structure accurately.


137-161: Excellent refactoring of base64 cell decoding utilities.

The extraction of cellFromBase64 improves code reuse and provides comprehensive error handling with descriptive error messages.


231-264: Helper functions are well-implemented.

Both tlbAccountState and wrapCell correctly handle all cases and provide clean abstractions for complex type conversions.

zetaclient/testutils/mocks/ton_rpc.go (1)

1-295: Generated mock correctly reflects RPC interface migration.

This mockery-generated file appropriately mirrors the transition from lite-client to RPC interface. No manual modifications needed.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

♻️ Duplicate comments (2)
zetaclient/chains/ton/rpc/tlbstack.go (1)

42-75: ⚠️ Potential issue

Add bounds checking for integer conversion to prevent overflow

The conversion from int64 to uint32 at line 74 can overflow if the exit code value exceeds the uint32 range or is negative. This could result in incorrect exit codes being returned.

Apply this fix to add proper bounds checking:

 func parseGetMethodResponse(res json.RawMessage) (uint32, tlb.VmStack, error) {
 	items := gjson.GetManyBytes(res, "exit_code", "stack")
 
 	exitCode, err := hexToInt(items[0].String())
 	if err != nil {
 		return 0, tlb.VmStack{}, errors.Wrapf(err, "unable to parse exit code")
 	}
+	
+	// Validate exit code is within uint32 range
+	if exitCode < 0 || exitCode > math.MaxUint32 {
+		return 0, tlb.VmStack{}, errors.Errorf("exit code %d is out of uint32 range", exitCode)
+	}
 
 	stack := tlb.VmStack{}

Note: You'll need to import the math package for MaxUint32.

🧰 Tools
🪛 GitHub Check: CodeQL

[failure] 74-74: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

zetaclient/chains/ton/rpc/client.go (1)

122-138: ⚠️ Potential issue

Add bounds check for integer conversion to prevent potential overflow.

While the comment suggests the value is "always in range", there's no explicit validation to ensure the VmStkTinyInt value fits within uint32 bounds. This could lead to silent data corruption if the value exceeds 4,294,967,295.

Apply this fix to add proper bounds checking:

 	default:
-		// #nosec G115 always in range
-		return uint32(stack[0].VmStkTinyInt), nil
+		value := stack[0].VmStkTinyInt
+		if value < 0 || value > math.MaxUint32 {
+			return 0, errors.Errorf("seqno value %d is out of uint32 range", value)
+		}
+		// #nosec G115 bounds checked above
+		return uint32(value), nil

Note: You'll need to import the math package for math.MaxUint32.

🧰 Tools
🪛 GitHub Check: CodeQL

[failure] 136-136: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

🪛 GitHub Check: codecov/patch

[warning] 122-136: zetaclient/chains/ton/rpc/client.go#L122-L136
Added lines #L122 - L136 were not covered by tests

🧹 Nitpick comments (8)
e2e/e2etests/test_ton_deposit_restricted_address.go (1)

12-12: Avoid generic rpc import alias. Consider aliasing the TON RPC client import (e.g., tonrpc "github.com/zeta-chain/node/zetaclient/chains/ton/rpc") to prevent confusion with Go’s standard rpc package and improve clarity.

zetaclient/chains/ton/observer/outbound.go (1)

112-114: Update error message to reflect RPC usage.

The error message on line 114 still references "liteapi" despite the migration to RPC client.

-		return errors.Wrap(err, "unable to get transaction form liteapi")
+		return errors.Wrap(err, "unable to get transaction from rpc")
zetaclient/testutils/testrpc/rpc_ton.go (1)

15-16: Fix function comment.

The comment incorrectly references "SuiServer" instead of "TONServer".

-// NewSuiServer creates a new SuiServer.
+// NewTONServer creates a new TONServer.
contrib/localnet/scripts/wait-for-ton.sh (1)

13-16: Improve response validation logic.

The current empty response check may not catch all failure scenarios, and the function could benefit from more robust error detection.

-    if [ -z "$response" ]; then
-        echo "Waiting: no response"
-        return 1
-    fi
+    if [ -z "$response" ] || [ "$response" = "null" ]; then
+        echo "Waiting: no response or null response"
+        return 1
+    fi
+    
+    # Check for HTTP error responses
+    if echo "$response" | jq -e '.error' >/dev/null 2>&1; then
+        echo "Waiting: JSON-RPC error received"
+        return 1
+    fi
e2e/runner/ton/client.go (1)

20-25: Consider making chainID configurable for better flexibility

While hardcoding chainID = 0 is acceptable for e2e tests, consider accepting it as a parameter to make the client more reusable across different test scenarios.

-func NewClient(url string) *Client {
-	// okay for e2e purposes
-	const chainID = 0
-
-	return &Client{Client: rpc.New(url, chainID)}
+func NewClient(url string, chainID int) *Client {
+	return &Client{Client: rpc.New(url, chainID)}
 }

If you prefer to keep the current signature for backward compatibility, you could add a NewClientWithChainID function instead.

zetaclient/orchestrator/bootstrap_test.go (1)

319-323: Consider documenting the purpose of empty mock functions

While these empty mock functions serve as no-ops for the test RPC server approach, their purpose might not be immediately clear to future maintainers.

Consider adding brief comments explaining why these functions are empty:

-// might be useful
-func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {}
-func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer)       {}
-func mockTONCalls(_ *testSuite, _ *testrpc.TONServer)       {}
+// No-op mock functions - test RPC servers handle the mock behavior internally
+func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {}
+func mockSuiCalls(_ *testSuite, _ *testrpc.SuiServer)       {}
+func mockTONCalls(_ *testSuite, _ *testrpc.TONServer)       {}
zetaclient/chains/ton/observer/observer.go (2)

54-55: Add test coverage for nil RPC validation

The nil check for the RPC parameter is important for preventing runtime panics, but static analysis indicates it lacks test coverage.

Would you like me to generate unit tests to cover this validation path?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 54-55: zetaclient/chains/ton/observer/observer.go#L54-L55
Added lines #L54 - L55 were not covered by tests


87-92: Consider adding test coverage for error paths

Static analysis indicates that the error handling paths in gas price fetching lack test coverage. These paths are critical for operational reliability.

Would you like me to generate comprehensive unit tests for the error scenarios in PostGasPrice?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2c403a and 7908b68.

📒 Files selected for processing (48)
  • changelog.md (1 hunks)
  • cmd/zetae2e/config/clients.go (1 hunks)
  • cmd/zetae2e/config/local.yml (1 hunks)
  • cmd/zetae2e/config/localnet.yml (1 hunks)
  • cmd/zetae2e/init.go (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • contrib/localnet/docker-compose.yml (1 hunks)
  • contrib/localnet/scripts/wait-for-ton.sh (1 hunks)
  • e2e/config/config.go (1 hunks)
  • e2e/e2etests/test_ton_deposit_restricted_address.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal.go (2 hunks)
  • e2e/e2etests/test_ton_withdrawal_concurrent.go (2 hunks)
  • e2e/runner/ton.go (6 hunks)
  • e2e/runner/ton/accounts.go (1 hunks)
  • e2e/runner/ton/client.go (4 hunks)
  • e2e/runner/ton/deployer.go (1 hunks)
  • zetaclient/chains/ton/config/config.go (0 hunks)
  • zetaclient/chains/ton/config/config_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_live_test.go (0 hunks)
  • zetaclient/chains/ton/liteapi/client_test.go (0 hunks)
  • zetaclient/chains/ton/observer/inbound.go (11 hunks)
  • zetaclient/chains/ton/observer/inbound_test.go (12 hunks)
  • zetaclient/chains/ton/observer/observer.go (4 hunks)
  • zetaclient/chains/ton/observer/observer_test.go (9 hunks)
  • zetaclient/chains/ton/observer/outbound.go (4 hunks)
  • zetaclient/chains/ton/observer/outbound_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/client.go (3 hunks)
  • zetaclient/chains/ton/rpc/client_live_test.go (3 hunks)
  • zetaclient/chains/ton/rpc/config.go (1 hunks)
  • zetaclient/chains/ton/rpc/tlbstack.go (1 hunks)
  • zetaclient/chains/ton/rpc/types.go (4 hunks)
  • zetaclient/chains/ton/rpc/types_test.go (1 hunks)
  • zetaclient/chains/ton/signer/signer.go (5 hunks)
  • zetaclient/chains/ton/signer/signer_test.go (9 hunks)
  • zetaclient/chains/ton/signer/signer_tracker.go (4 hunks)
  • zetaclient/config/config_chain.go (1 hunks)
  • zetaclient/config/types.go (1 hunks)
  • zetaclient/orchestrator/bootstrap.go (2 hunks)
  • zetaclient/orchestrator/bootstrap_test.go (3 hunks)
  • zetaclient/orchestrator/orchestrator_test.go (1 hunks)
  • zetaclient/orchestrator/preflight_metrics_reporter.go (2 hunks)
  • zetaclient/testutils/mocks/ton_gen.go (1 hunks)
  • zetaclient/testutils/mocks/ton_rpc.go (7 hunks)
  • zetaclient/testutils/testrpc/rpc.go (4 hunks)
  • zetaclient/testutils/testrpc/rpc_btc.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_evm.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_ton.go (1 hunks)
💤 Files with no reviewable changes (5)
  • zetaclient/chains/ton/liteapi/client_live_test.go
  • zetaclient/chains/ton/config/config_test.go
  • zetaclient/chains/ton/liteapi/client_test.go
  • zetaclient/chains/ton/config/config.go
  • zetaclient/chains/ton/liteapi/client.go
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.go`: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • e2e/config/config.go
  • e2e/e2etests/test_ton_deposit_restricted_address.go
  • cmd/zetae2e/init.go
  • e2e/runner/ton.go
  • zetaclient/testutils/testrpc/rpc_btc.go
  • zetaclient/config/config_chain.go
  • cmd/zetae2e/config/clients.go
  • zetaclient/chains/ton/observer/outbound_test.go
  • e2e/e2etests/test_ton_withdrawal.go
  • zetaclient/orchestrator/orchestrator_test.go
  • e2e/runner/ton/accounts.go
  • e2e/runner/ton/deployer.go
  • zetaclient/orchestrator/preflight_metrics_reporter.go
  • zetaclient/orchestrator/bootstrap_test.go
  • zetaclient/testutils/testrpc/rpc_evm.go
  • zetaclient/config/types.go
  • zetaclient/chains/ton/observer/outbound.go
  • zetaclient/chains/ton/rpc/types_test.go
  • zetaclient/chains/ton/signer/signer_test.go
  • zetaclient/chains/ton/observer/observer_test.go
  • zetaclient/orchestrator/bootstrap.go
  • zetaclient/testutils/testrpc/rpc_ton.go
  • e2e/runner/ton/client.go
  • zetaclient/chains/ton/rpc/client_live_test.go
  • zetaclient/chains/ton/rpc/tlbstack.go
  • e2e/e2etests/test_ton_withdrawal_concurrent.go
  • zetaclient/chains/ton/rpc/config.go
  • cmd/zetae2e/local/local.go
  • zetaclient/testutils/testrpc/rpc.go
  • zetaclient/chains/ton/signer/signer.go
  • zetaclient/chains/ton/signer/signer_tracker.go
  • zetaclient/chains/ton/observer/inbound_test.go
  • zetaclient/chains/ton/observer/inbound.go
  • zetaclient/chains/ton/rpc/client.go
  • zetaclient/chains/ton/observer/observer.go
  • zetaclient/chains/ton/rpc/types.go
  • zetaclient/testutils/mocks/ton_gen.go
  • zetaclient/testutils/mocks/ton_rpc.go
`**/*.sh`: Review the shell scripts, point out issues relative to security, performance, and maintainability.

**/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

  • contrib/localnet/scripts/wait-for-ton.sh
🧠 Learnings (1)
zetaclient/chains/ton/observer/observer_test.go (1)
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/orchestrator.go:222-237
Timestamp: 2024-07-04T23:47:56.072Z
Learning: The `GetUpdatedChainObserver` method in the `Orchestrator` class is covered by unit tests in `zetaclient/orchestrator/orchestrator_test.go` and `zetaclient/orchestrator/chain_activate_test.go`.
🪛 GitHub Check: codecov/patch
zetaclient/chains/ton/observer/outbound.go

[warning] 221-221: zetaclient/chains/ton/observer/outbound.go#L221
Added line #L221 was not covered by tests

zetaclient/chains/ton/observer/inbound.go

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests


[warning] 339-346: zetaclient/chains/ton/observer/inbound.go#L339-L346
Added lines #L339 - L346 were not covered by tests


[warning] 349-349: zetaclient/chains/ton/observer/inbound.go#L349
Added line #L349 was not covered by tests


[warning] 351-354: zetaclient/chains/ton/observer/inbound.go#L351-L354
Added lines #L351 - L354 were not covered by tests


[warning] 394-401: zetaclient/chains/ton/observer/inbound.go#L394-L401
Added lines #L394 - L401 were not covered by tests

zetaclient/chains/ton/rpc/client.go

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


[warning] 122-136: zetaclient/chains/ton/rpc/client.go#L122-L136
Added lines #L122 - L136 were not covered by tests


[warning] 255-258: zetaclient/chains/ton/rpc/client.go#L255-L258
Added lines #L255 - L258 were not covered by tests


[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests


[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

zetaclient/chains/ton/observer/observer.go

[warning] 54-55: zetaclient/chains/ton/observer/observer.go#L54-L55
Added lines #L54 - L55 were not covered by tests


[warning] 77-77: zetaclient/chains/ton/observer/observer.go#L77
Added line #L77 was not covered by tests


[warning] 82-82: zetaclient/chains/ton/observer/observer.go#L82
Added line #L82 was not covered by tests


[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests


[warning] 109-109: zetaclient/chains/ton/observer/observer.go#L109
Added line #L109 was not covered by tests

🪛 GitHub Check: CodeQL
zetaclient/chains/ton/rpc/tlbstack.go

[failure] 74-74: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

zetaclient/chains/ton/rpc/client.go

[failure] 136-136: Incorrect conversion between integer types
Incorrect conversion of a signed 64-bit integer from strconv.ParseInt to a lower bit size type uint32 without an upper bound check.

🔇 Additional comments (85)
e2e/config/config.go (1)

216-216: Default TON RPC endpoint updated. The default TON RPC endpoint now correctly points to http://ton:8081, replacing the legacy lite-client URL.

e2e/e2etests/test_ton_deposit_restricted_address.go (1)

45-45: Switch to new RPC utility for hash conversion. The call to rpc.TransactionToHashString(tx) replaces the deprecated liteapi invocation and aligns with the HTTP-RPC client interface.

zetaclient/orchestrator/orchestrator_test.go (1)

282-282: Use Endpoint for TONConfig. Updated to config.TONConfig{Endpoint: "localhost"} to match the new RPC-based configuration and supersede the deprecated LiteClientConfigURL field.

cmd/zetae2e/config/local.yml (1)

120-121: Switch TON endpoint to Center v2 RPC. The ton field now points to http://ton:8081, and the accompanying comment was updated. Confirm consistency with localnet.yml and other configuration files.

changelog.md (1)

8-8: Add UNRELEASED entry for TON HTTP-RPC integration. Documented PR #3958 under Features; ensure entry mirrors scope and style of existing changelog items.

cmd/zetae2e/init.go (1)

34-34: LGTM: TON endpoint migration is consistent with RPC client refactor.

The default TON URL change from lite-client JSON config to direct RPC endpoint aligns with the broader migration from lite-api to HTTP-RPC client implementation.

e2e/e2etests/test_ton_withdrawal.go (2)

13-13: LGTM: Import correctly updated for RPC client migration.

The import change from liteapi to rpc package is consistent with the TON client architecture migration.


79-79: LGTM: Function call correctly updated for RPC client.

The function call change from liteapi.TransactionHashFromString to rpc.TransactionHashFromString maintains the same functionality while using the new RPC client interface.

cmd/zetae2e/local/local.go (1)

748-750: LGTM: Enhanced keygen status handling with explicit success check.

The addition of explicit KeyGenSuccess status handling improves code clarity and prevents unnecessary waiting when keygen has already completed successfully. This defensive programming approach is more robust than relying solely on the existing error condition.

zetaclient/config/config_chain.go (1)

61-61: LGTM: Configuration properly updated for RPC client architecture.

The field change from LiteClientConfigURL to Endpoint with the updated URL correctly reflects the migration from lite-client JSON configuration to direct TON Center v2 RPC endpoint at port 8081.

cmd/zetae2e/config/localnet.yml (1)

116-117: LGTM! Configuration correctly updated for TON RPC integration.

The endpoint configuration properly reflects the migration from lite-client to TON Center v2 RPC, with clear documentation.

e2e/runner/ton/deployer.go (1)

40-40: Adapter pattern correctly implemented for RPC client migration.

The change properly uses tongoAdapter() to maintain tongo library compatibility while leveraging the new RPC client implementation.

e2e/e2etests/test_ton_withdrawal_concurrent.go (3)

6-6: Appropriate import addition for timing functionality.

The time import is necessary for the sleep call added to handle RPC timing issues.


64-65: Well-reasoned timing fix for RPC lag handling.

The one-second delay appropriately addresses potential RPC lag behind blockchain state, with clear documentation of the rationale.


70-70: Enhanced error reporting improves debugging capabilities.

Adding the recipient's raw address to the assertion message provides valuable context for debugging balance verification failures.

e2e/runner/ton/accounts.go (1)

59-59: Consistent adapter pattern implementation across codebase.

The change correctly uses tongoAdapter() to maintain tongo library compatibility, consistent with the pattern established in the deployer code.

zetaclient/orchestrator/preflight_metrics_reporter.go (2)

16-16: Import migration correctly updated.

The import change from liteapi to tonrpc aligns with the broader TON HTTP-RPC client migration.


162-164: Client instantiation simplified appropriately.

The migration from liteapi.NewFromSource() to tonrpc.New() removes configuration file complexity and directly uses the endpoint and chain ID. The HealthCheck() method interface remains consistent.

e2e/runner/ton.go (3)

20-20: Import migration correctly implemented.

The package import change from liteapi to rpc is consistent with the TON HTTP-RPC client migration.


73-74: Field name corrections improve accuracy.

The field name changes from LastTransHash/LastTransLt to LastTxHash/LastTxLT appear to correct mismatched field names to align with the actual RPC response structure. This improves code correctness.

Also applies to: 167-168


121-121: Transaction hash utility migration consistent.

All calls to TransactionToHashString() have been correctly updated from the liteapi package to the rpc package, maintaining consistent functionality across the migration.

Also applies to: 203-203, 289-289

zetaclient/testutils/testrpc/rpc_btc.go (1)

38-40: Parameter standardization improves test infrastructure.

The change from []any to map[string]any for handler parameters standardizes the test RPC server interface and better reflects JSON-RPC parameter handling, which typically uses named parameters rather than positional arrays.

Also applies to: 46-48

zetaclient/testutils/testrpc/rpc_evm.go (1)

22-24: Consistent parameter standardization across EVM handlers.

All handler functions have been updated to use map[string]any parameters instead of []any, maintaining consistency with the broader test RPC infrastructure improvements. This standardization better represents JSON-RPC parameter structures.

Also applies to: 28-30, 34-36, 40-42, 46-48

contrib/localnet/docker-compose.yml (1)

270-278: LGTM: Clean migration to TON RPC interface

The Docker image update and port change correctly reflect the migration from TON lite-client (port 4443) to the TON Center v2 RPC interface (port 8081). The comment accurately describes the new port purpose.

zetaclient/config/types.go (1)

64-67: Well-structured configuration update

The migration from LiteClientConfigURL to Endpoint simplifies the TON configuration by directly specifying the RPC endpoint. The masking tag ensures sensitive information is properly protected, and the comment provides clear guidance on the expected URL format.

zetaclient/chains/ton/observer/outbound_test.go (3)

14-14: Correct import update for RPC migration

The import change from liteapi to rpc package correctly aligns with the broader TON client migration.


27-27: Proper observer instantiation update

The change from ts.liteClient to ts.rpc correctly adapts the observer instantiation to use the new RPC client interface.


50-50: Consistent function migration

The update from liteapi.TransactionToHashString to rpc.TransactionToHashString maintains the same functionality while using the new RPC package interface.

zetaclient/chains/ton/observer/outbound.go (4)

15-15: LGTM: Import migration is correct.

The import change from liteapi to rpc package aligns with the migration objectives.


107-107: LGTM: Function call migration is correct.

The replacement of liteapi.TransactionHashFromString with rpc.TransactionHashFromString maintains the same functionality while using the new RPC client.


170-170: LGTM: Transaction hash conversion migration is correct.

The replacement of liteapi.TransactionToHashString with rpc.TransactionToHashString is consistent with the RPC migration.


221-221:

Details

✅ Verification successful

Ensure test coverage for transaction hash conversion.

The static analysis indicates this line lacks test coverage. Consider adding tests for the postVoteOutbound function to ensure the transaction hash conversion is properly tested.


🏁 Script executed:

#!/bin/bash
# Description: Check test coverage for postVoteOutbound function and TransactionToHashString usage
# Expected: Find existing tests or identify gaps in test coverage

# Search for tests covering postVoteOutbound function
rg -A 10 -B 5 "postVoteOutbound" --type go

# Search for tests covering TransactionToHashString in the rpc package
rg -A 5 -B 5 "TransactionToHashString" --type go --glob "*test*"

Length of output: 14450


🏁 Script executed:

#!/bin/bash
# Display the beginning of the TON observer outbound tests to verify coverage of postVoteOutbound
sed -n '1,200p' zetaclient/chains/ton/observer/outbound_test.go || echo "File not found or empty"

Length of output: 2287


No additional tests needed for transaction hash conversion

The existing TestOutbound in zetaclient/chains/ton/observer/outbound_test.go exercises the rpc.TransactionToHashString call via the ProcessOutboundTrackers path, which covers the conversion at outbound.go:221.
No further test cases are required for coverage here.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 221-221: zetaclient/chains/ton/observer/outbound.go#L221
Added line #L221 was not covered by tests

zetaclient/testutils/testrpc/rpc_ton.go (1)

10-21: LGTM: Test utility implementation is well-structured.

The TONServer struct and NewTONServer function provide a clean interface for creating test RPC servers and configurations. The pattern follows established conventions and will facilitate testing of the new RPC client.

zetaclient/chains/ton/rpc/types_test.go (1)

12-99: LGTM: Comprehensive test coverage for Account parsing.

The table-driven test approach effectively validates JSON unmarshaling of Account structures across different states (active, uninitialized). The test verifies critical fields like status, balance, transaction metadata, and code/data cells, ensuring the RPC client's account handling is robust.

zetaclient/chains/ton/signer/signer_tracker.go (5)

12-12: LGTM: Import migration aligns with RPC client adoption.

The replacement of the tlb package import with the rpc package is consistent with the broader migration strategy.


27-27: LGTM: Parameter type migration is correct.

The change from tlb.ShardAccount to rpc.Account properly reflects the new RPC client's type system while maintaining the same semantic purpose.


42-43: LGTM: Field access updates are consistent with new type.

The field name changes from LastTransLt/LastTransHash to LastTxLT/LastTxHash correctly adapt to the rpc.Account type's field naming conventions.


50-50: LGTM: Method call migration maintains functionality.

The replacement of s.client.GetTransactionsSince with s.rpc.GetTransactionsSince successfully adapts to the new RPC client interface while preserving the same operational semantics.


62-62: LGTM: Transaction hash conversion function migration is correct.

The change from liteapi.TransactionToHashString to rpc.TransactionToHashString maintains the same functionality while using the new RPC client utilities.

zetaclient/orchestrator/bootstrap.go (3)

252-254: LGTM! Proper endpoint validation implemented.

The explicit validation for empty RPC endpoint prevents runtime failures and provides clear error messaging.


256-261: LGTM! Excellent use of instrumented HTTP client.

Using metrics.GetInstrumentedHTTPClient provides proper observability for the RPC client, which is essential for production monitoring.


268-273: LGTM! Clean migration to RPC client.

The observer and signer initialization properly uses the new RPC client interface with consistent error handling.

zetaclient/chains/ton/signer/signer_test.go (4)

22-22: LGTM! Proper import migration to RPC package.

The import change from liteapi to rpc package aligns with the broader migration strategy.


68-68: LGTM! Correct field name migration.

The field name changes from LastTransLt/LastTransHash to LastTxLT/LastTxHash properly align with the new RPC types.


85-85: LGTM! Appropriate hash conversion function usage.

Using rpc.TransactionToHashString provides consistent hash representation across the RPC client interface.


95-137: LGTM! Comprehensive mock setup for RPC client.

The test suite properly initializes the TONRPC mock and maintains all necessary test infrastructure for thorough testing.

zetaclient/chains/ton/rpc/client_live_test.go (5)

55-57: LGTM! Enhanced account state validation.

The additional assertions for Code and Data fields ensure comprehensive account state retrieval validation.


63-65: LGTM! Proper conversion method testing.

Testing the ToShardAccount conversion method validates the compatibility between RPC types and TLB structures.


74-74: LGTM! Correct account status expectation.

The change from tlb.AccountNone to tlb.AccountUninit properly reflects the updated RPC client behavior for non-existent accounts.


86-102: LGTM! Valuable new test cases added.

The new test cases for GetSeqno and RunSmcMethod provide essential coverage for the additional RPC client functionality.


105-110: LGTM! Proper migration to new RPC config functions.

The update to use FetchGasConfigRPC and ParseGasPrice maintains gas configuration testing while using the new RPC-based implementation.

zetaclient/chains/ton/observer/inbound_test.go (4)

14-14: Import migration looks correct

The import change from liteapi to rpc package is consistent with the PR objective.


22-23: Constructor calls properly migrated to RPC client

All observer constructor calls have been consistently updated to use ts.rpc instead of the previous liteClient reference.

Also applies to: 31-32, 67-68, 123-124, 194-195, 231-232, 279-280, 374-375


56-56: Transaction hash utility functions correctly migrated

All transaction hash conversion functions have been properly updated from the liteapi namespace to the rpc namespace while preserving the same functionality.

Also applies to: 113-113, 173-173, 271-271, 342-343, 355-355, 365-365


115-115:

Details

✅ Verification successful

Verify the intentional change to zero block height

The assertions for InboundBlockHeight have been changed to expect a fixed value of 0. Please confirm this aligns with the new RPC implementation's design and won't impact block height tracking functionality.

Also applies to: 175-175


🏁 Script executed:

#!/bin/bash
# Description: Check if the RPC implementation still provides block height information
# and verify if other parts of the codebase rely on non-zero InboundBlockHeight values

# Search for InboundBlockHeight usage in the codebase
rg -A 3 "InboundBlockHeight" --type go

# Check if the observer implementation sets InboundBlockHeight
ast-grep --pattern 'InboundBlockHeight = $_'

Length of output: 7755


Confirmed: TON InboundBlockHeight Assertions are Intentional
The TON observer no longer retrieves block headers, so cctx.InboundBlockHeight is always 0. The assertions in zetaclient/chains/ton/observer/inbound_test.go (lines 115 & 175) correctly reflect this. Other chains still assert non-zero heights as expected. No further changes required.

zetaclient/chains/ton/rpc/tlbstack.go (2)

15-40: Stack marshaling implementation looks correct

The marshalStack function properly handles the supported VM stack types with appropriate error handling for unsupported types.


77-81: Helper function implementation is correct

The hexToInt function properly handles hex string parsing with optional "0x" prefix.

e2e/runner/ton/client.go (3)

47-47: Balance access correctly updated for new RPC client

The direct access to state.Balance is appropriate for the new RPC client's account state structure.


86-86: Account status check properly migrated

The use of tlb.AccountActive constant is more type-safe than the previous implementation.


117-135: Well-designed adapter for tongo library compatibility

The tongoAdapter implementation elegantly bridges the gap between the new RPC client and tongo library expectations. The adapter pattern is appropriately used here.

zetaclient/chains/ton/signer/signer.go (2)

18-22: Well-executed interface migration.

The transition from LiteClient to RPC interface is cleanly implemented with consistent naming throughout the struct and constructor.

Also applies to: 27-27, 47-47


127-127: RPC method calls properly updated.

The migration of GetAccountState and SendExternalMessage calls to use the new RPC interface maintains the correct signatures and error handling.

Also applies to: 137-137

zetaclient/testutils/testrpc/rpc.go (2)

18-18: Improved parameter handling for JSON-RPC testing.

The migration to map[string]any parameters provides better support for named parameters in JSON-RPC requests, enhancing test flexibility.

Also applies to: 25-25, 36-36, 45-45


40-42: Documentation inconsistency with array parameter handling.

The comment states that array parameters will be cast to map with "$idx" prefix (e.g., {"$idx0": "foo"}), but the implementation using gjson.ForEach will produce keys without the prefix (e.g., {"0": "foo"}).

Update the comment to match the actual behavior:

-// the latter would be casted to map["$idx"]any{"0": "foo" ,...}
+// the latter would be casted to map[string]any{"0": "foo", "1": "bar", ...}

Also applies to: 92-116

Likely an incorrect or invalid review comment.

zetaclient/chains/ton/rpc/config.go (2)

11-31: Clean configuration fetching implementation.

The ConfigGetter interface is well-defined and minimal. The FetchGasConfigRPC function properly handles fetching and unmarshaling with appropriate error wrapping.


33-71: Robust gas price parsing with proper sum type handling.

The function correctly handles all three gas price sum types with appropriate bit shifting to convert from nano tons per 65536 gas units to tons per gas unit. The recursive handling of GasFlatPfx and null checking are well implemented.

zetaclient/orchestrator/bootstrap_test.go (2)

199-206: Test setup properly migrated to RPC server

The migration from lite-client to test RPC server is correctly implemented. The test now uses testrpc.NewTONServer which aligns with the broader architectural changes.


297-297: Config field correctly updated

The clearChainConfigs helper properly clears the new Endpoint field instead of the removed LiteClientConfigURL field.

zetaclient/chains/ton/observer/observer.go (2)

33-47: Well-structured RPC interface definition

The new RPC interface provides a clean abstraction with properly typed methods. The migration from the lite-client interface is comprehensive and maintains type safety.


77-92: Robust gas price fetching implementation

The refactored gas price fetching correctly uses the new RPC methods and maintains proper error handling. The separation of fetching and parsing logic improves modularity.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 77-77: zetaclient/chains/ton/observer/observer.go#L77
Added line #L77 was not covered by tests


[warning] 82-82: zetaclient/chains/ton/observer/observer.go#L82
Added line #L82 was not covered by tests


[warning] 87-87: zetaclient/chains/ton/observer/observer.go#L87
Added line #L87 was not covered by tests


[warning] 89-89: zetaclient/chains/ton/observer/observer.go#L89
Added line #L89 was not covered by tests


[warning] 92-92: zetaclient/chains/ton/observer/observer.go#L92
Added line #L92 was not covered by tests

zetaclient/chains/ton/observer/inbound.go (2)

37-40: Improved method signature with explicit return values

The refactoring of ensureLastScannedTx to return values instead of modifying internal state is a significant improvement. This makes the method more testable and its behavior more predictable.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 39-39: zetaclient/chains/ton/observer/inbound.go#L39
Added line #L39 was not covered by tests


208-210: Appropriate simplification for TON's architecture

Setting seqno to 0 with a clear comment explaining TON's sharded architecture is the correct approach. This simplification aligns with TON's unique blockchain structure where sequential block numbers don't apply across shards.

zetaclient/chains/ton/observer/observer_test.go (1)

21-201: Test migration to RPC client is complete and consistent.

The test suite has been properly updated to use the new TONRPC mock interface instead of the legacy TONLiteClient. All method calls, type references, and mock setups have been correctly migrated.

zetaclient/testutils/mocks/ton_gen.go (1)

13-38: Mock interface definition properly updated for RPC client.

The tonRPC interface correctly defines the new method signatures and types required for generating mocks of the new RPC client implementation. The go:generate directive has been appropriately updated.

zetaclient/chains/ton/rpc/client.go (4)

115-117: Account initialization and RPC method update look good.

Initializing the Account struct with its ID ensures data consistency, and the RPC method change to "getAddressInformation" aligns with the new API specification.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 115-115: zetaclient/chains/ton/rpc/client.go#L115
Added line #L115 was not covered by tests


[warning] 117-117: zetaclient/chains/ton/rpc/client.go#L117
Added line #L117 was not covered by tests


255-304: Excellent refactoring of transaction fetching logic.

The improved comments clearly explain the reverse order behavior of the RPC API, and the explicit reversal of results ensures consistent ascending order. The pagination logic is well-structured.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 255-258: zetaclient/chains/ton/rpc/client.go#L255-L258
Added lines #L255 - L258 were not covered by tests


[warning] 267-267: zetaclient/chains/ton/rpc/client.go#L267
Added line #L267 was not covered by tests


[warning] 269-271: zetaclient/chains/ton/rpc/client.go#L269-L271
Added lines #L269 - L271 were not covered by tests


[warning] 273-273: zetaclient/chains/ton/rpc/client.go#L273
Added line #L273 was not covered by tests


[warning] 284-286: zetaclient/chains/ton/rpc/client.go#L284-L286
Added lines #L284 - L286 were not covered by tests


[warning] 288-289: zetaclient/chains/ton/rpc/client.go#L288-L289
Added lines #L288 - L289 were not covered by tests


[warning] 294-295: zetaclient/chains/ton/rpc/client.go#L294-L295
Added lines #L294 - L295 were not covered by tests


[warning] 297-297: zetaclient/chains/ton/rpc/client.go#L297
Added line #L297 was not covered by tests


[warning] 301-302: zetaclient/chains/ton/rpc/client.go#L301-L302
Added lines #L301 - L302 were not covered by tests


306-322: SendMessage implementation properly handles RPC responses.

The explicit RPC request construction and dual error handling (transport errors vs. response errors) provide clear error semantics.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 306-309: zetaclient/chains/ton/rpc/client.go#L306-L309
Added lines #L306 - L309 were not covered by tests


[warning] 311-320: zetaclient/chains/ton/rpc/client.go#L311-L320
Added lines #L311 - L320 were not covered by tests


324-348: Consider adding test coverage for the new RunSmcMethod.

The implementation correctly handles VM stack marshaling and response parsing. However, this critical method lacks test coverage according to the static analysis.

Would you like me to help generate comprehensive test cases for this method to improve coverage?

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 329-333: zetaclient/chains/ton/rpc/client.go#L329-L333
Added lines #L329 - L333 were not covered by tests


[warning] 337-339: zetaclient/chains/ton/rpc/client.go#L337-L339
Added lines #L337 - L339 were not covered by tests


[warning] 342-342: zetaclient/chains/ton/rpc/client.go#L342
Added line #L342 was not covered by tests

zetaclient/chains/ton/rpc/types.go (6)

36-46: LGTM! Struct fields appropriately model account state.

The addition of Code and Data fields as optional *boc.Cell pointers correctly represents the account's contract code and data storage.


48-107: Well-structured JSON unmarshaling with proper error handling.

The implementation efficiently parses account data using gjson and includes comprehensive error wrapping. The account status determination logic covers the main states appropriately.


109-135: Clean conversion implementation with proper edge case handling.

The ToShardAccount method correctly handles the conversion, particularly the AccountNone edge case, and leverages helper functions for maintainability.


137-161: Robust helper functions with defensive programming.

The base64 decoding functions include proper validation for empty inputs and ensure at least one cell exists after deserialization. Error messages provide sufficient context for debugging.


199-229: Well-designed transaction hash serialization utilities.

The functions provide a clean interface for converting between transaction hashes and their string representation. The format validation and error handling in TransactionHashFromString are particularly robust.


231-264: Clean helper functions for TLB type conversion.

The tlbAccountState and wrapCell functions properly handle all account states and nil values, providing clean abstractions for the type conversion logic.

zetaclient/testutils/mocks/ton_rpc.go (1)

1-295: Auto-generated mock file - no issues found.

This mockery-generated file correctly implements the updated RPC interface with appropriate type changes and method signatures.

@swift1337 swift1337 requested review from skosito and ws4charlie June 6, 2025 11:28
@swift1337 swift1337 enabled auto-merge June 6, 2025 16:13
@swift1337
Copy link
Contributor Author

There's an issue with TON docker image and the container crashes. We need to try this: zeta-chain/ton-docker#7

ton          | 2025-06-06T16:38:58.737343823Z 16:38:58.737 [ForkJoinPool.commonPool-worker-1] ERROR o.t.e.v.ValidatorEngineExecutor - node genesis with PID 83 has stopped. FATAL ERROR - see node's log file!
ton          | 2025-06-06T16:38:58.737494575Z 16:38:58.737 [ForkJoinPool.commonPool-worker-1] INFO  o.t.e.v.ValidatorEngineExecutor - re-starting validator genesis...
ton          | 2025-06-06T16:38:58.737557052Z 16:38:58.737 [ForkJoinPool.commonPool-worker-1] INFO  o.t.e.v.ValidatorEngine - starting validator-engine genesis
ton          | 2025-06-06T16:39:03.739672104Z 16:39:03.739 [ForkJoinPool.commonPool-worker-1] INFO  o.t.e.v.ValidatorEngine - genesis validator-engine started at 127.0.0.1:4442
ton          | 2025-06-06T16:39:03.739734033Z 16:39:03.739 [ForkJoinPool.commonPool-worker-1] INFO  o.t.e.v.ValidatorEngineExecutor - re-started validator genesis with pid 954
ton          | 2025-06-06T16:39:05.650299828Z 16:39:05.649 [MyLocalTon - genesis Status Monitor] INFO  org.ton.actions.MyLocalTon - genesis is ready
ton          | 2025-06-06T16:39:05.650322941Z 16:39:05.649 [MyLocalTon - node2 Status Monitor] INFO  org.ton.actions.MyLocalTon - node2 is ready
ton          | 2025-06-06T16:39:06.249619496Z 16:39:06.249 [MyLocalTon - Dump Block 110] INFO  org.ton.actions.MyLocalTon - (-1,8000000000000000,111)
ton          | 2025-06-06T16:39:07.241570291Z 16:39:07.241 [MyLocalTon - Dump Block 111] INFO  org.ton.actions.MyLocalTon - (-1,8000000000000000,112)
ton          | 2025-06-06T16:39:08.240164113Z 16:39:08.239 [MyLocalTon - Dump Block 112] INFO  org.ton.actions.MyLocalTon - (-1,8000000000000000,113)
ton          | 2025-06-06T16:39:09.066109271Z Jun 06, 2025 4:39:09 PM org.ton.java.tonlib.Tonlib syncAndRead
ton          | 2025-06-06T16:39:09.066203918Z INFO: {"@type":"error","code":500,"message":"LITE_SERVER_NETWORKadnl query timeout(during last block synchronization)","@extra":"0ec93949-32dd-4c25-9672-f40878fb38e4"}

@swift1337 swift1337 added this pull request to the merge queue Jun 10, 2025
@github-actions github-actions bot added the MERGE_FAILED Merge Queue CI failed label Jun 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 10, 2025
@swift1337 swift1337 added this pull request to the merge queue Jun 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 10, 2025
@swift1337 swift1337 added this pull request to the merge queue Jun 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 10, 2025
@swift1337 swift1337 enabled auto-merge June 11, 2025 10:50
@swift1337 swift1337 force-pushed the feat/ton-rpc-integration branch from 62930ea to 2c81997 Compare June 11, 2025 16:12
@swift1337 swift1337 added this pull request to the merge queue Jun 11, 2025
Merged via the queue into develop with commit 0d69ef1 Jun 11, 2025
48 of 49 checks passed
@swift1337 swift1337 deleted the feat/ton-rpc-integration branch June 11, 2025 16:47
swift1337 added a commit that referenced this pull request Jun 11, 2025
* Refactor observer; refactor mocks

* Fix signer & unit tests

* Drop liteapi

* Restore tx hash conversion aliases

* Fix E2E, adapt Tongo x RPC

* Update wait-for-ton

* Move tlb to rpc package

* fix e2e tests; simplify ensureLastScannedTx; fix client

* rename .rpc to .Endpoint in config

* Simplify config

* Update changelog

* lint

* Address PR comments

* PR fixes

* fix merge conflict

* bump linter timeout

* use ton localnet v2

* bump ton localnet

* bump ton localnet
swift1337 added a commit that referenced this pull request Jun 11, 2025
* feat: migrate to golangci-lint v2 (#3960)

* Migrate linter to V2

* Apply lint

* Improve makefile

* feat(ton): Implement HTTP-RPC based on toncenter v2 (#3929)

* Add TON HTTP-RPC client skeleton

* RPC WIP [1]

* RPC WIP [2]

* RPC WIP [3]

* Metrics note

* Record metrics

* Update changelog

* feat(zetaclient): integrate TON HTTP-RPC (#3958)

* Refactor observer; refactor mocks

* Fix signer & unit tests

* Drop liteapi

* Restore tx hash conversion aliases

* Fix E2E, adapt Tongo x RPC

* Update wait-for-ton

* Move tlb to rpc package

* fix e2e tests; simplify ensureLastScannedTx; fix client

* rename .rpc to .Endpoint in config

* Simplify config

* Update changelog

* lint

* Address PR comments

* PR fixes

* fix merge conflict

* bump linter timeout

* use ton localnet v2

* bump ton localnet

* bump ton localnet

* Bump changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor zetaclient & ensure e2e tests run on http-rpc

3 participants