Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use protocol contracts V2 with Bitcoin deposits #3426

Merged
merged 21 commits into from
Jan 31, 2025

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jan 28, 2025

Description

Closes #2711

Summary by CodeRabbit

Release Notes

  • New Features

    • Added liquidity cap parameter to ZRC20 creation
    • Upgraded to cosmos-sdk version 50.x
    • Enabled Bitcoin inscription parsing on mainnet
    • Added CLI command to fetch inbound ballots
    • Registered aborted cross-chain transactions for Bitcoin inbound transactions with insufficient depositor fees
    • Added support for Avalanche, Arbitrum, and World Chain networks
  • Refactoring

    • Implemented Orchestrator V2
    • Updated protocol contract imports
    • Improved Bitcoin RPC in zetaclient with enhanced performance and observability
    • Moved Bitcoin and EVM observer-signers to V2
  • Protocol Updates

    • Introduced new inbound status for invalid receiver addresses
    • Updated protocol contract version to V2 for Bitcoin deposits

Copy link
Contributor

coderabbitai bot commented Jan 28, 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 pull request introduces comprehensive updates to support Bitcoin transactions with Protocol Contract Version 2 architecture. The changes span multiple components of the ZetaChain ecosystem, focusing on enhancing cross-chain transaction handling, introducing new status categories, and updating contract interactions. Key modifications include updating inbound event processing, adding new protocol contract version support, and refactoring various contract-related utilities.

Changes

