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

Stress tests #54

Merged
merged 12 commits into from
Aug 4, 2016
Merged

Stress tests #54

merged 12 commits into from
Aug 4, 2016

Conversation

vqhuy
Copy link
Member

@vqhuy vqhuy commented Aug 2, 2016

Reopening for discussion here since I messed up #43 .

- added benchmarks for creating large directory and doing lookups from large directory
- TB test
- MakeRand and Digest test
- s/createLargePadForBenchmark/createPad <- could be useful for other tests, too
- added tests for some edge cases
- removed obsolete check `uint64 < 0` which can't happen and error
- benchmark pad.Update(nil) in tree with 10^5 users (takes on average 0.23 s and consumes 72 MB)
- more stress tests/benchmarks for PAD Update and LookUp (used for pprof)
- test coverage in utils package
@vqhuy vqhuy mentioned this pull request Aug 2, 2016
if int(binary.LittleEndian.Uint32(b)) != numInt {
t.Fatal("Conversion to bytes looks wrong!")
}
// TODO It is possible to call `IntToBytes` with a signed int < 0
Copy link
Member Author

Choose a reason for hiding this comment

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

Continue the discussion in #43 (comment).

Do you have any explanation for this? I really don't know the reason why Golang developers do this. Even if I try int(4294967254) == -42, it still returns false.

Copy link
Member

Choose a reason for hiding this comment

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

I thought this will be discussed (and resolved) in #53 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, agree!

}
numInt = -42
b = IntToBytes(numInt)
if int32(binary.LittleEndian.Uint32(b)) != int32(numInt) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Can it be simplified to int32(binary.LittleEndian.Uint32(b)) != numInt?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, pushed a second ago.

Copy link
Member

Choose a reason for hiding this comment

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

Wait, I changed another line; but here it's needed or not? int32(binary.LittleEndian.Uint32(b)) != numInt won't work because the type of numInt is an int and the type of int32(binary.LittleEndian.Uint32(b)) is an int32

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. Sorry for the noise.

// create next epoch and see if the TB is inserted as promised:
pad.Update(nil)

ap, err := pad.Lookup(key1)
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we also verify the proof of inclusion here, just to make this test as a sample for complete TB verification?

Copy link
Member

Choose a reason for hiding this comment

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

Like in 91a5725?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, I suggest to make some small changes, though.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for your feedback :-) 95650ab

if !bytes.Equal(ap.LookupIndex, tb.Index) || !bytes.Equal(ap.Leaf.Value(), tb.Value) {
t.Error("Value wasn't inserted as promised")
}
// step 1. verify VRF index
if !bytes.Equal(vrfPrivKey1.Compute([]byte(key)), ap.LookupIndex) {
Copy link
Member Author

@vqhuy vqhuy Aug 4, 2016

Choose a reason for hiding this comment

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

I think we should verify the VRF index in returned TB first (after verifying the signature), then we could remove this verification since we already compared both indices above.

Copy link
Member

Choose a reason for hiding this comment

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

Right. Thanks for your feedback!

Copy link
Member

Choose a reason for hiding this comment

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

Done in 95650ab

@vqhuy
Copy link
Member Author

vqhuy commented Aug 4, 2016

LGTM. Nice work @liamsi :). Thanks!

@@ -241,14 +241,14 @@ func TestPoliciesChange(t *testing.T) {
}

func TestTB(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Should TestTB() be moved to tb_test.go?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, why not. It makes sense (04cf99a)

@masomel
Copy link
Member

masomel commented Aug 4, 2016

LGTM. Thanks @liamsi!

@liamsi liamsi merged this pull request into master Aug 4, 2016
@liamsi liamsi deleted the stress_tests branch August 4, 2016 19:38
liamsi added a commit that referenced this pull request Aug 4, 2016
(stress) tests and some (test-related) improvements:
- added benchmarks for creating large directory, doing lookups from large directory, and calling `PAD.Update(nil)`
- added tests: MakeRand, Digest, and TB test
- added tests for some edge cases
- test coverage in utils package and some edge cases in other packages
- removed obsolete check `uint64 < 0` which can't happen (and corresponding error)
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.

3 participants