Skip to content

Commit

Permalink
remove newpulse event & increase max pulses
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnReedV committed Nov 15, 2024
1 parent 1323cc2 commit 1bfe856
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
18 changes: 7 additions & 11 deletions pallets/drand/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const CHAIN_HASH: &str = MAINNET_CHAIN_HASH;
#[cfg(not(feature = "mainnet"))]
const CHAIN_HASH: &str = QUICKNET_CHAIN_HASH;

pub const MAX_PULSES_TO_FETCH: u64 = 20;
pub const MAX_PULSES_TO_FETCH: u64 = 50;

/// Defines application identifier for crypto keys of this module.
///
Expand Down Expand Up @@ -203,11 +203,12 @@ pub mod pallet {
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
BeaconConfigChanged,
/// A user has successfully set a new value.
NewPulse {
/// The new value set.
rounds: Vec<RoundNumber>,
},
// Disabled because too spammy
// /// A user has successfully set a new value.
// NewPulse {
// /// The new value set.
// rounds: Vec<RoundNumber>,
// },
}

#[pallet::error]
Expand Down Expand Up @@ -333,11 +334,6 @@ pub mod pallet {
let current_block = frame_system::Pallet::<T>::block_number();
<NextUnsignedAt<T>>::put(current_block.saturating_add(One::one()));

// Emit a single event with all new rounds
if !new_rounds.is_empty() {
Self::deposit_event(Event::NewPulse { rounds: new_rounds });
}

Ok(())
}
/// allows the root user to set the beacon configuration
Expand Down
15 changes: 1 addition & 14 deletions pallets/drand/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use crate::{
mock::*, BeaconConfig, BeaconConfigurationPayload, BeaconInfoResponse, Call, DrandResponseBody,
Error, Event, Pulse, Pulses, PulsesPayload,
Error, Pulse, Pulses, PulsesPayload,
};
use codec::Encode;
use frame_support::{
Expand Down Expand Up @@ -122,13 +122,6 @@ fn it_can_submit_valid_pulse_when_beacon_config_exists() {
let pulse = Pulses::<Test>::get(ROUND_NUMBER);
assert!(pulse.is_some());
assert_eq!(pulse, Some(p));
// Assert that the correct event was deposited
System::assert_last_event(
Event::NewPulse {
rounds: vec![ROUND_NUMBER],
}
.into(),
);
});
}

Expand Down Expand Up @@ -219,12 +212,6 @@ fn it_rejects_pulses_with_non_incremental_round_numbers() {
let pulse = Pulses::<Test>::get(ROUND_NUMBER);
assert!(pulse.is_some());

System::assert_last_event(
Event::NewPulse {
rounds: vec![ROUND_NUMBER],
}
.into(),
);
System::set_block_number(2);

// Attempt to submit the same pulse again, which should fail
Expand Down

0 comments on commit 1bfe856

Please sign in to comment.