Downgrade the `fixed` crate to v1.11.0 (#500)

This commit is contained in:
Christian Kamm 2023-03-12 08:50:42 +01:00 committed by GitHub
parent 68f9f38a3c
commit 0349ace3b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 18 additions and 22 deletions

2
3rdparty/fixed vendored

@ -1 +1 @@
Subproject commit d0f6e6b64e9a434ed0a529538c6fd056b79507df
Subproject commit 95bf614b09742333451e073704f11ea502d4563b

9
Cargo.lock generated
View File

@ -1836,7 +1836,7 @@ dependencies = [
[[package]]
name = "fixed"
version = "1.23.0"
version = "1.11.0"
dependencies = [
"arbitrary",
"az",
@ -2164,12 +2164,9 @@ dependencies = [
[[package]]
name = "half"
version = "2.2.1"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0"
dependencies = [
"crunchy",
]
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "hash32"

View File

@ -15,7 +15,7 @@ anyhow = "1.0"
clap = { version = "3.1.8", features = ["derive", "env"] }
dotenv = "0.15.0"
env_logger = "0.8.4"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde", "borsh"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] }
futures = "0.3.21"
log = "0.4.0"
mango-v4 = { path = "../../programs/mango-v4", features = ["client"] }

View File

@ -15,7 +15,7 @@ anyhow = "1.0"
clap = { version = "3.1.8", features = ["derive", "env"] }
dotenv = "0.15.0"
env_logger = "0.8.4"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde", "borsh"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] }
futures = "0.3.21"
itertools = "0.10.3"
log = "0.4.0"

View File

@ -20,7 +20,7 @@ bytemuck = "^1.7.2"
bytes = "1.0"
clap = { version = "3.1.8", features = ["derive", "env"] }
dotenv = "0.15.0"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde"] }
futures = "0.3.17"
futures-core = "0.3"
futures-util = "0.3"

View File

@ -21,7 +21,7 @@ bytemuck = "^1.7.2"
bytes = "1.0"
clap = { version = "3.1.8", features = ["derive", "env"] }
dotenv = "0.15.0"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde"] }
futures = "0.3.17"
futures-core = "0.3"
futures-util = "0.3"

View File

@ -14,7 +14,7 @@ anyhow = "1.0"
async-channel = "1.6"
async-once-cell = { version = "0.4.2", features = ["unpin"] }
async-trait = "0.1.52"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde", "borsh"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh"] }
futures = "0.3.25"
itertools = "0.10.3"
jsonrpc-core = "18.0.0"

View File

@ -31,11 +31,11 @@ borsh = { version = "0.9.3", features = ["const-generics"] }
bytemuck = { version = "^1.7.2", features = ["min_const_generics"] }
default-env = "0.1.1"
derivative = "2.2.0"
fixed = { path = "../../3rdparty/fixed", version = "=1.23.0", features = ["serde", "borsh", "disable-cache", "debug-assert-in-release"] }
fixed = { path = "../../3rdparty/fixed", version = "1.11.0", features = ["serde", "borsh", "debug-assert-in-release"] }
num_enum = "0.5.1"
pyth-sdk-solana = "0.1.0"
serde = "^1.0"
serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false,features = ["no-entrypoint", "program"] }
serum_dex = { git = "https://github.com/openbook-dex/program.git", default-features=false, features = ["no-entrypoint", "program"] }
solana-address-lookup-table-program = "~1.14.9"
solana-program = "~1.14.9"
solana-sdk = { version = "~1.14.9", default-features = false, optional = true }

View File

@ -1,12 +1,9 @@
use anchor_lang::prelude::*;
use anchor_spl::token::{Mint, Token, TokenAccount};
use fixed::types::I80F48;
use crate::error::*;
use crate::state::*;
pub const INDEX_START: I80F48 = I80F48::lit("1_000_000");
const FIRST_BANK_NUM: u32 = 0;
#[derive(Accounts)]

View File

@ -801,6 +801,7 @@ mod tests {
use super::*;
use crate::state::*;
use serum_dex::state::OpenOrders;
use std::str::FromStr;
#[test]
fn test_precision() {

View File

@ -475,7 +475,7 @@ fn binary_search(
fun: impl Fn(I80F48) -> Result<I80F48>,
) -> Result<I80F48> {
let max_iterations = 50;
let target_error = I80F48::lit("0.1");
let target_error = I80F48::from_num(0.1);
let right_value = fun(right)?;
require_msg!(
(left_value <= target_value && right_value >= target_value)

View File

@ -1,6 +1,7 @@
use anchor_lang::prelude::*;
use fixed::types::{I80F48, U80F48};
use solana_program::{log::sol_log_compute_units, program_memory::sol_memcmp};
use std::str::FromStr;
use crate::accounts_ix::*;
use crate::i80f48::LowPrecisionDivision;

View File

@ -8,7 +8,7 @@ use crate::util::fill_from_str;
use crate::logs::TokenMetaDataLog;
pub const INDEX_START: I80F48 = I80F48::lit("1_000_000");
pub const INDEX_START: I80F48 = I80F48::from_bits(1_000_000 * I80F48::ONE.to_bits());
use crate::accounts_ix::*;

View File

@ -14,9 +14,9 @@ use std::mem::size_of;
pub const HOUR: i64 = 3600;
pub const DAY: i64 = 86400;
pub const DAY_I80F48: I80F48 = I80F48::lit("86_400");
pub const YEAR_I80F48: I80F48 = I80F48::lit("31_536_000");
pub const MINIMUM_MAX_RATE: I80F48 = I80F48::lit("0.5");
pub const DAY_I80F48: I80F48 = I80F48::from_bits(86_400 * I80F48::ONE.to_bits());
pub const YEAR_I80F48: I80F48 = I80F48::from_bits(31_536_000 * I80F48::ONE.to_bits());
pub const MINIMUM_MAX_RATE: I80F48 = I80F48::from_bits(I80F48::ONE.to_bits() / 2);
#[derive(Derivative)]
#[derivative(Debug)]