Skip to content

Conversation

@lgalabru
Copy link

@lgalabru lgalabru commented Nov 11, 2025

Howdy team!
First - Thank you so much for open sourcing this project, it's a gold mine!
We're pulling kora as a library in the context of a new project and we quickly experienced a blocker related to the way the config was being managed.
We have to rely on our fork for now but we'd love to contribute back, let us know this PR make sense to you!

Summary

Refactored functions to accept config as a parameter instead of calling
get_config() internally. Config is now fetched once at the RPC method level and passed
down through the call chain.

Motivation

Kora is available as a library, and the current global config approach adds constraints
for library consumers. This refactoring:

  • Enables flexible usage: Library consumers can pass different configs to different
    function calls
  • Explicit dependencies: Function signatures now clearly show data dependencies
  • Single responsibility: RPC layer handles config fetching; business logic remains pure

Important

Refactor code to pass config as a parameter instead of using global configuration, affecting multiple functions and tests.

  • Behavior:
    • Refactor functions to accept config as a parameter instead of using get_config().
    • config is fetched once at the RPC method level and passed down.
  • Functions:
    • Update initialize_atas_with_chunk_size() and find_missing_atas() in token_util.rs to accept config.
    • Modify CacheUtil::get_account() in cache.rs to require config.
    • Change estimate_transaction_fee() and sign_and_send_transaction() in rpc_server/method to use config.
    • Update validate_account() in account_validator.rs to take config.
    • Refactor validate_transaction() in transaction_validator.rs to use config.
  • Tests:
    • Update tests across multiple files to accommodate config parameter changes.
    • Ensure tests in transaction_validator.rs, account_validator.rs, and config_validator.rs reflect new config parameter usage.

This description was created by Ellipsis for 2b1be92. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to 2b1be92 in 6 minutes and 6 seconds. Click for details.
  • Reviewed 2365 lines of code in 15 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft 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/transaction_validator.rs:52
  • Draft comment:
    When converting allowed_tokens from strings to Pubkeys in the 'new' method, consider trimming whitespace to avoid parsing errors from accidental spaces.
  • 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:369
  • Draft comment:
    Document and/or clarify the units for fee amounts in validate_strict_pricing_with_fee so that maintainers understand that fees are in lamports and the logic for the strict pricing check.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. crates/lib/src/validator/transaction_validator.rs:305
  • Draft comment:
    In validate_disallowed_accounts, ensure that checking each account in instruction.accounts against the disallowed list covers all desired cases. Consider whether additional metadata should be inspected.
  • 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/admin/token_util.rs:378
  • Draft comment:
    Typo in assertion message: consider revising "Should return 1 missing ATAs" to "Should return 1 missing ATA" for grammatical consistency.
  • 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_qugYfhPsqJYbAIGo

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@lgalabru
Copy link
Author

lgalabru commented Nov 17, 2025

Hmm, I'm a bit puzzled by these errors from the CI, we're seeing build errors on lines of code that are not the ones you'd see in the diffs of this PR:

Screenshot 2025-11-17 at 09 35 20

Copy link
Contributor

@dev-jodee dev-jodee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR ! Appreciate the work, left a couple of comments to fix before we can bring this in main :)

@lgalabru lgalabru requested a review from dev-jodee November 18, 2025 17:04
Copy link
Contributor

@dev-jodee dev-jodee left a comment

Choose a reason for hiding this comment

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

Looks good, I won't merge it not just because we're finalizing the pr for the audit, I'll merge it into main as soon as we merge that other one just to keep them both separate :) shouldn't be too long ! thanks for the work

@lgalabru
Copy link
Author

Amazing! I'll point our project back to canonical version of kora when the changes are live, thanks so much for the quick review @dev-jodee !

@dev-jodee dev-jodee changed the base branch from release/feature-freeze-for-audit to main November 21, 2025 18:56
@dev-jodee dev-jodee changed the base branch from main to release/feature-freeze-for-audit November 21, 2025 18:56
dev-jodee added a commit that referenced this pull request Nov 24, 2025
Work done by @lgalabru

Commits of #247 but rebased on main / newer version
@dev-jodee
Copy link
Contributor

Reopened there #263

@dev-jodee dev-jodee closed this Nov 24, 2025
dev-jodee added a commit that referenced this pull request Nov 25, 2025
Work done by @lgalabru

Commits of #247 but rebased on main / newer version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants