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 test to check multisig and authz work together #462

Merged
merged 5 commits into from
Apr 13, 2023

Conversation

miladz68
Copy link
Contributor

@miladz68 miladz68 commented Apr 7, 2023

This change is Reviewable

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/modules/auth_test.go line 227 at r1 (raw file):

// TestAuthMultisigWithAuthz tests the cosmos-sdk multisig accounts works with authz.
func TestAuthMultisigWithAuthz(t *testing.T) {

The logic we wanted to test is different:

granter should be multisig account
and grantee should be usual account


integration-tests/modules/auth_test.go line 227 at r1 (raw file):

// TestAuthMultisigWithAuthz tests the cosmos-sdk multisig accounts works with authz.
func TestAuthMultisigWithAuthz(t *testing.T) {

minor:
IMO more logical place for this test is authz_test


integration-tests/modules/auth_test.go line 234 at r1 (raw file):

	requireT := require.New(t)

	signer1KeyInfo, err := chain.ClientContext.Keyring().KeyByAddress(chain.GenAccount())

IMO it makes sense to move multisig acc creation logic to a separate func since we reuse it in multiple places now

smth like:

func GenMultisig(sigNumber, threshold uint) # returns multisig account & list of signers

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dzmitryhil, @miladz68, @silverspase, and @wojtek-coreum)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/auth_test.go line 234 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

IMO it makes sense to move multisig acc creation logic to a separate func since we reuse it in multiple places now

smth like:

func GenMultisig(sigNumber, threshold uint) # returns multisig account & list of signers

Agree, because the code of the test is simpler than test preparation.

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/auth_test.go line 227 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

The logic we wanted to test is different:

granter should be multisig account
and grantee should be usual account

Done both ways.


integration-tests/modules/auth_test.go line 234 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

Agree, because the code of the test is simpler than test preparation.

Done.

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/modules/authz_test.go line 264 at r2 (raw file):

		grantee,
		authztypes.NewGenericAuthorization(sdk.MsgTypeURL(&banktypes.MsgSend{})),
		time.Now().Add(time.Hour),

any specific reason to use hour in one test & minute in another ?
I suggest to stick to one version everywhere

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/authz_test.go line 264 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

any specific reason to use hour in one test & minute in another ?
I suggest to stick to one version everywhere

Done.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @miladz68, @silverspase, and @ysv)


integration-tests/modules/auth_test.go line 202 at r3 (raw file):

}

func createMultisigAccount(

Maybe it should be a method of the chain?


integration-tests/modules/authz_test.go line 150 at r3 (raw file):

	multisigPublicKey, keyNamesSet := createMultisigAccount(t, chain, 3, 2)
	multisigAddress, err := sdk.AccAddressFromHex(multisigPublicKey.Address().String())

what about:

multisigAddress := multisigPublicKey.Address()

?

@ysv ysv requested a review from wojtek-coreum April 11, 2023 11:54
ysv
ysv previously approved these changes Apr 11, 2023
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @silverspase, and @wojtek-coreum)


integration-tests/modules/auth_test.go line 202 at r3 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

Maybe it should be a method of the chain?

good point, I agree

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase and @wojtek-coreum)


integration-tests/modules/auth_test.go line 202 at r3 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

good point, I agree

Done.


integration-tests/modules/authz_test.go line 150 at r3 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

what about:

multisigAddress := multisigPublicKey.Address()

?

Done.

dzmitryhil
dzmitryhil previously approved these changes Apr 12, 2023
Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

ysv
ysv previously approved these changes Apr 12, 2023
Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @silverspase and @wojtek-coreum)

wojtek-coreum
wojtek-coreum previously approved these changes Apr 13, 2023
Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

@miladz68 miladz68 dismissed stale reviews from wojtek-coreum, ysv, and dzmitryhil via 0108971 April 13, 2023 09:07
Copy link
Collaborator

@wojtek-coreum wojtek-coreum left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 3 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase)

@miladz68 miladz68 merged commit 4d8b6d5 into master Apr 13, 2023
@miladz68 miladz68 deleted the milad/authz-multisig-test branch April 13, 2023 10:31
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.

4 participants