MCPcopy
hub / github.com/canopy-network/canopy / TestHandleMessageChangeParameter

Function TestHandleMessageChangeParameter

fsm/message_test.go:1647–1773  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1645}
1646
1647func TestHandleMessageChangeParameter(t *testing.T) {
1648 uint64Any, _ := lib.NewAny(&lib.UInt64Wrapper{Value: 100})
1649 stringAny, _ := lib.NewAny(&lib.StringWrapper{Value: "2/2"})
1650 tests := []struct {
1651 name string
1652 detail string
1653 proposalConfig GovProposalVoteConfig
1654 height uint64
1655 msg *MessageChangeParameter
1656 error string
1657 }{
1658 {
1659 name: "before start height",
1660 detail: "the start height is greater than state machine height",
1661 height: 1,
1662 proposalConfig: AcceptAllProposals,
1663 msg: &MessageChangeParameter{
1664 ParameterSpace: "val",
1665 ParameterKey: ParamUnstakingBlocks,
1666 ParameterValue: uint64Any,
1667 StartHeight: 2,
1668 EndHeight: 3,
1669 Signer: newTestAddressBytes(t),
1670 },
1671 error: "proposal rejected",
1672 },
1673 {
1674 name: "after end height",
1675 detail: "the end height is less than state machine height",
1676 height: 4,
1677 proposalConfig: AcceptAllProposals,
1678 msg: &MessageChangeParameter{
1679 ParameterSpace: "val",
1680 ParameterKey: ParamUnstakingBlocks,
1681 ParameterValue: uint64Any,
1682 StartHeight: 2,
1683 EndHeight: 3,
1684 Signer: newTestAddressBytes(t),
1685 },
1686 error: "proposal rejected",
1687 },
1688 {
1689 name: "reject all config",
1690 detail: "configuration is set to reject all",
1691 proposalConfig: RejectAllProposals,
1692 height: 2,
1693 msg: &MessageChangeParameter{
1694 ParameterSpace: "val",
1695 ParameterKey: ParamUnstakingBlocks,
1696 ParameterValue: uint64Any,
1697 StartHeight: 2,
1698 EndHeight: 3,
1699 Signer: newTestAddressBytes(t),
1700 },
1701 error: "proposal rejected",
1702 },
1703 {
1704 name: "change unstaking blocks",

Callers

nothing calls this directly

Calls 8

NewAnyFunction · 0.92
FromAnyFunction · 0.92
newTestStateMachineFunction · 0.85
RunMethod · 0.80
EqualMethod · 0.80
newTestAddressBytesFunction · 0.70
GetParamsMethod · 0.45

Tested by

no test coverage detected