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

feat: detect memo in btc txn from OP_RETURN and inscription #2533

Merged
merged 50 commits into from
Aug 2, 2024

Conversation

bitSmiley
Copy link
Contributor

@bitSmiley bitSmiley commented Jul 23, 2024

Description

This is the start of a series of PRs that implements the solution mentioned in #2478. This is a follow up to #2524.

This PR integrated inscription detection into the GetBTCEvent. The key changes are:

The "inscription" is tested in mainnet through:

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Enhanced Bitcoin event processing with improved handling of witness data and memo extraction.
    • Introduced a script tokenizer for parsing Bitcoin script data, improving transaction processing capabilities.
    • Added functionality to decode specific Bitcoin envelope scripts related to inscriptions.
  • Bug Fixes

    • Improved validations to ensure correct transaction amounts and recipient addresses.
  • Tests

    • Expanded testing suite for Bitcoin event handling, including new tests for script parsing and decoding functionality.
  • Chores

    • Added two new JSON files representing sample Bitcoin transactions for testing and validation purposes.

bitSmiley and others added 15 commits July 21, 2024 23:53
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

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

The recent changes significantly enhance the processing capabilities for Bitcoin events by integrating witness data handling, improving validation checks, and expanding script parsing. The introduction of comprehensive testing ensures reliability across diverse transaction scenarios, while a new script tokenizer simplifies script parsing. Overall, these enhancements contribute to more efficient and accurate Bitcoin transaction management.

Changes

Files Change Summary
zetaclient/chains/bitcoin/observer/inbound.go, inbound_test.go Introduced new functions for processing Bitcoin events with witness data, improving validation, memo extraction, and including extensive tests for reliability.
zetaclient/chains/bitcoin/tokenizer.go Added a scriptTokenizer type to enhance parsing of Bitcoin scripts, improving overall script handling capabilities.
zetaclient/chains/bitcoin/tx_script.go, tx_script_test.go Implemented a DecodeScript function for decoding inscriptions, along with improved error handling and new tests to ensure robustness.
zetaclient/testdata/btc/chain_8332_inbound_raw_result_37777defed8717c581b4c0509329550e344bdc14ac38f71fc050096887e535c8.json, chain_8332_inbound_raw_result_7a57f987a3cb605896a5909d9ef2bf7afbf0c78f21e4118b85d00d9e4cce0c2c.json Added new JSON files that represent detailed attributes of Bitcoin transactions for enhanced testing and validation.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Observer
    participant Tokenizer
    participant TxScript

    Client->>Observer: Get BTC Event
    Observer->>Observer: Validate Transaction
    Observer->>Tokenizer: Tokenize Script
    Tokenizer->>Tokenizer: Parse Opcodes
    Tokenizer-->>Observer: Return Parsed Data
    Observer->>TxScript: Decode Script
    TxScript-->>Observer: Return Decoded Payload
    Observer-->>Client: Return BTC Inbound Event
Loading

🐰 "In the world of Bitcoin, we leap with delight,
With witness and scripts, we shine ever bright.
New functions and tests, all crafted with care,
In this dance of transactions, we hop without a care!
With every validation, our challenge we meet,
In the realm of crypto, we make our feat!" 🐇


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@bitSmiley
Copy link
Contributor Author

It seems that cross repo PR cannot be stacked on top of each other, ideally it should commit into #2524 but that branch is not found and only to develop. Maybe this PR will appear simplier when #2524 is merged.

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: 2

Outside diff range, codebase verification and nitpick comments (1)
zetaclient/chains/bitcoin/tokenizer.go (1)

67-155: Parsing logic looks good, but consider improving error messages.

The function correctly handles various opcodes and data pushes. However, the error messages could be more descriptive.

- t.err = fmt.Errorf("unexpected op code %d", op)
+ t.err = fmt.Errorf("unexpected opcode %d at offset %d", op, t.offset)
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f52da7c and bc349f1.