File Change Summary
changelog.md Added features for liquidity cap, cosmos-sdk upgrade, Bitcoin transaction handling, and chain support expansion
proto/crosschain/cross_chain_tx.proto Added new INVALID_RECEIVER_ADDRESS enum value
zetaclient/chains/bitcoin/observer/* Updated event processing and inbound vote message creation for Protocol Contract V2
testutil/contracts/* Updated contract bindings, ABIs, and bytecode for various contracts
x/crosschain/types/cctx.go Modified revert outbound address determination logic

Assessment against linked issues

Objective Addressed Explanation
Define logic for ProtocolContractVersion == 2
Correct message parsing in VoteInbound Parsing now done at ZetaClient level
Add E2E test for Deposit and DepositAndCall Multiple E2E tests updated
Preserve Origin field for Bitcoin context Maintained in implementation

Suggested Labels

chain:bitcoin, V2_TESTS

Suggested Reviewers

  • skosito
  • kingpinXD
  • ws4charlie
  • berndartmueller

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@lumtis lumtis changed the title Refactor/bitcoin contract v2 refactor: use protocol contracts V2 with Bitcoin deposits Jan 28, 2025
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.

Project coverage is 64.42%. Comparing base (7397d2c) to head (d22e91c).
Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
x/crosschain/types/cctx.go 55.55% 3 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3426      +/-   ##
===========================================
+ Coverage    63.28%   64.42%   +1.13%     
===========================================
  Files          437      436       -1     
  Lines        30746    30376     -370     
===========================================
+ Hits         19459    19571     +112     
+ Misses       10473     9963     -510     
- Partials       814      842      +28     
Files with missing lines Coverage Δ
zetaclient/chains/bitcoin/observer/event.go 95.77% <100.00%> (+0.06%) ⬆️
zetaclient/chains/solana/observer/inbound.go 40.68% <ø> (+5.51%) ⬆️
zetaclient/types/event.go 89.65% <100.00%> (ø)
x/crosschain/types/cctx.go 47.64% <55.55%> (-0.67%) ⬇️

... and 26 files with indirect coverage changes

@lumtis lumtis added the UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light label Jan 28, 2025
@lumtis lumtis marked this pull request as ready for review January 30, 2025 09:56
@lumtis lumtis requested a review from a team as a code owner January 30, 2025 09:56
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: 0

🧹 Nitpick comments (8)
testutil/contracts/Example.sol (1)

46-51: Consider restricting onCall visibility.

The onCall function is marked as public, allowing direct external calls. Consider using internal visibility since this appears to be an implementation detail used only by onCrossChainCall.

e2e/e2etests/test_bitcoin_std_deposit_and_call_revert_other_address.go (1)

45-47: LGTM: Improved transaction verification flow.

The changes properly verify transaction mining before checking the revert status, with added logging for better debugging. Consider adding a timeout check to ensure the test fails gracefully if mining takes too long.

+const maxMiningWaitTime = 5 * time.Minute
+
 cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, txHash.String(), r.CctxClient, r.Logger, r.CctxTimeout)
+require.NotNil(r, cctx, "transaction not mined within %s", maxMiningWaitTime)
 r.Logger.CCTX(*cctx, "bitcoin_std_memo_deposit")
e2e/e2etests/test_bitcoin_deposit_and_withdraw_with_dust.go (1)

49-50: Enhance logging with context.

While adding logging is good, consider enriching it with additional context about the test scenario.

-r.Logger.CCTX(*cctx, "deposit")
+r.Logger.CCTX(*cctx, "deposit with dust amount test")
zetaclient/types/event.go (1)

113-113: Consider adding explicit category validation.

The default return of InboundCategoryProcessable might benefit from explicit validation to ensure all conditions are met.

+       // Validate basic requirements for processable events
+       if event.Amount == 0 || len(event.Memo) == 0 {
+           return InboundCategoryUnknown
+       }
        return InboundCategoryProcessable
zetaclient/chains/bitcoin/observer/event.go (1)

194-204: Consider improving cross-chain call detection logic.

The current implementation determines cross-chain calls based on memo bytes length. This might lead to false positives if the memo contains data that's not intended for cross-chain calls.

Consider using a more explicit method to determine cross-chain calls, such as:

-crosschaintypes.WithCrossChainCall(len(event.MemoBytes) > 0),
+crosschaintypes.WithCrossChainCall(event.MemoBytes != nil && len(event.MemoBytes) > 0 && !bytes.Equal(event.MemoBytes, []byte(constant.DonationMessage))),
zetaclient/chains/bitcoin/observer/event_test.go (2)

Line range hint 360-384: Consider adding test cases for new fields.

While the changes correctly implement V2 protocol version support, consider adding test cases that specifically validate the behavior of RevertOptions and IsCrossChainCall fields.

t.Run("should handle revert options correctly", func(t *testing.T) {
    event := createTestBtcEvent(t, &chaincfg.MainNetParams, []byte("dummy memo"), nil)
    amountSats := big.NewInt(1000)
    
    vote := ob.NewInboundVoteFromLegacyMemo(&event, amountSats)
    require.True(t, vote.RevertOptions.IsEmpty())
})

t.Run("should set cross chain call flag correctly", func(t *testing.T) {
    event := createTestBtcEvent(t, &chaincfg.MainNetParams, []byte("dummy memo"), nil)
    amountSats := big.NewInt(1000)
    
    vote := ob.NewInboundVoteFromLegacyMemo(&event, amountSats)
    require.True(t, vote.IsCrossChainCall)
})

Line range hint 420-441: Consider validating hex address format.

The change to use MemoStd.Receiver.Hex() is correct, but consider adding validation to ensure the hex address format is valid.

t.Run("should validate receiver hex format", func(t *testing.T) {
    receiver := sample.EthAddress()
    event := createTestBtcEvent(t, &chaincfg.MainNetParams, []byte("dummy"), &memo.InboundMemo{
        FieldsV0: memo.FieldsV0{
            Receiver: receiver,
        },
    })
    
    vote := ob.NewInboundVoteFromStdMemo(&event, big.NewInt(1000))
    require.True(t, strings.HasPrefix(vote.Receiver, "0x"))
    require.Equal(t, 42, len(vote.Receiver))
})
docs/openapi/openapi.swagger.yaml (1)

59047-59052: Enhance the documentation with protocol V2 context.

The addition of INVALID_RECEIVER_ADDRESS status improves error handling for Bitcoin deposits. However, consider expanding the description to clarify its relationship with protocol V2 contracts.

     - INSUFFICIENT_DEPOSITOR_FEE: this field is specifically for Bitcoin when the deposit amount is less than
     depositor fee
-     - INVALID_RECEIVER_ADDRESS: the receiver address parsed from the inbound is invalid
+     - INVALID_RECEIVER_ADDRESS: the receiver address parsed from the inbound is invalid (introduced with protocol
+       contracts V2 for enhanced Bitcoin deposit validation)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5b8dd05 and 1b180d1.

⛔ Files ignored due to path filters (8)
  • testutil/contracts/Dapp.bin is excluded by !**/*.bin
  • testutil/contracts/DappReverter.bin is excluded by !**/*.bin
  • testutil/contracts/Depositor.bin is excluded by !**/*.bin
  • testutil/contracts/Example.bin is excluded by !**/*.bin
  • testutil/contracts/Reverter.bin is excluded by !**/*.bin
  • testutil/contracts/Withdrawer.bin is excluded by !**/*.bin
  • typescript/zetachain/zetacore/crosschain/cross_chain_tx_pb.d.ts is excluded by !**/*_pb.d.ts
  • x/crosschain/types/cross_chain_tx.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
