diff --git a/.gitmodules b/.gitmodules index 094afd43f..e79e14fd3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "3rdparty/fixed"] - path = 3rdparty/fixed - url = https://gitlab.com/ckamm/fixed.git [submodule "3rdparty/anchor"] path = 3rdparty/anchor url = https://github.com/openbook-dex/anchor.git diff --git a/3rdparty/fixed b/3rdparty/fixed deleted file mode 160000 index 95bf614b0..000000000 --- a/3rdparty/fixed +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 95bf614b09742333451e073704f11ea502d4563b diff --git a/Cargo.lock b/Cargo.lock index ee5fed424..41cd1f89d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1824,13 +1824,12 @@ dependencies = [ [[package]] name = "fixed" version = "1.11.0" +source = "git+https://github.com/blockworks-foundation/fixed.git?branch=v1.11.0-borsh0_10-mango#01516ae3e29418feb066b67830540aa81d04df05" dependencies = [ - "arbitrary", "az", - "borsh 0.9.3", + "borsh 0.10.3", "bytemuck", "half", - "num-traits", "serde", "typenum", ] diff --git a/Cargo.toml b/Cargo.toml index c22211362..c7fa3207f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ members = [ anchor-client = "0.28.0" anchor-lang = "0.28.0" anchor-spl = "0.28.0" -fixed = {path = "./3rdparty/fixed", version = "1.11.0"} +fixed = { git = "https://github.com/blockworks-foundation/fixed.git", branch = "v1.11.0-borsh0_10-mango" } pyth-sdk-solana = "0.8.0" solana-account-decoder = "~1.16.1" solana-client = "~1.16.1" diff --git a/programs/openbook-v2/src/i80f48.rs b/programs/openbook-v2/src/i80f48.rs new file mode 100644 index 000000000..75da25df6 --- /dev/null +++ b/programs/openbook-v2/src/i80f48.rs @@ -0,0 +1,10 @@ +use fixed::types::I80F48; + +// regression test for https://gitlab.com/tspiteri/fixed/-/issues/57 +// see https://github.com/blockworks-foundation/fixed/issues/1 +#[test] +fn bug_fixed_comparison_u64() { + let a: u64 = 66000; + let b: u64 = 1000; + assert!(I80F48::from(a) > b); // fails! +} diff --git a/programs/openbook-v2/src/lib.rs b/programs/openbook-v2/src/lib.rs index d6a911332..e3deb4d01 100644 --- a/programs/openbook-v2/src/lib.rs +++ b/programs/openbook-v2/src/lib.rs @@ -18,6 +18,7 @@ pub mod pubkey_option; pub mod state; pub mod token_utils; pub mod types; +mod i80f48; #[cfg(feature = "enable-gpl")] pub mod instructions;