Files selected for processing (6)
  • zetaclient/chains/bitcoin/observer/inbound.go (1 hunks)
  • zetaclient/chains/bitcoin/observer/inbound_test.go (1 hunks)
  • zetaclient/chains/bitcoin/tokenizer.go (1 hunks)
  • zetaclient/chains/bitcoin/tx_script.go (2 hunks)
  • zetaclient/chains/bitcoin/tx_script_test.go (1 hunks)
  • zetaclient/testdata/btc/chain_8332_inbound_raw_result_37777defed8717c581b4c0509329550e344bdc14ac38f71fc050096887e535c8.json (1 hunks)
Files skipped from review due to trivial changes (1)
  • zetaclient/testdata/btc/chain_8332_inbound_raw_result_37777defed8717c581b4c0509329550e344bdc14ac38f71fc050096887e535c8.json
Additional context used
Path-based instructions (5)
zetaclient/chains/bitcoin/tokenizer.go (1)

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

zetaclient/chains/bitcoin/tx_script.go (1)

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

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

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

zetaclient/chains/bitcoin/tx_script_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/inbound_test.go (1)

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

Learnings (2)
zetaclient/chains/bitcoin/tx_script.go (1)
Learnt from: lumtis
PR: zeta-chain/node#2524
File: zetaclient/chains/bitcoin/tx_script.go:280-324
Timestamp: 2024-07-22T10:48:05.549Z
Learning: Refactor loop structures in Go code for better readability by using the `for t.Next()` pattern instead of a `for { if !t.Next() { ... } }` pattern where applicable.
zetaclient/chains/bitcoin/observer/inbound_test.go (1)
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The `CreateSignerObserverBTC` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.
Gitleaks
zetaclient/chains/bitcoin/observer/inbound_test.go

626-626: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (18)
zetaclient/chains/bitcoin/tokenizer.go (4)

9-14: Initialization looks good.

The function correctly initializes the scriptTokenizer struct.


20-49: Struct and accessors look good.

The scriptTokenizer struct and its accessor methods are implemented correctly.


103-153: Handling of OP_PUSHDATA opcodes looks good.

The function correctly parses the length of the data for OP_PUSHDATA opcodes.


139-147: Data length validation looks good.

The function correctly validates the length of the data to ensure it fits within the script.

zetaclient/chains/bitcoin/tx_script.go (5)

210-223: Decoding logic looks good.

The function correctly uses the scriptTokenizer to parse the script and decode the memo. Error handling is also implemented.


306-318: Envelope validation looks good.

The function correctly validates the opcodes in the envelope.


195-209: OP_RETURN decoding logic looks good.

The function correctly handles the OP_RETURN script and decodes the memo. Error handling is also implemented.


Line range hint 224-278:
Decoding logic looks good.

The function correctly decodes the receiver and amount. Error handling is also implemented.


Line range hint 224-278:
Address encoding logic looks good.

The function correctly encodes the address. The implementation is straightforward.

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

476-534: Event processing logic looks good.

The function correctly handles the validation and extraction of memo data from the transaction. Error handling is also implemented.


536-553: OP_RETURN extraction logic looks good.

The function correctly handles the extraction of memo data from OP_RETURN outputs. Error handling is also implemented.


555-592: Witness script parsing logic looks good.

The function correctly handles the parsing of the script from the witness data. Error handling is also implemented.


594-614: Inscription extraction logic looks good.

The function correctly handles the extraction of memo data from the witness data. Error handling is also implemented.


616-624: Amount validation logic looks good.

The function correctly validates the transaction amount. The implementation is straightforward.


626-644: Recipient validation logic looks good.

The function correctly validates the recipient address. Error handling is also implemented.

zetaclient/chains/bitcoin/tx_script_test.go (1)

495-495: LGTM!

The new test function TestDecodeScript is well-structured and covers various scenarios, including valid and invalid cases.

zetaclient/chains/bitcoin/observer/inbound_test.go (2)

533-533: LGTM!

The new test function TestParseScriptFromWitness is well-structured and covers various scenarios, including valid and invalid cases.


562-562: LGTM!

The expanded function TestGetBtcEventFromInscription is well-structured and covers various scenarios, including valid and invalid cases.

