Skip to content

[ETCM-301] Fix block preparation#782

Merged
mmrozek merged 10 commits intodevelopfrom
etcm-301-fix-block-preparation
Nov 13, 2020
Merged

[ETCM-301] Fix block preparation#782
mmrozek merged 10 commits intodevelopfrom
etcm-301-fix-block-preparation

Conversation

@mmrozek
Copy link
Copy Markdown
Contributor

@mmrozek mmrozek commented Nov 6, 2020

Description

  1. Change type of stateRoot from Option to ByteString in WorldStateProxy to avoid mistakes
  2. Add a parent as a parameter of prepareBlock method.

This change should also solve the issue described in ETCM-329

Comment thread src/main/scala/io/iohk/ethereum/ledger/BlockExecution.scala Outdated
// // this seems to discard failures, for better errors messages we might want to implement a different method (simulateBlock?)
// val result = blockPreparator.prepareBlock(block)
// Right(result.blockResult.receipts)
// FIXME DO WE NEED THAT?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we could create task to delete those snappy tests? (I highly doubt anybody will ever use it)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@@ -67,7 +67,13 @@ class BlockExecution(
* @param block the block with transactions to run
*/
private[ledger] def executeBlockTransactions(block: Block): Either[BlockExecutionError, BlockResult] = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe it would be possible to pass parent header here as param , to avoid this blockchain.getBlockHeaderByHash(block.header.parentHash ?

@mmrozek mmrozek requested a review from kapke November 10, 2020 10:02
Comment thread src/main/scala/io/iohk/ethereum/ledger/BlockPreparator.scala Outdated
Copy link
Copy Markdown

@ntallar ntallar left a comment

Choose a reason for hiding this comment

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

Apart from the below comments, LGTM!

Do you think there's any test that could be added for any of the two issues?

Comment thread src/main/scala/io/iohk/ethereum/consensus/ethash/MockedMiner.scala Outdated
Comment thread src/test/scala/io/iohk/ethereum/jsonrpc/EthServiceSpec.scala
Comment thread src/main/scala/io/iohk/ethereum/ledger/BlockPreparator.scala
@mmrozek
Copy link
Copy Markdown
Contributor Author

mmrozek commented Nov 13, 2020

@ntallar I don't think that we are able to add some reliable test to check that. I can't imagine any

Copy link
Copy Markdown

@ntallar ntallar left a comment

Choose a reason for hiding this comment

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

LGTM!

 .\\            //.
. \ \          / /.
.\  ,\     /` /,.-
 -.   \  /'/ /  .
 ` -   `-'  \  -
   '.       /.\`
      -    .-
      :`//.'
      .`.'
      .' BP 

@mmrozek mmrozek merged commit 2047259 into develop Nov 13, 2020
@mmrozek mmrozek deleted the etcm-301-fix-block-preparation branch November 13, 2020 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants