diff --git a/Makefile b/Makefile index 401dd48153..2de6d14fc6 100644 --- a/Makefile +++ b/Makefile @@ -295,7 +295,7 @@ docker-build-all: docker-build-debug docker-build-hermes ### Linting ### ############################################################################### golangci_lint_cmd=golangci-lint -golangci_version=v1.53.3 +golangci_version=v1.60.1 lint: @echo "--> Running linter" diff --git a/app/upgrades/v20/upgrades.go b/app/upgrades/v20/upgrades.go index 09972a8619..02b7b4b216 100644 --- a/app/upgrades/v20/upgrades.go +++ b/app/upgrades/v20/upgrades.go @@ -2,6 +2,7 @@ package v20 import ( "context" + "encoding/json" "fmt" providerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper" @@ -725,6 +726,18 @@ func SetICSConsumerMetadata(ctx sdk.Context, providerKeeper providerkeeper.Keepe } if chainID == "stride-1" { + var metatadaField string + if u, err := json.Marshal(map[string]string{ + "phase": "mainnet", + "forge_json_url": "https://raw.githubusercontent.com/Stride-Labs/stride/main/forge.json", + }); err != nil { + ctx.Logger().Error( + fmt.Sprintf("cannot marshal metadata, consumerID(%s), chainID(%s): %s", consumerID, chainID, err.Error()), + ) + metatadaField = "" + } else { + metatadaField = string(u) + } metadata := providertypes.ConsumerMetadata{ Name: "Stride", Description: "The Stride blockchain has a single purpose: to provide the best liquid staking service for chains in the Cosmos ecosystem. " + @@ -734,7 +747,7 @@ func SetICSConsumerMetadata(ctx sdk.Context, providerKeeper providerkeeper.Keepe "Like the Cosmos Hub, Stride is a highly secure minimalist blockchain, with no smart contracts and no other apps beside the core liquid staking protocol. " + "The Stride codebase has been fully audited by numerous security firms, and receives continuous auditing from Informal Systems. " + "And the Stride blockchain is protected by IBC rate-limiting.", - Metadata: "https://github.com/Stride-Labs/stride", + Metadata: metatadaField, } err = providerKeeper.SetConsumerMetadata(ctx, consumerID, metadata) if err != nil { @@ -744,6 +757,18 @@ func SetICSConsumerMetadata(ctx sdk.Context, providerKeeper providerkeeper.Keepe continue } } else if chainID == "neutron-1" { + var metatadaField string + if u, err := json.Marshal(map[string]string{ + "phase": "mainnet", + "forge_json_url": "https://raw.githubusercontent.com/neutron-org/neutron/main/forge.json", + }); err != nil { + ctx.Logger().Error( + fmt.Sprintf("cannot marshal metadata, consumerID(%s), chainID(%s): %s", consumerID, chainID, err.Error()), + ) + metatadaField = "" + } else { + metatadaField = string(u) + } metadata := providertypes.ConsumerMetadata{ Name: "Neutron", Description: "Neutron is the only blockchain network specifically designed to support Integrated Applications. " + @@ -754,7 +779,7 @@ func SetICSConsumerMetadata(ctx sdk.Context, providerKeeper providerkeeper.Keepe "They can deploy and manage capital and integrations across multiple chains, maximising network effects and the ubiquity of their denominations.\n" + "These features allow Integrated Applications to establish stronger moats around their technology and business model, while providing a competitive edge that standard applications lack. " + "This makes them inherently more attractive and competitive, as they operate on an enhanced platform offering higher performance and broader reach compared to traditional applications.", - Metadata: "https://github.com/neutron-org/neutron", + Metadata: metatadaField, } err = providerKeeper.SetConsumerMetadata(ctx, consumerID, metadata) if err != nil { diff --git a/app/upgrades/v20/upgrades_test.go b/app/upgrades/v20/upgrades_test.go new file mode 100644 index 0000000000..0d19d0c0b6 --- /dev/null +++ b/app/upgrades/v20/upgrades_test.go @@ -0,0 +1,57 @@ +package v20_test + +import ( + "encoding/json" + "testing" + + "github.com/stretchr/testify/require" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types" + + "github.com/cosmos/gaia/v20/app/helpers" + v20 "github.com/cosmos/gaia/v20/app/upgrades/v20" +) + +func TestSetICSConsumerMetadata(t *testing.T) { + gaiaApp := helpers.Setup(t) + ctx := gaiaApp.NewUncachedContext(true, tmproto.Header{}) + + pk := gaiaApp.ProviderKeeper + + // Add consumer chains + neutronConsumerID := pk.FetchAndIncrementConsumerId(ctx) + pk.SetConsumerChainId(ctx, neutronConsumerID, "neutron-1") + pk.SetConsumerPhase(ctx, neutronConsumerID, providertypes.CONSUMER_PHASE_LAUNCHED) + strideConsumerID := pk.FetchAndIncrementConsumerId(ctx) + pk.SetConsumerChainId(ctx, strideConsumerID, "stride-1") + pk.SetConsumerPhase(ctx, strideConsumerID, providertypes.CONSUMER_PHASE_LAUNCHED) + + err := v20.SetICSConsumerMetadata(ctx, pk) + require.NoError(t, err) + + metadata, err := pk.GetConsumerMetadata(ctx, neutronConsumerID) + require.NoError(t, err) + require.Equal(t, "Neutron", metadata.Name) + expectedMetadataField := map[string]string{ + "phase": "mainnet", + "forge_json_url": "https://raw.githubusercontent.com/neutron-org/neutron/main/forge.json", + } + metadataField := map[string]string{} + err = json.Unmarshal([]byte(metadata.Metadata), &metadataField) + require.NoError(t, err) + require.Equal(t, expectedMetadataField, metadataField) + + metadata, err = pk.GetConsumerMetadata(ctx, strideConsumerID) + require.NoError(t, err) + require.Equal(t, "Stride", metadata.Name) + expectedMetadataField = map[string]string{ + "phase": "mainnet", + "forge_json_url": "https://raw.githubusercontent.com/Stride-Labs/stride/main/forge.json", + } + metadataField = map[string]string{} + err = json.Unmarshal([]byte(metadata.Metadata), &metadataField) + require.NoError(t, err) + require.Equal(t, expectedMetadataField, metadataField) +}