Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into test_zcash_script_v0.…
Browse files Browse the repository at this point in the history
…1.15
  • Loading branch information
oxarbitrage committed Apr 22, 2024
2 parents b53b0b9 + 2ba8374 commit 1ca6e8e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,9 @@ dependencies = [

[[package]]
name = "chrono"
version = "0.4.34"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
"android-tzdata",
"iana-time-zone",
Expand Down
2 changes: 1 addition & 1 deletion zebra-chain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ zcash_note_encryption = "0.4.0"
zcash_primitives = { version = "0.13.0", features = ["transparent-inputs"] }

# Time
chrono = { version = "0.4.34", default-features = false, features = ["clock", "std", "serde"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std", "serde"] }
humantime = "2.1.0"

# Error Handling & Formatting
Expand Down
22 changes: 5 additions & 17 deletions zebra-chain/src/block/tests/generate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Generate large transparent blocks and transactions for testing.
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::DateTime;
use std::sync::Arc;

use crate::{
Expand Down Expand Up @@ -42,18 +42,6 @@ pub fn transaction() -> (Transaction, Vec<u8>) {
(transaction, transaction_bytes)
}

/// Returns a generated transparent lock time, and its canonical serialized bytes.
pub fn lock_time() -> (LockTime, Vec<u8>) {
let lock_time = LockTime::Time(DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(61, 0)
.expect("in-range number of seconds and valid nanosecond"),
Utc,
));
let lock_time_bytes = lock_time.zcash_serialize_to_vec().unwrap();

(lock_time, lock_time_bytes)
}

/// Returns a generated transparent input, and its canonical serialized bytes.
pub fn input() -> (transparent::Input, Vec<u8>) {
// Some of the test vectors are in a non-canonical format,
Expand Down Expand Up @@ -182,8 +170,8 @@ fn single_transaction_block_many_inputs(oversized: bool) -> Block {
// A block header
let (block_header, block_header_bytes) = block_header();

// A LockTime
let (lock_time, lock_time_bytes) = lock_time();
let lock_time = LockTime::Time(DateTime::from_timestamp(61, 0).unwrap());
let lock_time_bytes = lock_time.zcash_serialize_to_vec().unwrap();

// Calculate the number of inputs we need,
// subtracting the bytes used to serialize the expected input count,
Expand Down Expand Up @@ -256,8 +244,8 @@ fn single_transaction_block_many_outputs(oversized: bool) -> Block {
// A block header
let (block_header, block_header_bytes) = block_header();

// A LockTime
let (lock_time, lock_time_bytes) = lock_time();
let lock_time = LockTime::Time(DateTime::from_timestamp(61, 0).unwrap());
let lock_time_bytes = lock_time.zcash_serialize_to_vec().unwrap();

// Calculate the number of outputs we need,
// subtracting the bytes used to serialize the expected output count,
Expand Down
15 changes: 3 additions & 12 deletions zebra-chain/src/transaction/tests/vectors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Fixed test vectors for transactions.
use chrono::{DateTime, NaiveDateTime, Utc};
use chrono::DateTime;
use color_eyre::eyre::Result;
use lazy_static::lazy_static;

Expand Down Expand Up @@ -220,13 +220,6 @@ fn deserialize_large_transaction() {
let output =
transparent::Output::zcash_deserialize(&zebra_test::vectors::DUMMY_OUTPUT1[..]).unwrap();

// Create a lock time.
let lock_time = LockTime::Time(DateTime::<Utc>::from_naive_utc_and_offset(
NaiveDateTime::from_timestamp_opt(61, 0)
.expect("in-range number of seconds and valid nanosecond"),
Utc,
));

// Serialize the input so that we can determine its serialized size.
let mut input_data = Vec::new();
input
Expand All @@ -241,14 +234,12 @@ fn deserialize_large_transaction() {
.take(tx_inputs_num)
.collect::<Vec<_>>();

let outputs = vec![output];

// Create an oversized transaction. Adding the output and lock time causes
// the transaction to overflow the threshold.
let oversized_tx = Transaction::V1 {
inputs,
outputs,
lock_time,
outputs: vec![output],
lock_time: LockTime::Time(DateTime::from_timestamp(61, 0).unwrap()),
};

// Serialize the transaction.
Expand Down
2 changes: 1 addition & 1 deletion zebra-consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jubjub = "0.10.0"
rand = "0.8.5"
rayon = "1.10.0"

chrono = { version = "0.4.34", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
displaydoc = "0.2.4"
lazy_static = "1.4.0"
once_cell = "1.18.0"
Expand Down
2 changes: 1 addition & 1 deletion zebra-network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl"]
bitflags = "2.5.0"
byteorder = "1.5.0"
bytes = "1.6.0"
chrono = { version = "0.4.34", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
dirs = "5.0.1"
hex = "0.4.3"
humantime-serde = "1.1.1"
Expand Down
2 changes: 1 addition & 1 deletion zebra-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ proptest-impl = [
]

[dependencies]
chrono = { version = "0.4.34", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
futures = "0.3.30"

# lightwalletd sends JSON-RPC requests over HTTP 1.1
Expand Down
2 changes: 1 addition & 1 deletion zebra-scan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ zebra-state = { path = "../zebra-state", version = "1.0.0-beta.36", features = [
zebra-node-services = { path = "../zebra-node-services", version = "1.0.0-beta.36", features = ["shielded-scan"] }
zebra-grpc = { path = "../zebra-grpc", version = "0.1.0-alpha.3" }

chrono = { version = "0.4.34", default-features = false, features = ["clock", "std", "serde"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std", "serde"] }

# test feature proptest-impl
proptest = { version = "1.4.0", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion zebra-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ elasticsearch = [

[dependencies]
bincode = "1.3.3"
chrono = { version = "0.4.34", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
dirs = "5.0.1"
futures = "0.3.30"
hex = "0.4.3"
Expand Down
2 changes: 1 addition & 1 deletion zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.36", optional = t

abscissa_core = "0.7.0"
clap = { version = "4.5.4", features = ["cargo"] }
chrono = { version = "0.4.34", default-features = false, features = ["clock", "std"] }
chrono = { version = "0.4.38", default-features = false, features = ["clock", "std"] }
humantime-serde = "1.1.1"
indexmap = "2.2.6"
lazy_static = "1.4.0"
Expand Down

0 comments on commit 1ca6e8e

Please sign in to comment.