Skip to content

Commit

Permalink
[wip] unjail works; proposal stopped working
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Nov 11, 2023
1 parent 7346cb5 commit 6677814
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 98 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN make install
FROM --platform=linux/amd64 ghcr.io/informalsystems/hermes:v1.7.0 AS hermes-builder

# Get CometMock
FROM ghcr.io/informalsystems/cometmock:v0.37.x as cometmock-builder
FROM ghcr.io/informalsystems/cometmock:v0.38.0 as cometmock-builder

# Get GoRelayer
FROM ghcr.io/informalsystems/relayer-no-gas-sim:v2.3.0-rc4-no-gas-sim AS gorelayer-builder
Expand Down
53 changes: 40 additions & 13 deletions app/provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"io"
stdlog "log"
"os"
"path/filepath"

Expand Down Expand Up @@ -32,6 +31,7 @@ import (
"cosmossdk.io/x/evidence"
evidencekeeper "cosmossdk.io/x/evidence/keeper"
evidencetypes "cosmossdk.io/x/evidence/types"
"cosmossdk.io/x/tx/signing"
"cosmossdk.io/x/upgrade"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
upgradetypes "cosmossdk.io/x/upgrade/types"
Expand All @@ -41,6 +41,7 @@ import (
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
Expand All @@ -59,6 +60,8 @@ import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"

txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
Expand Down Expand Up @@ -104,6 +107,8 @@ import (
tmos "github.com/cometbft/cometbft/libs/os"
dbm "github.com/cosmos/cosmos-db"

sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"

appparams "github.com/cosmos/interchain-security/v3/app/params"
testutil "github.com/cosmos/interchain-security/v3/testutil/integration"
icsprovider "github.com/cosmos/interchain-security/v3/x/ccv/provider"
Expand All @@ -113,9 +118,8 @@ import (
)

const (
AppName = "interchain-security-p"
upgradeName = "ics-v1-to-v2"
AccountAddressPrefix = "cosmos"
AppName = "interchain-security-p"
upgradeName = "ics-v1-to-v2"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -230,7 +234,7 @@ type App struct { // nolint: golint
func init() {
userHomeDir, err := os.UserHomeDir()
if err != nil {
stdlog.Println("Failed to get home dir %2", err)
panic(fmt.Sprintf("Failed to get home dir %v", err))
}

DefaultNodeHome = filepath.Join(userHomeDir, "."+AppName)
Expand All @@ -245,15 +249,23 @@ func New(
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) *App {
encodingConfig := makeEncodingConfig()
interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
ProtoFiles: proto.HybridResolver,
SigningOptions: signing.Options{
AddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(),
},
ValidatorAddressCodec: address.Bech32Codec{
Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(),
},
},
})
appCodec := codec.NewProtoCodec(interfaceRegistry)
legacyAmino := codec.NewLegacyAmino()
txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes)

interfaceRegistry := encodingConfig.InterfaceRegistry
appCodec := encodingConfig.Codec
legacyAmino := encodingConfig.Amino
txConfig := encodingConfig.TxConfig
std.RegisterLegacyAminoCodec(legacyAmino)
std.RegisterInterfaces(interfaceRegistry)

// ABCI++, v50
voteExtOp := func(bApp *baseapp.BaseApp) {
voteExtHandler := NewVoteExtensionHandler()
Expand Down Expand Up @@ -560,6 +572,21 @@ func New(
ModuleBasics.RegisterLegacyAminoCodec(app.legacyAmino)
ModuleBasics.RegisterInterfaces(app.interfaceRegistry)

enabledSignModes := append(authtx.DefaultSignModes,
sigtypes.SignMode_SIGN_MODE_TEXTUAL)
txConfigOpts := authtx.ConfigOptions{
EnabledSignModes: enabledSignModes,
TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper),
}
txConfig, err := authtx.NewTxConfigWithOptions(
appCodec,
txConfigOpts,
)
if err != nil {
panic(err)
}
app.txConfig = txConfig

app.MM.SetOrderPreBlockers(
upgradetypes.ModuleName,
)
Expand Down Expand Up @@ -638,7 +665,7 @@ func New(

app.MM.RegisterInvariants(&app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
err := app.MM.RegisterServices(app.configurator)
err = app.MM.RegisterServices(app.configurator)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -699,7 +726,7 @@ func New(
HandlerOptions: ante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
SignModeHandler: txConfig.SignModeHandler(),
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
IBCKeeper: app.IBCKeeper,
Expand Down
Loading

0 comments on commit 6677814

Please sign in to comment.