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

Add qgb data commitment tests #240

Merged

Conversation

rach-id
Copy link
Member

@rach-id rach-id commented Mar 11, 2022

Description

Adds QGB data commitment tests

closes: #238

@@ -119,3 +119,48 @@ func TestMsgValsetConfirm(t *testing.T) {
_, err = h(ctx, msg)
require.NoError(t, err)
}

Copy link
Member Author

@rach-id rach-id Mar 11, 2022

Choose a reason for hiding this comment

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

This will be fixed in a subsequent PR after I write an issue about a confusion we have with the validator address for data commitments

Copy link
Member

Choose a reason for hiding this comment

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

makes sense

commitment string,
) (confirms []types.MsgDataCommitmentConfirm) {
store := ctx.KVStore(k.storeKey)
iterator := store.Iterator(nil, nil) // Can we make this faster?
Copy link
Member Author

Choose a reason for hiding this comment

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

For now, this is iterating over the whole store and skipping elements it cannot unmarshall.
Any idea on how to make this faster ? Or maybe have some sort of indexing...

Copy link
Member

Choose a reason for hiding this comment

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

yeah, we can index by adding different prefixes
https://github.com/celestiaorg/cosmos-sdk/blob/568e61059a5275d63fae7980e196ff7b6ce07426/x/auth/types/keys.go#L22-L23

my understanding is if we wanted to index by nonce and MsgDataCommitmentConfirms, then we would define each prefix ahead of time, then append them when storing. something along the lines of MsgDataCommitmentConfirmKey + nonce + commitment.

let's obviously not tackle that in this PR, but we should probably discuss this further in its own issue and call #241

Comment on lines +41 to +43
if err != nil {
continue
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping if the item cannot be unmarshalled (not the correct interface)

@rach-id
Copy link
Member Author

rach-id commented Mar 11, 2022

@evan-forbes Please take a look at this when you have time. Thanks.

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! I think its okay to merge this now since we have documented the thing that we will need to finish in the upcoming PRs

@@ -119,3 +119,48 @@ func TestMsgValsetConfirm(t *testing.T) {
_, err = h(ctx, msg)
require.NoError(t, err)
}

Copy link
Member

Choose a reason for hiding this comment

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

makes sense

commitment string,
) (confirms []types.MsgDataCommitmentConfirm) {
store := ctx.KVStore(k.storeKey)
iterator := store.Iterator(nil, nil) // Can we make this faster?
Copy link
Member

Choose a reason for hiding this comment

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

yeah, we can index by adding different prefixes
https://github.com/celestiaorg/cosmos-sdk/blob/568e61059a5275d63fae7980e196ff7b6ce07426/x/auth/types/keys.go#L22-L23

my understanding is if we wanted to index by nonce and MsgDataCommitmentConfirms, then we would define each prefix ahead of time, then append them when storing. something along the lines of MsgDataCommitmentConfirmKey + nonce + commitment.

let's obviously not tackle that in this PR, but we should probably discuss this further in its own issue and call #241

@rach-id
Copy link
Member Author

rach-id commented Mar 11, 2022

@evan-forbes I have a final test almost ready.
It's a bit global as it creates a network, generate privates keys, create a validator, create eth keys, sign commitment and verify everything.
I guess it would be good to have it also as sort of simplified integration test.
I can put it in a separate PR if you want tho

@evan-forbes
Copy link
Member

merging this is fine I think as its targeted very specifically at data commitments, and then having a separate PR for the integration test makes sense imho.

up to you tho

@rach-id
Copy link
Member Author

rach-id commented Mar 11, 2022

Sounds good. Please merge. Thanks

@evan-forbes evan-forbes merged commit eaed5db into celestiaorg:qgb-integration Mar 11, 2022
@rach-id rach-id deleted the add_qgb_data_commitment_tests branch March 11, 2022 15:57
rach-id added a commit to rach-id/celestia-app that referenced this pull request May 9, 2022
* fixes data commitment keeper iterator

* adds data commitment by commitment query

* cosmetics

* adds data commitment queries tests

* cosmetics

* adds data commitment message validation tests

* adds commented msg data commitment confirm test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants