-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(rpc): Create a script that submits block proposals to zcashd (#5944
) * Revert "Update code that we're going to delete in the next PR anyway" This reverts commit 1fed70d. * Initial zcash-test-block-template script without block proposal construction * Try creating block data using jq and printf * Move proposal_block_from_template() to zebra-rpc and remove eyre dependency * Implement FromStr for DateTime32 and Duration32 * Basic block-template-to-proposal command without time source handling * Move block proposal code into its own module * Use time source in block-template-to-proposal * Make block-template-to-proposal require the getblocktemplate-rpcs feature * Use block-template-to-proposal in the test script zcash-rpc-block-template-to-proposal * Apply new hex formatting to commitments and nonces in block proposal tests * Re-add missing imports from rebase * Re-add missing conversions from rebase * Update to new method name after rebase * Derive a Default impl * Restore a comment that was accidentally deleted during the rebase * Avoid a clippy::unwrap-in-result * Temporarily fix the code for a disabled test * Fix tool build with Docker caches * Make clippy happy with the temporary fix * Give a pass/fail status for each proposal response * Accept zcashd block templates in block-template-to-proposal * Fix pretty printing * Zebra expects a longpollid, so give it a dummy value * Add "required" fields which Zebra requires * Use curtime as the dummy maxtime in zcashd templates * Support large block proposals by reading proposal data from a file * Test all valid time modes for each proposal * Allow the user to set the time command * Put debug logs into their own files * Exit with an error status when any proposal is invalid * Log the date and time to make it easier to match errors to node logs
- Loading branch information
Showing
9 changed files
with
585 additions
and
72 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,30 @@ authors = ["Zcash Foundation <[email protected]>"] | |
license = "MIT OR Apache-2.0" | ||
version = "1.0.0-beta.19" | ||
edition = "2021" | ||
|
||
# Prevent accidental publication of this utility crate. | ||
publish = false | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[[bin]] | ||
name = "block-template-to-proposal" | ||
# this setting is required for Zebra's Docker build caches | ||
path = "src/bin/block-template-to-proposal/main.rs" | ||
required-features = ["getblocktemplate-rpcs"] | ||
|
||
[features] | ||
default = [] | ||
|
||
# Production features that activate extra dependencies, or extra features in dependencies | ||
|
||
# Experimental mining RPC support | ||
getblocktemplate-rpcs = [ | ||
"zebra-rpc/getblocktemplate-rpcs", | ||
"zebra-node-services/getblocktemplate-rpcs", | ||
"zebra-chain/getblocktemplate-rpcs", | ||
] | ||
|
||
[dependencies] | ||
color-eyre = "0.6.2" | ||
# This is a transitive dependency via color-eyre. | ||
|
@@ -21,3 +42,6 @@ tracing-subscriber = "0.3.16" | |
|
||
zebra-node-services = { path = "../zebra-node-services" } | ||
zebra-chain = { path = "../zebra-chain" } | ||
|
||
# Experimental feature getblocktemplate-rpcs | ||
zebra-rpc = { path = "../zebra-rpc", optional = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//! block-template-to-proposal arguments | ||
//! | ||
//! For usage please refer to the program help: `block-template-to-proposal --help` | ||
|
||
use structopt::StructOpt; | ||
|
||
use zebra_rpc::methods::get_block_template_rpcs::get_block_template::proposal::TimeSource; | ||
|
||
/// block-template-to-proposal arguments | ||
#[derive(Clone, Debug, Eq, PartialEq, StructOpt)] | ||
pub struct Args { | ||
/// The source of the time in the block proposal header. | ||
/// Format: "curtime", "mintime", "maxtime", ["clamped"]u32, "raw"u32 | ||
/// Clamped times are clamped to the template's [`mintime`, `maxtime`]. | ||
/// Raw times are used unmodified: this can produce invalid proposals. | ||
#[structopt(default_value = "CurTime", short, long)] | ||
pub time_source: TimeSource, | ||
|
||
/// The JSON block template. | ||
/// If this argument is not supplied, the template is read from standard input. | ||
/// | ||
/// The template and proposal structures are printed to stderr. | ||
#[structopt(last = true)] | ||
pub template: Option<String>, | ||
} |
Oops, something went wrong.