-
Notifications
You must be signed in to change notification settings - Fork 412
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 grant system tests #1626
Add grant system tests #1626
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1626 +/- ##
==========================================
- Coverage 56.63% 56.60% -0.03%
==========================================
Files 64 64
Lines 8896 8904 +8
==========================================
+ Hits 5038 5040 +2
- Misses 3468 3475 +7
+ Partials 390 389 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good! Revisiting the logic from the client perspective inspired some changes to restructure the CLI tree.
tests/system/grant_test.go
Outdated
) | ||
|
||
//set params | ||
sut.ModifyGenesisJSON(t, SetCodeUploadPermission(t, "AnyOfAddresses", []string{account1Addr})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
tests/system/grant_test.go
Outdated
cli := NewWasmdCLI(t, sut, verbose) | ||
|
||
// add genesis account with some tokens | ||
account1Addr := cli.AddKey("account1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
account1 and 2 are not very verbose. Can think about the role that the address represents?
Maybe something like chain_authorization and dev ?
tests/system/grant_test.go
Outdated
rsp = cli.CustomCommand("tx", "wasm", "grant-store-code", account2Addr, "*:*", "--from="+account1Addr) | ||
RequireTxSuccess(t, rsp) | ||
|
||
// address2 store code fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// address2 store code fails | |
// address2 store code fails as the address is not in the code-upload accept-list |
tests/system/grant_test.go
Outdated
rsp = cli.CustomCommand("tx", "wasm", "store", "./testdata/hackatom.wasm.gzip", "--from="+account2Addr, "--gas=1500000", "--fees=2stake") | ||
RequireTxFailure(t, rsp) | ||
|
||
// create tx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// create tx | |
// create tx should work for addresses in the accept-list |
tests/system/grant_test.go
Outdated
err := os.WriteFile(pathToTx, []byte(tx), os.FileMode(0o744)) | ||
require.NoError(t, err) | ||
|
||
// address2 authz exec store code should succeed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// address2 authz exec store code should succeed | |
// store code via authz execution uses the given grant and should succeed |
tests/system/genesis_io.go
Outdated
@@ -31,3 +31,15 @@ func GetGenesisBalance(rawGenesis []byte, addr string) sdk.Coins { | |||
} | |||
return r | |||
} | |||
|
|||
// SetCodeUploadPermission sets the code upload permissions | |||
func SetCodeUploadPermission(t *testing.T, permission string, addresses []string) GenesisMutator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personal preference :-)
func SetCodeUploadPermission(t *testing.T, permission string, addresses []string) GenesisMutator { | |
func SetCodeUploadPermission(t *testing.T, permission string, addresses ...string) GenesisMutator { |
* Restructure CLI; fix system test * Review feedback
No description provided.