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

feat: udpate consensus branch id for nu6 #129

Merged
merged 7 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=4
# This is the minor version
APPVERSION_N=2
# This is the patch version
APPVERSION_P=2
APPVERSION_P=3
7 changes: 4 additions & 3 deletions app/src/refactor/sighash.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const uint8_t CTX_ZCASH_SHIELDED_OUTPUTS_HASH_PERSONALIZATION[] = "ZcashSOutputH

const uint8_t CONSENSUS_BRANCH_ID_SAPLING[4] = {0xBB, 0x09, 0xB8, 0x76}; // sapling
const uint8_t CONSENSUS_BRANCH_ID_ORCHARD[4] = {0xB4, 0xD0, 0xD6, 0xC2}; // orchard
const uint8_t CONSENSUS_BRANCH_ID_NU6[4] = {0x55, 0x10, 0xE7, 0xC8}; // nu6

zxerr_t sapling_transparent_prevouts_hash(const uint8_t *input, uint8_t *output) {
const uint8_t n = t_inlist_len();
Expand Down Expand Up @@ -148,7 +149,7 @@ static zxerr_t signature_hash_v4(const uint8_t *input, uint16_t inputlen, uint8_
cx_blake2b_t ctx = {0};

uint8_t personalization[16] = "ZcashSigHash";
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_ORCHARD, 4);
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_NU6, 4);

CHECK_CX_OK(cx_blake2b_init2_no_throw(&ctx, 256, NULL, 0, (uint8_t *)personalization, PERSONALIZATION_SIZE));
CHECK_CX_OK(cx_hash_no_throw(&ctx.header, CX_LAST, input, inputlen, output, HASH_SIZE));
Expand All @@ -166,7 +167,7 @@ static zxerr_t signature_hash_v5(
cx_blake2b_t ctx = {0};

uint8_t personalization[16] = "ZcashTxHash_";
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_ORCHARD, 4);
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_NU6, 4);
CHECK_CX_OK(cx_blake2b_init2_no_throw(&ctx, 256, NULL, 0, (uint8_t *)personalization, PERSONALIZATION_SIZE));

uint8_t header_digest[32] = {0};
Expand Down Expand Up @@ -215,7 +216,7 @@ static zxerr_t signature_script_hash_v4(

cx_blake2b_t ctx = {0};
uint8_t personalization[16] = "ZcashSigHash";
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_ORCHARD, 4);
MEMCPY(personalization + 12, CONSENSUS_BRANCH_ID_NU6, 4);

CHECK_CX_OK(cx_blake2b_init2_no_throw(&ctx, 256, NULL, 0, (uint8_t *)personalization, PERSONALIZATION_SIZE));
CHECK_CX_OK(cx_hash_no_throw(&ctx.header, 0, input, inputlen, NULL, 0));
Expand Down
Binary file modified tests_zemu/snapshots/fl-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/s-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/sp-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/st-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests_zemu/snapshots/x-mainmenu/00010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
106 changes: 31 additions & 75 deletions zcashtools/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions zcashtools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ opt-level = "s"
overflow-checks = true

[patch.crates-io]
ledger-zcash-builder = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "0dd05cee4427f2c7ff1bfc9fb11f62f878c0cfa8" }
ledger-zcash = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "0dd05cee4427f2c7ff1bfc9fb11f62f878c0cfa8" }
ledger-zcash-builder = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "3bad2fa4a7870270627edc25ebdb5b4818fd1855" }
ledger-zcash = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "3bad2fa4a7870270627edc25ebdb5b4818fd1855" }

# ledger-zcash-builder = { path = "../../ledger-zcash-rs/ledger-zcash-builder" }
# ledger-zcash = { path = "../../ledger-zcash-rs/ledger-zcash" }
6 changes: 3 additions & 3 deletions zcashtools/neon/native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ serde_derive = "1"
serde = "1"
log = "0.4"
snafu = { version = "0.8.2" }
zcash_primitives = { version = "0.7", features = ["transparent-inputs"] }
zcash_primitives = { git = "https://github.com/Zondax/librustzcash", rev = "112eedd27b2e51b9e1b77603a776cd78e738c3ae", features = ["transparent-inputs"], package = "zcash_primitives" }

neon-serde = { git = "https://github.com/Zondax/neon-serde", branch = "master", default-features = false, features = [
"napi-6",
] }

ledger-zcash-builder = "=0.11.2"
ledger-zcash = "0.11.2"
ledger-zcash-builder = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "3bad2fa4a7870270627edc25ebdb5b4818fd1855", package = "ledger-zcash-builder" }
ledger-zcash = { git = "https://github.com/Zondax/ledger-zcash-rs", rev = "3bad2fa4a7870270627edc25ebdb5b4818fd1855", package = "ledger-zcash" }

[dev-dependencies]
serde = { version = "1", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion zcashtools/neon/native/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl ZcashBuilderBridge {
AuthorisationStatus::Unauthorized(mut builder) => {
let mut prover =
txprover::LocalTxProver::new(Path::new(spendpath), Path::new(outputpath));
let res = builder.build(consensus::BranchId::Nu5, tx_ver, &mut prover);
let res = builder.build(consensus::BranchId::Nu6, tx_ver, &mut prover);
match res {
Ok(_) => self.zcashbuilder = AuthorisationStatus::Unauthorized(builder),
Err(ref e) => {
Expand Down
Loading