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

Blue account #1033

Merged
merged 16 commits into from
Oct 31, 2019
Merged

Blue account #1033

merged 16 commits into from
Oct 31, 2019

Conversation

husio
Copy link
Contributor

@husio husio commented Oct 28, 2019

Blue Account functionality implemented as described in #1031

Implementation follows closely acceptance criteria.

@husio husio requested a review from orkunkl October 28, 2019 15:45
Requests []Request
AfterTest func(t *testing.T, db weave.KVStore)
}{
"configuration can be updated": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add success to the beginning of the test case name so reading the test results will become easier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that adding "success" might help with readability. I do not know where to add it so that it makes sense.
I think you meant prefixing all "successful" tests with "success:". Initially I thought this is a great idea. Now that I am adding it, I am not so sure anymore. The reason is that scenario itself is neither success or failure (unless we talk about the test result). A test scenario in this case consuming messages in order and a certain state at the end is expected. In the process of consuming messages, success of failure is expected as well. I don't think this can be generalized to the whole test description.

In the case of configuration can be updated, adding success: prefix makes it look weird:

success: configuration can be updated

Now it looks like I expect the test to succeed. This is true, because I expect ALL tests to succeed 🙈 In my opinion adding success: does not provide any information and can only confuse.

What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO success or failure outcome must solely depend on the expected test outcome as you expect this test to successfully validate the values returned from config. Basically happy path

For the format:
I think it is better to only insert the prefix success or failure because when a test explodes the console output will be success:_configuration_can_be_updated. : looks weird. And for the sentence structure, I prefer success update configuration. Dead simple, no past or future tenses.

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, now I get it. Makes sense and we can go this direction.

The only complain I have is that success update configuration does not sound like a correct phrase. How should I rephrase those descriptions so that they do not sound weird 🇬🇧 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it have to be correct and sound English?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think yes. It might be very confusing otherwise. I believe it should briefly describe the test case.

Copy link
Contributor

Choose a reason for hiding this comment

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

@willclarktech please save us from this misery 😢

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not convinced you need these markers at all because it's clear to me at least that "configuration can be updated" is a happy path. If you want to improve visual grepping to distinguish happy paths from unhappy paths, why not prefix with "happy path:"/"unhappy path:" or better yet with 😄 and 😞?

Copy link
Contributor

@orkunkl orkunkl left a comment

Choose a reason for hiding this comment

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

I will continue tomorrow. The first round of review:

  • You made some typos around the code such as transferDomaiHandler. Also in some comments. Maybe we can add a go comment spelling checker to builds.
  • Model and message tests are missing. If you are running out of time, It is okay to leave a few technical debts.
  • Comment about validation logic is a very important one. This one absolutely should be fixed.

if _, err := h.validate(ctx, db, tx); err != nil {
return nil, err
}
return &weave.CheckResult{GasAllocated: 0}, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@husio husio Oct 30, 2019

Choose a reason for hiding this comment

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

I don't understand what those fees mean anymore. We have x/msgfee to handle both anti spam and product defined fees. Do you know why do we need additional hardcoded fee?

Ethan explain me this today. In german, so maybe I got some parts wrong 😅

The bottom line is that we do not support Gas, full integration was never finished which renders it useless to us. We set Gas as arbitrary values, without any bigger consideration of what those values means.

Gas is used by Tendermint. It is part of the ABCI and should be used to communicate the cost of processing a transaction. Cost as the computational effort, for example CPU usage or database writes.
Tendermint provides additional functionality that utilize Gas information - you can setup maximum Gas per block. As far as I know we do not use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

The outcome of the discussion is very productive and this should be documented as well.

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Added a few comments as Orkun requested

cmd/bnsd/x/blueaccount/handler.go Show resolved Hide resolved
cmd/bnsd/x/blueaccount/handler.go Outdated Show resolved Hide resolved
cmd/bnsd/x/blueaccount/handler.go Show resolved Hide resolved
husio added 2 commits October 30, 2019 11:50
Database cannot be accessed while an iterator is in use.
@codecov-io

This comment has been minimized.

orkunkl and others added 4 commits October 31, 2019 12:05
pkg string,
config OwnedConfig,
auth x.Authenticator,
initConfAdmin func(weave.ReadOnlyKVStore) (weave.Address, error),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ethanfrey @alpe Please have a look if you have a moment. I think this is a rather big change to weave configuration patterns.

This is solving the problem I have described in the comment above - I want to create a configuration and cannot authenticate, because configuration entity defines who can authenticate 🐣

Usually configuration is created via genesis. This is not possible if you add an extension to an existing state.

It is not possible to do this via migrations as Ethan suggested for two reasons:

  • migrations do not have access to the context. This is on purpose as the code that runs them might not have access to the context as well (i.e. bucket),
  • migrations are given only weave.ReadOnlyKVStore. This is also on purpose, so that they are not able to modify the database state (!). They are supposed to migrate the in memory entity representation.

I require explicit passing of an admin address function instead of directly importing migration.loadConf in gconf because of import cycle. I think it is also nice that initConfAdmin is optional.

What do you guys think?

@husio
Copy link
Contributor Author

husio commented Oct 31, 2019

This pull request is becoming a general fix change. I have noticed a few missing commands in bnscli and missing code in migrations and gconf packages. To deliver Blue Account I must fix all those issues.

@husio husio merged commit f768d58 into master Oct 31, 2019
@husio husio deleted the blueaccount branch October 31, 2019 12:56
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.

6 participants