cosmos-sdk/x/circuit/features/msg_trip.feature
Marko 54a14487e9
feature: add feature files for circuit (#14666)
Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
2023-01-30 18:58:47 +00:00

77 lines
2.4 KiB
Gherkin

Feature: MsgTripCircuitBreaker
Circuit breaker can disable message execution:
- when the caller trips the circuitbreaker for a message(s)
- when the caller has the correct permissions
Rule: a user must have permission to trip the circuit breaker for a message(s)
Example: user is a super admin
Given "acct1" has permission "LEVEL_SUPER_ADMIN"
When "acct1" attempts to disable msg execution
"""
{
"msg": "cosmos.bank.v1beta1.MsgSend"
}
"""
Then expect success
Example: user has no permissions
Given "acct1" has no permissions
When "acct1" attempts to disable msg execution
"""
{
"msg": "cosmos.bank.v1beta1.MsgSend"
}
"""
Then expect an "unauthorized" error
Example: user has permission for all messages
Given "acct1" has permission "LEVEL_ALL_MSGS"
When "acct1" attempts to disable msg execution
"""
{
"msg": "cosmos.bank.v1beta1.MsgSend"
}
"""
Then expect success
Example: user has permission for the messages
Given "acct1" has permission to disable "cosmos.bank.v1beta1.MsgSend" and "cosmos.staking.v1beta1.MsgDelegate"
When "acct1" attempts to disable msg execution
"""
{
"msgs": ["cosmos.bank.v1beta1.MsgSend",cosmos.staking.v1beta1.MsgDelegate"]
}
"""
Then expect success
Example: user does not have permission for 1 of the messages in the list
Given "acct1" has permission to disable "cosmos.bank.v1beta1.MsgSend"
When "acct1" attempts to disable msg execution
"""
{
"msgs": ["cosmos.bank.v1beta1.MsgSend","cosmos.staking.v1beta1.MsgCreateValidator"]
}
"""
Then expect an "unauthorized" error
Example: user does not have permission for the message
Given "acct1" has permission to diable "cosmos.bank.v1beta1.MsgSend"
When "acct1" attempts to disable msg execution
"""
{
"msg": "cosmos.bank.v1beta1.MultiSend"
}
"""
Then expect an "unauthorized" error
Example: user tries to trip an already tripped circuit breaker
Given "acct1" has permission to diable "cosmos.bank.v1beta1.MsgSend" & is already tripped
When "acct1" attempts to disable msg execution
"""
{
"msg": "cosmos.bank.v1beta1.MultiSend"
}
"""
Then expect an "msg disabled" error