📒 Files selected for processing (27)
  • changelog.md (1 hunks)
  • docs/openapi/openapi.swagger.yaml (1 hunks)
  • e2e/e2etests/test_bitcoin_deposit.go (1 hunks)
  • e2e/e2etests/test_bitcoin_deposit_and_withdraw_with_dust.go (1 hunks)
  • e2e/e2etests/test_bitcoin_std_deposit_and_call_revert_other_address.go (1 hunks)
  • e2e/utils/contracts.go (2 hunks)
  • proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1 hunks)
  • testutil/contracts/Dapp.go (3 hunks)
  • testutil/contracts/Dapp.json (1 hunks)
  • testutil/contracts/DappReverter.go (2 hunks)
  • testutil/contracts/DappReverter.json (1 hunks)
  • testutil/contracts/Depositor.go (2 hunks)
  • testutil/contracts/Depositor.json (1 hunks)
  • testutil/contracts/Example.abi (1 hunks)
  • testutil/contracts/Example.go (2 hunks)
  • testutil/contracts/Example.json (2 hunks)
  • testutil/contracts/Example.sol (1 hunks)
  • testutil/contracts/Reverter.go (3 hunks)
  • testutil/contracts/Reverter.json (1 hunks)
  • testutil/contracts/Withdrawer.go (2 hunks)
  • testutil/contracts/Withdrawer.json (1 hunks)
  • x/crosschain/types/cctx.go (2 hunks)
  • zetaclient/chains/bitcoin/observer/event.go (5 hunks)
  • zetaclient/chains/bitcoin/observer/event_test.go (5 hunks)
  • zetaclient/chains/solana/observer/inbound.go (1 hunks)
  • zetaclient/types/event.go (2 hunks)
  • zetaclient/types/event_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • testutil/contracts/Dapp.json
  • testutil/contracts/DappReverter.json
  • testutil/contracts/Depositor.json
🧰 Additional context used
📓 Path-based instructions (17)
proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1)

Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

zetaclient/types/event.go (1)

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

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

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

e2e/e2etests/test_bitcoin_std_deposit_and_call_revert_other_address.go (1)

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

testutil/contracts/Reverter.go (1)

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

testutil/contracts/Depositor.go (1)

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

x/crosschain/types/cctx.go (1)

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

zetaclient/types/event_test.go (1)

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

testutil/contracts/Withdrawer.go (1)

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

testutil/contracts/Dapp.go (1)

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

e2e/utils/contracts.go (1)

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

testutil/contracts/DappReverter.go (1)

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

e2e/e2etests/test_bitcoin_deposit.go (1)

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

testutil/contracts/Example.go (1)

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

e2e/e2etests/test_bitcoin_deposit_and_withdraw_with_dust.go (1)

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

zetaclient/chains/bitcoin/observer/event_test.go (1)

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

zetaclient/chains/bitcoin/observer/event.go (1)

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

📓 Learnings (1)
zetaclient/chains/bitcoin/observer/event.go (1)
Learnt from: ws4charlie
PR: zeta-chain/node#3025
File: zetaclient/chains/bitcoin/observer/event.go:110-115
Timestamp: 2024-11-12T13:20:12.658Z
Learning: In the `DecodeEventMemoBytes` function, a non-nil `memoStd` with a non-nil `err` indicates that the memo bytes are well-formatted as a memo but contain improper data.
🪛 GitHub Check: codecov/patch
x/crosschain/types/cctx.go

[warning] 139-141: x/crosschain/types/cctx.go#L139-L141
Added lines #L139 - L141 were not covered by tests

🔇 Additional comments (32)
e2e/e2etests/test_bitcoin_deposit.go (1)

22-22: LGTM: Protocol version verification added.

The assertion correctly verifies that Bitcoin deposits use protocol contract V2, ensuring compatibility with the new protocol version.

testutil/contracts/Example.sol (1)

43-44: LGTM: Clean refactor of common logic.

The modification to onCrossChainCall properly delegates to the new onCall function, improving code reusability.

e2e/utils/contracts.go (1)

27-28: Consider potential overflow risks with uint64 conversion.

The direct conversion to uint64 might truncate large values. Consider adding overflow checks or using SafeMath for values that could exceed uint64 range:

-amount.Uint64(),
-bar.Uint64(),
+require.True(t, amount.IsUint64(), "amount exceeds uint64 range")
+require.True(t, bar.IsUint64(), "bar exceeds uint64 range")
+amount.Uint64(),
+bar.Uint64(),

Also applies to: 43-44

e2e/e2etests/test_bitcoin_deposit_and_withdraw_with_dust.go (1)

39-43: Consider adding validation for payload size.

