From 044d362cc7d31dd8de63585e9d0d93c740172001 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Fri, 6 Oct 2023 14:52:10 -0300 Subject: [PATCH] fix: added to use builtin min and max from i64 --- src/model.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/model.rs b/src/model.rs index 50a9e9af..9a0937e7 100644 --- a/src/model.rs +++ b/src/model.rs @@ -10,8 +10,6 @@ use serde_json::Value as JsonValue; use strum_macros::Display; -const JSON_MAX_SAFE_INTERGER: i128 = 9007199254740991; - // We're duplicating the Era struct from Pallas for two reasons: a) we need it // to be serializable and we don't want to impose serde dependency on Pallas and // b) we prefer not to add dependencies to Pallas outside of the sources that @@ -386,7 +384,7 @@ fn serialize_int_scalar(value: &i128, serializer: S) -> Result JSON_MAX_SAFE_INTERGER || *value < -JSON_MAX_SAFE_INTERGER { + if *value > (i64::MAX as i128) || *value < (i64::MIN as i128) { return value.to_string().serialize(serializer); }