Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump all dependencies, revm 7 #7365

Merged
merged 4 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: chrono deprecation
  • Loading branch information
DaniPopes committed Mar 11, 2024
commit 43eb4914506deb1d41d0c112e2ec18219a3a6fc1
7 changes: 2 additions & 5 deletions crates/anvil/src/eth/backend/time.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
//! Manages the block time

use crate::eth::error::BlockchainError;
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::{DateTime, Utc};
use parking_lot::RwLock;
use std::{sync::Arc, time::Duration};

/// Returns the `Utc` datetime for the given seconds since unix epoch
pub fn utc_from_secs(secs: u64) -> DateTime<Utc> {
DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(secs as i64, 0).unwrap(),
Utc,
)
DateTime::from_timestamp(secs as i64, 0).unwrap()
}

/// Manages block time
Expand Down
5 changes: 2 additions & 3 deletions crates/cast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloy_primitives::{
};
use alloy_rlp::Decodable;
use base::{Base, NumberWithBase, ToBase};
use chrono::NaiveDateTime;
use chrono::DateTime;
use ethers_core::{
types::{
transaction::eip2718::TypedTransaction, BlockId, BlockNumber, Filter, NameOrAddress,
Expand Down Expand Up @@ -395,8 +395,7 @@ where
pub async fn age<T: Into<BlockId>>(&self, block: T) -> Result<String> {
let timestamp_str =
Cast::block_field_as_num(self, block, String::from("timestamp")).await?.to_string();
let datetime =
NaiveDateTime::from_timestamp_opt(timestamp_str.parse::<i64>().unwrap(), 0).unwrap();
let datetime = DateTime::from_timestamp(timestamp_str.parse::<i64>().unwrap(), 0).unwrap();
Ok(datetime.format("%a %b %e %H:%M:%S %Y").to_string())
}

Expand Down
Loading