build(deps): bump bitflags from 1.3.2 to 2.0.1 (#6346)

* build(deps): bump bitflags from 1.3.2 to 2.0.1

Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.0.1.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.0.1)

---
updated-dependencies:
- dependency-name: bitflags
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* make bitflag v2 work with zebra

* add doc suggestions

Co-authored-by: Marek <mail@marek.onl>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-03-22 02:49:21 +00:00 committed by GitHub
parent f1bedafbbb
commit d06b0b15a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 20 deletions

View File

@ -234,7 +234,7 @@ checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43"
dependencies = [
"async-trait",
"axum-core",
"bitflags",
"bitflags 1.3.2",
"bytes",
"futures-util",
"http",
@ -352,7 +352,7 @@ version = "0.64.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cexpr",
"clang-sys",
"lazy_static",
@ -403,6 +403,22 @@ version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5dd14596c0e5b954530d0e6f1fd99b89c03e313aa2086e8da4303701a09e1cf"
[[package]]
name = "bitflags-serde-legacy"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfecf9fa72400de980120c09d7027140daa6541292245ff61a4ad3b89771680e"
dependencies = [
"bitflags 2.0.1",
"serde",
]
[[package]]
name = "bitvec"
version = "1.0.1"
@ -735,7 +751,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"ansi_term 0.12.1",
"atty",
"bitflags",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap 0.11.0",
"unicode-width",
@ -748,7 +764,7 @@ version = "3.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23b71c3ce99b7611011217b366d923f1d0a7e07a92bb2dbf1e84508c673ca3bd"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"clap_lex",
"indexmap",
"textwrap 0.15.0",
@ -1666,7 +1682,7 @@ version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"libc",
"libgit2-sys",
"log",
@ -2756,7 +2772,7 @@ version = "0.10.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"cfg-if 1.0.0",
"foreign-types",
"libc",
@ -3234,7 +3250,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12e6c80c1139113c28ee4670dc50cc42915228b51f56a9e407f0ec60f966646f"
dependencies = [
"bit-set",
"bitflags",
"bitflags 1.3.2",
"byteorder",
"lazy_static",
"num-traits",
@ -3475,7 +3491,7 @@ version = "10.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "929f54e29691d4e6a9cc558479de70db7aa3d98cd6fe7ab86d7507aa2886b9d2"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -3557,7 +3573,7 @@ version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c"
dependencies = [
"bitflags",
"bitflags 1.3.2",
]
[[package]]
@ -3699,7 +3715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
dependencies = [
"base64 0.13.0",
"bitflags",
"bitflags 1.3.2",
"serde",
]
@ -3745,7 +3761,7 @@ version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"errno",
"io-lifetimes",
"libc",
@ -3868,7 +3884,7 @@ version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"core-foundation",
"core-foundation-sys",
"libc",
@ -4753,7 +4769,7 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
dependencies = [
"bitflags",
"bitflags 1.3.2",
"bytes",
"futures-core",
"futures-util",
@ -5683,7 +5699,8 @@ dependencies = [
name = "zebra-chain"
version = "1.0.0-beta.21"
dependencies = [
"bitflags",
"bitflags 2.0.1",
"bitflags-serde-legacy",
"bitvec",
"blake2b_simd",
"blake2s_simd",
@ -5787,7 +5804,7 @@ dependencies = [
name = "zebra-network"
version = "1.0.0-beta.21"
dependencies = [
"bitflags",
"bitflags 2.0.1",
"byteorder",
"bytes",
"chrono",

View File

@ -34,7 +34,8 @@ bench = ["zebra-test"]
# Cryptography
bitvec = "1.0.1"
bitflags = "1.3.2"
bitflags = "2.0.1"
bitflags-serde-legacy = "0.1.0"
blake2b_simd = "1.0.1"
blake2s_simd = "1.0.1"
bs58 = { version = "0.4.0", features = ["check"] }

View File

@ -223,7 +223,7 @@ bitflags! {
///
/// ([`bitflags`](https://docs.rs/bitflags/1.2.1/bitflags/index.html) restricts its values to the
/// set of valid flags)
#[derive(Deserialize, Serialize)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Flags: u8 {
/// Enable spending non-zero valued Orchard notes.
///
@ -234,6 +234,28 @@ bitflags! {
}
}
// We use the `bitflags 2.x` library to implement [`Flags`]. The
// `2.x` version of the library uses a different serialization
// format compared to `1.x`.
// This manual implementation uses the `bitflags_serde_legacy` crate
// to serialize `Flags` as `bitflags 1.x` would.
impl serde::Serialize for Flags {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
bitflags_serde_legacy::serialize(self, "Flags", serializer)
}
}
// We use the `bitflags 2.x` library to implement [`Flags`]. The
// `2.x` version of the library uses a different deserialization
// format compared to `1.x`.
// This manual implementation uses the `bitflags_serde_legacy` crate
// to deserialize `Flags` as `bitflags 1.x` would.
impl<'de> serde::Deserialize<'de> for Flags {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
bitflags_serde_legacy::deserialize("Flags", deserializer)
}
}
impl ZcashSerialize for Flags {
fn zcash_serialize<W: io::Write>(&self, mut writer: W) -> Result<(), io::Error> {
writer.write_u8(self.bits())?;

View File

@ -10,13 +10,14 @@ static ZIP143_EXPLANATION: &str = "Invalid transaction version: after Overwinter
bitflags::bitflags! {
/// The different SigHash types, as defined in <https://zips.z.cash/zip-0143>
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct HashType: u32 {
/// Sign all the outputs
const ALL = 0b0000_0001;
/// Sign none of the outputs - anyone can spend
const NONE = 0b0000_0010;
/// Sign one of the outputs - anyone can spend the rest
const SINGLE = Self::ALL.bits | Self::NONE.bits;
const SINGLE = Self::ALL.bits() | Self::NONE.bits();
/// Anyone can add inputs to this transaction
const ANYONECANPAY = 0b1000_0000;
}

View File

@ -14,7 +14,7 @@ default = []
proptest-impl = ["proptest", "proptest-derive", "zebra-chain/proptest-impl"]
[dependencies]
bitflags = "1.3.2"
bitflags = "2.0.1"
byteorder = "1.4.3"
bytes = "1.4.0"
chrono = { version = "0.4.24", default-features = false, features = ["clock", "std"] }

View File

@ -121,7 +121,7 @@ bitflags! {
///
/// Note that bits 24-31 are reserved for temporary experiments; other
/// service bits should be allocated via the ZIP process.
#[derive(Default)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct PeerServices: u64 {
/// NODE_NETWORK means that the node is a full node capable of serving
/// blocks, as opposed to a light client that makes network requests but