zetaclient/chains/bitcoin/observer/inbound_test.go Outdated Show resolved Hide resolved
zetaclient/chains/bitcoin/tx_script.go Outdated Show resolved Hide resolved
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: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bc349f1 and 46ceef9.

Files selected for processing (2)
  • zetaclient/chains/bitcoin/observer/inbound_test.go (1 hunks)
  • zetaclient/testdata/btc/chain_8332_inbound_raw_result_7a57f987a3cb605896a5909d9ef2bf7afbf0c78f21e4118b85d00d9e4cce0c2c.json (1 hunks)
Additional context used
Path-based instructions (1)
zetaclient/chains/bitcoin/observer/inbound_test.go (1)

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

Gitleaks
zetaclient/chains/bitcoin/observer/inbound_test.go

652-652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

Additional comments not posted (19)
zetaclient/testdata/btc/chain_8332_inbound_raw_result_7a57f987a3cb605896a5909d9ef2bf7afbf0c78f21e4118b85d00d9e4cce0c2c.json (1)

1-32: The JSON structure looks correct.

The JSON file appears to be well-formed and contains all necessary fields for a Bitcoin transaction.

zetaclient/chains/bitcoin/observer/inbound_test.go (18)

533-545: Good test coverage for ParseScriptFromWitness.

The sub-test "decode script ok" correctly tests the decoding of a valid script from witness data.


547-551: Valid test case for empty witness.

The sub-test "no witness" correctly handles the case where the witness array is empty.


553-559: Valid test case for ignoring key spending path.

The sub-test "ignore key spending path" correctly handles the case where the witness data is for a key spending path.


562-599: Good test coverage for decoding OP_RETURN.

The sub-test "decode OP_RETURN ok" correctly tests the decoding of OP_RETURN scripts and the generation of the expected event.


601-621: Good test coverage for decoding inscriptions.

The sub-test "decode inscription ok" correctly tests the decoding of inscriptions and the generation of the expected event.


623-647: Good test coverage for decoding inscriptions on mainnet.

The sub-test "decode inscription ok - mainnet" correctly tests the decoding of inscriptions on mainnet and the generation of the expected event.


649-659: Valid test case for non-TSS receiver address.

The sub-test "should skip tx if receiver address is not TSS address" correctly handles the case where the receiver address is not a TSS address.

Tools
Gitleaks

652-652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


661-671: Valid test case for amount less than depositor fee.

The sub-test "should skip tx if amount is less than depositor fee" correctly handles the case where the transaction amount is less than the depositor fee.


673-682: Valid test case for RPC client failure.

The sub-test "should return error if RPC client fails to get raw tx" correctly handles the case where the RPC client fails to retrieve the raw transaction.


Line range hint 474-494:
Good test coverage for P2TR sender address.

The sub-test "should get sender address from P2TR tx" correctly tests the retrieval of the sender address from a P2TR transaction.

Tools
Gitleaks

652-652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


Line range hint 496-516:
Good test coverage for P2WSH sender address.

The sub-test "should get sender address from P2WSH tx" correctly tests the retrieval of the sender address from a P2WSH transaction.

Tools
Gitleaks

652-652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


Line range hint 518-538:
Good test coverage for P2WPKH sender address.

The sub-test "should get sender address from P2WPKH tx" correctly tests the retrieval of the sender address from a P2WPKH transaction.

Tools
Gitleaks

652-652: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


540-560: Good test coverage for P2SH sender address.

The sub-test "should get sender address from P2SH tx" correctly tests the retrieval of the sender address from a P2SH transaction.


562-582: Good test coverage for P2PKH sender address.

The sub-test "should get sender address from P2PKH tx" correctly tests the retrieval of the sender address from a P2PKH transaction.


584-604: Valid test case for unknown script.

The sub-test "should get empty sender address on unknown script" correctly handles the case where the script is unknown.


606-612: Valid test case for invalid tx hash.

The sub-test "should get sender address from P2TR tx" correctly handles the case where the transaction hash is invalid.


614-620: Valid test case for RPC client failure.

The sub-test "should return error when RPC client fails to get raw tx" correctly handles the case where the RPC client fails to retrieve the raw transaction.


622-628: Valid test case for invalid output index.

