forked from 0dotxyz/marginfi-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
0.1.2 refactors #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 7b10c51
CLI: Account migration flag (#246)
d61516c
Oracle Liveness Alerter (#254)
f9033ac
fix: crossbar calls (#255)
losman0s 8a01852
Combined protocol "program" fees (#244)
jgur-psyops f51c25a
Origination fees on borrow (#239)
jgur-psyops 063a5de
CLI commands for managing fee state (#257)
jgur-psyops 244a3b3
Freeze bank settings (#261)
jgur-psyops f5cfba8
Freeze settings v2 (#263)
jgur-psyops f8ca780
Add deploy guide (#264)
jgur-psyops 464de33
Fix CLI get bank (#265)
jgur-psyops b2e769d
Staked collateral (#248)
jgur-psyops bd7efda
Transfer account guide (#267)
jgur-psyops 933e11e
Liquidate tests (#277)
IliaZyrin 56dc7c4
Minor bug in staked settings propagation (#285)
jgur-psyops 2d2c867
Oracle config dedicated ix (#283)
jgur-psyops 2c5a752
Release Jan 30 (#288)
jgur-psyops 3b7bf0a
Update marginfi Rust CLI README.md (#287)
andreimontchik a6965c2
Minor fix for staked collateral pricing (#291)
jgur-psyops b702db2
Deploy 0.1.1 to staging (#294)
jgur-psyops 0708d51
Remove unsafe zero copy and transmute
jgur-psyops 87da8b7
Withdraw staked tests 0.1.2 (#297)
jgur-psyops 7f39b98
Moar has_one upgrade pass 1
jgur-psyops dbb9ad2
Fix cli attempt 1
jgur-psyops 881b1e0
Fix inferred accounts in fuzz and liquidate tests
jgur-psyops 104d025
Try fix fuzz 1
jgur-psyops 036070e
Try fix fuzz 2
jgur-psyops 9b79825
Final has_one constraint migration
jgur-psyops f1384c4
Fix tests to reflect has_one anchor error instead of constraint fail
jgur-psyops f258b4e
Remove ignore fee deploy feature (#298)
jgur-psyops 413792e
Fix build script
jgur-psyops a1e8120
Deposit limit (#300)
jgur-psyops 792c6d7
Reconcile merge 0.1.2-refactors
jgur-psyops e17fb9e
More has_one conversions, WIP TS test for deposit to limit
jgur-psyops f46c647
Add deposit up to limit TS test
jgur-psyops 2e1e4c9
Fix cli attempt 1
jgur-psyops c2ad41c
Close marginfi accounts via CLI #258 (#301)
jgur-psyops 437e0fe
Minor test fix, move guides to custom folder
jgur-psyops 868d952
Getting started dev guide
jgur-psyops 95f2acf
Permissionless withdraw rewards (#302)
jgur-psyops c8e33fe
Convert permissionless emissions to use a wallet/ATA approach, tests WIP
jgur-psyops 736560b
WIP permissionless emissions test
jgur-psyops 3a4273d
Deploy 0.1.1 to mainnet (#305)
jgur-psyops 15455fa
Claim emissions and permissionless claim tests
jgur-psyops 30415c2
Resolve merge main
jgur-psyops 80dd8fc
Remove another unsafe transmute
jgur-psyops 194e6c3
Fix lint 1
jgur-psyops 135eb2b
Add logging on config ixes and failed risk engine (#306)
jgur-psyops b3b391f
Log echo changes to debt settlement or freeze flags
jgur-psyops d39d82f
Merge branch '0.1.2-refactors' of https://github.com/mrgnlabs/marginf…
jgur-psyops a71ad93
Detailed errors (#310)
IliaZyrin 5fae499
Health pulse (#307)
jgur-psyops f38f467
Reconcile new errors with localnet tests, add minor logging
jgur-psyops e269218
Localnet mocks of Pyth oracles (#314)
jgur-psyops 3dcb32c
clarify IllegalLiquidation codes and get rid of redundant msg! calls …
IliaZyrin 7c09922
Arena-limited groups (#312)
jgur-psyops b16719a
Fix lint 1
jgur-psyops 09d011a
compiling w v1.0.2
jwalin12 004907e
rm switchboard on demand
jwalin12 1c13875
rm switchboard
jwalin12 e4a85fe
remove anchor 0.29.0
Bhargavamacha 5669002
fix: merge
jwalin12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,6 @@ target | |
| # IDEs | ||
| .idea | ||
| *.iml | ||
| **/.vscode | ||
|
|
||
| # other | ||
| .env | ||
|
|
@@ -32,3 +31,4 @@ test-ledger/ | |
| # Allow specific json files | ||
| !tests/fixtures/**/*.json | ||
| !programs/marginfi/tests/fixtures/**/*.json | ||
| !.vscode/tasks.json | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the ignore rule for
.vscodewill cause all files within it (including user-specific settings) to be tracked by Git, which is likely unintended. Ignore the contents of the.vscodedirectory and then specifically un-ignoretasks.json.This can be achieved by ignoring
/.vscode/*and then adding an exception with!/.vscode/tasks.json.