Code Monkey home page Code Monkey logo

restaking's Introduction

Jito Staking Manager (JSM)

Build Status License codecov PRs Welcome

Jito Restaking is a next-generation restaking platform for Solana and SVM environments.

This project is currently under development and is not yet ready for production use. Expect breaking changes.

Table of Contents

Features

  • Universal framework for staking, restaking, and liquid restaking
  • VRT construction and management
  • Customizable slashing conditions
  • Flexible NCN and operator management

Installation

git clone https://github.com/jito-foundation/restaking.git
cd restaking
cargo-build-sbf

Usage

Building the software

cargo-build-sbf

Building the IDLs and client code

# Build the shank CLI tool
cargo b --release -p jito-shank-cli && ./target/release/jito-shank-cli
# Generate the client code
yarn generate-clients
# Rebuild the entire project
cargo b --release

Running Tests

If you haven't installed cargo-nextest yet, it's recommended to install it. You find the installation instructions here.

Outside of SVM

cargo nextest run

Testing using the SVM environment

cargo-build-sbf && SBF_OUT_DIR=$(pwd)/target/sbf-solana-solana/release cargo nextest run --all-features

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the project
  • Create your feature branch (git checkout -b username/feature_name)
  • Commit your changes (git commit -m 'Add some feature')
  • Push to the branch (git push origin username/feature_name)
  • Open a Pull Request

License

This project is licensed under the Business Source License 1.1 - see the LICENSE file for details.

restaking's People

Contributors

buffalu avatar aoikurokawa avatar coachchucksol avatar conr2d avatar ggnine-jito avatar

Stargazers

zeroone avatar Nick Cannon avatar kaz toc avatar Christopher Carvalho avatar Frances He avatar  avatar  avatar  avatar hussein-aitlahcen avatar mmdhrumil avatar vincent avatar Hossein avatar Joel Rousseau avatar Preston avatar Datt Goswami avatar  avatar Emerson avatar daiwanwei avatar  avatar Ramo avatar 0xrinegade avatar 开来超 avatar Arihant Bansal avatar 0xStone avatar Jarry Xiao avatar Jonathan Gan avatar Guenit avatar Barış Görgülü avatar Ian Jungyong Um avatar rms rob avatar David Eiber avatar kishi.sol avatar AJ Taylor avatar Gena avatar Nihar Shah avatar Dan Cline avatar John Johnson avatar Daniel Marin avatar Swen Schäferjohann avatar Dan Lee avatar Beta avatar Pratik Saria avatar Daniel Kim avatar  avatar Lostin avatar evalir avatar Jiachen Wang avatar Ben Sparks avatar Haythem Sellami avatar Madhav Goyal avatar Karthik Pariti avatar Rajiv Patel-O'Connor avatar  avatar

Watchers

Gena avatar Eric Semeniuc avatar Nick Cannon avatar

restaking's Issues

Vault: Add minAmountOut to burning

Add a minimum amount out when burning assets from the vault to avoid high slippage from fees or a slashing event in between getting the spot price and it executing on-chain

Vault: BurnWithdrawTicket is permissionless, but a slippage is provided

via Felix @ Asymmetric:

  • BurnWithdrawTicket is permissionless. I think that could be fine, but the problem is that min_out is passed via the Instruction. This could be abused by triggering a lot of slippage and burning other peoples withdraw tickets with a min_out of 0

We don't want vault withdrawal tickets sitting around as they cause a yield drag on the assets in the vault and can allow someone to continue earning rewards, but frontrun withdraws.

Vault: Fix accounting bug for the Vault::withdrawable_reserve_amount

Given:

  • There is a withdraw ticket created with funds cooling down for withdraw. Let's say the ratio is 1:1, so 1000 VRTs were deposited and 1000 collateral tokens were set aside.

When:

  • There is a slashing event of 100 tokens while the funds are maturing in the VaultDelegationList.

Then:

  • There will be 900 total tokens set aside for the withdrawal reserve in the vault, but the withdrawal ticket has 1000. When burning the withdraw ticket, there will be an underflow and the program is stuck.

Assertion failed: `'vault::crank_vault_update_state_tracker::tests::test_crank_vault_update_state_tracker_same_index_twice_fails`

When I run cargo nextest run --all-features, sometimes, test fails at vault::crank_vault_update_state_tracker::tests::test_crank_vault_update_state_tracker_same_index_twice_fails.

thread 'vault::crank_vault_update_state_tracker::tests::test_crank_vault_update_state_tracker_same_index_twice_fails' panicked at integration_tests/tests/vault/crank_vault_update_state_tracker.rs:289:9:
assertion `left == right` failed
  left: AlreadyProcessed
 right: InstructionError(0, Custom(2020))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Environment:
OS: Ubuntu 22.04.4 LTS
rustc: rustc 1.80.0 (051478957 2024-07-21)

Build accounting program to ease AVS accounting

AVS, operator, and vault opt-in is difficult to track across different accounts. In addition, the amount staked can be difficult to track across vaults too. For AVS that allow stake from different vaults, normalizing the prices between the assets in the vault can be difficult too.

Need to build a program that stores all of this information in an account so AVS can load it. As a part of this, it may be worth considering adding an activation period so staked amounts, opt-in/opt-out can't be changed mid-epoch.

Vault: Add minAmountOut to minting

Add a minimum amount out when minting assets from the vault to avoid high slippage from fees or a slashing event in between getting the spot price and it executing on-chain

Vault: Add maximum limitations on deposit/withdraw fee and ramp up/down

The vault needs some encoding around max deposit + withdraw fees. Something in the 5% range seems reasonable.

In addition, to avoid sudden changes in the withdraw/deposit fee, it would be wise to add limitations on how much the deposit/withdraw fees can change within a given time window.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.