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

QGB nits + docs for the merge 2 #753

Merged
merged 8 commits into from
Sep 21, 2022

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Sep 21, 2022

No description provided.

@rach-id rach-id added enhancement New feature or request C: QGB labels Sep 21, 2022
@rach-id rach-id self-assigned this Sep 21, 2022
Copy link
Collaborator

@rootulp rootulp left a comment

Choose a reason for hiding this comment

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

Will approve after:

  1. File is go formatted
  2. Negate check

x/qgb/keeper/keeper_attestation.go Outdated Show resolved Hide resolved
@rach-id
Copy link
Member Author

rach-id commented Sep 21, 2022

@rootulp Sorry, wasn't focusing earlier. The best we can do to refactor is:

	store := ctx.KVStore(k.storeKey)
	if k.CheckLatestAttestationNonce(ctx) {
		if k.GetLatestAttestationNonce(ctx)+1 != nonce {
			panic("not incrementing latest attestation nonce correctly")
		}
		store.Set([]byte(types.LatestAttestationtNonce), types.UInt64Bytes(nonce))
	}
	store.Set([]byte(types.LatestAttestationtNonce), types.UInt64Bytes(nonce))

But I don't think it is worth it.
In fact, we should never panic if the latest nonce doesn't exist in store. Because, if it doesn't, we just proceed and initialize it.
We could add a check nonce == 0 to know that we're initializing state for the first time. However, we might need in the future, after a hard fork, to manually set the first nonce, to a random value that is different from 0, and initialize the store using it.
Let me know what you think.

@rach-id
Copy link
Member Author

rach-id commented Sep 21, 2022

If you don't mind, I can rename this PR to contain extra nits that are taken from the Merge PR.

@codecov-commenter
Copy link

Codecov Report

Merging #753 (fd8d3e1) into qgb-integration (ab906e5) will increase coverage by 9.75%.
The diff coverage is 73.96%.

@@                 Coverage Diff                 @@
##           qgb-integration     #753      +/-   ##
===================================================
+ Coverage            12.60%   22.36%   +9.75%     
===================================================
  Files                   45       62      +17     
  Lines                 6448     7665    +1217     
===================================================
+ Hits                   813     1714     +901     
- Misses                5550     5809     +259     
- Partials                85      142      +57     
Impacted Files Coverage Δ
pkg/inclusion/get_commit.go 0.00% <0.00%> (ø)
pkg/prove/querier.go 0.00% <0.00%> (ø)
x/payment/types/tx.pb.gw.go 0.00% <0.00%> (ø)
x/qgb/keeper/hooks.go 36.11% <0.00%> (ø)
x/qgb/keeper/keeper_data_commitment.go 0.00% <ø> (ø)
x/qgb/keeper/keeper_valset.go 27.11% <ø> (ø)
x/qgb/keeper/query_valset.go 0.00% <ø> (ø)
x/qgb/types/genesis.go 70.96% <ø> (ø)
x/qgb/types/keys.go 0.00% <ø> (ø)
x/qgb/types/msgs.pb.gw.go 0.00% <0.00%> (ø)
... and 24 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rach-id rach-id changed the title QGB Separate SetLatestAttestation panics + update docs QGB nits + docs for the merge 2 Sep 21, 2022
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

nice additions

@rach-id rach-id merged commit d94943d into celestiaorg:qgb-integration Sep 21, 2022
@rach-id rach-id deleted the feedback_nits branch September 21, 2022 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants