Skip to content

0.1.2 refactors#2

Merged
jwalin12 merged 62 commits intomainfrom
0.1.2-refactors
Dec 16, 2025
Merged

0.1.2 refactors#2
jwalin12 merged 62 commits intomainfrom
0.1.2-refactors

Conversation

@Bhargavamacha
Copy link

No description provided.

losman0s and others added 30 commits September 6, 2024 17:23
* cli: lut check cmd

* indexer: swb pull support

* fix: exclude indexer from workspace
* feat: account migration flag

* fix: fmt
* feat: marginfi alerter

* fix: remove config

* fix: fmt

* fix: lint

---------

Co-authored-by: J <pseudorandomoracle@proton.me>
* Adds protocol fees and pool creation fees.

* Adds two new accounts to the add_pool and add_pool_with_seed ixes

* The FeeState account (unique per program) now administers "program fees", which go directly to the FeeState.global_fee_wallet's canonical ATA for any given bank's mint. For example, if a third party opens a new group and a new bank, the program fee will always go to get_associated_token_address(FeeState.global_fee_wallet, bank.mint).

* Groups will cache the program fees and the fee state's global fee wallet, which the global fee admin can change at any time. When fees update, they will propagate to groups using the permissionless propagate_fee ix.

* The global fee state admin can enable/disable program fees for any group without the group admin's permission.

* Note that fees which go to the group are still called "protocol" or "group" fees for legacy purposes. The new fees are always referred to as "program" fees.
Adds per-bank configurable origination fee that is recorded on the bank upon any borrow. The fee is configurable by the group admin, and is split between the program (i.e. fee state wallet) and the group.
Adds commands for:

* init_fee_state
* edit_fee_state
* config_group_fee
* propagate_fee (but you should probably use a script instead of updating one group at a time)
* Fix a bug where config doesn't update the protocol origination fee

* Enable freezing of bank settings
* To support arena, we added banks with frozen settings. After some consideration, we have determined that the pool administrator should be able to modify the deposit/borrow limits. Those settings are now configurable even on frozen pools.