The sub-test "should return error on invalid output index" correctly handles the case where the output index is invalid.

zetaclient/chains/bitcoin/observer/inbound_test.go Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 46ceef9 and 4467e13.

Files selected for processing (1)
  • zetaclient/chains/bitcoin/tx_script.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • zetaclient/chains/bitcoin/tx_script.go

@lumtis
Copy link
Member

lumtis commented Jul 25, 2024

It seems that cross repo PR cannot be stacked on top of each other, ideally it should commit into #2524 but that branch is not found and only to develop. Maybe this PR will appear simplier when #2524 is merged.

Can we address this #2524 (review) for the other PR? Otherwise the change looks good to me. Thanks for the contribution

zetaclient/chains/bitcoin/observer/inbound.go Outdated Show resolved Hide resolved
zetaclient/chains/bitcoin/observer/inbound.go Outdated Show resolved Hide resolved
zetaclient/chains/bitcoin/observer/inbound.go Outdated Show resolved Hide resolved
zetaclient/chains/bitcoin/observer/inbound.go Outdated Show resolved Hide resolved
zetaclient/chains/bitcoin/observer/inbound.go Outdated Show resolved Hide resolved
bitSmiley and others added 2 commits July 31, 2024 10:37
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
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

Outside diff range, codebase verification and nitpick comments (21)
zetaclient/chains/bitcoin/observer/inbound.go (21)

476-478: Add documentation for the function.

The function GetBtcEventWithWitness lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// GetBtcEventWithWitness either returns a valid BTCInboundEvent or nil.
// This method supports data with more than 80 bytes by scanning the witness for possible presence of a tapscript.
// It will first prioritize OP_RETURN over tapscript.

488-490: Improve logging level.

The debug log message "no output" might be more useful at the info level to provide better visibility into why the function returns nil.

logger.Info().Msgf("no output %s", tx.Txid)

492-494: Improve logging level.

The debug log message "no input found for inbound" might be more useful at the info level to provide better visibility into why the function returns nil.

logger.Info().Msgf("no input found for inbound: %s", tx.Txid)

497-499: Clarify logging message.

The message "irrelevant recipient" could be more descriptive to provide better context.

logger.Debug().Msgf("irrelevant recipient %s for inbound transaction: %s", tx.Vout[0].ScriptPubKey.Hex, tx.Txid)

502-507: Clarify logging message.

The message "btc deposit amount is less than depositor fee" could be more descriptive to provide better context.

logger.Info().Msgf("GetBtcEventWithWitness: btc deposit amount %v in txid %s is less than the required depositor fee %v", tx.Vout[0].Value, tx.Txid, depositorFee)

509-518: Add comments to explain the memo extraction logic.

Adding comments to explain the logic behind extracting OP_RETURN and inscription memos would improve readability.

// Try to extract OP_RETURN memo
if candidate := tryExtractOpRet(tx, logger); candidate != nil {
    memo = candidate
    logger.Debug().Msgf("GetBtcEventWithWitness: found OP_RETURN memo %s in tx %s", hex.EncodeToString(memo), tx.Txid)
} else if candidate = tryExtractInscription(tx, logger); candidate != nil {
    // Try to extract inscription memo
    memo = candidate
    logger.Debug().Msgf("GetBtcEventWithWitness: found inscription memo %s in tx %s", hex.EncodeToString(memo), tx.Txid)
} else {
    return nil, nil
}

536-536: Add documentation for the function.

The function tryExtractOpRet lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// tryExtractOpRet extracts OP_RETURN data from the transaction outputs.

537-539: Improve logging level.

The debug log message "txn has fewer than 2 outputs" might be more useful at the info level to provide better visibility into why the function returns nil.

logger.Info().Msgf("txn %s has fewer than 2 outputs, not target OP_RETURN txn", tx.Txid)

543-545: Clarify logging message.

The message "error decoding OP_RETURN memo" could be more descriptive to provide better context.

logger.Error().Err(err).Msgf("tryExtractOpRet: error decoding OP_RETURN memo in transaction %s: %s", tx.Txid, tx.Vout[1].ScriptPubKey.Hex)

554-556: Add documentation for the function.

