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

Support "pending" option for Web3 requests #713

Merged
merged 3 commits into from
Nov 20, 2018

Conversation

arajasek
Copy link
Contributor

Notice

It is not allowed to submit your PR to the master branch directly, please submit your PR to the master-pre-merge branch.

Description

Adds the "pending" option for the missing functions, thus fixing issue #709.

Type of change

Insert x into the following checkboxes to confirm (eg. [x]):

  • Bug fix.
  • New feature.
  • Enhancement.
  • Unit test.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

Testing

All existing tests pass, new tests added.

Verification

Insert x into the following checkboxes to confirm (eg. [x]):

  • I have self-reviewed my own code and conformed to the style guidelines of this project.
  • New and existing tests pass locally with my changes.
  • I have added tests for my fix or feature.
  • I have made appropriate changes to the corresponding documentation.
  • My code generates no new warnings.
  • Any dependent changes have been made.

@AlexandraRoatis AlexandraRoatis added the enhancement New feature or request label Nov 20, 2018
@AlexandraRoatis AlexandraRoatis added this to the 0.3.2 milestone Nov 20, 2018
Copy link
Contributor

@aion-kelvin aion-kelvin left a comment

Choose a reason for hiding this comment

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

Hey looks pretty sane overall ... as we talked about, wasn't practical to add any meaningful testing due to the way the code is layed out. Could you set up a jira task about making these class(es) more testable?

@@ -2872,6 +2838,14 @@ private IRepository getRepoByJsonBlockId(String _bnOrId) {
return ac.getRepository().getSnapshotTo(b.getStateRoot());
}

private AionBlock getBlockByBN(Long bn) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think long is better than Long here (probably doesn't make sense to pass in null)

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

@@ -2872,6 +2838,14 @@ private IRepository getRepoByJsonBlockId(String _bnOrId) {
return ac.getRepository().getSnapshotTo(b.getStateRoot());
}

private AionBlock getBlockByBN(Long bn) {
if (bn < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be bn == -1 instead?

(And if so, I think it'd be good to put -1 in a const like 'BEST_PENDING_BLOCK' or something to that effect)

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

return null;
}

if (bn < 0) return pendingState.getRepository();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it not be bn == -1?

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

@arajasek
Copy link
Contributor Author

All suggested changes have been implemented :)

Copy link
Contributor

@aion-kelvin aion-kelvin left a comment

Choose a reason for hiding this comment

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

looks good thanks for the changes!

@@ -1100,6 +1102,11 @@ private FltrLg createFilter(ArgFltr rf) {
return null;
}

if (bnTo != BEST_PENDING_BLOCK && (bnFrom > bnTo)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: unnecessary parens

Copy link
Contributor Author

Choose a reason for hiding this comment

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

KILLED them :)

Copy link
Collaborator

@AionJayT AionJayT left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the PR

@AlexandraRoatis AlexandraRoatis merged commit 286aa1c into master-pre-merge Nov 20, 2018
@AlexandraRoatis AlexandraRoatis deleted the pending-api branch November 20, 2018 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants