Skip to content

Commit

Permalink
dex: lift temporary consensus rule
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Jul 11, 2023
1 parent 099ed50 commit 5880d48
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ impl ActionHandler for PositionOpen {
// + the trading function doesn't specify a cyclic pair,
// + the fee is <=50%.
self.position.check_stateless()?;
// This is a temporary check that limits DEX values to 60 bits.
// To lift this check, delete this line and the method it invokes.
self.position.temporary_check()?;
Ok(())
}

Expand Down
15 changes: 0 additions & 15 deletions crates/core/component/dex/src/lp/position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,6 @@ impl Position {
}
}

/// Implements temporary limiting reserve/valuations values to 60 bits, for more
/// details, please check issue #2560.
pub fn temporary_check(&self) -> anyhow::Result<()> {
let max_60_bits: u128 = (1 << 60) - 1;
if self.reserves.r1.value() > max_60_bits || self.reserves.r2.value() > max_60_bits {
anyhow::bail!("we are temporarily limiting reserves to be at most 60 bits wide")
} else if self.phi.component.p.value() > max_60_bits
|| self.phi.component.q.value() > max_60_bits
{
anyhow::bail!("we are temporarily limiting trading function coefficient to be at most 60 bits wide")
} else {
Ok(())
}
}

/// Returns the amount of the given asset that is currently in the position's reserves.
pub fn reserves_for(&self, asset: asset::Id) -> Option<Amount> {
if asset == self.phi.pair.asset_1() {
Expand Down

0 comments on commit 5880d48

Please sign in to comment.