test: make Bitcoin inscription based depositAndCall compatible for live network#4040
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThis update refactors several Bitcoin and Ethereum end-to-end (E2E) tests, focusing on improved payload handling, dynamic fee estimation, and more robust transaction confirmation logic. The Bitcoin E2E runner’s transaction confirmation is now polling-based, and test contracts are replaced with predefined DApp addresses. Changelog and test documentation are updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Test as E2E Test
participant Runner as E2ERunner
participant BTCNode as Bitcoin Node
participant ZEVM as ZEVM Chain
Test->>Runner: Initiate BTC deposit/inscription with memo
Runner->>BTCNode: Send BTC transaction
Runner->>BTCNode: WaitForTxInclusion (polling)
BTCNode-->>Runner: Return TxRawResult after inclusion
Runner->>ZEVM: Wait for CCTX mined
ZEVM-->>Runner: Confirm DApp called with payload and amount
Runner-->>Test: Assert balance and payload delivery
Estimated code review effort4 (~90 minutes)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4040 +/- ##
========================================
Coverage 64.94% 64.94%
========================================
Files 475 475
Lines 35139 35142 +3
========================================
+ Hits 22821 22823 +2
Misses 11245 11245
- Partials 1073 1074 +1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
e2e/e2etests/helpers.go (2)
20-20: Clarify that the function returns a hex-encoded string.The comment should explicitly mention that the returned string is hex-encoded to avoid confusion.
-// randomPayloadWithSize generates a random payload string containing exactly 'size' characters +// randomPayloadWithSize generates a random hex-encoded string containing exactly 'size' characters
27-50: Simplify the implementation for better readability.The current implementation handles even and odd sizes separately, but this can be simplified while maintaining the same functionality.
- var ( - bytes []byte - even = size%2 == 0 - ) - - // the size will double when converting to hex string, so we just need half the size - if even { - bytes = make([]byte, size/2) - } else { - // add 1 more byte if size is odd, we trim it later - bytes = make([]byte, (size/2)+1) - } - - // generate random bytes + // hex encoding doubles the size, so we need ceil(size/2) bytes + bytes := make([]byte, (size+1)/2) _, err := rand.Read(bytes) require.NoError(r, err) - // hex encode the bytes, the size is double - if even { - return hex.EncodeToString(bytes) - } - - // trim the last letter to fit the odd size - return hex.EncodeToString(bytes)[:size] + // hex encode and trim to exact size + return hex.EncodeToString(bytes)[:size]e2e/runner/bitcoin.go (2)
491-491: Fix typo in comment.- // error may occue if the tx is not yet included + // error may occur if the tx is not yet included
506-509: Consider documenting the mempool acceptance rationale.The comment mentions accepting 0 confirmations (mempool transactions) is sufficient. While this is reasonable for E2E tests, consider adding a brief explanation about why this is safe in this context.
// as far as tx gets into the mempool (0 confirmations), we consider it included // there's no need to wait for 1 block to be able to send out subsequent transactions + // This is safe for E2E tests as we control the test environment and transaction ordering
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
changelog.md(1 hunks)e2e/e2etests/e2etests.go(0 hunks)e2e/e2etests/helpers.go(1 hunks)e2e/e2etests/test_bitcoin_deposit_call.go(2 hunks)e2e/e2etests/test_bitcoin_std_deposit_and_call.go(1 hunks)e2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.go(2 hunks)e2e/e2etests/test_bitcoin_withdraw_rbf.go(1 hunks)e2e/e2etests/test_eth_deposit_and_call_big_payload.go(1 hunks)e2e/e2etests/test_eth_withdraw_and_call_big_payload.go(1 hunks)e2e/runner/bitcoin.go(4 hunks)zetaclient/chains/bitcoin/observer/utxos.go(1 hunks)
📓 Path-based instructions (1)
**/*.go
⚙️ CodeRabbit Configuration File
Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
Files:
e2e/e2etests/test_eth_deposit_and_call_big_payload.goe2e/e2etests/test_bitcoin_withdraw_rbf.goe2e/e2etests/test_eth_withdraw_and_call_big_payload.gozetaclient/chains/bitcoin/observer/utxos.goe2e/e2etests/helpers.goe2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.goe2e/e2etests/test_bitcoin_std_deposit_and_call.goe2e/runner/bitcoin.goe2e/e2etests/test_bitcoin_deposit_call.go
🧠 Learnings (11)
📓 Common learnings
Learnt from: gartnera
PR: zeta-chain/node#3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like `cmd/zetae2e/init.go` in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: skosito
PR: zeta-chain/node#3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.
Learnt from: gartnera
PR: zeta-chain/node#3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
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`.
Learnt from: ws4charlie
PR: zeta-chain/node#2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The `bitcoin.CalcDepositorFee` function is covered by live tests.
Learnt from: ws4charlie
PR: zeta-chain/node#2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., `IsUTXO()` to `IsBitcoin()`), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: zeta-chain/node#3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in `zetaclient/orchestrator/orchestrator.go`, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: ws4charlie
PR: zeta-chain/node#4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: lumtis
PR: zeta-chain/node#2459
File: e2e/config/config.go:285-293
Timestamp: 2024-07-11T13:10:39.153Z
Learning: Tests should not be suggested in the `e2e` package for the `zeta-chain/node` repository.
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`.
Learnt from: kingpinXD
PR: zeta-chain/node#3503
File: e2e/runner/require.go:0-0
Timestamp: 2025-02-07T19:33:35.631Z
Learning: In e2e tests for the zeta-chain/node repository, minimize computation and avoid redundant checks that are already covered by unit tests to ensure faster execution. For example, ballot sorting is verified in unit tests, so e2e tests can safely assume the order.
Learnt from: gartnera
PR: zeta-chain/node#3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file `e2e/e2etests/test_pause_erc20_custody.go`, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
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`.
e2e/e2etests/test_eth_deposit_and_call_big_payload.go (9)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
e2e/e2etests/test_bitcoin_withdraw_rbf.go (11)
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:58-59
Timestamp: 2024-10-31T16:19:26.038Z
Learning: In the Go code within e2e/utils/zetacore.go, the function WaitCctxMinedByInboundHash does not return an error.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
e2e/e2etests/test_eth_withdraw_and_call_big_payload.go (10)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
changelog.md (7)
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: skosito
PR: #3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: kingpinXD
PR: #3503
File: e2e/runner/require.go:0-0
Timestamp: 2025-02-07T19:33:35.631Z
Learning: In e2e tests for the zeta-chain/node repository, minimize computation and avoid redundant checks that are already covered by unit tests to ensure faster execution. For example, ballot sorting is verified in unit tests, so e2e tests can safely assume the order.
Learnt from: lumtis
PR: #2459
File: e2e/config/config.go:285-293
Timestamp: 2024-07-11T13:10:39.153Z
Learning: Tests should not be suggested in the e2e package for the zeta-chain/node repository.
zetaclient/chains/bitcoin/observer/utxos.go (10)
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/observer/db.go:11-25
Timestamp: 2025-01-14T00:09:01.416Z
Learning: In Bitcoin observer, non-critical DB operations (like saving broadcasted transactions) should log errors but not return them to callers, as the errors are already handled appropriately through logging and don't affect the critical in-memory state.
Learnt from: gartnera
PR: #3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in zetaclient/orchestrator/orchestrator.go, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:43-43
Timestamp: 2025-01-13T23:25:05.336Z
Learning: In the Bitcoin implementation, UTXO amounts are represented as float64 to maintain compatibility with Bitcoin Core's JSON-RPC interface through btcd's ListUnspentResult struct, even though integer arithmetic would typically be preferred for cryptocurrency amounts.
Learnt from: ws4charlie
PR: #3381
File: zetaclient/chains/bitcoin/signer/outbound_data.go:29-29
Timestamp: 2025-01-21T04:34:47.335Z
Learning: In Bitcoin UTXO handling code, float64 must be used for amount fields as it's required by Bitcoin's RPC interface (btcd/btcjson.ListUnspentResult). While floating-point is generally avoided for monetary calculations, Bitcoin's RPC represents amounts in BTC as float64 values, making it a necessary exception in UTXO-related code.
e2e/e2etests/helpers.go (3)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
e2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.go (13)
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: ws4charlie
PR: #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.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The CreateSignerObserverEVM function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.
Learnt from: fbac
PR: #2979
File: x/fungible/keeper/zrc20_unlock_token.go:69-72
Timestamp: 2024-10-08T14:57:52.954Z
Learning: In x/fungible/keeper/zrc20_unlock_token.go, when performing type assertions like transferred, ok := ret[0].(bool), using the ok check is sufficient to prevent panics, and additional type handling is not required.
e2e/e2etests/test_bitcoin_std_deposit_and_call.go (13)
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #3381
File: zetaclient/chains/bitcoin/signer/outbound_data.go:29-29
Timestamp: 2025-01-21T04:34:47.335Z
Learning: In Bitcoin UTXO handling code, float64 must be used for amount fields as it's required by Bitcoin's RPC interface (btcd/btcjson.ListUnspentResult). While floating-point is generally avoided for monetary calculations, Bitcoin's RPC represents amounts in BTC as float64 values, making it a necessary exception in UTXO-related code.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:108-109
Timestamp: 2024-10-10T19:00:07.093Z
Learning: In testutil/sample/memo.go, BigEndian is used for ABI encoding functions, consistent with ABI specifications, whereas LittleEndian is used in compact encoding functions as appropriate.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
e2e/runner/bitcoin.go (17)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/observer/outbound.go:28-32
Timestamp: 2025-01-13T23:51:09.334Z
Learning: In Bitcoin observer, minTxConfirmations is set to 0 to allow observing mempool transactions without waiting for block confirmations, which is necessary due to Bitcoin's 10-minute block time. This is a deliberate design choice despite potential security implications, as other safety checks are in place through TSS validation.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:58-59
Timestamp: 2024-10-31T16:19:26.038Z
Learning: In the Go code within e2e/utils/zetacore.go, the function WaitCctxMinedByInboundHash does not return an error.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the e2e codebase, it's acceptable to use github.com/stretchr/testify/require outside of test files.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: gartnera
PR: #3395
File: .github/workflows/reusable-sim.yml:29-30
Timestamp: 2025-01-22T22:46:58.820Z
Learning: The zeta-chain/node repository uses Go version >= 1.22. Do not suggest downgrading to earlier versions like 1.21.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
e2e/e2etests/test_bitcoin_deposit_call.go (15)
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #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.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the e2e codebase, it's acceptable to use github.com/stretchr/testify/require outside of test files.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The CreateSignerObserverEVM function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
💤 Files with no reviewable changes (1)
- e2e/e2etests/e2etests.go
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go
⚙️ CodeRabbit Configuration File
Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
Files:
e2e/e2etests/test_eth_deposit_and_call_big_payload.goe2e/e2etests/test_bitcoin_withdraw_rbf.goe2e/e2etests/test_eth_withdraw_and_call_big_payload.gozetaclient/chains/bitcoin/observer/utxos.goe2e/e2etests/helpers.goe2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.goe2e/e2etests/test_bitcoin_std_deposit_and_call.goe2e/runner/bitcoin.goe2e/e2etests/test_bitcoin_deposit_call.go
🧠 Learnings (11)
📓 Common learnings
Learnt from: gartnera
PR: zeta-chain/node#3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like `cmd/zetae2e/init.go` in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: skosito
PR: zeta-chain/node#3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.
Learnt from: gartnera
PR: zeta-chain/node#3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
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`.
Learnt from: ws4charlie
PR: zeta-chain/node#2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The `bitcoin.CalcDepositorFee` function is covered by live tests.
Learnt from: ws4charlie
PR: zeta-chain/node#2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., `IsUTXO()` to `IsBitcoin()`), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: zeta-chain/node#3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in `zetaclient/orchestrator/orchestrator.go`, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: ws4charlie
PR: zeta-chain/node#4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: lumtis
PR: zeta-chain/node#2459
File: e2e/config/config.go:285-293
Timestamp: 2024-07-11T13:10:39.153Z
Learning: Tests should not be suggested in the `e2e` package for the `zeta-chain/node` repository.
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`.
Learnt from: kingpinXD
PR: zeta-chain/node#3503
File: e2e/runner/require.go:0-0
Timestamp: 2025-02-07T19:33:35.631Z
Learning: In e2e tests for the zeta-chain/node repository, minimize computation and avoid redundant checks that are already covered by unit tests to ensure faster execution. For example, ballot sorting is verified in unit tests, so e2e tests can safely assume the order.
Learnt from: gartnera
PR: zeta-chain/node#3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file `e2e/e2etests/test_pause_erc20_custody.go`, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
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`.
e2e/e2etests/test_eth_deposit_and_call_big_payload.go (9)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
e2e/e2etests/test_bitcoin_withdraw_rbf.go (11)
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:58-59
Timestamp: 2024-10-31T16:19:26.038Z
Learning: In the Go code within e2e/utils/zetacore.go, the function WaitCctxMinedByInboundHash does not return an error.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
e2e/e2etests/test_eth_withdraw_and_call_big_payload.go (10)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
changelog.md (7)
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: skosito
PR: #3939
File: go.mod:52-52
Timestamp: 2025-05-30T16:31:30.275Z
Learning: The ethermint dependency updates in the zeta-chain/node repository are typically moves between feature branches and main branch of the same fork, not breaking API changes. CI status should be verified before assuming compilation issues.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: kingpinXD
PR: #3503
File: e2e/runner/require.go:0-0
Timestamp: 2025-02-07T19:33:35.631Z
Learning: In e2e tests for the zeta-chain/node repository, minimize computation and avoid redundant checks that are already covered by unit tests to ensure faster execution. For example, ballot sorting is verified in unit tests, so e2e tests can safely assume the order.
Learnt from: lumtis
PR: #2459
File: e2e/config/config.go:285-293
Timestamp: 2024-07-11T13:10:39.153Z
Learning: Tests should not be suggested in the e2e package for the zeta-chain/node repository.
zetaclient/chains/bitcoin/observer/utxos.go (10)
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/observer/db.go:11-25
Timestamp: 2025-01-14T00:09:01.416Z
Learning: In Bitcoin observer, non-critical DB operations (like saving broadcasted transactions) should log errors but not return them to callers, as the errors are already handled appropriately through logging and don't affect the critical in-memory state.
Learnt from: gartnera
PR: #3228
File: zetaclient/orchestrator/orchestrator.go:388-401
Timestamp: 2024-11-27T22:01:49.732Z
Learning: When reviewing code changes in zetaclient/orchestrator/orchestrator.go, avoid suggesting refactoring that is unrelated to the current PR.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:43-43
Timestamp: 2025-01-13T23:25:05.336Z
Learning: In the Bitcoin implementation, UTXO amounts are represented as float64 to maintain compatibility with Bitcoin Core's JSON-RPC interface through btcd's ListUnspentResult struct, even though integer arithmetic would typically be preferred for cryptocurrency amounts.
Learnt from: ws4charlie
PR: #3381
File: zetaclient/chains/bitcoin/signer/outbound_data.go:29-29
Timestamp: 2025-01-21T04:34:47.335Z
Learning: In Bitcoin UTXO handling code, float64 must be used for amount fields as it's required by Bitcoin's RPC interface (btcd/btcjson.ListUnspentResult). While floating-point is generally avoided for monetary calculations, Bitcoin's RPC represents amounts in BTC as float64 values, making it a necessary exception in UTXO-related code.
e2e/e2etests/helpers.go (3)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #4007
File: e2e/runner/sui.go:237-274
Timestamp: 2025-07-14T21:08:08.725Z
Learning: In test code for the ZetaChain project, it's acceptable to use constants for EVM and Sui address lengths rather than adding complex validation logic. This applies to functions like payload construction in E2E tests where the expected lengths are well-defined and documented.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
e2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.go (13)
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: ws4charlie
PR: #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.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The CreateSignerObserverEVM function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.
Learnt from: fbac
PR: #2979
File: x/fungible/keeper/zrc20_unlock_token.go:69-72
Timestamp: 2024-10-08T14:57:52.954Z
Learning: In x/fungible/keeper/zrc20_unlock_token.go, when performing type assertions like transferred, ok := ret[0].(bool), using the ok check is sufficient to prevent panics, and additional type handling is not required.
e2e/e2etests/test_bitcoin_std_deposit_and_call.go (13)
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: ws4charlie
PR: #2987
File: pkg/memo/codec_abi.go:0-0
Timestamp: 2024-10-10T18:50:23.406Z
Learning: The constant ABIAlignment has been moved from pkg/memo/codec_abi.go to the testutil package.
Learnt from: ws4charlie
PR: #3381
File: zetaclient/chains/bitcoin/signer/outbound_data.go:29-29
Timestamp: 2025-01-21T04:34:47.335Z
Learning: In Bitcoin UTXO handling code, float64 must be used for amount fields as it's required by Bitcoin's RPC interface (btcd/btcjson.ListUnspentResult). While floating-point is generally avoided for monetary calculations, Bitcoin's RPC represents amounts in BTC as float64 values, making it a necessary exception in UTXO-related code.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:108-109
Timestamp: 2024-10-10T19:00:07.093Z
Learning: In testutil/sample/memo.go, BigEndian is used for ABI encoding functions, consistent with ABI specifications, whereas LittleEndian is used in compact encoding functions as appropriate.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
e2e/runner/bitcoin.go (17)
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:37-38
Timestamp: 2024-09-19T18:22:35.964Z
Learning: In BTCInboundEvent, it's acceptable to use float64 for monetary values (Value and DepositorFee) because precision is ensured through conversion to integer when building the vote message.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/observer/outbound.go:28-32
Timestamp: 2025-01-13T23:51:09.334Z
Learning: In Bitcoin observer, minTxConfirmations is set to 0 to allow observing mempool transactions without waiting for block confirmations, which is necessary due to Bitcoin's 10-minute block time. This is a deliberate design choice despite potential security implications, as other safety checks are in place through TSS validation.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:41-42
Timestamp: 2024-10-31T16:23:17.250Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, since some goroutines may fail, we should use a mutex to append durations of successful withdrawals for accurate latency reporting.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:58-59
Timestamp: 2024-10-31T16:19:26.038Z
Learning: In the Go code within e2e/utils/zetacore.go, the function WaitCctxMinedByInboundHash does not return an error.
Learnt from: ws4charlie
PR: #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.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the e2e codebase, it's acceptable to use github.com/stretchr/testify/require outside of test files.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: gartnera
PR: #3395
File: .github/workflows/reusable-sim.yml:29-30
Timestamp: 2025-01-22T22:46:58.820Z
Learning: The zeta-chain/node repository uses Go version >= 1.22. Do not suggest downgrading to earlier versions like 1.21.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
e2e/e2etests/test_bitcoin_deposit_call.go (15)
Learnt from: ws4charlie
PR: #2870
File: zetaclient/orchestrator/orchestrator.go:413-413
Timestamp: 2024-09-13T22:29:09.747Z
Learning: When a method is renamed (e.g., IsUTXO() to IsBitcoin()), and existing tests cover the affected code paths, do not request additional tests for the renamed methods.
Learnt from: ws4charlie
PR: #2899
File: zetaclient/chains/bitcoin/observer/inbound.go:366-371
Timestamp: 2024-09-19T18:28:58.296Z
Learning: The bitcoin.CalcDepositorFee function is covered by live tests.
Learnt from: gartnera
PR: #3105
File: e2e/runner/setup_bitcoin.go:51-69
Timestamp: 2024-11-06T21:10:14.301Z
Learning: In test code (e2e/runner/setup_bitcoin.go), adding security measures for private key handling in the GetBtcAddress method is not required.
Learnt from: gartnera
PR: #3079
File: e2e/e2etests/test_pause_erc20_custody.go:65-68
Timestamp: 2024-11-01T17:07:59.584Z
Learning: In the file e2e/e2etests/test_pause_erc20_custody.go, prefer verbosity and avoid extracting common event handling logic into helper functions to enhance readability and ease future refactoring.
Learnt from: ws4charlie
PR: #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.
Learnt from: gartnera
PR: #3071
File: e2e/e2etests/test_stress_eth_withdraw.go:0-0
Timestamp: 2024-10-31T16:21:47.362Z
Learning: In e2e/e2etests/test_stress_eth_withdraw.go, when handling the error returned by stats.Describe in the TestStressEtherWithdraw function, log the error instead of failing the test.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-09-23T19:51:43.360Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: ws4charlie
PR: #2907
File: zetaclient/chains/bitcoin/observer/outbound_test.go:81-82
Timestamp: 2024-10-08T15:34:48.217Z
Learning: In the mineTxNSetNonceMark function within bitcoin/observer/outbound_test.go, it's acceptable to hardcode the chain ID, as the tests do not require varying chain IDs.
Learnt from: gartnera
PR: #3070
File: cmd/zetae2e/init.go:0-0
Timestamp: 2024-10-30T17:56:16.341Z
Learning: In code reviews for Go files like cmd/zetae2e/init.go in the ZetaChain project, avoid suggesting unrelated refactoring. Focus comments on changes relevant to the PR objectives.
Learnt from: gartnera
PR: #3632
File: zetaclient/chains/solana/signer/signer.go:304-304
Timestamp: 2025-03-04T22:39:58.395Z
Learning: The Solana signer implementation in zetaclient/chains/solana/signer/signer.go has limited test coverage, particularly for the transaction broadcasting logic with fallback scenarios. Adding this coverage has been acknowledged as a potential future improvement outside the scope of immediate fixes.
Learnt from: ws4charlie
PR: #2987
File: testutil/sample/memo.go:0-0
Timestamp: 2024-10-10T18:54:33.554Z
Learning: In the testutil/sample/memo.go file, unchecked type assertions in the ABIPack function are acceptable because it is designed for unit tests and simplicity.
Learnt from: gartnera
PR: #3105
File: cmd/zetae2e/local/bitcoin.go:8-8
Timestamp: 2024-11-06T21:11:34.420Z
Learning: In the e2e codebase, it's acceptable to use github.com/stretchr/testify/require outside of test files.
Learnt from: ws4charlie
PR: #3306
File: zetaclient/chains/bitcoin/signer/sign.go:225-233
Timestamp: 2025-01-14T03:39:29.764Z
Learning: The signature hash calculation in Bitcoin TSS transactions using txscript.NewCannedPrevOutputFetcher([]byte{}, 0) with correct input amounts has been proven to work reliably in production, despite theoretical concerns about empty previous output fetcher.
Learnt from: ws4charlie
PR: #2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The CreateSignerObserverEVM function in zetaclient/orchestrator/chain_activate.go is covered by unit tests in zetaclient/orchestrator/chain_activate_test.go.
Learnt from: ws4charlie
PR: #3306
File: pkg/math/integer_test.go:0-0
Timestamp: 2025-01-14T03:37:18.430Z
Learning: Use big.Int for handling large number calculations and edge cases to avoid integer overflow issues.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Cursor Bugbot
- GitHub Check: start-e2e-test / e2e
- GitHub Check: gosec
- GitHub Check: build-and-test
- GitHub Check: analyze (go)
🔇 Additional comments (9)
e2e/e2etests/test_eth_deposit_and_call_big_payload.go (1)
26-27: LGTM! Payload size update aligns with gateway capabilities.The increase from 1440 to 2880 bytes correctly reflects the current maximum allowed payload size in the gateway, ensuring comprehensive testing coverage.
e2e/e2etests/test_eth_withdraw_and_call_big_payload.go (1)
26-27: LGTM! Consistent payload size update maintains test uniformity.The payload size increase mirrors the deposit test changes, ensuring both deposit and withdrawal flows are tested with the same maximum gateway payload capacity.
changelog.md (1)
37-37: LGTM! Changelog entry accurately reflects the PR objectives.The addition correctly documents the Bitcoin inscription e2e test improvements for live network compatibility in the appropriate Tests section.
e2e/e2etests/test_bitcoin_withdraw_rbf.go (1)
34-36: LGTM! Synchronization improvement enhances test reliability.The addition of the block wait after CCTX initiation prevents potential race conditions by ensuring on-chain confirmation before proceeding with outbound tracker operations. The 20-second timeout provides adequate buffer for test execution.
zetaclient/chains/bitcoin/observer/utxos.go (1)
32-35: LGTM! Node readiness check prevents unnecessary operations.The early exit condition appropriately avoids expensive Bitcoin RPC queries when the node is not ready, improving performance and operational robustness without treating the unavailable state as an error condition.
e2e/e2etests/test_bitcoin_std_memo_inscribed_deposit_and_call.go (1)
17-68: LGTM! Clean refactoring of the inscription test.The changes effectively simplify the test by:
- Using dynamic fee estimation instead of hardcoded values
- Leveraging predefined test DApp addresses
- Properly calculating received amounts from raw transactions
- Adding comprehensive balance verification
The comment accurately documents the memo structure (125 bytes total).
e2e/e2etests/test_bitcoin_deposit_call.go (1)
17-55: LGTM! Consistent refactoring pattern.The test follows the same improved pattern as other Bitcoin tests:
- Proper satoshi conversion with error handling
- Dynamic payload sizing using protocol constants
- Pre and post-transaction verification
- Accurate received amount calculation from raw transactions
Good use of
txscript.MaxDataCarrierSizeconstant for payload size calculation.e2e/e2etests/test_bitcoin_std_deposit_and_call.go (1)
16-65: LGTM! Well-structured standard memo test.The refactoring maintains consistency across all Bitcoin deposit tests:
- Accurate memo size calculation (80 bytes total)
- Proper amount handling in satoshis
- Comprehensive balance verification
- Clear separation of arrangement, action, and assertion phases
The comment correctly documents the memo structure breakdown.
e2e/runner/bitcoin.go (1)
481-512: LGTM! Excellent addition of robust transaction handling utilities.The new helper methods significantly improve the E2E test infrastructure:
WaitForTxInclusion: Provides reliable polling-based confirmation with proper timeout handlingCalcReceivedAmount: Accurately calculates net amounts after fee deductionEstimateFeeRate: Smart fee estimation with fallback for local networksThese utilities effectively support the test refactoring objectives.
Also applies to: 514-548
|
!!!WARNING!!! Be very careful about using 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 Pay extra attention to the way |
lumtis
left a comment
There was a problem hiding this comment.
LGTM if it has been tested on testnet
Currently there isn't a way to run e2e test on a custom branch (I tried) until we push it to |
…ve network (#4040) * make btc inscription based depositAndCall compatible for live network E2E test * add changelog entry * fix gosec error * use SelectUTXOs func to select UTXOs in E2E test * improve naming of helper functions in E2E runner
Description
The changes in this PR:
test_dapp_v2for Bitcoin deposit and call related E2E tests.randomPayloadWithSizeto return exact length (both odd and even) of payload.SelectUTXOsWaitForTxInclusionCalcReceivedAmountEstimateFeeRateCloses: #4031
How Has This Been Tested?
Summary by CodeRabbit
Tests
Chores
Bug Fixes