Skip to content

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

Merged
merged 9 commits into from
May 21, 2019
Merged

Conversation

sgkim126
Copy link
Contributor

It's to ready the ChangeParams.
The current code assumes that the CommonParams are immutable.

@sgkim126
Copy link
Contributor Author

It depends on #1545

@sgkim126 sgkim126 added the do-not-merge Do not merge (for mergify.io) label May 17, 2019
@sgkim126 sgkim126 mentioned this pull request May 20, 2019
@sgkim126 sgkim126 requested a review from HoOngEe May 20, 2019 08:22
@@ -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()) {
Copy link
Contributor

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.

Copy link
Contributor Author

@sgkim126 sgkim126 May 20, 2019

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.

Seulgi Kim and others added 6 commits May 20, 2019 19:33
…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.
Copy link
Contributor

@majecty majecty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sgkim126 sgkim126 removed the do-not-merge Do not merge (for mergify.io) label May 21, 2019
@mergify mergify bot merged commit 543fdab into CodeChain-io:master May 21, 2019
@sgkim126 sgkim126 deleted the veri branch May 21, 2019 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants