Skip to content

Commit

Permalink
chore: bump enum-iterator from 0.8.1 to 1.2.0 (solana-labs#27496)
Browse files Browse the repository at this point in the history
* chore: bump enum-iterator from 0.8.1 to 1.2.0

Bumps [enum-iterator](https://github.com/stephaneyfx/enum-iterator) from 0.8.1 to 1.2.0.
- [Release notes](https://github.com/stephaneyfx/enum-iterator/releases)
- [Commits](stephaneyfx/enum-iterator@0.8.1...1.2.0)

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

Signed-off-by: dependabot[bot] <[email protected]>

* Make versions consistent, and a-z toml

* Accommodate new apis

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <[email protected]>
  • Loading branch information
dependabot[bot] and Tyera Eulberg authored Aug 31, 2022
1 parent 12f9213 commit e22842f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion program-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ edition = "2021"
base64 = "0.13"
bincode = "1.3.3"
eager = "0.1.0"
enum-iterator = "1.2.0"
itertools = "0.10.1"
libc = "0.2.101"
libloading = "0.7.0"
Expand All @@ -26,7 +27,6 @@ solana-measure = { path = "../measure", version = "=1.12.0" }
solana-metrics = { path = "../metrics", version = "=1.12.0" }
solana-sdk = { path = "../sdk", version = "=1.12.0" }
thiserror = "1.0"
enum-iterator = "0.8.1"

[dev-dependencies]
solana-logger = { path = "../logger", version = "=1.12.0" }
Expand Down
10 changes: 5 additions & 5 deletions program-runtime/src/timings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
core::fmt,
enum_iterator::IntoEnumIterator,
enum_iterator::Sequence,
solana_sdk::{clock::Slot, pubkey::Pubkey, saturating_add_assign},
std::{
collections::HashMap,
Expand Down Expand Up @@ -40,7 +40,7 @@ impl ProgramTiming {
}

/// Used as an index for `Metrics`.
#[derive(Debug, IntoEnumIterator)]
#[derive(Debug, Sequence)]
pub enum ExecuteTimingType {
CheckUs,
LoadUs,
Expand All @@ -53,7 +53,7 @@ pub enum ExecuteTimingType {
UpdateTransactionStatuses,
}

pub struct Metrics([u64; ExecuteTimingType::ITEM_COUNT]);
pub struct Metrics([u64; ExecuteTimingType::CARDINALITY]);

impl Index<ExecuteTimingType> for Metrics {
type Output = u64;
Expand All @@ -70,7 +70,7 @@ impl IndexMut<ExecuteTimingType> for Metrics {

impl Default for Metrics {
fn default() -> Self {
Metrics([0; ExecuteTimingType::ITEM_COUNT])
Metrics([0; ExecuteTimingType::CARDINALITY])
}
}

Expand Down Expand Up @@ -337,7 +337,7 @@ impl ExecuteTimings {
let idx = timing_type as usize;
match self.metrics.0.get_mut(idx) {
Some(elem) => *elem = elem.saturating_add(value_to_add),
None => debug_assert!(idx < ExecuteTimingType::ITEM_COUNT, "Index out of bounds"),
None => debug_assert!(idx < ExecuteTimingType::CARDINALITY, "Index out of bounds"),
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions programs/bpf/Cargo.lock

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

2 changes: 1 addition & 1 deletion storage-bigtable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ backoff = { version = "0.4.0", features = ["tokio"] }
bincode = "1.3.3"
bytes = "1.2"
bzip2 = "0.4.3"
enum-iterator = "0.8.1"
enum-iterator = "1.2.0"
flate2 = "1.0.24"
futures = "0.3.23"
goauth = "0.13.1"
Expand Down
6 changes: 3 additions & 3 deletions storage-bigtable/src/compression.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use {
enum_iterator::IntoEnumIterator,
enum_iterator::{all, Sequence},
std::io::{self, BufReader, Read, Write},
};

#[derive(Debug, Serialize, Deserialize, IntoEnumIterator)]
#[derive(Debug, Serialize, Deserialize, Sequence)]
pub enum CompressionMethod {
NoCompression,
Bzip2,
Expand Down Expand Up @@ -76,7 +76,7 @@ pub fn compress(method: CompressionMethod, data: &[u8]) -> Result<Vec<u8>, io::E

pub fn compress_best(data: &[u8]) -> Result<Vec<u8>, io::Error> {
let mut candidates = vec![];
for method in CompressionMethod::into_enum_iter() {
for method in all::<CompressionMethod>() {
candidates.push(compress(method, data)?);
}

Expand Down
2 changes: 1 addition & 1 deletion storage-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ solana-sdk = { path = "../sdk", version = "=1.12.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.12.0" }

[dev-dependencies]
enum-iterator = "0.8.1"
enum-iterator = "1.2.0"

[lib]
crate-type = ["lib"]
Expand Down
4 changes: 2 additions & 2 deletions storage-proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ fn main() -> Result<(), std::io::Error> {
.build_server(false)
.type_attribute(
"TransactionErrorType",
"#[cfg_attr(test, derive(enum_iterator::IntoEnumIterator))]",
"#[cfg_attr(test, derive(enum_iterator::Sequence))]",
)
.type_attribute(
"InstructionErrorType",
"#[cfg_attr(test, derive(enum_iterator::IntoEnumIterator))]",
"#[cfg_attr(test, derive(enum_iterator::Sequence))]",
)
.compile(&protos, &[proto_base_path])
}
6 changes: 3 additions & 3 deletions storage-proto/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ impl TryFrom<tx_by_addr::TransactionByAddr> for Vec<TransactionByAddrInfo> {

#[cfg(test)]
mod test {
use {super::*, enum_iterator::IntoEnumIterator};
use {super::*, enum_iterator::all};

#[test]
fn test_reward_type_encode() {
Expand Down Expand Up @@ -1744,7 +1744,7 @@ mod test {
fn test_error_enums() {
let ix_index = 1;
let custom_error = 42;
for error in tx_by_addr::TransactionErrorType::into_enum_iter() {
for error in all::<tx_by_addr::TransactionErrorType>() {
match error {
tx_by_addr::TransactionErrorType::DuplicateInstruction
| tx_by_addr::TransactionErrorType::InsufficientFundsForRent => {
Expand All @@ -1762,7 +1762,7 @@ mod test {
assert_eq!(tx_by_addr_error, transaction_error.into());
}
tx_by_addr::TransactionErrorType::InstructionError => {
for ix_error in tx_by_addr::InstructionErrorType::into_enum_iter() {
for ix_error in all::<tx_by_addr::InstructionErrorType>() {
if ix_error != tx_by_addr::InstructionErrorType::Custom {
let tx_by_addr_error = tx_by_addr::TransactionError {
transaction_error: error as i32,
Expand Down

0 comments on commit e22842f

Please sign in to comment.