The function ParseScriptFromWitness lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// ParseScriptFromWitness attempts to parse the script from the witness data. Ideally it should be handled by
// a bitcoin library; however, it's not found in the existing library version. Replace this with an actual library implementation
// if libraries are updated.

560-562: Improve logging level.

The debug log message "invalid witness element" might be more useful at the info level to provide better visibility into why the function returns nil.

logger.Info().Msgf("invalid witness element")

579-581: Clarify logging message.

The message "not script path spending detected, ignore" could be more descriptive to provide better context.

logger.Debug().Msgf("not script path spending detected, ignoring transaction")

586-588: Clarify logging message.

The message "witness script cannot be decoded from hex, ignore" could be more descriptive to provide better context.

logger.Debug().Msgf("witness script cannot be decoded from hex, ignoring transaction")

593-593: Add documentation for the function.

The function tryExtractInscription lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// tryExtractInscription parses the witness data to find potential inscription scripts.

600-601: Add comments to explain the memo extraction logic.

Adding comments to explain the logic behind extracting memos from witness scripts would improve readability.

logger.Debug().Msgf("potential witness script, tx %s, input idx %d", tx.Txid, i)

604-606: Clarify logging message.

The message "invalid witness script" could be more descriptive to provide better context.

logger.Debug().Msgf("invalid witness script, tx %s, input idx %d", tx.Txid, i)

608-609: Clarify logging message.

The message "found memo in inscription" could be more descriptive to provide better context.

logger.Debug().Msgf("found memo in inscription, tx %s, input idx %d", tx.Txid, i)

615-615: Add documentation for the function.

The function isValidAmount lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// isValidAmount validates the incoming amount against a minimal value and returns a boolean indicating validity and the adjusted amount.

625-625: Add documentation for the function.

The function isValidRecipient lacks detailed documentation. Adding comments to explain the purpose and logic of the function would improve readability.

// isValidRecipient validates the recipient address against the expected TSS address.

633-634: Clarify logging message.

The message "invalid p2wpkh script detected" could be more descriptive to provide better context.

logger.Debug().Msgf("invalid p2wpkh script detected: %s", err)

639-640: Clarify logging message.

The message "irrelevant recipient" could be more descriptive to provide better context.

logger.Debug().Msgf("irrelevant recipient: %s", receiver)
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4467e13 and 1b9187d.

Files selected for processing (1)
  • zetaclient/chains/bitcoin/observer/inbound.go (1 hunks)
Additional context used
Path-based instructions (1)
zetaclient/chains/bitcoin/observer/inbound.go (1)

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

@bitSmiley
Copy link
Contributor Author

@lumtis @fbac I have updated accordingly, please help take a look.

@bitSmiley bitSmiley requested review from lumtis and fbac July 31, 2024 04:34
@fbac
Copy link
Contributor

fbac commented Jul 31, 2024

Please do not forget that this branch has to be updated and requires resolving the conflicts.

@bitSmiley
Copy link
Contributor Author

@fbac The conflicts are resolved, should be ok now.

@fbac
Copy link
Contributor

fbac commented Aug 1, 2024

Thanks @bitSmiley, LGTM. ;)

@fbac
Copy link
Contributor

fbac commented Aug 1, 2024

@bitSmiley Seems like there is some cleaning up to do yet, when the PR passes all the CI we can merge it.

@lumtis lumtis added this pull request to the merge queue Aug 2, 2024
Merged via the queue into zeta-chain:develop with commit 65ff18f Aug 2, 2024
20 checks passed
lumtis pushed a commit that referenced this pull request Aug 6, 2024
* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* clean up

* format code

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
gartnera pushed a commit that referenced this pull request Aug 15, 2024
* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* clean up

