Msg/UpdatePolicy

UpdatePolicy is successful when:

  • admin is the admin address

UpdatePolicy has the following outcomes:

  • Policy is updated in state
  • EventUpdatePolicy is emitted
  • MsgUpdatePolicyResponse is returned

The admin must be the admin address

Background

Given admin "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38"

And policy

{
  "signedBlocksWindow": 100
}

admin is admin address

When msg update policy

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "signedBlocksWindow": 100
}

Then expect no error.

admin is not admin address

When msg update policy

{
  "admin": "chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup",
  "signedBlocksWindow": 100
}

Then expect the error

admin: expected chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38: received chora1s3x2yhc4qf59gf53hwsnhkh7gqa3eryxnu6nup: unauthorized

Policy is updated in state

Background

Given admin "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38"

And policy

{
  "signedBlocksWindow": 100
}

policy updated

When msg update policy

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "signedBlocksWindow": 200
}

Then expect policy

{
  "signedBlocksWindow": 200
}

EventUpdatePolicy emitted

Background

Given admin "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38"

And policy

{
  "signedBlocksWindow": 100
}

event remove emitted

When msg update policy

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "signedBlocksWindow": 200
}

Then expect event update policy

{
  "signedBlocksWindow": 200
}

MsgUpdatePolicyResponse returned

Background

Given admin "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38"

And policy

{
  "signedBlocksWindow": 100
}

message response returned

When msg update policy

{
  "admin": "chora1q5m97jdcksj24g9enlkjqq75ygt5q6ak54jk38",
  "signedBlocksWindow": 200
}

Then expect response

{
  "signedBlocksWindow": 200
}