Skip to content

Commit dc4c38f

Browse files
committed
Merge branch 'ci-update-to-rust-stable' into background-txs
2 parents 8ab92f1 + 2b223a5 commit dc4c38f

21 files changed

+196
-308
lines changed

.github/actions/build_env/action.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ runs:
2727
- uses: actions-rs/toolchain@v1
2828
with:
2929
profile: minimal
30-
toolchain: 1.78.0
30+
toolchain: stable
3131
override: true
3232

3333
- name: install rustfmt clippy

compatibility/src/sdk/v5_0_0_genesis_transaction_script_builder.rs

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#![allow(clippy::unnecessary_wraps)]
1616
#![allow(unused_imports)]
1717
#![allow(dead_code)]
18+
#![allow(clippy::doc_lazy_continuation)]
19+
#![allow(clippy::empty_line_after_doc_comments)]
20+
1821
use crate::version_five::{
1922
language_storage_v5::{ModuleIdV5 as ModuleId, TypeTagV5 as TypeTag},
2023
legacy_address_v5::LegacyAddressV5 as AccountAddress,

compatibility/src/sdk/v5_2_0_transaction_script_builder.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#![allow(clippy::unnecessary_wraps)]
1414
#![allow(unused_imports)]
1515
#![allow(dead_code)]
16+
// legacy code from diem, clippy warnings since 1.80
17+
#![allow(clippy::doc_lazy_continuation)]
18+
#![allow(clippy::empty_line_after_doc_comments)]
1619
use crate::version_five::{
1720
language_storage_v5::{ModuleIdV5 as ModuleId, TypeTagV5 as TypeTag},
1821
legacy_address_v5::LegacyAddressV5 as AccountAddress,
@@ -4421,7 +4424,6 @@ pub fn encode_create_child_vasp_account_script_function(
44214424
/// | `human_name` | `vector<u8>` | ASCII-encoded human name for the Designated Dealer. |
44224425
/// | `add_all_currencies` | `bool` | Whether to publish preburn, balance, and tier info resources for all known (SCS) currencies or just `Currency` when the account is created. |
44234426
///
4424-
44254427
/// # Common Abort Conditions
44264428
/// | Error Category | Error Reason | Description |
44274429
/// | ---------------- | -------------- | ------------- |
@@ -4695,9 +4697,7 @@ pub fn encode_create_validator_account_script_function(
46954697
/// # Events
46964698
/// Successful execution will emit:
46974699
/// * A `DiemAccount::CreateAccountEvent` with the `created` field being `new_account_address`,
4698-
/// and the `rold_id` field being `Roles::VALIDATOR_OPERATOR_ROLE_ID`. This is emitted on the
4699-
/// `DiemAccount::AccountOperationsCapability` `creation_events` handle.
4700-
///
4700+
/// and the `rold_id` field being `Roles::VALIDATOR_OPERATOR_ROLE_ID`. This is emitted on the `DiemAccount::AccountOperationsCapability` `creation_events` handle.
47014701
/// # Parameters
47024702
/// | Name | Type | Description |
47034703
/// | ------ | ------ | ------------- |
@@ -5058,11 +5058,9 @@ pub fn encode_peer_to_peer_with_metadata_script_function(
50585058
///
50595059
/// # Events
50605060
/// Successful execution of this script emits two events:
5061-
/// * `DiemAccount::SentPaymentEvent ` on `account`'s `DiemAccount::DiemAccount` `sent_events`
5062-
/// handle with the `payee` and `payer` fields being `account`'s address; and
5061+
/// * `DiemAccount::SentPaymentEvent ` on `account`'s `DiemAccount::DiemAccount` `sent_events` handle with the `payee` and `payer` fields being `account`'s address; and
50635062
/// * A `Diem::PreburnEvent` with `Token`'s currency code on the
5064-
/// `Diem::CurrencyInfo<Token`'s `preburn_events` handle for `Token` and with
5065-
/// `preburn_address` set to `account`'s address.
5063+
/// `Diem::CurrencyInfo<Token`'s `preburn_events` handle for `Token` and with `preburn_address` set to `account`'s address.
50665064
///
50675065
/// # Parameters
50685066
/// | Name | Type | Description |
@@ -5504,9 +5502,7 @@ pub fn encode_rotate_authentication_key_with_recovery_address_script_function(
55045502
///
55055503
/// # Events
55065504
/// Successful execution of this transaction emits two events:
5507-
/// * A `DualAttestation::ComplianceKeyRotationEvent` containing the new compliance public key, and
5508-
/// the blockchain time at which the key was updated emitted on the `DualAttestation::Credential`
5509-
/// `compliance_key_rotation_events` handle published under `account`; and
5505+
/// * A `DualAttestation::ComplianceKeyRotationEvent` containing the new compliance public key, and the blockchain time at which the key was updated emitted on the `DualAttestation::Credential` `compliance_key_rotation_events` handle published under `account`; and
55105506
/// * A `DualAttestation::BaseUrlRotationEvent` containing the new base url to be used for
55115507
/// off-chain communication, and the blockchain time at which the url was updated emitted on the
55125508
/// `DualAttestation::Credential` `base_url_rotation_events` handle published under `account`.
@@ -6543,11 +6539,9 @@ pub fn encode_cancel_burn_script(token: TypeTag, preburn_address: AccountAddress
65436539
/// ## Events
65446540
/// Successful execution with a `child_initial_balance` greater than zero will emit:
65456541
/// * A `DiemAccount::SentPaymentEvent` with the `payer` field being the Parent VASP's address,
6546-
/// and payee field being `child_address`. This is emitted on the Parent VASP's
6547-
/// `DiemAccount::DiemAccount` `sent_events` handle.
6542+
/// and payee field being `child_address`. This is emitted on the Parent VASP's `DiemAccount::DiemAccount` `sent_events` handle.
65486543
/// * A `DiemAccount::ReceivedPaymentEvent` with the `payer` field being the Parent VASP's address,
6549-
/// and payee field being `child_address`. This is emitted on the new Child VASPS's
6550-
/// `DiemAccount::DiemAccount` `received_events` handle.
6544+
/// and payee field being `child_address`. This is emitted on the new Child VASPS's `DiemAccount::DiemAccount` `received_events` handle.
65516545
///
65526546
/// # Parameters
65536547
/// | Name | Type | Description |

compatibility/src/sdk/v6_libra_framework_sdk_builder.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#![allow(dead_code)]
2121
#![allow(unused_imports)]
2222
#![allow(clippy::too_many_arguments)]
23+
// legacy code from diem, clippy warnings since 1.80
24+
#![allow(clippy::doc_lazy_continuation)]
2325
use diem_types::{
2426
account_address::AccountAddress,
2527
transaction::{EntryFunction, TransactionPayload},

compatibility/src/sdk/v7_libra_framework_sdk_builder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#![allow(dead_code)]
2121
#![allow(unused_imports)]
22-
#![allow(clippy::too_many_arguments)]
22+
#![allow(clippy::too_many_arguments, clippy::doc_lazy_continuation)]
2323
use diem_types::{
2424
account_address::AccountAddress,
2525
transaction::{EntryFunction, TransactionPayload},
@@ -44,8 +44,8 @@ type Bytes = Vec<u8>;
4444
// explorer and data warehouse
4545
//////// end ////////
4646
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
47-
#[cfg_attr(feature = "fuzzing", derive(proptest_derive::Arbitrary))]
48-
#[cfg_attr(feature = "fuzzing", proptest(no_params))]
47+
// #[cfg_attr(feature = "fuzzing", derive(proptest_derive::Arbitrary))]
48+
// #[cfg_attr(feature = "fuzzing", proptest(no_params))]
4949
pub enum EntryFunctionCall {
5050
/// Offers rotation capability on behalf of `account` to the account at address `recipient_address`.
5151
/// An account can delegate its rotation capability to only one other address at one time. If the account

compatibility/src/version_five/hash_value_v5.rs

+4-240
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ use std::{
114114
};
115115
use tiny_keccak::{Hasher, Sha3};
116116

117-
/// A prefix used to begin the salt of every diem hashable structure. The salt
118-
/// consists in this global prefix, concatenated with the specified
119-
/// serialization name of the struct.
120-
// pub(crate) const DIEM_HASH_PREFIX: &[u8] = b"DIEM::";
121-
122117
/// Output value of our hash function. Intentionally opaque for safety and modularity.
123118
#[derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)]
124119
pub struct HashValueV5 {
@@ -269,7 +264,7 @@ impl HashValueV5 {
269264
/// generating basic mock hash values.
270265
///
271266
/// Ex: HashValue::from_u64(0x1234) => HashValue([0, .., 0, 0x12, 0x34])
272-
#[cfg(any(test, feature = "fuzzing"))]
267+
#[cfg(test)]
273268
pub fn from_u64(v: u64) -> Self {
274269
let mut hash = [0u8; Self::LENGTH];
275270
let bytes = v.to_be_bytes();
@@ -439,7 +434,7 @@ impl<'a> HashValueBitIterator<'a> {
439434
}
440435
}
441436

442-
impl<'a> std::iter::Iterator for HashValueBitIterator<'a> {
437+
impl std::iter::Iterator for HashValueBitIterator<'_> {
443438
type Item = bool;
444439

445440
fn next(&mut self) -> Option<Self::Item> {
@@ -451,241 +446,10 @@ impl<'a> std::iter::Iterator for HashValueBitIterator<'a> {
451446
}
452447
}
453448

454-
impl<'a> std::iter::DoubleEndedIterator for HashValueBitIterator<'a> {
449+
impl std::iter::DoubleEndedIterator for HashValueBitIterator<'_> {
455450
fn next_back(&mut self) -> Option<Self::Item> {
456451
self.pos.next_back().map(|x| self.get_bit(x))
457452
}
458453
}
459454

460-
impl<'a> std::iter::ExactSizeIterator for HashValueBitIterator<'a> {}
461-
462-
// /// A type that can be cryptographically hashed to produce a `HashValue`.
463-
// ///
464-
// /// In most cases, this trait should not be implemented manually but rather derived using
465-
// /// the macros `serde::Serialize`, `CryptoHasher`, and `BCSCryptoHash`.
466-
// pub trait CryptoHash {
467-
// /// The associated `Hasher` type which comes with a unique salt for this type.
468-
// type Hasher: CryptoHasher;
469-
470-
// /// Hashes the object and produces a `HashValue`.
471-
// fn hash(&self) -> HashValue;
472-
// }
473-
474-
// /// A trait for representing the state of a cryptographic hasher.
475-
// pub trait CryptoHasher: Default + std::io::Write {
476-
// /// the seed used to initialize hashing `Self` before the serialization bytes of the actual value
477-
// fn seed() -> &'static [u8; 32];
478-
479-
// /// Write bytes into the hasher.
480-
// fn update(&mut self, bytes: &[u8]);
481-
482-
// /// Finish constructing the [`HashValue`].
483-
// fn finish(self) -> HashValue;
484-
485-
// /// Convenience method to compute the hash of a complete byte slice.
486-
// fn hash_all(bytes: &[u8]) -> HashValue {
487-
// let mut hasher = Self::default();
488-
// hasher.update(bytes);
489-
// hasher.finish()
490-
// }
491-
// }
492-
493-
// /// The default hasher underlying generated implementations of `CryptoHasher`.
494-
// #[doc(hidden)]
495-
// #[derive(Clone)]
496-
// pub struct DefaultHasher {
497-
// state: Sha3,
498-
// }
499-
500-
// impl DefaultHasher {
501-
// #[doc(hidden)]
502-
// /// This function does not return a HashValue in the sense of our usual
503-
// /// hashes, but a construction of initial bytes that are fed into any hash
504-
// /// provided we're passed a (bcs) serialization name as argument.
505-
// pub fn prefixed_hash(buffer: &[u8]) -> [u8; HashValue::LENGTH] {
506-
// // The salt is initial material we prefix to actual value bytes for
507-
// // domain separation. Its length is variable.
508-
// let salt: Vec<u8> = [DIEM_HASH_PREFIX, buffer].concat();
509-
// // The seed is a fixed-length hash of the salt, thereby preventing
510-
// // suffix attacks on the domain separation bytes.
511-
// HashValue::sha3_256_of(&salt[..]).hash
512-
// }
513-
514-
// #[doc(hidden)]
515-
// pub fn new(typename: &[u8]) -> Self {
516-
// let mut state = Sha3::v256();
517-
// if !typename.is_empty() {
518-
// state.update(&Self::prefixed_hash(typename));
519-
// }
520-
// DefaultHasher { state }
521-
// }
522-
523-
// #[doc(hidden)]
524-
// pub fn update(&mut self, bytes: &[u8]) {
525-
// self.state.update(bytes);
526-
// }
527-
528-
// #[doc(hidden)]
529-
// pub fn finish(self) -> HashValue {
530-
// let mut hasher = HashValue::default();
531-
// self.state.finalize(hasher.as_ref_mut());
532-
// hasher
533-
// }
534-
// }
535-
536-
// impl fmt::Debug for DefaultHasher {
537-
// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
538-
// write!(f, "DefaultHasher: state = Sha3")
539-
// }
540-
// }
541-
542-
// macro_rules! define_hasher {
543-
// (
544-
// $(#[$attr:meta])*
545-
// ($hasher_type: ident, $hasher_name: ident, $seed_name: ident, $salt: expr)
546-
// ) => {
547-
548-
// #[derive(Clone, Debug)]
549-
// $(#[$attr])*
550-
// pub struct $hasher_type(DefaultHasher);
551-
552-
// impl $hasher_type {
553-
// fn new() -> Self {
554-
// $hasher_type(DefaultHasher::new($salt))
555-
// }
556-
// }
557-
558-
// static $hasher_name: Lazy<$hasher_type> = Lazy::new(|| { $hasher_type::new() });
559-
// static $seed_name: OnceCell<[u8; 32]> = OnceCell::new();
560-
561-
// impl Default for $hasher_type {
562-
// fn default() -> Self {
563-
// $hasher_name.clone()
564-
// }
565-
// }
566-
567-
// impl CryptoHasher for $hasher_type {
568-
// fn seed() -> &'static [u8;32] {
569-
// $seed_name.get_or_init(|| {
570-
// DefaultHasher::prefixed_hash($salt)
571-
// })
572-
// }
573-
574-
// fn update(&mut self, bytes: &[u8]) {
575-
// self.0.update(bytes);
576-
// }
577-
578-
// fn finish(self) -> HashValue {
579-
// self.0.finish()
580-
// }
581-
// }
582-
583-
// impl std::io::Write for $hasher_type {
584-
// fn write(&mut self, bytes: &[u8]) -> std::io::Result<usize> {
585-
// self.0.update(bytes);
586-
// Ok(bytes.len())
587-
// }
588-
// fn flush(&mut self) -> std::io::Result<()> {
589-
// Ok(())
590-
// }
591-
// }
592-
// };
593-
// }
594-
595-
// define_hasher! {
596-
// /// The hasher used to compute the hash of an internal node in the transaction accumulator.
597-
// (
598-
// TransactionAccumulatorHasher,
599-
// TRANSACTION_ACCUMULATOR_HASHER,
600-
// TRANSACTION_ACCUMULATOR_SEED,
601-
// b"TransactionAccumulator"
602-
// )
603-
// }
604-
605-
// define_hasher! {
606-
// /// The hasher used to compute the hash of an internal node in the event accumulator.
607-
// (
608-
// EventAccumulatorHasher,
609-
// EVENT_ACCUMULATOR_HASHER,
610-
// EVENT_ACCUMULATOR_SEED,
611-
// b"EventAccumulator"
612-
// )
613-
// }
614-
615-
// define_hasher! {
616-
// /// The hasher used to compute the hash of an internal node in the Sparse Merkle Tree.
617-
// (
618-
// SparseMerkleInternalHasher,
619-
// SPARSE_MERKLE_INTERNAL_HASHER,
620-
// SPARSE_MERKLE_INTERNAL_SEED,
621-
// b"SparseMerkleInternal"
622-
// )
623-
// }
624-
625-
// define_hasher! {
626-
// /// The hasher used to compute the hash of an internal node in the transaction accumulator.
627-
// (
628-
// VoteProposalHasher,
629-
// VOTE_PROPOSAL_HASHER,
630-
// VOTE_PROPOSAL_SEED,
631-
// b"VoteProposalHasher"
632-
// )
633-
// }
634-
635-
// define_hasher! {
636-
// /// The hasher used only for testing. It doesn't have a salt.
637-
// (TestOnlyHasher, TEST_ONLY_HASHER, TEST_ONLY_SEED, b"")
638-
// }
639-
640-
// fn create_literal_hash(word: &str) -> HashValue {
641-
// let mut s = word.as_bytes().to_vec();
642-
// assert!(s.len() <= HashValue::LENGTH);
643-
// s.resize(HashValue::LENGTH, 0);
644-
// HashValue::from_slice(&s).expect("Cannot fail")
645-
// }
646-
647-
// /// Placeholder hash of `Accumulator`.
648-
// pub static ACCUMULATOR_PLACEHOLDER_HASH: Lazy<HashValue> =
649-
// Lazy::new(|| create_literal_hash("ACCUMULATOR_PLACEHOLDER_HASH"));
650-
651-
// /// Placeholder hash of `SparseMerkleTree`.
652-
// pub static SPARSE_MERKLE_PLACEHOLDER_HASH: Lazy<HashValue> =
653-
// Lazy::new(|| create_literal_hash("SPARSE_MERKLE_PLACEHOLDER_HASH"));
654-
655-
// /// Block id reserved as the id of parent block of the genesis block.
656-
// pub static PRE_GENESIS_BLOCK_ID: Lazy<HashValue> =
657-
// Lazy::new(|| create_literal_hash("PRE_GENESIS_BLOCK_ID"));
658-
659-
// /// Genesis block id is used as a parent of the very first block executed by the executor.
660-
// pub static GENESIS_BLOCK_ID: Lazy<HashValue> = Lazy::new(|| {
661-
// // This maintains the invariant that block.id() == block.hash(), for
662-
// // the genesis block and allows us to (de/)serialize it consistently
663-
// HashValue::new([
664-
// 0x5e, 0x10, 0xba, 0xd4, 0x5b, 0x35, 0xed, 0x92, 0x9c, 0xd6, 0xd2, 0xc7, 0x09, 0x8b, 0x13,
665-
// 0x5d, 0x02, 0xdd, 0x25, 0x9a, 0xe8, 0x8a, 0x8d, 0x09, 0xf4, 0xeb, 0x5f, 0xba, 0xe9, 0xa6,
666-
// 0xf6, 0xe4,
667-
// ])
668-
// });
669-
670-
// /// Provides a test_only_hash() method that can be used in tests on types that implement
671-
// /// `serde::Serialize`.
672-
// ///
673-
// /// # Example
674-
// /// ```
675-
// /// use diem_crypto::hash::TestOnlyHash;
676-
// ///
677-
// /// b"hello world".test_only_hash();
678-
// /// ```
679-
// pub trait TestOnlyHash {
680-
// /// Generates a hash used only for tests.
681-
// fn test_only_hash(&self) -> HashValue;
682-
// }
683-
684-
// impl<T: ser::Serialize + ?Sized> TestOnlyHash for T {
685-
// fn test_only_hash(&self) -> HashValue {
686-
// let bytes = bcs::to_bytes(self).expect("serialize failed during hash.");
687-
// let mut hasher = TestOnlyHasher::default();
688-
// hasher.update(&bytes);
689-
// hasher.finish()
690-
// }
691-
// }
455+
impl std::iter::ExactSizeIterator for HashValueBitIterator<'_> {}

0 commit comments

Comments
 (0)