Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
ARG GO_VERSION
ARG IMG_TAG=latest

# Compile the atomoned binary
FROM golang:1.22-alpine AS atomoned-builder
FROM golang:${GO_VERSION:-1.24.5}-alpine AS atomoned-builder
WORKDIR /src/app/
COPY go.mod go.sum* ./
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN apk add --no-cache $PACKAGES
RUN apk add --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN CGO_ENABLED=0 make install

# Add to a distroless container
FROM cgr.dev/chainguard/static:$IMG_TAG
ARG IMG_TAG
COPY --from=atomoned-builder /go/bin/atomoned /usr/local/bin/
EXPOSE 26656 26657 1317 9090
USER 0
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ test-race: ARGS=-timeout=5m -race
test-race: TEST_PACKAGES=$(PACKAGES_UNIT)
test-e2e: ARGS=-timeout=25m -v
test-e2e: TEST_PACKAGES=$(PACKAGES_E2E)
test-e2e: docker-build-debug
$(TEST_TARGETS): run-tests

run-tests:
Expand Down
32 changes: 32 additions & 0 deletions app/keepers/gov_adapter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package keepers

import (
ccvtypes "github.com/cosmos/interchain-security/v5/x/ccv/types"

sdk "github.com/cosmos/cosmos-sdk/types"

atomonegovkeeper "github.com/atomone-hub/atomone/x/gov/keeper"
)

// GovKeeperAdapter adapts AtomOne's gov keeper to match the interface expected by ICS
type GovKeeperAdapter struct {
keeper *atomonegovkeeper.Keeper
}

// NewGovKeeperAdapter creates a new adapter for AtomOne's gov keeper
func NewGovKeeperAdapter(k *atomonegovkeeper.Keeper) *GovKeeperAdapter {
return &GovKeeperAdapter{keeper: k}
}

// GetProposal retrieves a proposal and converts it to ICS's Proposal type
func (a *GovKeeperAdapter) GetProposal(ctx sdk.Context, proposalID uint64) (ccvtypes.Proposal, bool) {
prop, found := a.keeper.GetProposal(ctx, proposalID)
if !found {
return ccvtypes.Proposal{}, false
}

// Convert AtomOne proposal to ICS proposal - only copy the Messages field
return ccvtypes.Proposal{
Messages: prop.Messages,
}, true
}
47 changes: 38 additions & 9 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"
icsprovider "github.com/cosmos/interchain-security/v5/x/ccv/provider"
icsproviderkeeper "github.com/cosmos/interchain-security/v5/x/ccv/provider/keeper"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"

"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
Expand Down Expand Up @@ -87,11 +90,13 @@ type AppKeepers struct {
ConsensusParamsKeeper consensusparamkeeper.Keeper
PhotonKeeper *photonkeeper.Keeper
DynamicfeeKeeper *dynamicfeekeeper.Keeper
ProviderKeeper icsproviderkeeper.Keeper

// Modules
ICAModule ica.AppModule
TransferModule transfer.AppModule
TMClientModule ibctm.AppModule
ProviderModule icsprovider.AppModule
}

func NewAppKeeper(
Expand Down Expand Up @@ -211,15 +216,6 @@ func NewAppKeeper(
authorityStr,
)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
appKeepers.StakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(
appKeepers.DistrKeeper.Hooks(),
appKeepers.SlashingKeeper.Hooks(),
),
)

// UpgradeKeeper must be created before IBCKeeper
appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper(
skipUpgradeHeights,
Expand Down Expand Up @@ -304,9 +300,41 @@ func NewAppKeeper(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

// Initialize ProviderKeeper
appKeepers.ProviderKeeper = icsproviderkeeper.NewKeeper(
appCodec,
appKeepers.keys[providertypes.StoreKey],
appKeepers.GetSubspace(providertypes.ModuleName),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.IBCKeeper.ConnectionKeeper,
appKeepers.IBCKeeper.ClientKeeper,
appKeepers.StakingKeeper,
appKeepers.SlashingKeeper,
appKeepers.AccountKeeper,
appKeepers.DistrKeeper,
appKeepers.BankKeeper,
NewGovKeeperAdapter(appKeepers.GovKeeper), // inline the adapter creation
authorityStr,
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()),
addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()),
authtypes.FeeCollectorName,
)

// Register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
// This includes hooks from distribution, slashing, and provider modules
appKeepers.StakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(
appKeepers.DistrKeeper.Hooks(),
appKeepers.SlashingKeeper.Hooks(),
appKeepers.ProviderKeeper.Hooks(),
),
)

