Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

fix broken getInclusionStates API call #1685

Merged
merged 8 commits into from
Jan 20, 2020

Conversation

acha-bill
Copy link
Contributor

Description

Updates getInclusionStates API call to only check the snapshot index of the given transactions.
Tips are therefore irrelevant.

Fixes #1350

Type of change

  • Bug fix (a non-breaking change which fixes an issue)

How Has This Been Tested?

  • All existing unit tests pass
  • API regression tests pass

Checklist:

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes

@@ -154,7 +154,7 @@ Feature: Test API calls on Machine 1

Then the response for "getInclusionStates" should return with:
|keys |values |type |
|states |False |bool |
|states |True |bool |
Copy link
Contributor

Choose a reason for hiding this comment

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

really?
We will wait for @DyrellC to say whether this makes sense and wait for buildkite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, @DyrellC, this is what I was talking to you about needing to to properly document the DBs, currently it changed and I have no idea why by just looking at the code.

Besides that, @acha-bill, maybe it is worth while to have another scenario (or step) in this PR for getInclusionStates. We want to have both the True and False cases.
We also want to make sure that we can accept a list of Hashes and not just one single hash.
You can wait for @DyrellC to explain to you what is going on with the DB

Copy link
Contributor

Choose a reason for hiding this comment

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

@galrogo this instance was actually the db that you had provided in the previous regression tests, but it does highlight this point yes.
@acha-bill since the getInclusionStates call will no longer need the tip list, you can remove that from the input side of the test. You could also add the list example that @galrogo is asking for with a 2 for 1 by having another scenario that tests inclusion state on a list of randomly generated hashes and having that return a boolList of false. That would cover testing a list scenario as well as making sure we have false cases register false as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DyrellC The python lib throws expected 3 args for getInclusionStates.
So we'll leave the tips param there for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I am adding communicating with clients to checklist

private AbstractResponse getInclusionStatesStatement(
final List<String> transactions,
final List<String> tips) throws Exception {
private AbstractResponse getInclusionStatesStatement(final List<String> transactions ) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

did you test what happens when someone passes tips still?
(it should work, but just checking)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

works. No difference

@GalRogozinski GalRogozinski added the L-Awaiting More Reviews Lifecycle - Every PR must have at least 2 reviewers label Dec 26, 2019
Copy link
Contributor

@DyrellC DyrellC left a comment

Choose a reason for hiding this comment

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

Just the commentary on the test itself for adding the additional use case, i'll leave it to @galrogo discretion as to whether to add that in this issue or as a future PR.

@@ -154,7 +154,7 @@ Feature: Test API calls on Machine 1

Then the response for "getInclusionStates" should return with:
|keys |values |type |
|states |False |bool |
|states |True |bool |
Copy link
Contributor

Choose a reason for hiding this comment

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

@galrogo this instance was actually the db that you had provided in the previous regression tests, but it does highlight this point yes.
@acha-bill since the getInclusionStates call will no longer need the tip list, you can remove that from the input side of the test. You could also add the list example that @galrogo is asking for with a 2 for 1 by having another scenario that tests inclusion state on a list of randomly generated hashes and having that return a boolList of false. That would cover testing a list scenario as well as making sure we have false cases register false as well.

Copy link
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

I want to expand the scenario
Let's finish this feature correctly

TEST_TIP_LIST = ["SBKWTQWCFTF9DBZHJKQJKU9LXMZD9BMWJIJLZCCZYJFWIBGYYQBJOWWFWIHDEDTIHUB9PMOWZVCPKV999"]
TEST_HASH_LIST = ["NMPXODIWSCTMWRTQ9AI9VROYNFACWCQDXDSJLNC9HKCECBCGQTBUBKVROXZLQWAZRQUGIJTLTMAMSH999",
"INVALIDWSCTMWRTQ9AI9VROYNFACWCQDXDSJLNC9HKCECBCGQTBUBKVROXZLQWAZRQUGIJTLTMAMSH999"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose the second tx is a made up transaction.
Can we also add a real tx that is not included?

I think the scenarios should include:

  1. A bundle tail that is approved
  2. A bundle tail that is not approved
  3. A non-tail that is approved
  4. A non-tail that is not apporved
  5. a made up tx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropping scenario 2 and 4 as agreed with @galrogo .

@@ -154,7 +154,18 @@ Feature: Test API calls on Machine 1

Then the response for "getInclusionStates" should return with:
|keys |values |type |
|states |True |bool |
| states | TEST_HASH_RES | staticValue |
Copy link
Contributor

Choose a reason for hiding this comment

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

Only in case it is not too much work (no more than 5-10 minutes)
I think that maybe for the responses we can put the actual list in the table instead of the static val.
I just don't like it that we mask what's going on too much.

With long hashes there is less of a choice because they are long and ugly...

If this requires work than just comment on the reply and ignore

Copy link
Contributor

Choose a reason for hiding this comment

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

You can just use a boolList type here instead of loading a staticValue. Bool list will make an array of bools to compare with. So all you need to do is change the line to:
|states | True | boolList |
see line 113 in python-regression/utils/test_logic/value_fetch_logic.py


Then the response for "getInclusionStates" should return with:
| keys | values | type |
| states | TEST_RESPONSE | staticValue |
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

Choose a reason for hiding this comment

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

see above comment, same thing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DyrellC add new type boolListMixed cause boolList could only convert 1 type.

Copy link
Contributor

Choose a reason for hiding this comment

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

Lovely 👌

Copy link
Contributor

@DyrellC DyrellC 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 now

Copy link
Contributor

@DyrellC DyrellC left a comment

Choose a reason for hiding this comment

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

New scenario addition looks good.

@GalRogozinski GalRogozinski removed the L-Awaiting More Reviews Lifecycle - Every PR must have at least 2 reviewers label Jan 20, 2020
@GalRogozinski GalRogozinski merged commit 7cdc6db into iotaledger:dev Jan 20, 2020
@GalRogozinski GalRogozinski mentioned this pull request May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetInclusionStates api call is broken
3 participants