-
Notifications
You must be signed in to change notification settings - Fork 51
Split the verification that needs CommonParams and doesn't need it #1546
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
Conversation
It depends on #1545 |
rpc/src/v1/impls/chain.rs
Outdated
@@ -237,7 +238,7 @@ where | |||
} | |||
|
|||
fn get_min_transaction_fee(&self, action_type: String, block_number: u64) -> Result<Option<u64>> { | |||
if let Some(common_parameters) = self.client.common_params(Some(block_number)) { | |||
if let Some(common_parameters) = self.client.common_params(block_number.into()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use parent's block common params?
If the RPC's caller wants to fee to creates transactions in the next block, the current implementation is OK.
However, if the RPC's caller wants to check the block's min_fee to verify the block, we should use the previous block's common params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it use the parameters of the parent block.
…t block Currently, CommonParams is immutable, but the next patch will make it changeable. So we need to check it on the parent states.
After introducing ChangeParams, common_params should return None, when the block is not executed yet.
Currently, CodeChainMachine manages the CommonParams, but it's fragile on reogranization. This patch makes CodeChainMachine has only the genesis parameters and the engine read the parameters from states.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It's to ready the ChangeParams.
The current code assumes that the CommonParams are immutable.