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 OneOf #38 #49

Merged
merged 5 commits into from
Feb 4, 2019
Merged

Support OneOf #38 #49

merged 5 commits into from
Feb 4, 2019

Conversation

alexeyneu
Copy link
Contributor

@alexeyneu alexeyneu commented Jan 12, 2019

Fixes #38

@alexeyneu alexeyneu changed the title #38 Support OneOf #38 Jan 12, 2019
@codecov
Copy link

codecov bot commented Jan 12, 2019

Codecov Report

Merging #49 into master will decrease coverage by 1.38%.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
- Coverage   88.94%   87.55%   -1.39%     
==========================================
  Files           4        4              
  Lines         624      635      +11     
==========================================
+ Hits          555      556       +1     
- Misses         38       44       +6     
- Partials       31       35       +4
Impacted Files Coverage Δ
proofs/flatten.go 78.57% <28.57%> (-4.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c3b6a2...8d0e0f2. Read the comment docs.

Copy link
Member

@lucasvo lucasvo left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request.
I would like to ask you for a few changes:

  • Could you please revert the formatting changes you made?
  • Could you please document the added feature?
  • Could you add a usage of it to example.proto and make use of it in a unit test?

@@ -55,8 +55,12 @@ func (f *messageFlattener) handleValue(prop Property, value reflect.Value, saltV

// Handle each field of the struct
for i := 0; i < value.NumField(); i++ {
var oneof_here bool
Copy link
Member

Choose a reason for hiding this comment

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

Could you rename this to oneOfField?

@codecov
Copy link

codecov bot commented Jan 16, 2019

Codecov Report

Merging #49 into master will decrease coverage by 0.12%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
- Coverage   88.69%   88.56%   -0.13%     
==========================================
  Files           3        3              
  Lines         575      586      +11     
==========================================
+ Hits          510      519       +9     
- Misses         36       37       +1     
- Partials       29       30       +1
Impacted Files Coverage Δ
proofs/flatten.go 82.56% <85.71%> (-0.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14aec56...dad389d. Read the comment docs.

@@ -28,7 +28,7 @@ func TestFillSalts(t *testing.T) {

//Document with oneof fieldset
Copy link
Member

Choose a reason for hiding this comment

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

	// Document with oneof fieldset

Space between double dashes and comment please

err = doctree.Generate()

_, err = doctree.CreateProof("InexistentField")
assert.EqualError(t, err, "No such field: InexistentField in obj")
Copy link
Member

Choose a reason for hiding this comment

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

You probably don't need to test this here if it's tested elsewhere.

Copy link
Member

@lucasvo lucasvo left a comment

Choose a reason for hiding this comment

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

The coverage report shows this line not being covered, is this correct? https://codecov.io/gh/centrifuge/precise-proofs/pull/49/diff?src=pr&el=tree#D6-97

In addition, it would be nice to add a similar test as this one here:

assert.Equal(t, []Property{

That would show that if valueC is set, then the tree would have: valueA, valueC as properties and if valueB is set it would only have valueA, valueB as properties?

assert.Nil(t, err)

falseProof, err := doctree.CreateProof("valueB")
falseProof.Value = "Invalid"
Copy link
Member

Choose a reason for hiding this comment

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

this test doesn't test much and is covered in other test cases already


proof, err := doctree.CreateProof("valueB")
assert.Nil(t, err)
assert.Equal(t, ReadableName("valueB"), proof.Property)
Copy link
Member

Choose a reason for hiding this comment

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

Could you create a test for the following additional scenario: Try to create a proof for valueC when valueB is set

Copy link
Member

Choose a reason for hiding this comment

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

And when both are nil create a proof for either one (or even both) when both are nil.

@lucasvo
Copy link
Member

lucasvo commented Jan 18, 2019

We've changed how salts are handled in #43 and that code has now been merged. Could you resolve the conflicts please?

@alexeyneu
Copy link
Contributor Author

it's coz scott agreed to pay part of money himself

@alexeyneu
Copy link
Contributor Author

0xa5868913c4E26Bd4aE688B02D165a6bec5121aA0

@lucasvo
Copy link
Member

lucasvo commented Feb 2, 2019

@alexeyneu thank you for resolving the conflicts. @vimukthi-git will review the PR and test it locally. We might still have some smaller feedback but given that is all addressed we'll merge it and pay out the bounty.

@lucasvo lucasvo merged commit 4b2df65 into centrifuge:master Feb 4, 2019
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.

None yet

3 participants