Skip to content

Commit

Permalink
Add shardtree crate
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Dec 11, 2024
1 parent 97fccd9 commit 231d3e6
Show file tree
Hide file tree
Showing 31 changed files with 7,263 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ deps = {
"url": "https://github.com/ronaldoussoren/macholib.git@36a6777ccd0891c5d1b44ba885573d7c90740015",
"condition": "checkout_mac",
},
"components/brave_wallet/browser/zcash/rust/librustzcash/src": "https://github.com/brave/librustzcash.git@4d44f5dc3429dce7df37359b8b3c4716807770ea",
"components/brave_wallet/browser/zcash/rust/librustzcash/src": "https://github.com/brave/librustzcash.git@5b496c6ead39a0e0f32337f9b6bbf63e7ce92830",
}

recursedeps = [
Expand Down
2 changes: 2 additions & 0 deletions components/brave_wallet/browser/zcash/rust/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ rust_static_library("rust_lib") {
cxx_bindings = [ "lib.rs" ]

deps = [
"librustzcash:zcash_client_backend",
"librustzcash:zcash_primitives",
"//brave/components/brave_wallet/rust:rust_lib",
"//brave/third_party/rust/incrementalmerkletree/v0_5:lib",
"//brave/third_party/rust/memuse/v0_2:lib",
"//brave/third_party/rust/nonempty/v0_7:lib",
"//brave/third_party/rust/orchard/v0_8:lib",
"//brave/third_party/rust/rand/v0_8:lib",
"//brave/third_party/rust/shardtree/v0_3:lib",
"//brave/third_party/rust/zcash_note_encryption/v0_4:lib",
"//third_party/rust/byteorder/v1:lib",
]
Expand Down
4 changes: 3 additions & 1 deletion components/brave_wallet/browser/zcash/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ cxx = { version = "1" }
orchard = { version = "0.8.0", default-features = false }
rand = "0.8"
zcash_primitives = { version = "0.15.1", default-features = false }
zcash_note_encryption = "0.4"
zcash_note_encryption = "0.4"
zcash_client_backend = { version = "0.12.1", default-features = false }
shardtree = { version="0.3", features=["legacy-api"] }

[lib]
name = "zcash"
Expand Down
26 changes: 25 additions & 1 deletion components/brave_wallet/browser/zcash/rust/librustzcash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ rust_static_library("zcash_protocol") {
}

rust_static_library("zcash_encoding") {
visibility = [ ":zcash_primitives" ]
visibility = [
":zcash_client_backend",
":zcash_primitives",
]
crate_name = "zcash_encoding"
crate_root = "src/components/zcash_encoding/src/lib.rs"
sources = [ "src/components/zcash_encoding/src/lib.rs" ]
Expand All @@ -36,6 +39,7 @@ rust_static_library("zcash_encoding") {

rust_static_library("zcash_primitives") {
visibility = [
":zcash_client_backend",
"//brave/components/brave_wallet/browser/zcash/rust:rust_lib",
"//brave/components/brave_wallet/browser/zcash/rust:rust_lib_cxx_generated",
]
Expand All @@ -58,3 +62,23 @@ rust_static_library("zcash_primitives") {
"//third_party/rust/byteorder/v1:lib",
]
}

rust_static_library("zcash_client_backend") {
visibility = [
"//brave/components/brave_wallet/browser/zcash/rust:rust_lib",
"//brave/components/brave_wallet/browser/zcash/rust:rust_lib_cxx_generated",
]
crate_name = "zcash_client_backend"
crate_root = "src/zcash_client_backend/src/lib.rs"
sources = [
"src/zcash_client_backend/src/lib.rs",
"src/zcash_client_backend/src/serialization.rs",
"src/zcash_client_backend/src/serialization/shardtree.rs",
]
deps = [
":zcash_encoding",
":zcash_primitives",
"//brave/third_party/rust/byteorder/v1:lib",
"//brave/third_party/rust/shardtree/v0_3:lib",
]
}
3 changes: 2 additions & 1 deletion script/brave_license_helper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2019 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/. */
# You can obtain one at https://mozilla.org/MPL/2.0/.

import os
import re
Expand Down Expand Up @@ -60,6 +60,7 @@ def AddBraveCredits(root, prune_paths, special_cases, prune_dirs,
os.path.join('brave', 'third_party', 'rust', 'anyhow'),
os.path.join('brave', 'third_party', 'rust', 'base64'),
os.path.join('brave', 'third_party', 'rust', 'bitflags'),
os.path.join('brave', 'third_party', 'rust', 'bitflags', 'v2'),
os.path.join('brave', 'third_party', 'rust', 'byteorder', 'v1'),
os.path.join('brave', 'third_party', 'rust', 'cfg_if'),
os.path.join('brave', 'third_party', 'rust', 'cxx'),
Expand Down
23 changes: 23 additions & 0 deletions third_party/rust/chromium_crates_io/Cargo.lock

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

5 changes: 5 additions & 0 deletions third_party/rust/chromium_crates_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,8 @@ package = "zerocopy"
[patch.crates-io.zerocopy_derive_v0_7]
path = "../../../../third_party/rust/chromium_crates_io/vendor/zerocopy-derive-0.7.35"
package = "zerocopy-derive"

[patch.crates-io.zcash_client_backend_v0_12]
path = "../../../components/brave_wallet/browser/zcash/rust/librustzcash/src/zcash_client_backend"
package = "zcash_client_backend"

3 changes: 3 additions & 0 deletions third_party/rust/chromium_crates_io/gnrt_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,6 @@ license_files = ['../../../../../common/licenses/Apache-2.0']

[crate.zcash_protocol]
license_files = ['../../../../../common/licenses/Apache-2.0']

[crate.zcash_client_backend]
license_files = ['../../../../../common/licenses/Apache-2.0']
Loading

0 comments on commit 231d3e6

Please sign in to comment.