// Middleware Stacks
appKeepers.ICAModule = ica.NewAppModule(nil, &appKeepers.ICAHostKeeper)
appKeepers.TransferModule = transfer.NewAppModule(appKeepers.TransferKeeper)
appKeepers.ProviderModule = icsprovider.NewAppModule(&appKeepers.ProviderKeeper, appKeepers.GetSubspace(providertypes.ModuleName), nil)

// create IBC module from bottom to top of stack
var (
Expand Down Expand Up @@ -366,6 +394,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(providertypes.ModuleName)

return paramsKeeper
}
2 changes: 2 additions & 0 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"

storetypes "cosmossdk.io/store/types"
evidencetypes "cosmossdk.io/x/evidence/types"
Expand Down Expand Up @@ -47,6 +48,7 @@ func (appKeepers *AppKeepers) GenerateKeys() {
consensusparamtypes.StoreKey,
photontypes.StoreKey,
dynamicfeetypes.StoreKey,
providertypes.StoreKey,
)

// Define transient store keys
Expand Down
27 changes: 17 additions & 10 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v10/modules/core"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
providertypes "github.com/cosmos/interchain-security/v5/x/ccv/provider/types"

"cosmossdk.io/x/evidence"
evidencetypes "cosmossdk.io/x/evidence/types"
Expand Down Expand Up @@ -48,16 +49,18 @@ import (
)

var maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
photontypes.ModuleName: {authtypes.Minter, authtypes.Burner},
dynamicfeetypes.ModuleName: nil,
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
photontypes.ModuleName: {authtypes.Minter, authtypes.Burner},
dynamicfeetypes.ModuleName: nil,
providertypes.ConsumerRewardsPool: nil,
providertypes.ModuleName: nil,
}

func appModules(
Expand Down Expand Up @@ -99,6 +102,7 @@ func appModules(
app.TransferModule,
app.ICAModule,
app.TMClientModule,
app.ProviderModule,
}
}

Expand Down Expand Up @@ -127,6 +131,7 @@ func orderBeginBlockers() []string {
banktypes.ModuleName,
photontypes.ModuleName,
govtypes.ModuleName,
providertypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
Expand All @@ -152,6 +157,7 @@ func orderEndBlockers() []string {
dynamicfeetypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
providertypes.ModuleName, // provider.EndBlock must be after staking.EndBlock
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
icatypes.ModuleName,
Expand Down Expand Up @@ -193,6 +199,7 @@ func orderInitBlockers() []string {
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
providertypes.ModuleName,
evidencetypes.ModuleName,
authz.ModuleName,
feegrant.ModuleName,
Expand Down
10 changes: 4 additions & 6 deletions e2e.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ ARG GO_VERSION
ARG IMG_TAG=latest

# Compile the atomoned binary
FROM golang:$GO_VERSION-alpine AS atomoned-builder
FROM golang:${GO_VERSION:-1.24.5}-alpine AS atomoned-builder
WORKDIR /src/app/
COPY go.mod go.sum* ./
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN apk add --no-cache $PACKAGES
RUN apk add --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN CGO_ENABLED=0 make install

# Add to a distroless container
FROM alpine:$IMG_TAG
FROM alpine:${IMG_TAG:-latest}
RUN adduser -D nonroot
ARG IMG_TAG
COPY --from=atomoned-builder /go/bin/atomoned /usr/local/bin/
EXPOSE 26656 26657 1317 9090
USER nonroot
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ replace (
cosmossdk.io/x/upgrade => github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1
github.com/cosmos/cosmos-sdk => github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1
github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.2.0
github.com/cosmos/interchain-security/v5 => github.com/allinbits/interchain-security/v5 v5.3.0-ics1-alpha.2
)

require (
Expand All @@ -32,6 +33,7 @@ require (
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/v10 v10.2.0
github.com/cosmos/interchain-security/v5 v5.2.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/gofuzz v1.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/allinbits/interchain-security/v5 v5.3.0-ics1-alpha.2 h1:atMMFEPFblMO5RvKCNJRt3QlMhaORsrwWZ2PmZBgrTA=
github.com/allinbits/interchain-security/v5 v5.3.0-ics1-alpha.2/go.mod h1:HZrUn4V6oF8Aw9/vXh309EcPEWUAxmZ4YULDCv1FX5c=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0=
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func (s *IntegrationTestSuite) submitGovCommand(chainAAPIEndpoint, sender string
require.NoError(c, err)
assert.Equal(c, res.GetProposal().Status.String(), expectedStatus.String())
},
15*time.Second,
20*time.Second,
time.Second,
)
}
Expand Down
Loading