Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: inline get_epoch_minted_amount in epoch manager #12435

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2308,7 +2308,7 @@ impl Chain {
return Err(Error::InvalidGasPrice);
}
let minted_amount = if self.epoch_manager.is_next_block_epoch_start(&prev_hash)? {
Some(self.epoch_manager.get_epoch_minted_amount(header.next_epoch_id())?)
Some(self.epoch_manager.get_epoch_info(header.next_epoch_id())?.minted_amount())
} else {
None
};
Expand Down
4 changes: 0 additions & 4 deletions chain/chain/src/test_utils/kv_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,6 @@ impl EpochManagerAdapter for MockEpochManager {
Ok(self.store.store_update())
}

fn get_epoch_minted_amount(&self, _epoch_id: &EpochId) -> Result<Balance, EpochError> {
Ok(0)
}

fn get_epoch_protocol_version(
&self,
_epoch_id: &EpochId,
Expand Down
2 changes: 1 addition & 1 deletion chain/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ impl Client {
let next_epoch_id = self.epoch_manager.get_next_epoch_id_from_prev_block(&prev_hash)?;

let minted_amount = if self.epoch_manager.is_next_block_epoch_start(&prev_hash)? {
Some(self.epoch_manager.get_epoch_minted_amount(&next_epoch_id)?)
Some(self.epoch_manager.get_epoch_info(&next_epoch_id)?.minted_amount())
} else {
None
};
Expand Down
8 changes: 0 additions & 8 deletions chain/epoch-manager/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,6 @@ pub trait EpochManagerAdapter: Send + Sync {
random_value: CryptoHash,
) -> Result<StoreUpdate, EpochError>;

/// Amount of tokens minted in given epoch.
fn get_epoch_minted_amount(&self, epoch_id: &EpochId) -> Result<Balance, EpochError>;

/// Epoch active protocol version.
fn get_epoch_protocol_version(&self, epoch_id: &EpochId)
-> Result<ProtocolVersion, EpochError>;
Expand Down Expand Up @@ -866,11 +863,6 @@ impl EpochManagerAdapter for EpochManagerHandle {
epoch_manager.add_validator_proposals(block_info, random_value)
}

fn get_epoch_minted_amount(&self, epoch_id: &EpochId) -> Result<Balance, EpochError> {
let epoch_manager = self.read();
Ok(epoch_manager.get_epoch_info(epoch_id)?.minted_amount())
}

fn get_epoch_protocol_version(
&self,
epoch_id: &EpochId,
Expand Down
Loading