diff --git a/proto/observer/params.proto b/proto/observer/params.proto index 7ad2d5ebf2..463c827336 100644 --- a/proto/observer/params.proto +++ b/proto/observer/params.proto @@ -30,7 +30,7 @@ message ChainParams { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool is_supported = 16; + bool is_active = 16; } // Deprecated: Use ChainParamsList @@ -44,7 +44,7 @@ message ObserverParams { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - bool is_supported = 5; + bool is_active = 5; } enum Policy_Type { diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index a88018e8f7..be2d464bb3 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -109,7 +109,7 @@ func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessag // set chain params with chains all enabled state.ChainParamsList = observertypes.GetDefaultChainParams() for i := range state.ChainParamsList.ChainParams { - state.ChainParamsList.ChainParams[i].IsSupported = true + state.ChainParamsList.ChainParams[i].IsActive = true } // set params diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index 19b186e845..4e00eec09c 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -99,13 +99,13 @@ func ChainParams(chainID int64) *types.ChainParams { OutboundTxScheduleLookahead: Int64InRange(r, 1, 500), BallotThreshold: fiftyPercent, MinObserverDelegation: sdk.NewDec(r.Int63()), - IsSupported: false, + IsActive: false, } } func ChainParamsSupported(chainID int64) *types.ChainParams { cp := ChainParams(chainID) - cp.IsSupported = true + cp.IsActive = true return cp } diff --git a/typescript/observer/params_pb.d.ts b/typescript/observer/params_pb.d.ts index 9825349298..c010d9c732 100644 --- a/typescript/observer/params_pb.d.ts +++ b/typescript/observer/params_pb.d.ts @@ -116,9 +116,9 @@ export declare class ChainParams extends Message { minObserverDelegation: string; /** - * @generated from field: bool is_supported = 16; + * @generated from field: bool is_active = 16; */ - isSupported: boolean; + isActive: boolean; constructor(data?: PartialMessage); @@ -157,9 +157,9 @@ export declare class ObserverParams extends Message { minObserverDelegation: string; /** - * @generated from field: bool is_supported = 5; + * @generated from field: bool is_active = 5; */ - isSupported: boolean; + isActive: boolean; constructor(data?: PartialMessage); diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go index 7457068b38..c54f1669c1 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go @@ -158,7 +158,7 @@ func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_inde ConnectorContractAddress: block.Transactions()[tx_index].To().Hex(), BallotThreshold: sdk.OneDec(), MinObserverDelegation: sdk.OneDec(), - IsSupported: true, + IsActive: true, }, }}) zk.ObserverKeeper.SetCrosschainFlags(ctx, observertypes.CrosschainFlags{ diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go index 436a6b69c9..3d974a742f 100644 --- a/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go @@ -164,7 +164,7 @@ func setupTssMigrationParams( ChainId: chain.ChainId, BallotThreshold: sdk.NewDec(0), MinObserverDelegation: sdk.OneDec(), - IsSupported: true, + IsActive: true, }, }, }) diff --git a/x/crosschain/keeper/utils_test.go b/x/crosschain/keeper/utils_test.go index 83f37b2799..3f879c756f 100644 --- a/x/crosschain/keeper/utils_test.go +++ b/x/crosschain/keeper/utils_test.go @@ -227,7 +227,7 @@ func setSupportedChain(ctx sdk.Context, zk testkeeper.ZetaKeepers, chainIDs ...i chainParamsList := make([]*observertypes.ChainParams, len(chainIDs)) for i, chainID := range chainIDs { chainParams := sample.ChainParams(chainID) - chainParams.IsSupported = true + chainParams.IsActive = true chainParamsList[i] = chainParams } zk.ObserverKeeper.SetChainParamsList(ctx, observertypes.ChainParamsList{ diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 1f22e4208f..10f32e0a24 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -22,11 +22,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } else { // if no chain params are defined, set localnet chains for test purposes btcChainParams := types.GetDefaultBtcRegtestChainParams() - btcChainParams.IsSupported = true + btcChainParams.IsActive = true goerliChainParams := types.GetDefaultGoerliLocalnetChainParams() - goerliChainParams.IsSupported = true + goerliChainParams.IsActive = true zetaPrivnetChainParams := types.GetDefaultZetaPrivnetChainParams() - zetaPrivnetChainParams.IsSupported = true + zetaPrivnetChainParams.IsActive = true k.SetChainParamsList(ctx, types.ChainParamsList{ ChainParams: []*types.ChainParams{ btcChainParams, diff --git a/x/observer/keeper/chain_params.go b/x/observer/keeper/chain_params.go index b28adc6e23..86a15f44b1 100644 --- a/x/observer/keeper/chain_params.go +++ b/x/observer/keeper/chain_params.go @@ -49,7 +49,7 @@ func (k Keeper) GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *co } for _, cp := range cpl.ChainParams { - if cp.ChainId == chainID && cp.IsSupported { + if cp.ChainId == chainID && cp.IsActive { return common.GetChainFromChainID(chainID) } } @@ -65,7 +65,7 @@ func (k Keeper) GetSupportedChains(ctx sdk.Context) []*common.Chain { var chains []*common.Chain for _, cp := range cpl.ChainParams { - if cp.IsSupported { + if cp.IsActive { chains = append(chains, common.GetChainFromChainID(cp.ChainId)) } } diff --git a/x/observer/keeper/chain_params_test.go b/x/observer/keeper/chain_params_test.go index c9142b7526..72d664cbda 100644 --- a/x/observer/keeper/chain_params_test.go +++ b/x/observer/keeper/chain_params_test.go @@ -23,7 +23,7 @@ func TestKeeper_GetSupportedChainFromChainID(t *testing.T) { // chain params list but chain not supported chainParams := sample.ChainParams(getValidEthChainIDWithIndex(t, 0)) - chainParams.IsSupported = false + chainParams.IsActive = false k.SetChainParamsList(ctx, types.ChainParamsList{ ChainParams: []*types.ChainParams{chainParams}, }) diff --git a/x/observer/keeper/utils.go b/x/observer/keeper/utils.go index 5a1896755e..f0a2017a05 100644 --- a/x/observer/keeper/utils.go +++ b/x/observer/keeper/utils.go @@ -57,7 +57,7 @@ func (k Keeper) FindBallot( observerSet, _ := k.GetObserverSet(ctx) cp, found := k.GetChainParamsByChainID(ctx, chain.ChainId) - if !found || cp == nil || !cp.IsSupported { + if !found || cp == nil || !cp.IsActive { err = types.ErrSupportedChains return } diff --git a/x/observer/keeper/utils_test.go b/x/observer/keeper/utils_test.go index e62cc57758..14f76e7223 100644 --- a/x/observer/keeper/utils_test.go +++ b/x/observer/keeper/utils_test.go @@ -21,7 +21,7 @@ func setSupportedChain(ctx sdk.Context, observerKeeper keeper.Keeper, chainIDs . chainParamsList := make([]*types.ChainParams, len(chainIDs)) for i, chainID := range chainIDs { chainParams := sample.ChainParams(chainID) - chainParams.IsSupported = true + chainParams.IsActive = true chainParamsList[i] = chainParams } observerKeeper.SetChainParamsList(ctx, types.ChainParamsList{ diff --git a/x/observer/migrations/v4/migrate.go b/x/observer/migrations/v4/migrate.go index a23cc28dd5..78a54ae878 100644 --- a/x/observer/migrations/v4/migrate.go +++ b/x/observer/migrations/v4/migrate.go @@ -64,7 +64,7 @@ func MigrateObserverParams(ctx sdk.Context, observerKeeper observerKeeper) error if chainParamsList.ChainParams[i].ChainId == observerParam.Chain.ChainId { chainParamsList.ChainParams[i].MinObserverDelegation = observerParam.MinObserverDelegation chainParamsList.ChainParams[i].BallotThreshold = observerParam.BallotThreshold - chainParamsList.ChainParams[i].IsSupported = observerParam.IsSupported + chainParamsList.ChainParams[i].IsActive = observerParam.IsActive break } } diff --git a/x/observer/migrations/v4/migrate_test.go b/x/observer/migrations/v4/migrate_test.go index 3a64fd97ab..105012cf59 100644 --- a/x/observer/migrations/v4/migrate_test.go +++ b/x/observer/migrations/v4/migrate_test.go @@ -63,13 +63,13 @@ func TestMigrateObserverParams(t *testing.T) { Chain: &common.Chain{ChainId: 2}, BallotThreshold: dec42, MinObserverDelegation: dec1000, - IsSupported: true, + IsActive: true, }, { Chain: &common.Chain{ChainId: 3}, BallotThreshold: dec43, MinObserverDelegation: dec1001, - IsSupported: true, + IsActive: true, }, }, } @@ -92,16 +92,16 @@ func TestMigrateObserverParams(t *testing.T) { require.EqualValues(t, dec1000, newChainParamsList.ChainParams[1].MinObserverDelegation) require.EqualValues(t, dec43, newChainParamsList.ChainParams[2].BallotThreshold) require.EqualValues(t, dec1001, newChainParamsList.ChainParams[2].MinObserverDelegation) - require.True(t, newChainParamsList.ChainParams[1].IsSupported) - require.True(t, newChainParamsList.ChainParams[2].IsSupported) + require.True(t, newChainParamsList.ChainParams[1].IsActive) + require.True(t, newChainParamsList.ChainParams[2].IsActive) // check remaining values are unchanged previousChainParamsList.ChainParams[1].BallotThreshold = dec42 previousChainParamsList.ChainParams[2].BallotThreshold = dec43 previousChainParamsList.ChainParams[1].MinObserverDelegation = dec1000 previousChainParamsList.ChainParams[2].MinObserverDelegation = dec1001 - previousChainParamsList.ChainParams[1].IsSupported = true - previousChainParamsList.ChainParams[2].IsSupported = true + previousChainParamsList.ChainParams[1].IsActive = true + previousChainParamsList.ChainParams[2].IsActive = true require.EqualValues(t, previousChainParamsList.ChainParams[1], newChainParamsList.ChainParams[1]) require.EqualValues(t, previousChainParamsList.ChainParams[2], newChainParamsList.ChainParams[2]) } diff --git a/x/observer/types/chain_params.go b/x/observer/types/chain_params.go index 78b66af17d..16d373ba50 100644 --- a/x/observer/types/chain_params.go +++ b/x/observer/types/chain_params.go @@ -153,7 +153,7 @@ func GetDefaultEthMainnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultBscMainnetChainParams() *ChainParams { @@ -171,7 +171,7 @@ func GetDefaultBscMainnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultBtcMainnetChainParams() *ChainParams { @@ -189,7 +189,7 @@ func GetDefaultBtcMainnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultGoerliTestnetChainParams() *ChainParams { @@ -208,7 +208,7 @@ func GetDefaultGoerliTestnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultBscTestnetChainParams() *ChainParams { @@ -226,7 +226,7 @@ func GetDefaultBscTestnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultMumbaiTestnetChainParams() *ChainParams { @@ -244,7 +244,7 @@ func GetDefaultMumbaiTestnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 60, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultBtcTestnetChainParams() *ChainParams { @@ -262,7 +262,7 @@ func GetDefaultBtcTestnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 100, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultBtcRegtestChainParams() *ChainParams { @@ -280,7 +280,7 @@ func GetDefaultBtcRegtestChainParams() *ChainParams { OutboundTxScheduleLookahead: 5, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultGoerliLocalnetChainParams() *ChainParams { @@ -298,7 +298,7 @@ func GetDefaultGoerliLocalnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 5, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } func GetDefaultZetaPrivnetChainParams() *ChainParams { @@ -316,6 +316,6 @@ func GetDefaultZetaPrivnetChainParams() *ChainParams { OutboundTxScheduleLookahead: 0, BallotThreshold: DefaultBallotThreshold, MinObserverDelegation: DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } diff --git a/x/observer/types/chain_params_test.go b/x/observer/types/chain_params_test.go index 5852f1f661..946a9595d9 100644 --- a/x/observer/types/chain_params_test.go +++ b/x/observer/types/chain_params_test.go @@ -59,7 +59,7 @@ func (s *UpdateChainParamsSuite) SetupTest() { OutboundTxScheduleLookahead: 1, BallotThreshold: types.DefaultBallotThreshold, MinObserverDelegation: types.DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } s.btcParams = &types.ChainParams{ ConfirmationCount: 1, @@ -75,7 +75,7 @@ func (s *UpdateChainParamsSuite) SetupTest() { OutboundTxScheduleLookahead: 1, BallotThreshold: types.DefaultBallotThreshold, MinObserverDelegation: types.DefaultMinObserverDelegation, - IsSupported: false, + IsActive: false, } } diff --git a/x/observer/types/params.go b/x/observer/types/params.go index 13910baa97..549f5f6102 100644 --- a/x/observer/types/params.go +++ b/x/observer/types/params.go @@ -32,7 +32,7 @@ func DefaultParams() Params { observerParams := make([]*ObserverParams, len(chains)) for i, chain := range chains { observerParams[i] = &ObserverParams{ - IsSupported: true, + IsActive: true, Chain: chain, BallotThreshold: sdk.MustNewDecFromStr("0.66"), MinObserverDelegation: sdk.MustNewDecFromStr("1000000000000000000000"), // 1000 ZETA diff --git a/x/observer/types/params.pb.go b/x/observer/types/params.pb.go index 066685bb22..5cee0b535d 100644 --- a/x/observer/types/params.pb.go +++ b/x/observer/types/params.pb.go @@ -109,7 +109,7 @@ type ChainParams struct { OutboundTxScheduleLookahead int64 `protobuf:"varint,13,opt,name=outbound_tx_schedule_lookahead,json=outboundTxScheduleLookahead,proto3" json:"outbound_tx_schedule_lookahead,omitempty"` BallotThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,14,opt,name=ballot_threshold,json=ballotThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ballot_threshold"` MinObserverDelegation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,15,opt,name=min_observer_delegation,json=minObserverDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_observer_delegation"` - IsSupported bool `protobuf:"varint,16,opt,name=is_supported,json=isSupported,proto3" json:"is_supported,omitempty"` + IsActive bool `protobuf:"varint,16,opt,name=is_active,json=isSupported,proto3" json:"is_supported,omitempty"` } func (m *ChainParams) Reset() { *m = ChainParams{} } @@ -222,9 +222,9 @@ func (m *ChainParams) GetOutboundTxScheduleLookahead() int64 { return 0 } -func (m *ChainParams) GetIsSupported() bool { +func (m *ChainParams) GetIsActive() bool { if m != nil { - return m.IsSupported + return m.IsActive } return false } @@ -234,7 +234,7 @@ type ObserverParams struct { Chain *common.Chain `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"` BallotThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=ballot_threshold,json=ballotThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ballot_threshold"` MinObserverDelegation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=min_observer_delegation,json=minObserverDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_observer_delegation"` - IsSupported bool `protobuf:"varint,5,opt,name=is_supported,json=isSupported,proto3" json:"is_supported,omitempty"` + IsActive bool `protobuf:"varint,5,opt,name=is_active,json=isSupported,proto3" json:",omitempty"` } func (m *ObserverParams) Reset() { *m = ObserverParams{} } @@ -277,9 +277,9 @@ func (m *ObserverParams) GetChain() *common.Chain { return nil } -func (m *ObserverParams) GetIsSupported() bool { +func (m *ObserverParams) GetIsActive() bool { if m != nil { - return m.IsSupported + return m.IsActive } return false } @@ -520,9 +520,9 @@ func (m *ChainParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.IsSupported { + if m.IsActive { i-- - if m.IsSupported { + if m.IsActive { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -636,9 +636,9 @@ func (m *ObserverParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.IsSupported { + if m.IsActive { i-- - if m.IsSupported { + if m.IsActive { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -844,7 +844,7 @@ func (m *ChainParams) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.MinObserverDelegation.Size() n += 1 + l + sovParams(uint64(l)) - if m.IsSupported { + if m.IsActive { n += 3 } return n @@ -864,7 +864,7 @@ func (m *ObserverParams) Size() (n int) { n += 1 + l + sovParams(uint64(l)) l = m.MinObserverDelegation.Size() n += 1 + l + sovParams(uint64(l)) - if m.IsSupported { + if m.IsActive { n += 2 } return n @@ -1347,7 +1347,7 @@ func (m *ChainParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 16: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsSupported", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -1364,7 +1364,7 @@ func (m *ChainParams) Unmarshal(dAtA []byte) error { break } } - m.IsSupported = bool(v != 0) + m.IsActive = bool(v != 0) default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) @@ -1521,7 +1521,7 @@ func (m *ObserverParams) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsSupported", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field IsActive", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -1538,7 +1538,7 @@ func (m *ObserverParams) Unmarshal(dAtA []byte) error { break } } - m.IsSupported = bool(v != 0) + m.IsActive = bool(v != 0) default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])