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

added skipchain and identity-changes #607

Merged
merged 22 commits into from
Sep 29, 2016
Merged

added skipchain and identity-changes #607

merged 22 commits into from
Sep 29, 2016

Conversation

ineiti
Copy link
Member

@ineiti ineiti commented Sep 23, 2016

  • a SecureTCPHost opens a connection so that it can be closed again
  • putting the time-out in identity-service from 1sec to 10sec
  • adding a test for GetUpdateChain in skipchain
  • registering services uses a slice so that the instantiations get done chronologically
  • verifier-functions in SkipChain get now registered directly to the instance of the service

@ineiti ineiti self-assigned this Sep 23, 2016
Copy link
Contributor

@nikkolasg nikkolasg left a comment

Choose a reason for hiding this comment

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

Cool changes, still need some refinements before going into master.

@@ -110,7 +110,7 @@ func (s *Service) CreateIdentity(si *network.ServerIdentity, ai *CreateIdentity)

roster := ids.Root.Roster
replies, err := manage.PropagateStartAndWait(s.Context, roster,
&PropagateIdentity{ids}, 1000, s.Propagate)
&PropagateIdentity{ids}, 10000, s.Propagate)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of 10000 or 1000, it should be easier to change at a single place using an unexported (or exported?) global variable (or with getter/setter). Even better, we could specify a value to the service (service.SetTimeout()) and the service would use the default unexported global variable by default otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's very specific for that service and shouldn't change during runtime, so I'll put in a constant.

@@ -150,7 +150,7 @@ func (s *Service) ProposeSend(si *network.ServerIdentity, p *ProposeSend) (netwo
}
roster := sid.Root.Roster
replies, err := manage.PropagateStartAndWait(s.Context, roster,
p, 1000, s.Propagate)
p, 10000, s.Propagate)
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above.


// RegisterVerification stores the verification in a map and will
// call it whenever a verification needs to be done.
func VerificationRegistration(v VerifierID, f bftcosi.VerificationFunction) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistency between names here RegisterVerification vs VerificationRegistration. (I have a preference for the former)

Copy link
Member Author

Choose a reason for hiding this comment

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

Me too.

@@ -397,7 +397,7 @@ func (s *Service) startPropagation(blocks []*SkipBlock) error {
roster = sb.Roster
}
replies, err := manage.PropagateStartAndWait(s.Context, roster,
block, 1000, s.PropagateSkipBlock)
block, 10000, s.PropagateSkipBlock)
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as for the identity service.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same reasoning as above. I'll put in a constant.

@@ -443,30 +443,36 @@ func (s *Service) bftVerify(msg []byte, data []byte) bool {
return true
}
}
default:
f, ok := verifiers[sb.VerifierID]
Copy link
Contributor

@nikkolasg nikkolasg Sep 23, 2016

Choose a reason for hiding this comment

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

Discussion: Maybe it's not possible directly or with too much work I don't know but since we introduce the registration of verification functions, it seems best to

  • delete the two above case
  • put their logic into separate verification functions
  • register these verification functions in a init() or so
  • get rid of this switch case

That way all is "unified" according to this new way of using verification functions (and in a few months we won't be like whut ? Why is it not used in a registration function ... ?? ).
What do you think ? From just what I see now it does not seem to be too much work but @ineiti you know better this code so what's your thoughts on this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I left it here because it uses fields of the structure, but it makes sense what you say. It will be a bit clumsy, but probably nicer...

@ineiti
Copy link
Member Author

ineiti commented Sep 26, 2016

All changes implemented - waiting for travis.

@@ -411,6 +447,7 @@ func (s *Service) startPropagation(blocks []*SkipBlock) error {
// bftVerify takes a message and verifies it's valid
func (s *Service) bftVerify(msg []byte, data []byte) bool {
log.Lvlf4("%s verifying block %x", s.ServerIdentity(), msg)
// XXX What's this variable for ?
s.testVerify = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I wrote it in the code; What's testVerify for ?

Copy link
Member Author

Choose a reason for hiding this comment

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

// testVerify is set to true if a verification happened - only for testing


// RegisterVerification stores the verification in a map and will
// call it whenever a verification needs to be done.
func RegisterVerification(c *sda.Context, v VerifierID, f SkipBlockVerifier) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be deleted I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought keeping it, so that Identity or any other skipchain can call skipchain.RegisterVerification and give its sda.Context, so that it gets stored correctly.

@nikkolasg nikkolasg merged commit 114fd22 into master Sep 29, 2016
@nikkolasg nikkolasg deleted the nsdi_skipchain_602 branch September 29, 2016 15:25
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

2 participants