Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d33e649
Man0s/crossbar legacy indexer (#245)
losman0s Sep 6, 2024
7b10c51
CLI: Account migration flag (#246)
Sep 21, 2024
d61516c
Oracle Liveness Alerter (#254)
Oct 17, 2024
f9033ac
fix: crossbar calls (#255)
losman0s Oct 20, 2024
8a01852
Combined protocol "program" fees (#244)
jgur-psyops Oct 21, 2024
f51c25a
Origination fees on borrow (#239)
jgur-psyops Oct 23, 2024
063a5de
CLI commands for managing fee state (#257)
jgur-psyops Nov 21, 2024
244a3b3
Freeze bank settings (#261)
jgur-psyops Dec 6, 2024
f5cfba8
Freeze settings v2 (#263)
jgur-psyops Dec 19, 2024
f8ca780
Add deploy guide (#264)
jgur-psyops Dec 19, 2024
464de33
Fix CLI get bank (#265)
jgur-psyops Dec 19, 2024
b2e769d
Staked collateral (#248)
jgur-psyops Dec 24, 2024
bd7efda
Transfer account guide (#267)
jgur-psyops Dec 24, 2024
933e11e
Liquidate tests (#277)
IliaZyrin Jan 27, 2025
56dc7c4
Minor bug in staked settings propagation (#285)
jgur-psyops Jan 30, 2025
2d2c867
Oracle config dedicated ix (#283)
jgur-psyops Jan 30, 2025
2c5a752
Release Jan 30 (#288)
jgur-psyops Jan 30, 2025
3b7bf0a
Update marginfi Rust CLI README.md (#287)
andreimontchik Jan 31, 2025
a6965c2
Minor fix for staked collateral pricing (#291)
jgur-psyops Feb 7, 2025
b702db2
Deploy 0.1.1 to staging (#294)
jgur-psyops Feb 7, 2025
0708d51
Remove unsafe zero copy and transmute
jgur-psyops Feb 7, 2025
87da8b7
Withdraw staked tests 0.1.2 (#297)
jgur-psyops Feb 7, 2025
7f39b98
Moar has_one upgrade pass 1
jgur-psyops Feb 7, 2025
dbb9ad2
Fix cli attempt 1
jgur-psyops Feb 7, 2025
881b1e0
Fix inferred accounts in fuzz and liquidate tests
jgur-psyops Feb 8, 2025
104d025
Try fix fuzz 1
jgur-psyops Feb 8, 2025
036070e
Try fix fuzz 2
jgur-psyops Feb 10, 2025
9b79825
Final has_one constraint migration
jgur-psyops Feb 11, 2025
f1384c4
Fix tests to reflect has_one anchor error instead of constraint fail
jgur-psyops Feb 11, 2025
f258b4e
Remove ignore fee deploy feature (#298)
jgur-psyops Feb 11, 2025
413792e
Fix build script
jgur-psyops Feb 11, 2025
a1e8120
Deposit limit (#300)
jgur-psyops Feb 12, 2025
792c6d7
Reconcile merge 0.1.2-refactors
jgur-psyops Feb 12, 2025
e17fb9e
More has_one conversions, WIP TS test for deposit to limit
jgur-psyops Feb 12, 2025
f46c647
Add deposit up to limit TS test
jgur-psyops Feb 12, 2025
2e1e4c9
Fix cli attempt 1
jgur-psyops Feb 12, 2025
c2ad41c
Close marginfi accounts via CLI #258 (#301)
jgur-psyops Feb 12, 2025
437e0fe
Minor test fix, move guides to custom folder
jgur-psyops Feb 13, 2025
868d952
Getting started dev guide
jgur-psyops Feb 13, 2025
95f2acf
Permissionless withdraw rewards (#302)
jgur-psyops Feb 13, 2025
c8e33fe
Convert permissionless emissions to use a wallet/ATA approach, tests WIP
jgur-psyops Feb 13, 2025
736560b
WIP permissionless emissions test
jgur-psyops Feb 15, 2025
3a4273d
Deploy 0.1.1 to mainnet (#305)
jgur-psyops Feb 18, 2025
15455fa
Claim emissions and permissionless claim tests
jgur-psyops Feb 18, 2025
30415c2
Resolve merge main
jgur-psyops Feb 19, 2025
80dd8fc
Remove another unsafe transmute
jgur-psyops Mar 1, 2025
194e6c3
Fix lint 1
jgur-psyops Mar 1, 2025
135eb2b
Add logging on config ixes and failed risk engine (#306)
jgur-psyops Mar 3, 2025
b3b391f
Log echo changes to debt settlement or freeze flags
jgur-psyops Mar 5, 2025
d39d82f
Merge branch '0.1.2-refactors' of https://github.com/mrgnlabs/marginf…
jgur-psyops Mar 5, 2025
a71ad93
Detailed errors (#310)
IliaZyrin Mar 11, 2025
5fae499
Health pulse (#307)
jgur-psyops Mar 11, 2025
f38f467
Reconcile new errors with localnet tests, add minor logging
jgur-psyops Mar 11, 2025
e269218
Localnet mocks of Pyth oracles (#314)
jgur-psyops Mar 13, 2025
3dcb32c
clarify IllegalLiquidation codes and get rid of redundant msg! calls …
IliaZyrin Mar 14, 2025
7c09922
Arena-limited groups (#312)
jgur-psyops Mar 14, 2025
b16719a
Fix lint 1
jgur-psyops Mar 14, 2025
09d011a
compiling w v1.0.2
jwalin12 Apr 10, 2025
004907e
rm switchboard on demand
jwalin12 Apr 10, 2025
1c13875
rm switchboard
jwalin12 Apr 10, 2025
e4a85fe
remove anchor 0.29.0
Bhargavamacha Jul 18, 2025
5669002
fix: merge
jwalin12 Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/actions/setup-common/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Setup common"
description: "Setup common"
runs:
using: "composite"
steps:
- run: sudo apt-get update
shell: bash

- run: sudo apt-get install -y pkg-config build-essential libudev-dev
shell: bash

- uses: actions-rs/toolchain@v1
name: Install minimal rust toolchain with clippy and rustfmt
with:
profile: minimal
toolchain: ${{ env.RUST_TOOLCHAIN }}
target: x86_64-unknown-linux-gnu
components: rustfmt, clippy
default: true

- run: cargo install cargo-nextest --version "0.9.81" --locked
shell: bash

- run: cargo nextest --version
shell: bash
109 changes: 109 additions & 0 deletions .github/workflows/release-program.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Program+IDL Upgrade MS Proposal

on:
push:
tags:
- "testest-program-*"

env:
RUST_TOOLCHAIN: 1.75.0
SOLANA_CLI_VERSION: 1.18.17
ANCHOR_CLI_VERSION: 0.30.1
ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321
CARGO_TERM_COLOR: always

jobs:
build-verifiable:
name: Generate verifiable build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install common dependencies
uses: ./.github/actions/setup-common/

- name: Install Anchor CLI
uses: ./.github/actions/setup-anchor-cli/

- name: Extract tag information
run: |
TAG=${GITHUB_REF#refs/tags/} # Extract tag name from ref
echo "Tag name: $TAG"
PROGRAM=$(echo $TAG | sed 's/testest-program-\(.*\)-[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/\1/')
VERSION=$(echo $TAG | sed 's/.*-\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)$/\1/')
PROGRAM_LIB_NAME=${PROGRAM//-/_} # Substitute dashes with underscores
PROGRAM_ID=$(~/.cargo/bin/toml get Anchor.toml programs.mainnet.${PROGRAM_LIB_NAME} | tr -d '"')

echo "Program: $PROGRAM"
echo "Program ID: $PROGRAM_ID"
echo "Version: $VERSION"
echo "PROGRAM_ID=${PROGRAM_ID}" >> $GITHUB_ENV
echo "PROGRAM_LIB_NAME=${PROGRAM_LIB_NAME}" >> $GITHUB_ENV

# Solely to generate the IDL
- name: Build program using Anchor
uses: ./.github/actions/build-program/
with:
program_lib_name: ${{ env.PROGRAM_LIB_NAME }}

# Build verifiable program - store it in target/deploy/${PROGRAM_LIB_NAME}.so
- name: Build verifiable program
uses: ./.github/actions/build-verifiable-program/
with:
program_lib_name: ${{ env.PROGRAM_LIB_NAME }}

- name: Patch IDL and TS files
run: |
cargo run \
--release \
--package marginfi-v2-cli \
--features dev \
-- patch-idl target/idl/${{ env.PROGRAM_LIB_NAME }}.json
rm target/idl/${{ env.PROGRAM_LIB_NAME }}.json
mv target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.json target/idl/${{ env.PROGRAM_LIB_NAME }}.json

# Display contents of /target/deploy and /target/idl
- run: ls -l target/deploy
- run: ls -l target/idl

- name: Upload program and IDL to buffers
uses: ./.github/actions/deploy-buffers/
id: deploy-buffers
with:
program-lib-name: ${{ env.PROGRAM_LIB_NAME }}
program-id: ${{ env.PROGRAM_ID }}
deployer-keypair: ${{ secrets.DEPLOYER_KEYPAIR }}
buffer-authority: ${{ secrets.MULTISIG_VAULT }}
rpc-endpoint: ${{ secrets.RPC_ENDPOINT }}

# # Create MS proposal for program upgrade
# - name: Squads program upgrade
# uses: mrgnlabs/squads-program-upgrade@v0.3.1
# with:
# network-url: "https://api.mainnet-beta.solana.com"
# program-multisig: ${{ secrets.MULTISIG }}
# program-id: ${{ env.PROGRAM_ID }}
# buffer: ${{ steps.deploy-buffers.outputs.program-buffer }}
# idl-buffer: ${{ steps.deploy-buffers.outputs.idl-buffer }}
# spill-address: ${{ secrets.DEPLOYER_ADDRESS }}
# authority: ${{ secrets.MULTISIG_VAULT }}
# name: "Deploy ${{env.PROGRAM_LIB_NAME}} ${{env.VERSION}}"
# keypair: ${{ secrets.DEPLOYER_KEYPAIR }}

# - name: Upload program
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-verifiable_build-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/deploy/${{ env.PROGRAM_LIB_NAME }}.so

# - name: Upload IDL (json)
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-idl-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.json

# - name: Upload IDL (types)
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-types-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.ts
185 changes: 185 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: Test

on:
push:
branches:
- main
pull_request:
branches:
- "*"

defaults:
run:
shell: bash
working-directory: .

env:
RUST_TOOLCHAIN: 1.75.0
SOLANA_CLI_VERSION: 1.18.11
ANCHOR_CLI_VERSION: 0.30.1
ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321
CARGO_TERM_COLOR: always

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Rust Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-common/
- uses: ./.github/actions/setup-anchor-cli/

# - uses: actions/cache@v2
# name: Cache Cargo registry + index
# id: cache-cargo-build
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}

- run: cargo fmt -- --check

- run: ./scripts/lint.sh

test-unit:
name: Rust Unit Tests
runs-on: ubuntu-latest
# env:
# RUSTUP_TOOLCHAIN: stable
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-common/
- uses: ./.github/actions/setup-anchor-cli/

# - uses: actions/cache@v2
# name: Cache Cargo registry + index
# id: cache-cargo-build
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}

- run: cargo test --lib

build-and-test-workspace:
name: Build And Test Anchor Programs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: ./.github/actions/setup-common/
- uses: ./.github/actions/setup-anchor-cli/

- uses: ./.github/actions/build-workspace/

- run: ./scripts/test-program.sh all --sane
shell: bash

fuzz:
name: Fuzz The marginfi Program
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./programs/marginfi/fuzz

steps:
- uses: actions/checkout@v3
# - name: cache dependencies
# uses: Swatinem/rust-cache@v2
- name: Install full rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2024-06-05
components: rust-src
- name: Run fuzz tests in fuzz dir
run: |
python ./generate_corpus.py
cargo install cargo-fuzz --locked
cargo +nightly-2024-06-05 fuzz run lend -Zbuild-std --strip-dead-code --no-cfg-fuzzing -- -max_total_time=300
- name: Pass after fuzzing
run: echo "Fuzzing completed"

localnet-test-marginfi:
name: Anchor localnet tests marginfi
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "20.10.0"

- uses: ./.github/actions/setup-common/
- uses: ./.github/actions/setup-anchor-cli/

- uses: ./.github/actions/build-workspace/

- name: Install Node.js dependencies
run: yarn install

- name: Build marginfi program
run: anchor build -p marginfi -- --no-default-features

- name: Build mocks program
run: anchor build -p mocks

# Handles extraneous (os error 2) that appears during testing in some versions of solana. See:
# https://solana.stackexchange.com/questions/1648/error-no-such-file-or-directory-os-error-2-error-from-anchor-test
- name: Run Anchor tests
run: |
set +e
anchor test --skip-build 2>&1 | tee test_output.log
ANCHOR_EXIT_CODE=$?
set -e

if grep -q "failing" test_output.log; then
echo "Real test failure detected."
exit 1
fi

if grep -q "No such file or directory (os error 2)" test_output.log; then
echo "Extraneous error detected, ignoring it..."
exit 0
fi

if [ $ANCHOR_EXIT_CODE -ne 0 ]; then
echo "Anchor test exited with code $ANCHOR_EXIT_CODE due to an unexpected error."
exit 1
else
echo "Test run completed successfully without extraneous errors."
exit 0
fi

# - name: Start Solana Test Validator
# run: |
# solana-test-validator --reset --limit-ledger-size 1000 \

# - name: Wait for Validator to Start
# run: sleep 60

# - name: Deploy Liquidity Incentive Program
# run: solana program deploy --program-id Lip1111111111111111111111111111111111111111 target/deploy/liquidity_incentive_program.so

# - name: Deploy Marginfi Program
# run: solana program deploy --program-id 2jGhuVUuy3umdzByFx8sNWUAaf5vaeuDm78RDPEnhrMr target/deploy/marginfi.so

# - name: Deploy Mocks Program
# run: solana program deploy --program-id 5XaaR94jBubdbrRrNW7DtRvZeWvLhSHkEGU3jHTEXV3C target/deploy/mocks.so
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ target
# IDEs
.idea
*.iml
**/.vscode

Copy link
Copy Markdown

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/*

# other
.env
Expand All @@ -32,3 +31,4 @@ test-ledger/
# Allow specific json files
!tests/fixtures/**/*.json
!programs/marginfi/tests/fixtures/**/*.json
!.vscode/tasks.json
Copy link
Copy Markdown

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

Loading
Loading