@@ -229,7 +229,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
229229 self . record_shard_write_metric ( shard_id, "save_state_changes_data" , "state_changes_data" ) ;
230230
231231 // Extract relevant data
232- let inserts: Vec < ( String , String , Vec < u8 > , bigdecimal :: BigDecimal ) > = state_changes
232+ let inserts: Vec < ( String , String , Vec < u8 > , i64 ) > = state_changes
233233 . iter ( )
234234 . filter_map ( |change| {
235235 if let near_primitives:: views:: StateChangeValueView :: DataUpdate {
@@ -243,7 +243,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
243243 account_id. to_string ( ) ,
244244 data_key,
245245 value. clone ( ) . to_vec ( ) ,
246- bigdecimal :: BigDecimal :: from ( block_height) ,
246+ block_height as i64 , // Convert to i64 for database compatibility
247247 ) )
248248 } else {
249249 None
@@ -269,7 +269,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
269269 ) -> anyhow:: Result < ( ) > {
270270 self . record_shard_write_metric ( shard_id, "save_state_changes_data" , "state_changes_data" ) ;
271271
272- let updates: Vec < ( String , String , bigdecimal :: BigDecimal ) > =
272+ let updates: Vec < ( String , String , i64 ) > =
273273 state_changes
274274 . iter ( )
275275 . filter_map ( |change| match & change. value {
@@ -287,7 +287,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
287287 Some ( (
288288 account_id. to_string ( ) ,
289289 data_key,
290- bigdecimal :: BigDecimal :: from ( block_height) ,
290+ block_height as i64 , // Convert to i64 for database compatibility
291291 ) )
292292 }
293293 _ => None ,
@@ -320,7 +320,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
320320 ) ;
321321
322322 // Extract relevant updates
323- let inserts: Vec < ( String , String , Vec < u8 > , bigdecimal :: BigDecimal ) > = state_changes
323+ let inserts: Vec < ( String , String , Vec < u8 > , i64 ) > = state_changes
324324 . iter ( )
325325 . filter_map ( |change| {
326326 if let near_primitives:: views:: StateChangeValueView :: AccessKeyUpdate {
@@ -338,7 +338,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
338338 account_id. to_string ( ) ,
339339 data_key,
340340 data_value,
341- bigdecimal :: BigDecimal :: from ( block_height) ,
341+ block_height as i64 , // Convert to i64 for database compatibility
342342 ) )
343343 } else {
344344 None
@@ -379,8 +379,8 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
379379 ) ;
380380
381381 // Collect updates as triples (account_id, data_key, block_height)
382- let block_height_bd = bigdecimal :: BigDecimal :: from ( block_height) ;
383- let updates: Vec < ( String , String , bigdecimal :: BigDecimal ) > = state_changes
382+ let block_height_bd = block_height as i64 ; // Convert to i64 for database compatibility
383+ let updates: Vec < ( String , String , i64 ) > = state_changes
384384 . iter ( )
385385 . filter_map ( |c| match & c. value {
386386 near_primitives:: views:: StateChangeValueView :: AccessKeyUpdate {
@@ -394,7 +394,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
394394 } => Some ( (
395395 account_id. to_string ( ) ,
396396 hex:: encode ( public_key. key_data ( ) ) ,
397- block_height_bd. clone ( ) , // same height for all rows
397+ block_height_bd, // same height for all rows
398398 ) ) ,
399399 _ => None ,
400400 } )
@@ -428,19 +428,15 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
428428 ) ;
429429
430430 // Extract only ContractCodeUpdate
431- let inserts: Vec < ( String , Vec < u8 > , bigdecimal :: BigDecimal ) > = state_changes
431+ let inserts: Vec < ( String , Vec < u8 > , i64 ) > = state_changes
432432 . into_iter ( )
433433 . filter_map ( |change| {
434434 if let near_primitives:: views:: StateChangeValueView :: ContractCodeUpdate {
435435 account_id,
436436 code,
437437 } = change. value
438438 {
439- Some ( (
440- account_id. to_string ( ) ,
441- code. to_vec ( ) ,
442- bigdecimal:: BigDecimal :: from ( block_height) ,
443- ) )
439+ Some ( ( account_id. to_string ( ) , code. to_vec ( ) , block_height as i64 ) )
444440 } else {
445441 None
446442 }
@@ -536,7 +532,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
536532 ) ;
537533
538534 // Extract account updates
539- let inserts: Vec < ( String , Vec < u8 > , bigdecimal :: BigDecimal ) > = state_changes
535+ let inserts: Vec < ( String , Vec < u8 > , i64 ) > = state_changes
540536 . into_iter ( )
541537 . filter_map ( |change| {
542538 if let near_primitives:: views:: StateChangeValueView :: AccountUpdate {
@@ -550,7 +546,7 @@ impl crate::StateIndexerDbManager for crate::PostgresDBManager {
550546 Some ( (
551547 account_id. to_string ( ) ,
552548 data_value,
553- bigdecimal :: BigDecimal :: from ( block_height) ,
549+ block_height as i64 , // Convert to i64 for database compatibility
554550 ) )
555551 } else {
556552 None
0 commit comments