Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed Oct 4, 2024
1 parent d70c71d commit 36ae184
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
12 changes: 1 addition & 11 deletions core/node/api_server/src/web3/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,10 @@ impl InternalApiConfig {
///
/// The information may be temporarily outdated and thus should only be used where this is OK
/// (e.g., for metrics reporting). The value is updated by [`Self::diff()`] and [`Self::diff_with_block_args()`].
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct SealedL2BlockNumber(Arc<AtomicU32>);

impl SealedL2BlockNumber {
pub fn new() -> Self {
Self(Arc::default())
}

/// Potentially updates the last sealed L2 block number by comparing it to the provided
/// sealed L2 block number (not necessarily the last one).
///
Expand Down Expand Up @@ -213,12 +209,6 @@ impl SealedL2BlockNumber {
}
}

impl Default for SealedL2BlockNumber {
fn default() -> Self {
Self::new()
}
}

#[derive(Debug, Clone)]
pub struct BridgeAddressesHandle(Arc<RwLock<BridgeAddresses>>);

Expand Down
2 changes: 1 addition & 1 deletion core/node/api_server/src/web3/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async fn spawn_server(

let mut namespaces = Namespace::DEFAULT.to_vec();
namespaces.extend([Namespace::Debug, Namespace::Snapshots, Namespace::Unstable]);
let sealed_l2_block_handle = SealedL2BlockNumber::new();
let sealed_l2_block_handle = SealedL2BlockNumber::default();
let bridge_addresses_handle = BridgeAddressesHandle::new(api_config.bridge_addresses.clone());

let server_builder = match transport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ impl Task for BridgeAddressesUpdaterTask {
}

async fn run(self: Box<Self>, mut stop_receiver: StopReceiver) -> anyhow::Result<()> {
let update_interval = self.update_interval.unwrap_or(Duration::from_secs(30));
const DEFAULT_INTERVAL: Duration = Duration::from_secs(30);

let update_interval = self.update_interval.unwrap_or(DEFAULT_INTERVAL);
while !*stop_receiver.0.borrow_and_update() {
match self.main_node_client.get_bridge_contracts().await {
Ok(bridge_addresses) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl WiringLayer for Web3ServerLayer {
let sync_state = input.sync_state.map(|state| state.0);
let tree_api_client = input.tree_api_client.map(|client| client.0);

let sealed_l2_block_handle = SealedL2BlockNumber::new();
let sealed_l2_block_handle = SealedL2BlockNumber::default();
let bridge_addresses_handle =
BridgeAddressesHandle::new(self.internal_api_config.bridge_addresses.clone());

Expand Down

0 comments on commit 36ae184

Please sign in to comment.