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

Extend block parameter methods to accept 'finalized' and 'safe' as block tags #3950

Merged
merged 3 commits into from
Jun 10, 2022

Conversation

fab-10
Copy link
Contributor

@fab-10 fab-10 commented Jun 9, 2022

Signed-off-by: Fabio Di Fabio fabio.difabio@consensys.net

PR description

Fixed Issue(s)

fixes #3947

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

…ock tags

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 force-pushed the get_block_finalized_safe branch from 337e94e to c8b0d8e Compare June 9, 2022 11:52
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
@fab-10 fab-10 marked this pull request as ready for review June 9, 2022 15:15
@fab-10 fab-10 added doc-change-required Indicates an issue or PR that requires doc to be updated mainnet labels Jun 9, 2022
Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

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

LGTM presuming a change in the changelog and restoring the 'if/else if' chaining

CHANGELOG.md Outdated
@@ -4,6 +4,7 @@

### Additions and Improvements
- \[EXPERIMENTAL\] Add checkpoint sync `--sync-mode="X_CHECKPOINT"` [#3849](https://github.com/hyperledger/besu/pull/3849)
- Support `latest` and `safe` as tags for the block parameter in RPC APIs [#3950](https://github.com/hyperledger/besu/pull/3950)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/latest/finalized/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// If block parameter is not numeric or latest, it is pending.
result = pendingResult(request);
return resultByBlockNumber(request, blockNumber.get());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Style wise these should remain if/else chained. They are not proper "guard blocks" and readability would be improved by retaining the if/elseif/elseif chain. Bringing in the last return as an else would further improve the readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Copy link

@callree callree left a comment

Choose a reason for hiding this comment

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

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/AbstractBlockParameterMethod.java

@fab-10 fab-10 merged commit a5dd7b8 into hyperledger:main Jun 10, 2022
@fab-10 fab-10 deleted the get_block_finalized_safe branch June 10, 2022 07:39
@fab-10
Copy link
Contributor Author

fab-10 commented Jun 10, 2022

ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/AbstractBlockParameterMethod.java

what do you mean?

@rolandtyler rolandtyler removed the doc-change-required Indicates an issue or PR that requires doc to be updated label Jun 14, 2022
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
…ock tags (hyperledger#3950)


Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend eth_getBlockByNumber to support finalized and safe as block tags
4 participants