feat: unit testing coverage#190
Conversation
… order to reach the coveted 80% coverage - Added `redis-test` crate for improved testing of caching functionality. - Refactored `CacheUtil` to enhance account caching methods, including reintroducing `get_account_from_rpc_and_cache` and adding `is_cache_enabled` method. - Updated tests to utilize new mock structures for Redis caching, ensuring robust validation of caching behavior. - Cleaned up unused methods and improved overall code organization in cache-related files.
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed everything up to 05d7227 in 2 minutes and 37 seconds. Click for details.
- Reviewed
6286lines of code in42files - Skipped
0files when reviewing. - Skipped posting
9draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/tests/toml_mock.rs:234
- Draft comment:
Consider providing a more descriptive error message instead of using unwrap when writing the temp file in build_config. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. crates/lib/src/token/spl_token_2022.rs:92
- Draft comment:
Document that validate_and_adjust_amount returns the unchanged amount when no fee conditions apply. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. crates/lib/src/token/token.rs:69
- Draft comment:
Avoid using unwrap when converting token addresses; consider handling conversion errors gracefully. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. crates/lib/src/transaction/versioned_transaction.rs:164
- Draft comment:
Instead of using unwrap_or_default() when decoding inner instruction data with bs58::decode, consider propagating the error to avoid silently ignoring potential decoding issues. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. crates/lib/src/validator/config_validator.rs:92
- Draft comment:
Ensure that treating an empty allowed_tokens list as a fatal error (instead of a warning) is the intended behavior, as it differs from the behavior in validate_with_result. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. crates/lib/src/validator/transaction_validator.rs:69
- Draft comment:
Avoid using unwrap when converting allowed_tokens to Pubkeys; handle any potential conversion errors instead of panicking. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. crates/lib/src/validator/transaction_validator.rs:176
- Draft comment:
Include the fee payer's pubkey in the error message within the check_if_allowed closure for better debugging. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. crates/lib/src/validator/transaction_validator.rs:102
- Draft comment:
This validate_transaction function chains several validation steps; consider modularizing these steps into smaller helper functions to improve readability and ease debugging. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. crates/lib/src/admin/token_util.rs:30
- Draft comment:
Typo: 'funciton' should be corrected to 'function'. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_EWJwfgFmzm1xna4Q
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
📊 Rust Coverage ReportCoverage: 4.9% View detailed reportCoverage artifacts have been uploaded to this workflow run. |
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 120a1f0 in 1 minute and 27 seconds. Click for details.
- Reviewed
223lines of code in2files - Skipped
1files when reviewing. - Skipped posting
5draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/rpc_server/rpc.rs:217
- Draft comment:
The test 'test_method_delegation_with_mocks' calls update_config and setup_or_get_test_signer, which modify global state. Consider isolating test state (or using mocks with isolated state) to prevent interference between tests. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. crates/lib/src/rpc_server/rpc.rs:227
- Draft comment:
Tests here only assert that responses are OK. Consider verifying the actual content of responses to improve test robustness, especially for critical endpoints. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
3. crates/lib/src/rpc_server/server.rs:103
- Draft comment:
The macro 'register_method_if_enabled' ignores potential errors from method registration (using 'let _ ='). Consider handling or logging these errors to aid debugging during module setup. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
4. crates/lib/src/rpc_server/server.rs:255
- Draft comment:
The test 'test_build_rpc_module_all_methods_enabled' asserts a hard-coded method count (10), which might be brittle if new methods are added. Consider verifying the presence of expected method names rather than only the count. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
5. crates/lib/src/rpc_server/server.rs:213
- Draft comment:
Tests for get_value_by_priority use environment variables and manually remove them. Wrapping such setup/cleanup in a guard could ensure cleanup even if a panic occurs, enhancing test isolation. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_ExCjZz0kFHA7DS9i
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed b8e8a83 in 2 minutes and 53 seconds. Click for details.
- Reviewed
714lines of code in2files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/transaction/versioned_transaction.rs:107
- Draft comment:
Typo in comment: 'accout' should be 'account'. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
2. crates/lib/src/transaction/versioned_transaction.rs:164
- Draft comment:
Consider propagating the decode error from bs58 instead of using unwrap_or_default(), which may mask decoding issues. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. crates/lib/src/transaction/versioned_transaction.rs:753
- Draft comment:
Typographical error: The owner string "AddressLookupTab1e1111111111111111111111111" in the GetAccountInfo mock appears to have a typo. Should it be "AddressLookupTable1111111111111111111111111"? - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This is a test file and the string in question is just mock data. The exact value of this string doesn't matter for the test functionality - it's just being used as a placeholder owner address in a mock response. Whether it has a "1" or an "l" makes no difference to the test behavior. The test is about resolving lookup table addresses, not validating program owners. Could the typo indicate a copy-paste error from real code that should be fixed? Could using the correct program ID string make the test more realistic? While using the real program ID would be slightly more realistic, this is clearly marked as test code and the exact value doesn't affect the test's validity. The test is focused on address resolution logic, not program ownership validation. Delete the comment. The suggested change is purely cosmetic in test mock data and doesn't affect test functionality or correctness.
Workflow ID: wflow_EdpioBFDcgHZAbeP
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 57c1891 in 3 minutes and 3 seconds. Click for details.
- Reviewed
528lines of code in4files - Skipped
0files when reviewing. - Skipped posting
4draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/signer/privy/signer.rs:288
- Draft comment:
The test for sign_solana expects the signature’s to_string() to yield 64 characters (hex), but solana_sdk::signature::Signature typically uses base58 encoding (usually ~88 chars). Confirm the intended encoding. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% Looking at the code, I see that the signature comes from a mock response that we control. The test is just verifying we can parse the mock response correctly. The actual encoding used in production is not relevant to this test. The test is working as intended - it's testing our ability to parse the mock data, not testing real Solana signature behavior. The comment raises a valid point about Solana's typical signature encoding. Maybe there's something important about maintaining consistency with Solana conventions. The test is focused on parsing mock data, not on real Solana behavior. The encoding choice is an implementation detail of our test, not a functional requirement. The comment should be deleted. The test is correctly verifying our mock data parsing, and the actual encoding used is just an implementation detail of our test.
2. crates/lib/src/signer/turnkey/signer.rs:320
- Draft comment:
The test for sign_solana in TurnkeySigner expects a base58 encoded signature length of 87, which differs from the PrivySigner test. Ensure that the signature encoding is intentionally different or standardize the format. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% 1. The comment is speculative - it assumes there might be an inconsistency without evidence. 2. The base58 encoding length of 87 appears to be a valid expectation for Solana signatures. 3. The comment asks for verification without providing clear evidence of an issue. 4. Cross-file comparisons are out of scope per review rules. I might be overlooking a real inconsistency in signature formats that could cause issues. The length difference could indicate a real problem. While signature format inconsistency could be an issue, this comment is speculative and relies on cross-file comparison which is out of scope. If there was a real issue, it would manifest as test failures. Delete the comment as it is speculative, asks for verification without clear evidence of an issue, and relies on cross-file comparison which is out of scope for this review.
3. crates/lib/src/signer/turnkey/signer.rs:120
- Draft comment:
Avoid using unwrap() on bytes_to_hex; prefer propagating the error with '?' to prevent potential panics. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. crates/lib/src/signer/vault/vault_signer.rs:54
- Draft comment:
The new() function maps over 'client' with map_err even though 'client' is not a Result. This appears to be a leftover and should be removed. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_AZB9bKsuBGsEwVnd
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed bc188e0 in 7 minutes and 37 seconds. Click for details.
- Reviewed
147lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/rust.yml:55
- Draft comment:
Multiple invocations of 'cargo llvm-cov test' (unit tests and integration tests) may risk not aggregating coverage data as expected. Verify that the coverage data from successive commands is merged correctly in the final report. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is asking the PR author to verify that the coverage data is merged correctly, which falls under the rule of not asking the author to ensure behavior is intended or to double-check things. It does not provide a specific suggestion or point out a specific issue with the code.
2. .github/workflows/rust.yml:190
- Draft comment:
The regex used to remove the existing coverage section in the PR body relies on specific newline formatting. Consider making it more robust in case the section formatting changes. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The regex is actually quite robust already - it handles multiple newline formats (\s\S), accounts for both section boundaries and end of text, and uses non-greedy matching. The current implementation seems well thought out and handles various edge cases. The comment is speculative about potential future issues rather than pointing out a concrete problem. I could be underestimating the variety of PR description formats that might be encountered. There could be edge cases I haven't considered. While edge cases are possible, the current regex is already quite flexible and there's no evidence of actual problems. The comment doesn't provide specific scenarios where it would fail. The comment should be deleted as it's speculative and doesn't point to a concrete issue with the implementation. The current regex appears sufficiently robust.
Workflow ID: wflow_kl9KofssRjrHbJUM
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 425c9a2 in 3 minutes and 20 seconds. Click for details.
- Reviewed
20lines of code in1files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/rust.yml:185
- Draft comment:
Ensure 'context.runId' is defined for the report URL; verify this change works in all environments. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
2. .github/workflows/rust.yml:191
- Draft comment:
The new regex with literal newlines is clearer; double-check it matches the PR body format as expected. - Reason this comment was not posted:
Confidence changes required:33%<= threshold50%None
Workflow ID: wflow_JrcNKhuwDZZR3YJz
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed d29b175 in 1 minute and 59 seconds. Click for details.
- Reviewed
719lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/validator/account_validator.rs:92
- Draft comment:
The error message for executable flag mismatch is misleading when the expected value is false. When an account is executable but should not be, the error still says "is not executable". Consider adjusting the message to reflect the expected state. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. crates/lib/src/validator/transaction_validator.rs:428
- Draft comment:
The test 'test_transfer_amount_limits' only exercises transfers where the fee payer isn’t the sender. To fully validate the outflow logic (which uses the fee payer’s transfers), consider adding a test case where the fee payer is the sender and the transfer amount exceeds the max allowed lamports. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_hRtHOlYFJS1rsxxO
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed bb3f5c3 in 3 minutes and 33 seconds. Click for details.
- Reviewed
1040lines of code in8files - Skipped
0files when reviewing. - Skipped posting
4draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/validator/account_validator.rs:92
- Draft comment:
The error message in the executability check is hard-coded to refer to a Program ("cannot be a Program") even when validating Mint or TokenAccount (expected non‑executable). Consider adjusting the message to reflect the expected executable flag (e.g. 'expected non‑executable'). - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. crates/lib/src/validator/account_validator.rs:30
- Draft comment:
Consider adding inline comments or using more specific error variants instead of always wrapping failures as 'InternalServerError'. This can improve debugging and error handling clarity, especially when validating different account types. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. crates/lib/src/token/spl_token_2022.rs:842
- Draft comment:
The test function name is stilltest_token2022_account_extension_methodswhich suggests it should be using a builder with "2022" in its name. The change fromToken2022AccountMockBuildertoTokenAccountMockBuildermight be an unintentional inconsistency. Please verify if this is the intended behavior. - Reason this comment was not posted:
Comment looked like it was already resolved.
4. crates/lib/src/token/spl_token_2022.rs:851
- Draft comment:
There might be a typographical error in the method name: currently it's written asbuild_as_custom_token2022_token_account. Please double-check if it should bebuild_as_custom_token_2022_token_account(with an underscore between "token" and "2022") for consistency with naming conventions. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This is a very minor stylistic suggestion about a test helper method name. The current name is used consistently throughout the test file. The suggestion is purely about adding an underscore between "token" and "2022", but this doesn't affect functionality. The current name follows the pattern used in the actual SPL Token 2022 codebase where "token2022" is commonly used without an underscore. I could be wrong about the SPL Token 2022 codebase conventions. Maybe there is an established style guide that mandates underscores between "token" and "2022". Even if there was such a style guide, this is a minor naming issue in test code that doesn't affect functionality. The current name is clear and used consistently. This comment should be deleted as it's a minor stylistic suggestion about test code naming that doesn't affect functionality or clarity.
Workflow ID: wflow_az8S8SG9rjT5OjoT
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
amilz
left a comment
There was a problem hiding this comment.
Looks great. Left a couple of minor suggestions, also not a huge deal, but I if you want the unit tests to be deterministic I think you'd want to replace the use of Pubkey::new_unique() and Keypair::new() with hard-coded values. IMO fine as-is and good to merge.
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed 5a528f1 in 2 minutes and 0 seconds. Click for details.
- Reviewed
204lines of code in6files - Skipped
0files when reviewing. - Skipped posting
6draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/metrics/balance.rs:261
- Draft comment:
Test now asserts that BalanceTracker::init() returns Ok. Verify if re-initialization should error (as previously allowed both Ok/Err) and consider adding a separate test for multiple initializations. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. crates/lib/src/rpc_server/method/get_config.rs:56
- Draft comment:
The test 'test_get_config_success' now thoroughly asserts default configuration values. Ensure that any future changes to default config values are reflected here. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
3. crates/lib/src/rpc_server/method/get_supported_tokens.rs:29
- Draft comment:
Using the #[serial] attribute on tests is a good practice here to ensure isolation when updating global config state. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
4. crates/lib/src/signer/memory_signer/solana_signer.rs:141
- Draft comment:
Hardcoding the expected base58 public key in the test (test_from_private_key_string_base58) enforces determinism. Just ensure that future changes to key generation don't unexpectedly break this test. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
5. crates/lib/src/signer/privy/signer.rs:36
- Draft comment:
Renaming get_auth_header to get_privy_auth_header improves clarity by specifying its context. The consistent updates across the file and tests are appreciated. - Reason this comment was not posted:
Confidence changes required:0%<= threshold50%None
6. crates/lib/src/token/token.rs:161
- Draft comment:
In validate_token2022_extensions_for_payment, downcast_ref() is used with unwrap() for both mint and token accounts. Consider handling downcast failures gracefully (e.g. by returning an appropriate KoraError) instead of panicking. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_NTXz4sPZ84l1AMy0
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
* feat(tests): (PRO-163) massive rehaul of mocking for unit testing, in order to reach the coveted 80% coverage - Added `redis-test` crate for improved testing of caching functionality. - Refactored `CacheUtil` to enhance account caching methods, including reintroducing `get_account_from_rpc_and_cache` and adding `is_cache_enabled` method. - Updated tests to utilize new mock structures for Redis caching, ensuring robust validation of caching behavior. - Cleaned up unused methods and improved overall code organization in cache-related files. * Cache tests * Config tests * Error tests * Fee tests * Balance tests * RPC methods unit test * Signer test (part 1) * RPC tests * Transaction tests * Signers external call tests * Tokens Tests * Rust CI update
* refactor: Main PR representing refactoring & code clean up & organiza… (#146) * refactor: Main PR representing refactoring & code clean up & organization before release - Introduced `FeeConfigUtil` for improved transaction fee estimation and fee payer outflow calculations. - Reorganized the code in different folder that are linked (validators, fees, etc.) - Cleaned up mod.rs's so they don't contain code - Created testing utils for unit testing to reuse functions - Reorganized unit tests to be in the same file as the code they are testing, removed external unit tests files * refactor: reorganize signer modules and remove legacy dependencies Privy and Turnkey as separate crates wasn't needed, we would never publish the crates themselves and they were tightly coupled with kora_lib - Removed `kora-privy` and `kora-turnkey` crates, consolidating their functionality into the `signer` module. - Introduced new `privy` and `turnkey` submodules within the `signer` module for better organization. - Added utility functions for hex and byte conversions in the `signer` module. * refactor: enhance transaction handling with utility methods - Added trait extension to make it more organized. - Introduced `TransactionUtil` for transaction encoding/decoding and signing operations. - Updated transaction methods to utilize the new utility functions for better organization and readability. - Refactored transaction fee estimation and signing processes to leverage the new utility methods. - Improved modularity by separating versioned message and transaction functionalities into dedicated files. - Enhanced tests to ensure correctness of new utility methods and transaction handling. * refactor: consolidate RPC server functionality into kora-cli - Removed the kora-rpc crate and integrated its functionality into the kora-cli crate. - Updated CLI commands to reflect the new structure, including changes to command usage and options. - Enhanced documentation to guide users on the new CLI commands and configuration. - Refactored code to improve organization and maintainability, including the introduction of a dedicated RPC server module. - Added new RPC methods and improved existing ones for better performance and usability. - Updated tests to ensure coverage of new functionality and validate the CLI interface. * refactor: consolidate mock RPC client functions into common test utilities - Moved mock RPC client creation functions to a common module for reuse across tests. - Removed redundant mock implementations from individual test modules. - Added new mock account creation functions for SPL and Token2022 mints. - Updated tests to utilize the new common mock functions for improved organization and maintainability. * chore: update dependencies and improve test environment setup - Added new dependencies: `hex`, `hmac`, `once_cell`, `reqwest`, and `sha2` to `Cargo.lock`. - Updated configuration paths in `CLAUDE.md`, `Makefile`, and GitHub Actions to reflect new test fixture locations. - Refactored test environment setup scripts for better organization and clarity. - Introduced new test fixtures for authentication and kora configuration. - Enhanced integration tests with additional RPC methods and improved error handling. * chore: refactor token utilities - Added Rust tests badge to README for CI visibility. - Refactored token utility functions to improve organization and maintainability. - Updated token interface and program implementations to utilize new utility methods. - Enhanced transaction handling with improved token validation and processing logic. * Fix typescript tests * Update README.md * Pr comments fixes - Separate args in different structure -Organization of signers -Constants added * docs(auth): Update authentication config docs for [kora.auth] section Documentation now clarifies that authentication settings should be placed in the [kora.auth] section of kora.toml. Examples and configuration guides have been updated to reflect this, improving clarity for operators configuring authentication. --------- Co-authored-by: amilz <85324096+amilz@users.noreply.github.com> * chore(github action): update pre-commit configuration and add development documentation (#131) - Added conventional commit hook to .pre-commit-config.yaml for enforcing commit message standards. - Introduced CLAUDE.md for development workflow guidelines, including branch strategy and commit message format. - Created DEVELOPMENT.md to outline best practices for development, including commit message conventions and pull request processes. - Removed outdated GitHub workflows for crate publishing and replaced with a unified rust-publish.yml workflow. - Refactored error handling in lib/src/error.rs and updated transaction fee handling in lib/src/transaction/fees.rs. - Improved test assertions in lib/src/transaction/tests.rs for better readability. Changes to only publish the rpc crate, as this is the main one people will be using. * feat: (PRO-149) (PRO-153) Improve process transfer transaction, so that if the ATA doesn't exists, we can process with the Mint for TransferChecked (#157) Added a new Makefile target to generate OpenAPI spec with documentation features. Created openapi.json to define the API schema for the Kora RPC server. Updated the update_docs function to handle OpenAPI spec generation and validation. Enhanced token interfaces and validation logic to support new features. Refactored token utilities to improve organization and maintainability. Updated tests to validate new functionality and ensure correctness. * chore: add Codecov configuration and coverage reporting for Rust and TypeScript (#158) - Introduced `codecov.yml` for coverage settings and CI requirements. - Updated Rust workflow to upload coverage reports to Codecov. - Enhanced TypeScript workflow to run tests with coverage and upload results. - Configured Jest to collect coverage data and specify output formats. Implemented own version of code coverage instead ci permission fix * docs(sdk): (PRO-75) add TypeDoc auto-documentation (and PRO-148) (#149) * feat(sdk): add TypeDoc auto-documentation adds clean single-file output * docs(sdk): update allowed policies/enabled methods * docs(quickstart): update guide (PRO-154) (#160) - use @kora/sdk - update kora.toml example - update makefile * feat(metrics): add metrics collection and monitoring for Kora RPC (PRO-61) (#161) Introduced a new kora-metrics crate for Prometheus metrics. Implemented HTTP metrics collection with HttpMetricsLayer and MetricsHandlerLayer. Updated Docker and Docker Compose configurations for metrics services (Prometheus and Grafana). Enhanced Makefile with new targets for running the monitoring stack. Added Grafana dashboard and Prometheus configuration for Kora metrics. Updated Cargo.toml and .env.example to include new dependencies and environment variables for metrics. * tests(sdk): add hmac/api testing (#162) add auth testing to TS SDK, including CI * chore: Switch OpenAPI validation to Redocly CLI (#163) Replaces the use of 'swagger-cli validate' (deprecated) with 'npx @redocly/cli@latest lint --extends=minimal' for OpenAPI document validation in update_docs(). * chore(sdk): (PRO-184) test cleanup & prettier (#166) - fix ts test make command - add prettier to ts sdk - add prettier to precommit - run prettier * tests(sdk): handle various signing strategies (#167) * fix(signers):(PRO-204) Privy Signer Initialization and Fee Payer Position (#168) * fix: Privy Signer Initialization and Fee Payer Position Fixes critical bug where Privy signer was not properly initialized, causing transaction signature failures. Root Cause Privy signer was created but never initialized, leaving public_key as Pubkey::default() instead of the actual wallet address. Changes Privy Signer Initialization: - Add async initialization call in init_privy_signer() to fetch public key from Privy API - Use tokio::task::block_in_place to handle async call in sync context Transaction Signing Fix: - Replace hardcoded transaction.signatures[0] with dynamic fee payer position lookup - Prevents signature position mismatches when fee payer is not at index 0 (this was not the issue, but seems worth keeping in since it was a potential source of error when debugging) * async function instead of thread block * removed comment --------- Co-authored-by: Jo D <jo.desorm@proton.me> * Create ADDING_SIGNERS.md (#169) * chore(metrics): update metrics configuration and Docker setup (#170) * chore(metrics): update metrics configuration and Docker setup - Added default metrics constants for endpoint, port, and scrape interval. - Enhanced Docker Compose setup for Prometheus and Grafana with container names and volume management. - Updated Makefile targets for running and cleaning metrics services. - Improved configuration update logic for Prometheus and Grafana, ensuring correct URLs and paths. - Introduced Grafana datasource configuration for Prometheus. * chore(docs): update start command --------- Co-authored-by: amilz <85324096+amilz@users.noreply.github.com> * feat(cli): add initialize-atas command for payment token ATAs & custo… (#173) * feat(cli): add initialize-atas command for payment token ATAs & custom payment address for Paymaster - Introduced a new subcommand `initialize-atas` under the RPC command to initialize associated token accounts (ATAs) for allowed payment tokens. - Updated CLI structure to support the new command. - Enhanced KoraConfig to include an optional payment address. - Implemented logic to validate and create ATAs directly from the command line. - Added tests to verify the functionality of the new command. Refactor/improve integration testing (#174) * feat(config): implement global configuration management and hot-reloading - Added `init_config` and `get_config` functions for global configuration management. - Updated `KoraRpc` and various RPC methods to utilize the global configuration. - Introduced `update_config` method for hot-reloading configuration in dev/test environments. - Refactored existing methods to remove direct config dependencies, enhancing modularity. - Added tests for new configuration functionalities. * -Reorganized config to be a global state that is shared, instead of passing as arguments everywhere -Broke down the Makefile into sub make files to better structure and separate -Reorged the rust integration tests to have a better structure * chore: update docs Added documentation and configuration examples for specifying a custom payment address in kora.toml, allowing separation of fee payer and payment recipient. Updated guides and sample configs to clarify initialization of payment ATAs and usage of the payment_address option. * chore: fix TS integration test - Better ATA init function (chunks, compute) - Validate missing ata if user is validating config with rpc - Better decode transfer instruction - CI on demand release --------- Co-authored-by: amilz <85324096+amilz@users.noreply.github.com> * refactor: (PRO-213) Inner instruction support + refactor to have support of lookup tables and inner instructions across all of Kora (#177) * refactor: (PRO-213) Inner instruction support + refactor to have support of lookup tables and inner instructions across all of Kroa - Added `solana-transaction-status-client-types` dependency to `Cargo.toml` and `Cargo.lock`. - Updated `fee.rs` to utilize `VersionedTransactionResolved` for transaction handling. - Refactored transaction-related methods in `rpc_server` to work with the new transaction structure. - Introduced `instruction_util.rs` for instruction parsing and utility functions. - Removed deprecated `ix_utils.rs` as part of the cleanup. - Adjusted tests to accommodate changes in transaction handling and ensure compatibility with new structures. * Implemented resolve transaction for SPL transfers as well * chore: Update fee-payer key path in run target (#176) Changed the path to the fee-payer-local.json file in the run target to reflect its new location under tests/src/common/local-keys. This ensures the correct key file is used when running the default configuration. * feat: Implement payment instruction fee estimation and validation (#178) - Added `is_payment_required` method to `ValidationConfig` to determine if a payment instruction is necessary. - Enhanced `estimate_transaction_fee` to include estimated fees for payment instructions. - Introduced `has_payment_instruction` to check for payment instructions in transactions. - Updated transaction signing methods to utilize the new fee estimation logic. - Refactored instruction parsing to validate account indexes for various SPL and system instructions. - Added tests to ensure correct fee estimation behavior with and without payment instructions. * feat: (PRO-212) token 2022 improvements (#179) * feat: Token 2022 Improvements -Update Token2022 account and mint structures to use HashMap for extensions - Replaced raw extension data Vec<u8> with HashMap<u16, ParsedExtension> in Token2022Account and Token2022Mint. - Introduced ParsedExtension enum to encapsulate various extension types. - Refactored methods to utilize the new extensions structure for better type safety and clarity. - Removed deprecated methods related to raw extension data parsing. - Updated tests to reflect changes in the extensions handling. - Added all extensions that we want to support - ATA creation fee now takes into accoutn spl 2022 (could be bigger account size) Added check on payment transaction to make sure that the mint / token account doesn't have blocked extensions * PR Comments * feat: (PRO-162) Implement Redis caching for account data (#180) * feat: (PRO-162) Implement Redis caching for account data - Added Redis-based caching functionality to improve performance for Solana RPC calls. - Introduced CacheUtil for managing cache operations, including initialization, retrieval, and invalidation of cached account data. - Updated Kora configuration to support cache settings, including enabling/disabling and TTL values. - Integrated caching into various components, replacing direct RPC calls with cache lookups where applicable. - Enhanced Docker setup to include a Redis service for local development. - Updated tests to validate caching behavior and configuration parsing. * docs:(PRO-220) update config docs (redis & spl22) (#181) * feat: (PRO-162) Implement Redis caching for account data - Added Redis-based caching functionality to improve performance for Solana RPC calls. - Introduced CacheUtil for managing cache operations, including initialization, retrieval, and invalidation of cached account data. - Updated Kora configuration to support cache settings, including enabling/disabling and TTL values. - Integrated caching into various components, replacing direct RPC calls with cache lookups where applicable. - Enhanced Docker setup to include a Redis service for local development. - Updated tests to validate caching behavior and configuration parsing. * docs: update config docuemntation - add redis - add token 2022 --------- Co-authored-by: Jo D <jo.desorm@proton.me> * chore:(PRO-224) fix ci (#182) * chore: fix TS CI * chore: fix Rust CI (add ATA init step) * chore: add CI test to Release branch pulls * feat(metrics): (PRO-160) add fee payer balance tracking via metrics (#183) * feat(metrics): (PRO-160) add fee payer balance tracking via metrics - Introduced a new balance tracking feature for monitoring the fee payer's SOL balance using Prometheus metrics. - Updated Docker configuration to include Redis URL for caching. - Enhanced Kora configuration to support fee payer balance metrics with expiry settings. - Refactored cache handling to integrate account caching with balance tracking. - Added tests for balance tracking functionality and updated metrics server to handle background tasks. * docs: monitoring docs --------- Co-authored-by: amilz <85324096+amilz@users.noreply.github.com> * feat(signer): (PRO-215) implement multi-signer support with different strategies (#184) * feat(signer): implement multi-signer support with different strategies - Added support for multiple signers in Kora gasless relayer, allowing for load balancing and high availability. - Introduced `signers.toml` configuration file for defining signer pool and strategies. - Updated CLI to accept `--signers-config` for multi-signer initialization. - Refactored signer initialization logic to accommodate both single and multi-signer modes. - Enhanced global state management to support signer pools. - Added new types and methods for managing signer metadata and selection strategies. - Updated relevant tests and documentation to reflect new functionality. * feat(signer): enhance multi-signer functionality with optional signer hints - Introduced `get_request_signer_with_hint` to allow specifying a signer hint for consistent signer usage across RPC calls. - Updated relevant RPC methods to utilize the new signer hint feature, ensuring the correct signer is used based on client requests. - Enhanced metrics tracking to support multiple signers, including updates to balance tracking and Prometheus metrics. - Refactored tests to validate multi-signer behavior and hint functionality, ensuring robust integration with existing features. - Updated configuration to support multiple fee payers, reflecting changes in the signer pool structure. * chore: (PRO-229) signer docs & sdk updates (#185) * sdk: update request/response types * docs: update signer documentation Update ADDING_SIGNERS.md Update QUICK_START.md Update MONITORING.md Update SIGNERS.md Update README.md --------- Co-authored-by: amilz <85324096+amilz@users.noreply.github.com> * chore: update signer documentation (#187) * feat: (PRO-231): add get_signer_payer method (#188) * feat: add get_payer_signer method * tests: rust basic integration tests * sdk: update TS SDK * docs: add to docs * chore: use helper method & cleanup * chore: run typedocs (#189) * chore: refactor TS CI (#191) * Update typescript-integration.yml * Revert "Update typescript-integration.yml" This reverts commit e97ebce. * chore: test error codes * chore: update commitment * chore: finalize mint setup * feat:(PRO-144) Add getPaymentInstruction SDK method (#192) * Update typescript-integration.yml * Revert "Update typescript-integration.yml" This reverts commit e97ebce. * chore: test error codes * chore: update commitment * chore: finalize mint setup * feat: add getPaymentInstruction - adds a helper instruction to get a payment instruction based on a transaction - adds a couple of private helper methods * unit tests * chore: add todo * chore: update estimate txn fee response add payment address to est fee response for better devex Update rpc_integration_tests.rs * chore: update ts tests * chore: remove unused methods * Apply suggestion from @ellipsis-dev[bot] Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: jo <17280917+dev-jodee@users.noreply.github.com> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * docs:(PRO-237) release punchlist (#193) * docs: add getPaymentInstruction to TS SDK * docs: update CONFIGURATION.md * update reference to payment addresses and signers * docs: update Quick Start Guide * docs: update MONITORING.md * docs: update SIGNERS.md * docs: update CLAUDE.md * feat: unit testing coverage (#190) * feat(tests): (PRO-163) massive rehaul of mocking for unit testing, in order to reach the coveted 80% coverage - Added `redis-test` crate for improved testing of caching functionality. - Refactored `CacheUtil` to enhance account caching methods, including reintroducing `get_account_from_rpc_and_cache` and adding `is_cache_enabled` method. - Updated tests to utilize new mock structures for Redis caching, ensuring robust validation of caching behavior. - Cleaned up unused methods and improved overall code organization in cache-related files. * Cache tests * Config tests * Error tests * Fee tests * Balance tests * RPC methods unit test * Signer test (part 1) * RPC tests * Transaction tests * Signers external call tests * Tokens Tests * Rust CI update * docs: add CLI docs and update existing docs (#195) - add CLI documentation - fix legacy cli commands across guides - update Quick Start Guide & Config - update Railway Guide & Config * wip * feat:(PRO-246) Enhance TypeScript SDK with auto instruction parsing from b64 messages (#196) * feat/add client base64 message instruction parsing Enhances the KoraClient's transferTransaction method to include parsed instructions from the base64-encoded transaction message in its response. Updates documentation, types, and tests to reflect this change, and introduces a utility for extracting instructions from transaction messages. * chore: Make instructions field always present in TransferTransactionResponse - Changed instructions from optional (Instruction[]?) to required (Instruction[]) in the response type - Ensures we always set the field, even for empty/invalid messages (returns empty array) - Better API consistency - developers can always rely on the field being present - Maintains backward compatibility while providing a cleaner interface * chore: update typedocs * docs: remove console logs from example * feat: Integration testing rehaul (#198) * feat: Integration testing rehaul -Refactor Makefile structure and add new build, client, coverage, documentation, metrics, and TypeScript test makefiles for improved organization and functionality. refactor: Update error handling and enhance integration tests - Refactor error display and debug formatting in KoraError tests for improved readability. - Revise Makefile to streamline integration test phases and update test names for clarity. - Introduce new integration tests for API key and HMAC authentication, ensuring robust coverage of authentication scenarios. - Consolidate and reorganize existing tests, removing deprecated files and enhancing structure for better maintainability. refactor: Update test structure and add lookup table functionality & payment test for v0 - Add new tests for payment address handling with legacy and V0 formats, including scenarios for valid and invalid payment addresses. - Introduce a new module for managing lookup tables, enhancing test setup and organization. - Update Makefile and CI workflow for improved coverage reporting and integration test execution. - Clean up existing test utilities and remove deprecated code related to lookup tables. feat: Enhance fee estimation and transaction signing with lookup table support - Implement `get_estimate_fee_resolved` to handle V0 transactions with lookup tables. - Update transaction fee validation to utilize resolved transactions. - Refactor tests to streamline transaction signing and fee estimation for legacy and V0 formats, incorporating lookup table scenarios. - Improve test structure for better organization and clarity in handling payment addresses and transaction types. feat: Add V0 transaction signing and simulation tests with lookup table support - Introduce new tests for signing and simulating V0 transactions, including scenarios with and without lookup tables. - Enhance existing tests for transaction signing to cover SPL transfers and fee payment scenarios. - Refactor test names for clarity and consistency in handling V0 transaction formats. - Clean up unused imports and improve test structure for better organization. * docs/draft client flow guide * Update docs/getting-started/demo/client/src/full-demo.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --------- Co-authored-by: jo <17280917+dev-jodee@users.noreply.github.com> Co-authored-by: Jo D <jo.desorm@proton.me> Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Important
Enhance unit testing coverage for token, transaction, and validator modules, adding tests for various functions and scenarios.
TokenTypemethods intoken.rsto verify correct token program retrieval.TokenUtilmethods to validate token price calculations and extension validations.VersionedMessageExtinversioned_message.rsto ensure base64 encoding correctness.VersionedTransactionResolvedinversioned_transaction.rsto verify transaction resolution and signing.AccountTypevalidation inaccount_validator.rsto ensure correct account type handling.validate_accountfunction to check account validation logic.This description was created by
for 5a528f1. You can customize this summary. It will automatically update as commits are pushed.
📊 Test Coverage
Coverage: 85.8%
View Detailed Coverage Report