The appended payload might affect the Bitcoin transaction size. Consider adding validation to ensure the combined size of withdrawer address and payload doesn't exceed Bitcoin's limitations.

zetaclient/types/event.go (1)

24-25: LGTM! Clear and descriptive naming.

The rename from InboundCategoryGood to InboundCategoryProcessable improves clarity by better describing the category's purpose.

testutil/contracts/Example.abi (1)

66-110: LGTM! Well-structured function definition.

The new onCall function is well-defined with appropriate parameter types and state mutability. The structure follows Solidity best practices.

zetaclient/types/event_test.go (1)

75-81: LGTM! Test cases updated consistently.

The test case updates correctly reflect the category rename while maintaining comprehensive coverage.

zetaclient/chains/bitcoin/observer/event.go (3)

78-78: LGTM: Improved semantic clarity in category naming.

The change from InboundCategoryGood to InboundCategoryProcessable better reflects the actual state of the inbound event.


221-243: LGTM: Robust cross-chain call detection.

The implementation correctly identifies cross-chain calls by checking both OpCodeCall and OpCodeDepositAndCall operations, providing a more reliable detection mechanism.


119-126: LGTM: Enhanced legacy memo handling.

The update improves the handling of legacy memo decoding and ensures consistent state by updating the MemoBytes field with the decoded payload.

Please ensure test coverage for this change. Run the following to check coverage:

✅ Verification successful

Test coverage verified: Comprehensive test suite present

The code changes are thoroughly tested in event_test.go with the Test_DecodeEventMemoBytes test suite, which covers:

  • Standard and legacy memo decoding
  • MemoBytes field updates
  • Error handling
  • Chain-specific behavior
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check test coverage for the DecodeMemoBytes method
go test -coverprofile=coverage.out ./zetaclient/chains/bitcoin/observer/
go tool cover -func=coverage.out | grep -A 1 "DecodeMemoBytes"

Length of output: 16555


Script:

#!/bin/bash
# Search for test files containing DecodeMemoBytes
ast-grep --pattern 'func Test$_($_, $_) {
  $$$
  DecodeMemoBytes
  $$$
}'

# Search for test files in the observer directory
fd ".*_test\.go$" | grep -i "observer"

Length of output: 4149


Script:

#!/bin/bash
# Check content of event_test.go for related test cases
cat zetaclient/chains/bitcoin/observer/event_test.go

# Search for any test cases that might be using MemoBytes
ast-grep --pattern 'func Test$_($_, $_) {
  $$$
  MemoBytes
  $$$
}'

Length of output: 13683

x/crosschain/types/cctx.go (2)

120-124: LGTM: Well-documented V1 compatibility logic.

The comments clearly explain why V1 logic is retained during the transition period, with references to relevant issues.


138-146: Add test coverage for Bitcoin revert address handling.

The new Bitcoin-specific revert address logic lacks test coverage.

Run the following to verify test coverage:

✅ Verification successful

Bitcoin revert address handling has sufficient test coverage

The codebase includes comprehensive test coverage for Bitcoin revert address handling in both revert_options_test.go and cctx_test.go, covering address validation, network compatibility, and error cases.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check test coverage for Bitcoin revert address handling
go test -coverprofile=coverage.out ./x/crosschain/types/
go tool cover -func=coverage.out | grep -A 1 "AddRevertOutbound"

Length of output: 430


Script:

