Merge remote-tracking branch 'origin/main' into test_zcash_script_v0.1.15

This commit is contained in:
Alfredo Garcia 2024-04-22 09:53:17 -03:00
commit 1ca6e8e42b
10 changed files with 17 additions and 38 deletions

View File

@ -705,9 +705,9 @@ dependencies = [
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.34" version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",

View File

@ -100,7 +100,7 @@ zcash_note_encryption = "0.4.0"
zcash_primitives = { version = "0.13.0", features = ["transparent-inputs"] } zcash_primitives = { version = "0.13.0", features = ["transparent-inputs"] }
# Time # 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" humantime = "2.1.0"
# Error Handling & Formatting # Error Handling & Formatting

View File

@ -1,6 +1,6 @@
//! Generate large transparent blocks and transactions for testing. //! Generate large transparent blocks and transactions for testing.
use chrono::{DateTime, NaiveDateTime, Utc}; use chrono::DateTime;
use std::sync::Arc; use std::sync::Arc;
use crate::{ use crate::{
@ -42,18 +42,6 @@ pub fn transaction() -> (Transaction, Vec<u8>) {
(transaction, transaction_bytes) (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. /// Returns a generated transparent input, and its canonical serialized bytes.
pub fn input() -> (transparent::Input, Vec<u8>) { pub fn input() -> (transparent::Input, Vec<u8>) {
// Some of the test vectors are in a non-canonical format, // Some of the test vectors are in a non-canonical format,
@ -182,8 +170,8 @@ fn single_transaction_block_many_inputs(oversized: bool) -> Block {
// A block header // A block header
let (block_header, block_header_bytes) = block_header(); let (block_header, block_header_bytes) = block_header();
// A LockTime let lock_time = LockTime::Time(DateTime::from_timestamp(61, 0).unwrap());
let (lock_time, lock_time_bytes) = lock_time(); let lock_time_bytes = lock_time.zcash_serialize_to_vec().unwrap();
// Calculate the number of inputs we need, // Calculate the number of inputs we need,
// subtracting the bytes used to serialize the expected input count, // subtracting the bytes used to serialize the expected input count,
@ -256,8 +244,8 @@ fn single_transaction_block_many_outputs(oversized: bool) -> Block {
// A block header // A block header
let (block_header, block_header_bytes) = block_header(); let (block_header, block_header_bytes) = block_header();
// A LockTime let lock_time = LockTime::Time(DateTime::from_timestamp(61, 0).unwrap());
let (lock_time, lock_time_bytes) = lock_time(); let lock_time_bytes = lock_time.zcash_serialize_to_vec().unwrap();
// Calculate the number of outputs we need, // Calculate the number of outputs we need,
// subtracting the bytes used to serialize the expected output count, // subtracting the bytes used to serialize the expected output count,

View File

@ -1,6 +1,6 @@
//! Fixed test vectors for transactions. //! Fixed test vectors for transactions.
use chrono::{DateTime, NaiveDateTime, Utc}; use chrono::DateTime;
use color_eyre::eyre::Result; use color_eyre::eyre::Result;
use lazy_static::lazy_static; use lazy_static::lazy_static;
@ -220,13 +220,6 @@ fn deserialize_large_transaction() {
let output = let output =
transparent::Output::zcash_deserialize(&zebra_test::vectors::DUMMY_OUTPUT1[..]).unwrap(); 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. // Serialize the input so that we can determine its serialized size.
let mut input_data = Vec::new(); let mut input_data = Vec::new();
input input
@ -241,14 +234,12 @@ fn deserialize_large_transaction() {
.take(tx_inputs_num) .take(tx_inputs_num)
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let outputs = vec![output];
// Create an oversized transaction. Adding the output and lock time causes // Create an oversized transaction. Adding the output and lock time causes
// the transaction to overflow the threshold. // the transaction to overflow the threshold.
let oversized_tx = Transaction::V1 { let oversized_tx = Transaction::V1 {
inputs, inputs,
outputs, outputs: vec![output],
lock_time, lock_time: LockTime::Time(DateTime::from_timestamp(61, 0).unwrap()),
}; };
// Serialize the transaction. // Serialize the transaction.

View File

@ -43,7 +43,7 @@ jubjub = "0.10.0"
rand = "0.8.5" rand = "0.8.5"
rayon = "1.10.0" 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" displaydoc = "0.2.4"
lazy_static = "1.4.0" lazy_static = "1.4.0"
once_cell = "1.18.0" once_cell = "1.18.0"

View File

@ -43,7 +43,7 @@ proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl"]
bitflags = "2.5.0" bitflags = "2.5.0"
byteorder = "1.5.0" byteorder = "1.5.0"
bytes = "1.6.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" dirs = "5.0.1"
hex = "0.4.3" hex = "0.4.3"
humantime-serde = "1.1.1" humantime-serde = "1.1.1"

View File

@ -42,7 +42,7 @@ proptest-impl = [
] ]
[dependencies] [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" futures = "0.3.30"
# lightwalletd sends JSON-RPC requests over HTTP 1.1 # lightwalletd sends JSON-RPC requests over HTTP 1.1

View File

@ -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-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" } 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 # test feature proptest-impl
proptest = { version = "1.4.0", optional = true } proptest = { version = "1.4.0", optional = true }

View File

@ -47,7 +47,7 @@ elasticsearch = [
[dependencies] [dependencies]
bincode = "1.3.3" 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" dirs = "5.0.1"
futures = "0.3.30" futures = "0.3.30"
hex = "0.4.3" hex = "0.4.3"

View File

@ -173,7 +173,7 @@ zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.36", optional = t
abscissa_core = "0.7.0" abscissa_core = "0.7.0"
clap = { version = "4.5.4", features = ["cargo"] } 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" humantime-serde = "1.1.1"
indexmap = "2.2.6" indexmap = "2.2.6"
lazy_static = "1.4.0" lazy_static = "1.4.0"