* Adds a floor to oracle_max_age
* Add deploy guide, fix CI pipeline
* Bug in get bank cli, now "accrues" interest before printing bank data.
* Adds the ability to use SOL assets staked to vanilla Solana staking (https://github.com/anza-xyz/agave/tree/master/sdk/program/src/stake) as collateral to borrow SOL.
* Validators (or anyone: the process is permissionless) will use the Single Pool program (https://github.com/solana-labs/solana-program-library/tree/master/single-pool) to create an "LST" that uses that just that validator (unlike a traditional LST which will have several validators). After a bank for this LST is created, the LST can be deposited as collateral in the main pool. Only SOL can be borrowed against this kind of asset.
* Adds Bankrun simulation of creating a validator, native SOL staking + delegation from users, deposit into a Single Pool, and integration with mrgnlend
* Guide to migrating a pwned account to a new wallet

* Moar docs
* enables liquidators to liquidate staked collateral accounts
* Adds tests for normal and staked collateral liquidation to the TS suite.
* minor bugfix and refactor for checking certain oracle settings when configuring staked banks
* Removes oracle configuration from add_bank, add_bank_with_seed, and configure_bank.

* Oracle configuration is now a dedicated instruction.
* marks the program state as of the Jan 30 deployment to staging
* Update marginfi Rust CLI README.md
* Minor fix for staked collateral pricing when staked pools have a small balance. Now also uses the stake account stake directly so excess unstaked lamps sent to the account don't count
* Merges 0dotxyz#280 upgrades into consolidation PR 0dotxyz#295
* Removes ignore-fee-deploy feature flag

---------

Co-authored-by: lastemp <emmanuelochieng797@gmail.com>
jgur-psyops and others added 22 commits February 13, 2025 14:26
* Permissionless withdraw rewards instruction

---------

Co-authored-by: lastemp <emmanuelochieng797@gmail.com>
* Record timestamp of mainnet 0.1.1 upgrade
* Echos settings changed in all configuration ixes, improving ease of debug using explorer tools. This is particularly useful when simulating a tx in squads.
* Now logs risk engine health metrics on rejection, enabling easier debugging of pricing issues (upon request from integrators)
* Allows the global fee admin to be configured (to move away from squads v3)
* propagate actual MarginFi error for price feeds
* Various improvements to logging and more specific errors when failures due to oracle issues occur

---------

Co-authored-by: Ilia Zyrin <iz@MacBook-Pro.local>
* Adds an instruction that caches the risk engine's internal health information on-chain.

* borrow/withdraw now also cache internal health information on success.
* Allows the mock program to make a pretend PriceUpdateV2 and feed, enabling the use of pull oracles on localnet.
…dotxyz#315)

* clarify IllegalLiquidation codes and get rid of redundant msg! calls

* fix fuzz tests

---------

Co-authored-by: Ilia Zyrin <iz@MacBook-Pro.local>
* Adds a ARENA_GROUP flag to groups, which limits them to have only two or fewer banks.

* Setting a group as an arena group is permanent and cannot be undone.
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @Bhargavamacha, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a comprehensive refactoring and update of the project's core infrastructure. It involves a significant shift in how dependencies are managed, particularly for Anchor, moving towards official crates.io releases. The changes also enhance the local development environment with new VS Code tasks, update the Solana toolchain and test configurations, and clean up the overall project workspace by removing outdated components and dependencies. The aim is to improve maintainability, build reliability, and developer productivity.

Highlights

  • Dependency Management Overhaul: Migrated Anchor-related dependencies (e.g., anchor-lang, anchor-spl, anchor-syn) from a custom Git fork to their official crates.io versions, along with updating spl-token references to be unversioned. This significantly streamlines dependency resolution and maintenance.
  • Build and Test Environment Updates: Updated the solana_version in Anchor.toml to 1.18.17 and increased the test startup_wait to 60 seconds. New test validator accounts and a genesis program for spl_single_pool were added to support expanded testing scenarios.
  • Developer Experience Improvements: Introduced a new .vscode/tasks.json file with predefined tasks for setting up and running Anchor and Rust tests, aiming to simplify local development workflows. The .gitignore was adjusted to track this new configuration file.
  • Workspace and Dependency Cleanup: The [workspace] members in Cargo.toml were narrowed to programs/*, removing clients/rust/* and tools/* from the main workspace. Numerous unused or outdated dependencies were removed from Cargo.lock, including anchor-client, switchboard-on-demand, and various native-tls related crates.
  • CI/CD and Documentation Refinements: The GitHub Actions setup was updated to pin the cargo-nextest version and verify its installation. Minor formatting and path corrections were applied to the README.md for test command instructions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request refactors and updates dependencies, including switching to official Anchor crates, removing client and tool crates, and improving the development setup with VS Code tasks and updated test configurations. Key issues identified include a borsh version mismatch and .gitignore configuration that need to be addressed.

Cargo.toml Outdated
pyth-solana-receiver-sdk = "=0.3.1"
switchboard-solana = "0.29.0"
switchboard-on-demand = "0.1.14"
borsh = "0.10.3"

Choose a reason for hiding this comment

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

critical

The new anchor-lang version 0.30.1 from crates.io depends on borsh version 0.9.3, but the current version is borsh = "0.10.3". Having two different versions of a serialization library like borsh in the dependency tree is risky and can lead to serialization/deserialization mismatches. Align the borsh version across the workspace by downgrading to 0.9.3 to match anchor-lang.

borsh = "0.9.3"

.idea
*.iml
**/.vscode

Choose a reason for hiding this comment

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

high

Removing the ignore rule for .vscode will cause all files within it (including user-specific settings) to be tracked by Git, which is likely unintended. Ignore the contents of the .vscode directory and then specifically un-ignore tasks.json.

This can be achieved by ignoring /.vscode/* and then adding an exception with !/.vscode/tasks.json.

/.vscode/*

"problemMatcher": [],
"group": {
"kind": "test",
"isDefault": true

Choose a reason for hiding this comment

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

high

Multiple tasks have "isDefault": true within the same "test" group (also on lines 29, 47, 65). According to VS Code documentation, only one task can be the default for a given group. Remove this line from all but one task in the test group, or from all of them if no default is desired.

# Allow specific json files
!tests/fixtures/**/*.json
!programs/marginfi/tests/fixtures/**/*.json
!.vscode/tasks.json No newline at end of file

Choose a reason for hiding this comment

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

medium

For consistency and to ensure this rule applies only to the root .vscode directory, prefix the path with a /.

!/.vscode/tasks.json

@jwalin12 jwalin12 reopened this Dec 16, 2025
@jwalin12 jwalin12 merged commit 1b95846 into main Dec 16, 2025
0 of 5 checks passed
@jwalin12 jwalin12 deleted the 0.1.2-refactors branch December 16, 2025 20:27
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.

6 participants