#!/bin/bash
# Search for test files and Bitcoin-related test cases
rg -l "TestCctx" ./x/crosschain/types/
rg -A 10 -B 10 "IsBitcoinChain|RevertAddress" ./x/crosschain/types/*_test.go

Length of output: 25288

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 139-141: x/crosschain/types/cctx.go#L139-L141
Added lines #L139 - L141 were not covered by tests

zetaclient/chains/bitcoin/observer/event_test.go (1)

58-63: LGTM! Improved naming clarity.

The rename from InboundCategoryGood to InboundCategoryProcessable better describes the purpose and state of the inbound event.

testutil/contracts/Withdrawer.go (1)

29-29: LGTM! Improved contract binding implementation.

The changes follow best practices by:

  1. Using abi.ConvertType for type conversions
  2. Updating contract bytecode
  3. Using GetAbi() for consistent ABI handling

Also applies to: 35-35, 160-164

testutil/contracts/Depositor.go (1)

29-29: LGTM! Consistent contract binding implementation.

The changes maintain consistency with other contract implementations by following the same pattern of improvements.

Also applies to: 35-35, 160-164

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

431-431: LGTM! Consistent category naming.

The change to use InboundCategoryProcessable maintains consistency with the updated category naming convention.

testutil/contracts/Example.go (2)

41-42: LGTM: Contract metadata updates are consistent.

The updated ABI and bytecode correctly reflect the contract's interface changes, including the new onCall method.


358-377: LGTM: OnCall method implementations are well-structured.

The new method implementations follow the standard go-ethereum binding patterns with proper error handling and type safety.

testutil/contracts/Dapp.go (2)

29-29: LGTM: Import addition aligns with go-ethereum practices.

The addition of abi.ConvertType import supports proper type handling in the contract bindings.


179-183: LGTM: Improved ABI handling in bindDapp.

The updated implementation uses the more efficient GetAbi() method and maintains consistent error handling patterns across contract bindings.

testutil/contracts/Reverter.json (1)

Line range hint 1-54: LGTM! Test contract looks well-structured.

The contract ABI is properly defined with clear parameter types and the bytecode reflects the compiled implementation.

testutil/contracts/Withdrawer.json (1)

Line range hint 1-32: LGTM! Test contract looks well-structured.

The contract ABI is properly defined with clear parameter types and the bytecode reflects the compiled implementation.

proto/zetachain/zetacore/crosschain/cross_chain_tx.proto (1)

37-38: LGTM! New status enum value is well-documented.

The addition of INVALID_RECEIVER_ADDRESS status enhances error handling for inbound transactions with invalid receiver addresses. This change is linked to issue #3435 as noted in previous reviews.

✅ Verification successful

Verified: New status enum value is correctly implemented as per issue #3435

The addition of INVALID_RECEIVER_ADDRESS status directly implements the requirement from issue #3435 to handle invalid receiver addresses in cross-chain transactions, allowing the protocol to document and revert such transactions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the linked issue exists and is related to this change.
gh issue view 3435

Length of output: 109


Script:

#!/bin/bash
# Verify issue #3435 and search for related references
gh issue view 3435
echo "---"
# Search for issue references in commit messages
git log --grep="#3435" --oneline
echo "---"
# Search for any code references to the issue number
rg -i "3435" --type-add 'proto:*.proto'

Length of output: 87320

testutil/contracts/Example.json (2)

67-111: LGTM! New function is well-defined.

The new onCall function follows consistent patterns with existing cross-chain call functions, with proper parameter types and structure.


158-158: LGTM! Bytecode update reflects the new function.

The bytecode has been properly updated to include the implementation of the new onCall function.

changelog.md (1)

Line range hint 1-24: LGTM! Changelog is well-maintained.

Changes are properly categorized and documented with clear references to pull requests. The entries align with the code changes observed in the reviewed files.

testutil/contracts/DappReverter.go (3)

35-35: LGTM: Contract bytecode updated.

The contract bytecode has been updated to reflect the latest implementation.


160-164: LGTM: Improved ABI parsing approach.

The migration from direct ABI parsing to using GetAbi() enhances maintainability and consistency.


29-29: Verify the necessity of the unused import.

The abi.ConvertType import is currently unused. If it's intended for future use, consider adding a comment explaining its purpose.

✅ Verification successful

The unused import is an expected pattern in contract bindings.

The abi.ConvertType import is part of the standard boilerplate for auto-generated Go contract bindings. While currently unused, it should be retained as it may be required in future regenerations of the contract bindings.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of ConvertType in the codebase
rg "ConvertType" -A 3 -B 3

Length of output: 86779


Script:

#!/bin/bash
# Search for ConvertType usage specifically in DappReverter.go
rg "ConvertType" testutil/contracts/DappReverter.go

Length of output: 72

testutil/contracts/Reverter.go (3)

29-29: Duplicate observation: Verify the necessity of the unused import.

Similar to DappReverter.go, the abi.ConvertType import is currently unused.


42-42: LGTM: Contract bytecode updated.

The contract bytecode has been updated to reflect the latest implementation.


167-171: LGTM: Consistent ABI parsing approach.

The migration to GetAbi() maintains consistency with other contract bindings.

@lumtis lumtis added the CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change label Jan 30, 2025
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

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

overall looks good. Left minor comment

@lumtis lumtis enabled auto-merge January 31, 2025 09:27
@lumtis lumtis added this pull request to the merge queue Jan 31, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 31, 2025
@lumtis lumtis added the UPGRADE_TESTS Run make start-upgrade-tests label Jan 31, 2025
@lumtis lumtis added this pull request to the merge queue Jan 31, 2025
Merged via the queue into develop with commit f1a9c5d Jan 31, 2025
44 checks passed
@lumtis lumtis deleted the refactor/bitcoin-contract-v2 branch January 31, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:proto CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Bitcoin with Protocol contract v2 architecture
4 participants