* format code

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
gartnera added a commit that referenced this pull request Aug 16, 2024
* feat: parse inscription like witness data (#2524)

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

fix version

* feat: detect memo in btc txn from OP_RETURN and inscription (#2533)

* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* clean up

* format code

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* refactor(zetaclient)!: improve AppContext (#2568)

* Implement chain registry

* Rewrite test-cases for AppContext

* Drop `supplychecker`

* Refactor app ctx Update worker

* Refactor orchestrator

* Refactor observer&signer; DROP postBlockHeaders

* Fix test cases [1]

* Update changelog

* Allow Zeta Chain in appContext; address PR comments [1]

* Fix app context update

* Check for `chain.IsZeta()`

* Add AppContext.FilterChains

* Fix test cases [2]

* Fix test cases [3]

* Address PR comments [1]

* Address PR comments [2]

* Add tests for `slices`

* Fix e2e tests [1]

* Fix e2e tests [2]

* Resolve conflicts, converge codebase between PRs

* Add lodash; remove slices pkg

* Address PR comments

* Minor logging fix

* Address PR comments

tmp

* feat(zetaclient): add generic rpc metrics (#2597)

* feat(zetaclient): add generic rpc metrics

* feedback

* changelog

* fmt

* fix(zetaclient): use name in pending tx metric (#2642)

* feat(pkg): add `ticker` package (#2617)

* Add `pkg/ticker`

* Sample ticker usage in evm observer

* Change naming

* Address PR comments

* Address PR comments

* feat(zetaclient)!: Add support for EIP-1559 gas fees (#2634)

* Add Gas struct

* Add EIP-1559 fees

* Update changelog

* Add test cases for legacy vs dynamicFee txs

* Fix typo; Add E2E coverage

* Address PR comments

* Address PR comments

* Use gasFeeCap formula

* Revert "Use gasFeeCap formula"

This reverts commit 2260925.

* Address PR comments

* Fix e2e upgrade tests

* fix: adjust evm outbound tracker reporter to avoid submitting invalid hashes (#2628)

* refactor and fix evm outbound tracker reporter to avoid invalid hashes; print log when outbound tracker is full of invalid hashes

* add changelog entry

* used predefined log fields

* remove repeated fields information from log message; Devops team would configure Datadog to show the fields

* remove redundant fields in log message; unified logs

* remove pending transaction map from observer; the outbound tracker reporter will no longer report pending hash

* use bg.Work() to launch outbound tracker reporter goroutines

* bring the checking EnsureNoTrackers() back

* add more rationale to EVM outbound tracker submission

* sync observer and signers without wait on startup

* try fixing tss migration E2E failure by increase timeout

* feat: Solana relayer (fee payer) key importer, encryption and decryption (#2673)

* configure observer relayer key for Solana; remove hardcoded solana test key from zetaclient code

* implementation of relayer key importer, encryption and decryption

* integrate relayer key into E2E and Solana signer

* add relayer_key_balance metrics and unit tests

* use TrimSpace to trim password

* add changelog entry

* use relayer account array in E2E config; a few renaming; add private key validation when importing

* fix linter

* remove GetNetworkName method for simplification

* added PromptPassword method to prompt single password

* use network name as map index to store relayer key passwords

* moved relayer passwords to chain registry

* airdrop SOL token only if solana local node is available

---------

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* ci: Set Docker Workflow to use Go 1.22 (#2722)

* Set go 1.22.2

* Set go 1.22.2

* Set go 1.22

* Set go 1.22

* Refactor contrib/rpc and contrib/docker-scripts to use snapshots API (#2724)

Co-authored-by: Julian Rubino <julian@zetachain.com>

---------

Co-authored-by: dev-bitSmiley <153714963+bitSmiley@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Co-authored-by: Charlie <31941002+CharlieMc0@users.noreply.github.com>
Co-authored-by: Julian Rubino <julian.rubino0@gmail.com>
Co-authored-by: Julian Rubino <julian@zetachain.com>
github-merge-queue bot pushed a commit that referenced this pull request Aug 19, 2024
* update protocol contracts package

* update config and runner

* init contract deploy

* add erc1967proxy in contracts

* fix gateway evm deploy

* zevm setuip

* format

* update version

* update v1 import path

* reorganize import v2

* fix import

* update new version

* add custody setup

* feat(E2E): add body for smart contract V2 tests (#2609)

* add runner for v2

* implement helper function

* add test bodies

* add makefile entry

* import

* update system contracts

* feat: implement gas token deposit with protocol contract v2 (#2616)

* add protocol contract version in cctx

* read deposit from ZetaClient

* deposit gas token

* run deposit

* add tests

* add event check

* add workflow for test

* put error handling higher level ObserverGateway

* add named interface

* feat: withdraw SOL from ZEVM to Solana (#2560)

* port Panruo's outbound code and make compile pass

* make SOL withdraw e2e test passing

* make solana outbound tracker goroutine working

* allow solana gateway address to update

* integrate sub methods of SignMsgWithdraw and SignWithdrawTx

* initiate solana outbound tracker reporter

* implemented solana outbound tx verification

* use the amount in tx result for outbound vote

* post Solana priority fee to zetacore

* config Solana fee payer private key

* resolve 1st wave of comments in PR review

* resolve 2nd wave of comments

* refactor IsOutboundProcessed as VoteOutboundIfConfirmed; move outbound tracker iteration logic into ProcessOutboundTrackers sub method

* resolve 3rd wave of PR feedback

* added description to explain what do we do about the outbound tracker txHash

* add additional error message; add additional method comment

* fix gosec err

* replace contex.TODO() with context.Background()

* feat: detect memo in btc txn from OP_RETURN and inscription (#2533)

* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* clean up

* format code

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* refactor(zetaclient)!: improve AppContext (#2568)

* Implement chain registry

* Rewrite test-cases for AppContext

* Drop `supplychecker`

* Refactor app ctx Update worker

* Refactor orchestrator

* Refactor observer&signer; DROP postBlockHeaders

* Fix test cases [1]

* Update changelog

* Allow Zeta Chain in appContext; address PR comments [1]

* Fix app context update

* Check for `chain.IsZeta()`

* Add AppContext.FilterChains

* Fix test cases [2]

* Fix test cases [3]

* Address PR comments [1]

* Address PR comments [2]

* Add tests for `slices`

* Fix e2e tests [1]

* Fix e2e tests [2]

* Resolve conflicts, converge codebase between PRs

* Add lodash; remove slices pkg

* Address PR comments

* Minor logging fix

* Address PR comments

* fix(`crosschain`): set sender for ERC20 whitelist admin CCTX inbound (#2631)

* fix whitelist sender

* add E2E test

* fix(ci): Update golang cross compile to 1.22.4 (#2635)

* Update golang cross compile to 1.22.4

* update deprecated --skip-validate --skip-release flags

* Added goreleaser check (#2636)

* update solidity version

* feat: integrate Smart Contract V2 `depositAndCall` for ETH and ERC20 (#2639)

* add testdapp v2

* update ZRC20 version

* initialize deposit and call

* add deposit and call

* implement E2E test

* move contracts

* fix evm deploy ZRC20

* deposit and call local test

* complete deposit and call test

* add support for E2E tests

* comments

* fix unit tests

* feat: support withdraws, calls and reverts with Gateway contract (#2666)

* add v2 zevm inbound

* refactor abi in signers

* outbound for gas withdraw

* fix withdraw

* gateway execute parse

* add support for withdraw and call

* erc20 withdraw and withdraw and call

* implement erc20 withdraw e2e tests

* test withdraw and call

* reading inbound for no assset call

* simple call implementation

* initialize revert

* fix the tests

* upgrade smart contracts to latest version

* small fix smart contract call

* revert tests skeleton

* fix test

* implement revert tests

* add revert support

* fix revert tests

* make generate

* add support for revert gas limit

* fix tests

* add liquidity test

* fix liquidity test

* Update proto/zetachain/zetacore/pkg/coin/coin.proto

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update x/crosschain/types/revert_options.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update x/crosschain/types/revert_options.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Borja comments

* Stefan comments

* dmitry review

* fix unit tests

---------

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* changelogs

* fix unit test

* tentative fix for upgrade

* fix gateway zero address

* fix admin test

* add back admin tests

* v2 conditional matric

---------

Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Co-authored-by: dev-bitSmiley <153714963+bitSmiley@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
Co-authored-by: Christopher Fuka <97121270+CryptoFewka@users.noreply.github.com>
Co-authored-by: Charlie <31941002+CharlieMc0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants