From 40f3fdd35220efbdd34f75312513b63464a3d470 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Mon, 19 Dec 2022 09:52:08 +0800 Subject: [PATCH 01/12] on-chain upgrade to consumer chain wip --- app/consumer-democracy/app.go | 10 +- .../ccv/consumer/v1/genesis.proto | 6 + .../ccv/provider/v1/provider.proto | 2 + x/ccv/consumer/keeper/genesis.go | 6 + x/ccv/consumer/keeper/relay.go | 1 + x/ccv/consumer/types/genesis.pb.go | 367 +++++++++++++++--- x/ccv/democracy/staking/expected_keepers.go | 11 + x/ccv/democracy/staking/module.go | 28 +- x/ccv/provider/types/provider.pb.go | 299 +++++++++----- 9 files changed, 561 insertions(+), 169 deletions(-) create mode 100644 x/ccv/democracy/staking/expected_keepers.go diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 5f5106f7ec..fa4eb46a32 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -483,7 +483,7 @@ func New( ccvmint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsumerKeeper), ccvdistr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName), - ccvstaking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + ccvstaking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsumerKeeper), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), params.NewAppModule(app.ParamsKeeper), @@ -506,6 +506,7 @@ func New( ccvdistrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, + ibcconsumertypes.ModuleName, // Note: consumer initiation before staking module ccvstakingtypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, @@ -517,11 +518,11 @@ func New( vestingtypes.ModuleName, ibctransfertypes.ModuleName, ibchost.ModuleName, - ibcconsumertypes.ModuleName, ) app.MM.SetOrderEndBlockers( crisistypes.ModuleName, ccvgovtypes.ModuleName, + ibcconsumertypes.ModuleName, // Note: consumer initiation before staking module ccvstakingtypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, @@ -537,7 +538,6 @@ func New( vestingtypes.ModuleName, ibctransfertypes.ModuleName, ibchost.ModuleName, - ibcconsumertypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -550,6 +550,7 @@ func New( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, + ibcconsumertypes.ModuleName, // Note: consumer initiation before staking module ccvdistrtypes.ModuleName, ccvstakingtypes.ModuleName, slashingtypes.ModuleName, @@ -564,7 +565,6 @@ func New( vestingtypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, - ibcconsumertypes.ModuleName, ) app.MM.RegisterInvariants(&app.CrisisKeeper) @@ -584,7 +584,7 @@ func New( feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), ccvgov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, IsProposalWhitelisted), ccvmint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), - ccvstaking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + ccvstaking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.ConsumerKeeper), ccvdistr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), params.NewAppModule(app.ParamsKeeper), diff --git a/proto/interchain_security/ccv/consumer/v1/genesis.proto b/proto/interchain_security/ccv/consumer/v1/genesis.proto index a755dd7eb8..d6344807f6 100644 --- a/proto/interchain_security/ccv/consumer/v1/genesis.proto +++ b/proto/interchain_security/ccv/consumer/v1/genesis.proto @@ -39,6 +39,12 @@ message GenesisState { // LastTransmissionBlockHeight nil on new chain, filled in on restart. interchain_security.ccv.consumer.v1.LastTransmissionBlockHeight last_transmission_block_height = 12 [ (gogoproto.nullable) = false ]; + // TODO: preCCV could be replaced by params.Enabled + bool preCCV = 13; // flag indicating whether the consumer CCV module starts in pre-CCV state + google.protobuf.Duration unbonding_period = 14; // the unbonding period on the consumer chain. + string conn_id = 15; // the ID of the connection end on the consumer chain on top of which the CCV channel will be established. + string counterparty_client_id = 16; // the ID of the client of the consumer chain on the provider chain. + string transfer_channel_id = 17; // the ID of a token transfer channel used for the Reward Distribution sub-protocol. } // MaturingVSCPacket defines the genesis information for the diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 87a0058b4c..cdb24198e4 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -59,6 +59,8 @@ message ConsumerAdditionProposal { // This param is a part of the cosmos sdk staking module. In the case of // a ccv enabled consumer chain, the ccv module acts as the staking module. int64 historical_entries = 13; + string conn_id = 15; // the ID of the connection end on the consumer chain on top of which the CCV channel will be established. + string transfer_channel_id = 16; // the ID of a token transfer channel used for the Reward Distribution sub-protocol. } // ConsumerRemovalProposal is a governance proposal on the provider chain to remove (and stop) a consumer chain. diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 088ce6adc4..14b0c9c9d1 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -17,6 +17,12 @@ import ( // 2. A consumer chain restarts after a client to the provider was created, but the CCV channel handshake is still in progress // 3. A consumer chain restarts after the CCV channel handshake was completed. func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) []abci.ValidatorUpdate { + // PreCCV is true when consumer chain used to be running on non-consumer chain, and when it is in the progress of upgrading + // to consumer chain, where consumer chain upgrade is done. + if state.PreCCV { + return []abci.ValidatorUpdate{} + } + k.SetParams(ctx, state.Params) // TODO: Remove enabled flag and find a better way to setup e2e tests // See: https://github.com/cosmos/interchain-security/issues/339 diff --git a/x/ccv/consumer/keeper/relay.go b/x/ccv/consumer/keeper/relay.go index 05b48085f7..f4afc24047 100644 --- a/x/ccv/consumer/keeper/relay.go +++ b/x/ccv/consumer/keeper/relay.go @@ -24,6 +24,7 @@ import ( // Note: CCV uses an ordered IBC channel, meaning VSC packet changes will be accumulated (and later // processed by ApplyCCValidatorChanges) s.t. more recent val power changes overwrite older ones. func (k Keeper) OnRecvVSCPacket(ctx sdk.Context, packet channeltypes.Packet, newChanges ccv.ValidatorSetChangePacketData) exported.Acknowledgement { + // TODO: validator set update on receive packet // get the provider channel providerChannel, found := k.GetProviderChannel(ctx) if found && providerChannel != packet.DestinationChannel { diff --git a/x/ccv/consumer/types/genesis.pb.go b/x/ccv/consumer/types/genesis.pb.go index 0573a6471b..9c39b640df 100644 --- a/x/ccv/consumer/types/genesis.pb.go +++ b/x/ccv/consumer/types/genesis.pb.go @@ -10,7 +10,7 @@ import ( _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" types1 "github.com/tendermint/tendermint/abci/types" - _ "google.golang.org/protobuf/types/known/durationpb" + durationpb "google.golang.org/protobuf/types/known/durationpb" io "io" math "math" math_bits "math/bits" @@ -49,6 +49,11 @@ type GenesisState struct { PendingConsumerPackets ConsumerPackets `protobuf:"bytes,11,opt,name=pending_consumer_packets,json=pendingConsumerPackets,proto3" json:"pending_consumer_packets"` // LastTransmissionBlockHeight nil on new chain, filled in on restart. LastTransmissionBlockHeight LastTransmissionBlockHeight `protobuf:"bytes,12,opt,name=last_transmission_block_height,json=lastTransmissionBlockHeight,proto3" json:"last_transmission_block_height"` + PreCCV bool `protobuf:"varint,13,opt,name=preCCV,proto3" json:"preCCV,omitempty"` + UnbondingPeriod *durationpb.Duration `protobuf:"bytes,14,opt,name=unbonding_period,json=unbondingPeriod,proto3" json:"unbonding_period,omitempty"` + ConnId string `protobuf:"bytes,15,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"` + CounterpartyClientId string `protobuf:"bytes,16,opt,name=counterparty_client_id,json=counterpartyClientId,proto3" json:"counterparty_client_id,omitempty"` + TransferChannelId string `protobuf:"bytes,17,opt,name=transfer_channel_id,json=transferChannelId,proto3" json:"transfer_channel_id,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -168,6 +173,41 @@ func (m *GenesisState) GetLastTransmissionBlockHeight() LastTransmissionBlockHei return LastTransmissionBlockHeight{} } +func (m *GenesisState) GetPreCCV() bool { + if m != nil { + return m.PreCCV + } + return false +} + +func (m *GenesisState) GetUnbondingPeriod() *durationpb.Duration { + if m != nil { + return m.UnbondingPeriod + } + return nil +} + +func (m *GenesisState) GetConnId() string { + if m != nil { + return m.ConnId + } + return "" +} + +func (m *GenesisState) GetCounterpartyClientId() string { + if m != nil { + return m.CounterpartyClientId + } + return "" +} + +func (m *GenesisState) GetTransferChannelId() string { + if m != nil { + return m.TransferChannelId + } + return "" +} + // MaturingVSCPacket defines the genesis information for the // unbonding VSC packet type MaturingVSCPacket struct { @@ -334,56 +374,63 @@ func init() { } var fileDescriptor_2db73a6057a27482 = []byte{ - // 784 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6f, 0xc3, 0x34, - 0x14, 0x6e, 0x58, 0x57, 0x5a, 0x6f, 0x63, 0x9b, 0x37, 0xaa, 0xb0, 0x8a, 0x50, 0xba, 0x4b, 0x25, - 0x20, 0x51, 0x07, 0x42, 0x08, 0x24, 0x04, 0xeb, 0x24, 0xa8, 0x04, 0x63, 0x6a, 0xbb, 0x1e, 0x76, - 0x89, 0x5c, 0xc7, 0x24, 0xd6, 0x12, 0xbb, 0x8a, 0x9d, 0x8c, 0x1d, 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e9, 0xbc, 0x20, 0xd2, 0x3d, 0x29, 0x6b, 0x10, 0xff, 0xb7, 0x4b, 0xe7, 0x12, 0x1c, 0xbe, 0x99, - 0x41, 0x78, 0x0c, 0xb6, 0x73, 0x81, 0x07, 0x81, 0xda, 0x32, 0xd5, 0xa1, 0xbe, 0xc0, 0x53, 0xb0, - 0xa7, 0xa7, 0x52, 0xde, 0xfb, 0x45, 0x1d, 0xd5, 0xb2, 0xa8, 0x0e, 0x77, 0xcb, 0xc7, 0x31, 0x4d, - 0x48, 0xe7, 0x06, 0x34, 0xd7, 0x0f, 0x04, 0x6c, 0x82, 0x9a, 0x49, 0x4f, 0xb3, 0x9a, 0x1b, 0xec, - 0x82, 0x83, 0x37, 0xf3, 0xa7, 0x99, 0xdf, 0xcb, 0x57, 0x86, 0xa6, 0x73, 0x0d, 0x8e, 0xd6, 0x74, - 0x1a, 0x7e, 0x0b, 0x5a, 0x79, 0x39, 0xf2, 0x4b, 0xdf, 0x1d, 0x05, 0x41, 0x4a, 0x84, 0xde, 0x94, - 0x8d, 0xe1, 0x07, 0x73, 0x97, 0xf9, 0x0f, 0xfe, 0x5e, 0x3b, 0x9c, 0x8f, 0x1f, 0x9e, 0x1d, 0xeb, - 0xf1, 0xd9, 0xb1, 0x9e, 0x9e, 0x1d, 0xeb, 0xaf, 0x17, 0xa7, 0xf2, 0xf8, 0xe2, 0x54, 0xfe, 0x7e, - 0x71, 0x2a, 0x37, 0x5f, 0x87, 0x54, 0x46, 0xd9, 0xd4, 0xc5, 0x3c, 0xf1, 0x30, 0x17, 0x09, 0x17, - 0xde, 0xa2, 0x25, 0x9f, 0xcd, 0x57, 0xfc, 0x6f, 0xab, 0x4b, 0x5e, 0x6d, 0xf0, 0x69, 0x4d, 0xad, - 0xf0, 0xcf, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x8a, 0xe8, 0x9f, 0xf7, 0x06, 0x00, 0x00, + // 888 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0xe4, 0x34, + 0x14, 0x6e, 0xd8, 0xee, 0x6c, 0xeb, 0xb6, 0xdb, 0xa9, 0x5b, 0x86, 0x6c, 0x2b, 0x86, 0xa1, 0x7b, + 0x19, 0x09, 0x48, 0xd4, 0xb2, 0x42, 0x08, 0x24, 0x04, 0x9d, 0x4a, 0x30, 0x12, 0x2c, 0xd5, 0xb4, + 0x3b, 0x87, 0xbd, 0x44, 0x1e, 0xc7, 0x9b, 0x58, 0x9b, 0xd8, 0x91, 0xed, 0xa4, 0xf4, 0xc0, 0x85, + 0x2b, 0x17, 0xfe, 0x21, 0xee, 0x7b, 0xdc, 0x23, 0x27, 0x84, 0xda, 0x7f, 0x04, 0xf9, 0x47, 0x32, + 0x99, 0xed, 0x20, 0xe6, 0x66, 0xfb, 0xbd, 0xf7, 0x7d, 0xef, 0x87, 0xfd, 0x19, 0x9c, 0x50, 0xa6, + 0x88, 0xc0, 0x29, 0xa2, 0x2c, 0x92, 0x04, 0x97, 0x82, 0xaa, 0x9b, 0x10, 0xe3, 0x2a, 0xc4, 0x9c, + 0xc9, 0x32, 0x27, 0x22, 0xac, 0x4e, 0xc2, 0x84, 0x30, 0x22, 0xa9, 0x0c, 0x0a, 0xc1, 0x15, 0x87, + 0x4f, 0x97, 0x84, 0x04, 0x18, 0x57, 0x41, 0x1d, 0x12, 0x54, 0x27, 0x87, 0xfd, 0x84, 0xf3, 0x24, + 0x23, 0xa1, 0x09, 0x99, 0x95, 0xaf, 0xc2, 0xb8, 0x14, 0x48, 0x51, 0xce, 0x2c, 0xc8, 0x61, 0x48, + 0x67, 0x38, 0xcc, 0x68, 0x92, 0x2a, 0x9c, 0x51, 0xc2, 0x94, 0x0c, 0x15, 0x61, 0x31, 0x11, 0x39, + 0x65, 0x4a, 0x53, 0xce, 0x77, 0x2e, 0xe0, 0x63, 0x1d, 0x80, 0xb9,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1, 0x38, 0x36, 0x12, 0xba, + 0x3e, 0xb1, 0x1b, 0xf8, 0x14, 0xec, 0xd8, 0x27, 0xa7, 0x6e, 0x22, 0x7d, 0x49, 0x8c, 0x12, 0xae, + 0x4f, 0xb6, 0xeb, 0xc3, 0x2b, 0x9a, 0x93, 0xe3, 0x97, 0xa0, 0xb7, 0xfc, 0xb6, 0xeb, 0x36, 0xba, + 0xd9, 0x59, 0x54, 0xb7, 0x83, 0x43, 0xd0, 0xbd, 0xf7, 0xb8, 0x2c, 0xf2, 0xe3, 0x6a, 0xe1, 0x45, + 0x1c, 0xbf, 0x00, 0xfb, 0x4b, 0xae, 0x31, 0xfc, 0x06, 0x1c, 0x55, 0xf5, 0x7b, 0x6e, 0x69, 0x19, + 0x8a, 0x63, 0x41, 0xa4, 0xfd, 0x06, 0x36, 0x27, 0x4f, 0x1a, 0x97, 0x46, 0x9e, 0xbe, 0xb3, 0x0e, + 0x67, 0x57, 0x6f, 0x6e, 0xfb, 0xde, 0xdb, 0xdb, 0xbe, 0xf7, 0xcf, 0x6d, 0xdf, 0xfb, 0xe3, 0xae, + 0xbf, 0xf6, 0xf6, 0xae, 0xbf, 0xf6, 0xd7, 0x5d, 0x7f, 0xed, 0xe5, 0x57, 0x09, 0x55, 0x69, 0x39, + 0x0b, 0x30, 0xcf, 0x43, 0xcc, 0x65, 0xce, 0x65, 0x38, 0xbf, 0x6f, 0x9f, 0x35, 0xff, 0xd7, 0x2f, + 0x8b, 0x3f, 0x98, 0xf9, 0x9e, 0x66, 0x1d, 0x33, 0xfb, 0xcf, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, + 0x93, 0x2d, 0x0b, 0xa2, 0xd4, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -406,6 +453,53 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.TransferChannelId) > 0 { + i -= len(m.TransferChannelId) + copy(dAtA[i:], m.TransferChannelId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.TransferChannelId))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x8a + } + if len(m.CounterpartyClientId) > 0 { + i -= len(m.CounterpartyClientId) + copy(dAtA[i:], m.CounterpartyClientId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.CounterpartyClientId))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if len(m.ConnId) > 0 { + i -= len(m.ConnId) + copy(dAtA[i:], m.ConnId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConnId))) + i-- + dAtA[i] = 0x7a + } + if m.UnbondingPeriod != nil { + { + size, err := m.UnbondingPeriod.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x72 + } + if m.PreCCV { + i-- + if m.PreCCV { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } { size, err := m.LastTransmissionBlockHeight.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -705,6 +799,25 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) l = m.LastTransmissionBlockHeight.Size() n += 1 + l + sovGenesis(uint64(l)) + if m.PreCCV { + n += 2 + } + if m.UnbondingPeriod != nil { + l = m.UnbondingPeriod.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.ConnId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.CounterpartyClientId) + if l > 0 { + n += 2 + l + sovGenesis(uint64(l)) + } + l = len(m.TransferChannelId) + if l > 0 { + n += 2 + l + sovGenesis(uint64(l)) + } return n } @@ -1177,6 +1290,158 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreCCV", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PreCCV = bool(v != 0) + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UnbondingPeriod == nil { + m.UnbondingPeriod = &durationpb.Duration{} + } + if err := m.UnbondingPeriod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConnId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CounterpartyClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransferChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/democracy/staking/expected_keepers.go b/x/ccv/democracy/staking/expected_keepers.go new file mode 100644 index 0000000000..9a7322e648 --- /dev/null +++ b/x/ccv/democracy/staking/expected_keepers.go @@ -0,0 +1,11 @@ +package staking + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" +) + +// ConsumerKeeper defines the contract needed to be fulfilled for staking module. +type ConsumerKeeper interface { + GetParams(ctx sdk.Context) consumertypes.Params +} diff --git a/x/ccv/democracy/staking/module.go b/x/ccv/democracy/staking/module.go index aa27177f0a..ae6adbcedf 100644 --- a/x/ccv/democracy/staking/module.go +++ b/x/ccv/democracy/staking/module.go @@ -29,20 +29,22 @@ type AppModule struct { // embed the Cosmos SDK's x/staking AppModule staking.AppModule - keeper keeper.Keeper - accKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + accKeeper types.AccountKeeper + bankKeeper types.BankKeeper + consumerKeeper ConsumerKeeper } // NewAppModule creates a new AppModule object using the native x/staking module // AppModule constructor. -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak types.AccountKeeper, bk types.BankKeeper, ck ConsumerKeeper) AppModule { stakingAppMod := staking.NewAppModule(cdc, keeper, ak, bk) return AppModule{ - AppModule: stakingAppMod, - keeper: keeper, - accKeeper: ak, - bankKeeper: bk, + AppModule: stakingAppMod, + keeper: keeper, + accKeeper: ak, + bankKeeper: bk, + consumerKeeper: ck, } } @@ -54,7 +56,10 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. var genesisState types.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) - _ = staking.InitGenesis(ctx, am.keeper, am.accKeeper, am.bankKeeper, &genesisState) + valUpdates := staking.InitGenesis(ctx, am.keeper, am.accKeeper, am.bankKeeper, &genesisState) + if !am.consumerKeeper.GetParams(ctx).Enabled { + return valUpdates + } return []abci.ValidatorUpdate{} } @@ -64,6 +69,9 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. // consumer chain's x/cvv/consumer module and so this module is not responsible // for returning the initial validator set. func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - _ = am.keeper.BlockValidatorUpdates(ctx) + valUpdates := am.keeper.BlockValidatorUpdates(ctx) + if !am.consumerKeeper.GetParams(ctx).Enabled { + return valUpdates + } return []abci.ValidatorUpdate{} } diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 78eaa34c1a..ba8f8037b5 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -53,9 +53,9 @@ type ConsumerAdditionProposal struct { // spawn time is the time on the provider chain at which the consumer chain genesis is finalized and all validators // will be responsible for starting their consumer chain validator node. SpawnTime time.Time `protobuf:"bytes,7,opt,name=spawn_time,json=spawnTime,proto3,stdtime" json:"spawn_time"` - // BlocksPerDistributionTransmission is the number of blocks between ibc-token-transfers from the consumer chain to the provider chain. - // Note that at this transmission event a fraction of the accumulated tokens are divided and sent consumer redistribution address. - BlocksPerDistributionTransmission int64 `protobuf:"varint,8,opt,name=blocks_per_distribution_transmission,json=blocksPerDistributionTransmission,proto3" json:"blocks_per_distribution_transmission,omitempty"` + // Unbonding period for the consumer, + // which should be smaller than that of the provider in general. + UnbondingPeriod time.Duration `protobuf:"bytes,8,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period"` // Sent CCV related IBC packets will timeout after this duration CcvTimeoutPeriod time.Duration `protobuf:"bytes,9,opt,name=ccv_timeout_period,json=ccvTimeoutPeriod,proto3,stdduration" json:"ccv_timeout_period"` // Sent transfer related IBC packets will timeout after this duration @@ -64,13 +64,15 @@ type ConsumerAdditionProposal struct { // during distribution events. The fraction is a string representing a // decimal number. For example "0.75" would represent 75%. ConsumerRedistributionFraction string `protobuf:"bytes,11,opt,name=consumer_redistribution_fraction,json=consumerRedistributionFraction,proto3" json:"consumer_redistribution_fraction,omitempty"` + // BlocksPerDistributionTransmission is the number of blocks between ibc-token-transfers from the consumer chain to the provider chain. + // On sending transmission event, `consumer_redistribution_fraction` of the accumulated tokens are sent to the consumer redistribution address. + BlocksPerDistributionTransmission int64 `protobuf:"varint,12,opt,name=blocks_per_distribution_transmission,json=blocksPerDistributionTransmission,proto3" json:"blocks_per_distribution_transmission,omitempty"` // The number of historical info entries to persist in store. // This param is a part of the cosmos sdk staking module. In the case of // a ccv enabled consumer chain, the ccv module acts as the staking module. - HistoricalEntries int64 `protobuf:"varint,12,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` - // Unbonding period for the consumer, - // which should be smaller than that of the provider in general. - UnbondingPeriod time.Duration `protobuf:"bytes,13,opt,name=unbonding_period,json=unbondingPeriod,proto3,stdduration" json:"unbonding_period"` + HistoricalEntries int64 `protobuf:"varint,13,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` + ConnId string `protobuf:"bytes,15,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"` + TransferChannelId string `protobuf:"bytes,16,opt,name=transfer_channel_id,json=transferChannelId,proto3" json:"transfer_channel_id,omitempty"` } func (m *ConsumerAdditionProposal) Reset() { *m = ConsumerAdditionProposal{} } @@ -544,69 +546,72 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 992 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x4d, 0x6f, 0xdb, 0xb6, - 0x1b, 0xb7, 0x9a, 0xc4, 0x2f, 0x74, 0xfa, 0x12, 0xb6, 0xff, 0x54, 0xce, 0xbf, 0xb0, 0x5d, 0x6f, - 0x07, 0x0f, 0x45, 0x25, 0x24, 0xbd, 0x6c, 0xc5, 0x76, 0x70, 0xdc, 0x75, 0x19, 0xb0, 0x6e, 0xae, - 0x62, 0x6c, 0xc0, 0x76, 0x10, 0x28, 0x8a, 0xb1, 0x88, 0x48, 0xa2, 0x40, 0xd2, 0x5a, 0xf2, 0x0d, - 0x76, 0x2c, 0xb0, 0x4b, 0x8f, 0xfd, 0x06, 0xfb, 0x1a, 0x3d, 0xf6, 0xb8, 0xd3, 0x36, 0x24, 0x9f, - 0x62, 0xb7, 0x81, 0xa4, 0xe4, 0xb7, 0xa6, 0x80, 0x83, 0x61, 0x37, 0xf1, 0x79, 0x7e, 0xcf, 0x8f, - 0x3f, 0x3e, 0x2f, 0xa4, 0xc0, 0x01, 0x4d, 0x25, 0xe1, 0x38, 0x42, 0x34, 0xf5, 0x05, 0xc1, 0x53, - 0x4e, 0xe5, 0xb9, 0x8b, 0x71, 0xee, 0x66, 0x9c, 0xe5, 0x34, 0x24, 0xdc, 0xcd, 0xf7, 0x67, 0xdf, - 0x4e, 0xc6, 0x99, 0x64, 0xf0, 0xa3, 0x2b, 0x62, 0x1c, 0x8c, 0x73, 0x67, 0x86, 0xcb, 0xf7, 0xf7, - 0xee, 0x4d, 0xd8, 0x84, 0x69, 0xbc, 0xab, 0xbe, 0x4c, 0xe8, 0x5e, 0x67, 0xc2, 0xd8, 0x24, 0x26, - 0xae, 0x5e, 0x05, 0xd3, 0x13, 0x57, 0xd2, 0x84, 0x08, 0x89, 0x92, 0xac, 0x00, 0xb4, 0x57, 0x01, - 0xe1, 0x94, 0x23, 0x49, 0x59, 0x5a, 0x12, 0xd0, 0x00, 0xbb, 0x98, 0x71, 0xe2, 0xe2, 0x98, 0x92, - 0x54, 0x2a, 0x79, 0xe6, 0xab, 0x00, 0xb8, 0x0a, 0x10, 0xd3, 0x49, 0x24, 0x8d, 0x59, 0xb8, 0x92, - 0xa4, 0x21, 0xe1, 0x09, 0x35, 0xe0, 0xf9, 0xca, 0x04, 0xf4, 0x7e, 0xad, 0x02, 0x7b, 0xc8, 0x52, - 0x31, 0x4d, 0x08, 0x1f, 0x84, 0x21, 0x55, 0x9b, 0x8d, 0x38, 0xcb, 0x98, 0x40, 0x31, 0xbc, 0x07, - 0xb6, 0x24, 0x95, 0x31, 0xb1, 0xad, 0xae, 0xd5, 0x6f, 0x78, 0x66, 0x01, 0xbb, 0xa0, 0x19, 0x12, - 0x81, 0x39, 0xcd, 0x14, 0xd8, 0xbe, 0xa1, 0x7d, 0x8b, 0x26, 0xd8, 0x02, 0x75, 0x93, 0x1f, 0x1a, - 0xda, 0x1b, 0xda, 0x5d, 0xd3, 0xeb, 0xaf, 0x43, 0xf8, 0x15, 0xb8, 0x45, 0x53, 0x2a, 0x29, 0x8a, - 0xfd, 0x88, 0x28, 0x9d, 0xf6, 0x66, 0xd7, 0xea, 0x37, 0x0f, 0xf6, 0x1c, 0x1a, 0x60, 0x47, 0x1d, - 0xcd, 0x29, 0x0e, 0x94, 0xef, 0x3b, 0x47, 0x1a, 0x71, 0xb8, 0xf9, 0xf6, 0x8f, 0x4e, 0xc5, 0xbb, - 0x59, 0xc4, 0x19, 0x23, 0x7c, 0x08, 0xb6, 0x27, 0x24, 0x25, 0x82, 0x0a, 0x3f, 0x42, 0x22, 0xb2, - 0xb7, 0xba, 0x56, 0x7f, 0xdb, 0x6b, 0x16, 0xb6, 0x23, 0x24, 0x22, 0xd8, 0x01, 0xcd, 0x80, 0xa6, - 0x88, 0x9f, 0x1b, 0x44, 0x55, 0x23, 0x80, 0x31, 0x69, 0xc0, 0x10, 0x00, 0x91, 0xa1, 0x9f, 0x53, - 0x5f, 0xd5, 0xc1, 0xae, 0x15, 0x42, 0x4c, 0x0d, 0x9c, 0xb2, 0x06, 0xce, 0xb8, 0x2c, 0xd2, 0x61, - 0x5d, 0x09, 0x79, 0xf5, 0x67, 0xc7, 0xf2, 0x1a, 0x3a, 0x4e, 0x79, 0xe0, 0x77, 0xe0, 0xe3, 0x20, - 0x66, 0xf8, 0x54, 0xf8, 0x19, 0xe1, 0x7e, 0x48, 0x85, 0xe4, 0x34, 0x98, 0xaa, 0x3c, 0xf8, 0x92, - 0xa3, 0x54, 0x24, 0x54, 0x08, 0x95, 0xa7, 0x7a, 0xd7, 0xea, 0x6f, 0x78, 0x0f, 0x0d, 0x76, 0x44, - 0xf8, 0xb3, 0x05, 0xe4, 0x78, 0x01, 0x08, 0x5f, 0x02, 0x88, 0x71, 0xae, 0x35, 0xb1, 0xa9, 0x54, - 0xac, 0x94, 0x85, 0x76, 0x43, 0xab, 0x6b, 0xbd, 0xa7, 0xee, 0x59, 0xd1, 0x21, 0x46, 0xdc, 0x6b, - 0x25, 0xee, 0x0e, 0xc6, 0xf9, 0xd8, 0x44, 0x8f, 0x74, 0x30, 0xfc, 0x09, 0xdc, 0xd7, 0x5a, 0x4e, - 0x08, 0x5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x37, 0xe9, 0x9c, 0x55, 0xf5, 0xea, 0x7e, - 0xde, 0xf8, 0x37, 0xfd, 0x7c, 0x0c, 0xee, 0xaa, 0xdb, 0x60, 0x95, 0x73, 0x73, 0x7d, 0xce, 0x1d, - 0x15, 0xbf, 0x4c, 0xfa, 0x12, 0xc0, 0x5c, 0xe0, 0x55, 0xce, 0xad, 0x6b, 0xe8, 0xcc, 0x05, 0x5e, - 0xa6, 0x0c, 0xc1, 0x03, 0x11, 0x23, 0x11, 0xf9, 0x09, 0x91, 0x7a, 0x3a, 0xb2, 0x98, 0xa4, 0x54, - 0x44, 0x25, 0x79, 0x75, 0x7d, 0xf2, 0x96, 0x26, 0x7a, 0xa1, 0x78, 0xbc, 0x92, 0xa6, 0xd8, 0x65, - 0x08, 0xda, 0x57, 0xef, 0x32, 0x2b, 0x50, 0x4d, 0xf7, 0xdb, 0xff, 0xaf, 0xa0, 0x98, 0x55, 0xe9, - 0x33, 0xd0, 0x4a, 0xd0, 0x99, 0x9f, 0x11, 0x33, 0x4e, 0x86, 0x30, 0x43, 0xf8, 0x94, 0x48, 0x51, - 0xdc, 0x5d, 0xbb, 0x09, 0x3a, 0x1b, 0x19, 0xff, 0xb1, 0x72, 0x8f, 0x8c, 0xb7, 0x17, 0x80, 0x9d, - 0x23, 0x94, 0x86, 0x22, 0x42, 0xa7, 0xe4, 0x05, 0x91, 0x28, 0x44, 0x12, 0xc1, 0x27, 0x60, 0xb7, - 0x7c, 0x10, 0xfd, 0x13, 0x42, 0xfc, 0x8c, 0xb1, 0xd8, 0x47, 0x61, 0xc8, 0x8b, 0xb9, 0xb9, 0x5b, - 0x7a, 0x9f, 0x13, 0x32, 0x62, 0x2c, 0x1e, 0x84, 0x21, 0x87, 0x36, 0xa8, 0xe5, 0x84, 0x8b, 0xf9, - 0x04, 0x95, 0xcb, 0xde, 0x27, 0xa0, 0xa1, 0xf7, 0x1c, 0xe0, 0x53, 0x01, 0x1f, 0x80, 0x86, 0x62, - 0x22, 0x42, 0x10, 0x61, 0x5b, 0xdd, 0x8d, 0x7e, 0xc3, 0x9b, 0x1b, 0x7a, 0x12, 0xb4, 0x3e, 0xf4, - 0xa2, 0x09, 0xf8, 0x03, 0xa8, 0x15, 0x47, 0xd4, 0x81, 0xcd, 0x83, 0x2f, 0x9c, 0x35, 0xde, 0x73, - 0xe7, 0x43, 0x84, 0x5e, 0xc9, 0xd6, 0xe3, 0xf3, 0x77, 0x74, 0xe5, 0xc6, 0x10, 0xf0, 0xfb, 0xd5, - 0x4d, 0x3f, 0xbf, 0xd6, 0xa6, 0x2b, 0x7c, 0xf3, 0x3d, 0x1f, 0x81, 0xe6, 0xc0, 0x1c, 0xfb, 0x1b, - 0x2a, 0xe4, 0xfb, 0x69, 0xd9, 0x5e, 0x48, 0xcb, 0xe1, 0xf8, 0xed, 0x45, 0xdb, 0x7a, 0x77, 0xd1, - 0xb6, 0xfe, 0xba, 0x68, 0x5b, 0xaf, 0x2e, 0xdb, 0x95, 0x77, 0x97, 0xed, 0xca, 0xef, 0x97, 0xed, - 0xca, 0x8f, 0x4f, 0x27, 0x54, 0x46, 0xd3, 0xc0, 0xc1, 0x2c, 0x71, 0x31, 0x13, 0x09, 0x13, 0xee, - 0x5c, 0xde, 0xe3, 0xd9, 0x7f, 0xd1, 0xd9, 0xf2, 0x9f, 0x91, 0x3c, 0xcf, 0x88, 0x08, 0xaa, 0xba, - 0x67, 0x9f, 0xfc, 0x13, 0x00, 0x00, 0xff, 0xff, 0xbc, 0xa3, 0xcd, 0xef, 0x4a, 0x09, 0x00, 0x00, + // 1026 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6f, 0xdb, 0x36, + 0x14, 0xc7, 0xad, 0x26, 0xb1, 0x63, 0x3a, 0x6d, 0x12, 0xa6, 0x4b, 0x94, 0xac, 0xb0, 0x5d, 0x6f, + 0x87, 0x0c, 0x45, 0x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c, 0xbc, 0x96, 0xc3, 0xd3, 0xb7, 0x57, 0x4d, 0xe7, 0xdd, + 0x55, 0xd3, 0xf9, 0xfb, 0xaa, 0xe9, 0xbc, 0xba, 0x6e, 0x56, 0xde, 0x5d, 0x37, 0x2b, 0xbf, 0x5f, + 0x37, 0x2b, 0x3f, 0x3d, 0x1d, 0x50, 0x15, 0x0f, 0xfb, 0x1e, 0xe6, 0xa9, 0x8f, 0xb9, 0x4c, 0xb9, + 0xf4, 0xc7, 0xe9, 0x3d, 0x1e, 0xfd, 0x60, 0x5d, 0x4c, 0xff, 0x62, 0xa9, 0xcb, 0x8c, 0xc8, 0x7e, + 0xd5, 0xf4, 0xec, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xbe, 0x72, 0xa9, 0x93, 0x09, + 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -629,17 +634,30 @@ func (m *ConsumerAdditionProposal) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):]) - if err1 != nil { - return 0, err1 + if len(m.TransferChannelId) > 0 { + i -= len(m.TransferChannelId) + copy(dAtA[i:], m.TransferChannelId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.TransferChannelId))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if len(m.ConnId) > 0 { + i -= len(m.ConnId) + copy(dAtA[i:], m.ConnId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ConnId))) + i-- + dAtA[i] = 0x7a } - i -= n1 - i = encodeVarintProvider(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x6a if m.HistoricalEntries != 0 { i = encodeVarintProvider(dAtA, i, uint64(m.HistoricalEntries)) i-- + dAtA[i] = 0x68 + } + if m.BlocksPerDistributionTransmission != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerDistributionTransmission)) + i-- dAtA[i] = 0x60 } if len(m.ConsumerRedistributionFraction) > 0 { @@ -649,27 +667,30 @@ func (m *ConsumerAdditionProposal) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x5a } - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TransferTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TransferTimeoutPeriod):]) + n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.TransferTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.TransferTimeoutPeriod):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintProvider(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x52 + n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) if err2 != nil { return 0, err2 } i -= n2 i = encodeVarintProvider(dAtA, i, uint64(n2)) i-- - dAtA[i] = 0x52 - n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + dAtA[i] = 0x4a + n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod):]) if err3 != nil { return 0, err3 } i -= n3 i = encodeVarintProvider(dAtA, i, uint64(n3)) i-- - dAtA[i] = 0x4a - if m.BlocksPerDistributionTransmission != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.BlocksPerDistributionTransmission)) - i-- - dAtA[i] = 0x40 - } + dAtA[i] = 0x42 n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.SpawnTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.SpawnTime):]) if err4 != nil { return 0, err4 @@ -1078,9 +1099,8 @@ func (m *ConsumerAdditionProposal) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.SpawnTime) n += 1 + l + sovProvider(uint64(l)) - if m.BlocksPerDistributionTransmission != 0 { - n += 1 + sovProvider(uint64(m.BlocksPerDistributionTransmission)) - } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod) + n += 1 + l + sovProvider(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod) n += 1 + l + sovProvider(uint64(l)) l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.TransferTimeoutPeriod) @@ -1089,11 +1109,20 @@ func (m *ConsumerAdditionProposal) Size() (n int) { if l > 0 { n += 1 + l + sovProvider(uint64(l)) } + if m.BlocksPerDistributionTransmission != 0 { + n += 1 + sovProvider(uint64(m.BlocksPerDistributionTransmission)) + } if m.HistoricalEntries != 0 { n += 1 + sovProvider(uint64(m.HistoricalEntries)) } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingPeriod) - n += 1 + l + sovProvider(uint64(l)) + l = len(m.ConnId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + l = len(m.TransferChannelId) + if l > 0 { + n += 2 + l + sovProvider(uint64(l)) + } return n } @@ -1494,10 +1523,10 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) } - m.BlocksPerDistributionTransmission = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -1507,11 +1536,25 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CcvTimeoutPeriod", wireType) @@ -1611,6 +1654,25 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { m.ConsumerRedistributionFraction = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlocksPerDistributionTransmission", wireType) + } + m.BlocksPerDistributionTransmission = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlocksPerDistributionTransmission |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) } @@ -1629,11 +1691,11 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { break } } - case 13: + case 15: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ConnId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -1643,24 +1705,55 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err + m.ConnId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF } + m.TransferChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From aa566c92df42a4789e4ca7b2b0cd72bf91bb1286 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Tue, 20 Dec 2022 00:03:27 +0800 Subject: [PATCH 02/12] add preCCV store and use it on democracy staking --- x/ccv/consumer/keeper/genesis.go | 1 + x/ccv/consumer/keeper/keeper.go | 19 +++++++++++++++++++ x/ccv/consumer/types/keys.go | 7 +++++++ x/ccv/democracy/staking/expected_keepers.go | 1 + x/ccv/democracy/staking/module.go | 4 ++-- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 14b0c9c9d1..76c3e86296 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -20,6 +20,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) // PreCCV is true when consumer chain used to be running on non-consumer chain, and when it is in the progress of upgrading // to consumer chain, where consumer chain upgrade is done. if state.PreCCV { + k.SetPreCCV(ctx) return []abci.ValidatorUpdate{} } diff --git a/x/ccv/consumer/keeper/keeper.go b/x/ccv/consumer/keeper/keeper.go index e04b00a965..c94c11acb8 100644 --- a/x/ccv/consumer/keeper/keeper.go +++ b/x/ccv/consumer/keeper/keeper.go @@ -206,6 +206,25 @@ func (k Keeper) DeletePendingChanges(ctx sdk.Context) { store.Delete(types.PendingChangesKey()) } +func (k Keeper) IsPreCCV(ctx sdk.Context) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.PreCCVKey()) + if bz != nil { + return true + } + return false +} + +func (k Keeper) SetPreCCV(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Set(types.PreCCVKey(), []byte{1}) +} + +func (k Keeper) DeletePreCCV(ctx sdk.Context) { + store := ctx.KVStore(k.storeKey) + store.Delete(types.PreCCVKey()) +} + // IteratePacketMaturityTime iterates through the VSC packet maturity times set in the store func (k Keeper) IteratePacketMaturityTime(ctx sdk.Context, cb func(vscId, timeNs uint64) (stop bool)) { store := ctx.KVStore(k.storeKey) diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index 46fb5e9b8a..185050974f 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -67,6 +67,9 @@ const ( // CrossChainValidatorPrefix is the byte prefix that will store cross-chain validators by consensus address CrossChainValidatorBytePrefix + + // PreCCVPrefix is the byte prefix to store the consumer is running on democracy staking module without consumer + PreCCVPrefix ) // PortKey returns the key to the port ID in the store @@ -99,6 +102,10 @@ func PendingChangesKey() []byte { return []byte{PendingChangesByteKey} } +func PreCCVKey() []byte { + return []byte{PreCCVPrefix} +} + // PacketMaturityTimeKey returns the key for storing maturity time for a given received VSC packet id func PacketMaturityTimeKey(id uint64) []byte { seqBytes := make([]byte, 8) diff --git a/x/ccv/democracy/staking/expected_keepers.go b/x/ccv/democracy/staking/expected_keepers.go index 9a7322e648..66cb093d37 100644 --- a/x/ccv/democracy/staking/expected_keepers.go +++ b/x/ccv/democracy/staking/expected_keepers.go @@ -8,4 +8,5 @@ import ( // ConsumerKeeper defines the contract needed to be fulfilled for staking module. type ConsumerKeeper interface { GetParams(ctx sdk.Context) consumertypes.Params + IsPreCCV(ctx sdk.Context) bool } diff --git a/x/ccv/democracy/staking/module.go b/x/ccv/democracy/staking/module.go index ae6adbcedf..9180652acf 100644 --- a/x/ccv/democracy/staking/module.go +++ b/x/ccv/democracy/staking/module.go @@ -57,7 +57,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. cdc.MustUnmarshalJSON(data, &genesisState) valUpdates := staking.InitGenesis(ctx, am.keeper, am.accKeeper, am.bankKeeper, &genesisState) - if !am.consumerKeeper.GetParams(ctx).Enabled { + if am.consumerKeeper.IsPreCCV(ctx) { return valUpdates } @@ -70,7 +70,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. // for returning the initial validator set. func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { valUpdates := am.keeper.BlockValidatorUpdates(ctx) - if !am.consumerKeeper.GetParams(ctx).Enabled { + if am.consumerKeeper.IsPreCCV(ctx) { return valUpdates } return []abci.ValidatorUpdate{} From dc9768de8064b4c749d6318cab46098be2f70df8 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Tue, 20 Dec 2022 00:46:57 +0800 Subject: [PATCH 03/12] add TODOs and one more packet possibility --- proto/interchain_security/ccv/provider/v1/provider.proto | 2 ++ proto/interchain_security/ccv/v1/ccv.proto | 8 ++++++++ x/ccv/consumer/ibc_module.go | 1 + x/ccv/provider/keeper/relay.go | 1 + 4 files changed, 12 insertions(+) diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index cdb24198e4..afb19b755a 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -61,6 +61,8 @@ message ConsumerAdditionProposal { int64 historical_entries = 13; string conn_id = 15; // the ID of the connection end on the consumer chain on top of which the CCV channel will be established. string transfer_channel_id = 16; // the ID of a token transfer channel used for the Reward Distribution sub-protocol. + // TODO: preCCV field shouldn't be added here? to make sure if it's a new chain with consumer initial validator set + // or if initial validator set will be provided from provider chain via packet } // ConsumerRemovalProposal is a governance proposal on the provider chain to remove (and stop) a consumer chain. diff --git a/proto/interchain_security/ccv/v1/ccv.proto b/proto/interchain_security/ccv/v1/ccv.proto index f25b997356..dd59456861 100644 --- a/proto/interchain_security/ccv/v1/ccv.proto +++ b/proto/interchain_security/ccv/v1/ccv.proto @@ -9,6 +9,14 @@ import "cosmos/staking/v1beta1/staking.proto"; import "gogoproto/gogo.proto"; import "tendermint/abci/types.proto"; +// This packet is to send for preCCV chain, and once it's received consumer chain sends VSCMaturedPacketData +// and consumer chain becomes preCCV chain as false, and provider chain record preCCV field as false on provider chain +message ReplaceWholeValidatorSet { + repeated .tendermint.abci.ValidatorUpdate initial_val_set = 1 + [ (gogoproto.nullable) = false ]; + uint64 valset_update_id = 2; +} + // This packet is sent from provider chain to consumer chain if the validator // set for consumer chain changes (due to new bonding/unbonding messages or // slashing events) A VSCMatured packet from consumer chain will be sent diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index 59e5382040..d18edddf90 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -213,6 +213,7 @@ func (am AppModule) OnRecvPacket( errAck := channeltypes.NewErrorAcknowledgement("cannot unmarshal CCV packet data") ack = &errAck } else { + // TODO: add possibility to receive ReplaceValidatorSet if it's the first time switching to consumer chain ack = am.keeper.OnRecvVSCPacket(ctx, packet, data) } diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index 9b3cc39fc3..d8485dc6af 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -161,6 +161,7 @@ func (k Keeper) SendVSCPackets(ctx sdk.Context) { // SendVSCPacketsToChain sends all queued VSC packets to the specified chain func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) { + // TODO: send init genesis packet if target chain is preCCV? pendingPackets := k.GetPendingVSCPackets(ctx, chainID) for _, data := range pendingPackets { // send packet over IBC From 473e467adcf1e0b90aa726028e433e7ac6023fa2 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Thu, 29 Dec 2022 01:35:07 +0800 Subject: [PATCH 04/12] status update --- app/consumer-democracy/app.go | 31 +- app/consumer/app.go | 2 +- app/sovereign/app.go | 808 ++++++++++++++++++ app/sovereign/encoding.go | 38 + app/sovereign/export.go | 201 +++++ app/sovereign/genesis.go | 20 + app/sovereign/upgrades.go | 31 + app/sovereign/upgrades/v3/upgrades.go | 26 + cmd/interchain-security-sd/main.go | 32 + consumer/README.md | 64 ++ consumer/build_binaries.sh | 6 + consumer/run.sh | 6 + consumer/start_consumer.sh | 315 +++++++ consumer/start_provider.sh | 134 +++ .../ccv/consumer/v1/genesis.proto | 9 +- .../ccv/provider/v1/provider.proto | 6 +- proto/interchain_security/ccv/v1/ccv.proto | 8 - x/ccv/consumer/keeper/genesis.go | 19 +- x/ccv/consumer/keeper/keeper.go | 21 +- x/ccv/consumer/keeper/relay.go | 1 - x/ccv/consumer/keeper/validators.go | 2 + x/ccv/consumer/module.go | 36 +- x/ccv/consumer/types/genesis.pb.go | 327 ++----- x/ccv/provider/keeper/relay.go | 1 - x/ccv/provider/types/provider.pb.go | 221 ++--- 25 files changed, 1906 insertions(+), 459 deletions(-) create mode 100644 app/sovereign/app.go create mode 100644 app/sovereign/encoding.go create mode 100644 app/sovereign/export.go create mode 100644 app/sovereign/genesis.go create mode 100644 app/sovereign/upgrades.go create mode 100644 app/sovereign/upgrades/v3/upgrades.go create mode 100644 cmd/interchain-security-sd/main.go create mode 100644 consumer/README.md create mode 100644 consumer/build_binaries.sh create mode 100644 consumer/run.sh create mode 100644 consumer/start_consumer.sh create mode 100644 consumer/start_provider.sh diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index fa4eb46a32..296bdf0e14 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -8,6 +8,8 @@ import ( "os" "path/filepath" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -436,7 +438,7 @@ func New( // register slashing module StakingHooks to the consumer keeper app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks()) - consumerModule := ibcconsumer.NewAppModule(app.ConsumerKeeper) + consumerModule := ibcconsumer.NewAppModule(app.ConsumerKeeper, app.StakingKeeper) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, @@ -625,6 +627,8 @@ func New( app.UpgradeKeeper.SetUpgradeHandler( upgradeName, func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { + fmt.Println("UPGRADING DATA!!!", upgradeName) + app.IBCKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) fromVM := make(map[string]uint64) @@ -633,6 +637,26 @@ func New( fromVM[moduleName] = eachModule.ConsensusVersion() } + // TODO: should have a way to read from current node home + userHomeDir, err := os.UserHomeDir() + if err != nil { + stdlog.Println("Failed to get home dir %2", err) + } + nodeHome := userHomeDir + "/.sovereign/config/genesis.json" + fmt.Println("NodeHome:", nodeHome) + appState, _, err := genutiltypes.GenesisStateFromGenFile(nodeHome) + if err != nil { + return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err) + } + + var consumerGenesis = ibcconsumertypes.GenesisState{} + appCodec.MustUnmarshalJSON(appState[ibcconsumertypes.ModuleName], &consumerGenesis) + + fmt.Println("appState[ibcconsumertypes.ModuleName]", string(appState[ibcconsumertypes.ModuleName])) + consumerGenesis.PreCCV = true + fmt.Println("consumerGenesis", consumerGenesis) + app.ConsumerKeeper.InitGenesis(ctx, &consumerGenesis) + ctx.Logger().Info("start to run module migrations...") return app.MM.RunMigrations(ctx, app.configurator, fromVM) @@ -645,7 +669,10 @@ func New( } if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - storeUpgrades := store.StoreUpgrades{} + fmt.Println("UPGRADING STORAGE!!!", upgradeName) + storeUpgrades := store.StoreUpgrades{ + Added: []string{ibcconsumertypes.ModuleName}, + } // configure store loader that checks if version == upgradeHeight and applies store upgrades app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) diff --git a/app/consumer/app.go b/app/consumer/app.go index 2da5e560eb..ce343a9f52 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -344,7 +344,7 @@ func New( // register slashing module Slashing hooks to the consumer keeper app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks()) - consumerModule := ibcconsumer.NewAppModule(app.ConsumerKeeper) + consumerModule := ibcconsumer.NewAppModule(app.ConsumerKeeper, nil) app.TransferKeeper = ibctransferkeeper.NewKeeper( appCodec, diff --git a/app/sovereign/app.go b/app/sovereign/app.go new file mode 100644 index 0000000000..73ca49b716 --- /dev/null +++ b/app/sovereign/app.go @@ -0,0 +1,808 @@ +package app + +import ( + "io" + "os" + "path/filepath" + + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" + "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/server/api" + "github.com/cosmos/cosmos-sdk/server/config" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + "github.com/cosmos/cosmos-sdk/x/auth/ante" + authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + 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" + "github.com/cosmos/cosmos-sdk/x/authz" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/capability" + capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" + capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + "github.com/cosmos/cosmos-sdk/x/crisis" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + "github.com/cosmos/cosmos-sdk/x/evidence" + evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" + evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" + "github.com/cosmos/cosmos-sdk/x/feegrant" + feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" + feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" + "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/cosmos/cosmos-sdk/x/gov" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/cosmos/cosmos-sdk/x/params" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cosmos/cosmos-sdk/x/upgrade" + upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" + upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + ibcporttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/spf13/cast" + "github.com/tendermint/spm/cosmoscmd" + abci "github.com/tendermint/tendermint/abci/types" + tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/tendermint/tendermint/libs/log" + tmos "github.com/tendermint/tendermint/libs/os" + dbm "github.com/tendermint/tm-db" + + // add mint + mint "github.com/cosmos/cosmos-sdk/x/mint" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" +) + +const ( + AccountAddressPrefix = "cosmos" + AppName = "interchain-security-sovereign" + Version = "3.0.0" +) + +// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals + +func getGovProposalHandlers() []govclient.ProposalHandler { + var govProposalHandlers []govclient.ProposalHandler + // this line is used by starport scaffolding # stargate/app/govProposalHandlers + + govProposalHandlers = append(govProposalHandlers, + paramsclient.ProposalHandler, + distrclient.ProposalHandler, + upgradeclient.ProposalHandler, + upgradeclient.CancelProposalHandler, + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, + // this line is used by starport scaffolding # stargate/app/govProposalHandler + ) + + return govProposalHandlers +} + +var ( + // DefaultNodeHome default home directories for the application daemon + DefaultNodeHome string + + // ModuleBasics defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration + // and genesis verification. + ModuleBasics = module.NewBasicManager( + auth.AppModuleBasic{}, + authzmodule.AppModuleBasic{}, + genutil.AppModuleBasic{}, + bank.AppModuleBasic{}, + capability.AppModuleBasic{}, + staking.AppModuleBasic{}, + distr.AppModuleBasic{}, + gov.NewAppModuleBasic(getGovProposalHandlers()...), + params.AppModuleBasic{}, + crisis.AppModuleBasic{}, + slashing.AppModuleBasic{}, + feegrantmodule.AppModuleBasic{}, + ibc.AppModuleBasic{}, + upgrade.AppModuleBasic{}, + evidence.AppModuleBasic{}, + transfer.AppModuleBasic{}, + vesting.AppModuleBasic{}, + ica.AppModuleBasic{}, + mint.AppModuleBasic{}, + ) + + // module account permissions + maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + // mint module needs burn access to remove excess validator tokens (it overallocates, then burns) + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + icatypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + // this line is used by starport scaffolding # stargate/app/maccPerms + } +) + +var ( + _ servertypes.Application = (*SovereignApp)(nil) +) + +func init() { + userHomeDir, err := os.UserHomeDir() + if err != nil { + panic(err) + } + + DefaultNodeHome = filepath.Join(userHomeDir, "."+AppName) +} + +// SovereignApp extends an ABCI application, but with most of its parameters exported. +// They are exported for convenience in creating helper functions, as object +// capabilities aren't needed for testing. +type SovereignApp struct { + *baseapp.BaseApp + + cdc *codec.LegacyAmino + appCodec codec.Codec + interfaceRegistry types.InterfaceRegistry + + invCheckPeriod uint + + // keys to access the substores + keys map[string]*sdk.KVStoreKey + tkeys map[string]*sdk.TransientStoreKey + memKeys map[string]*sdk.MemoryStoreKey + + // keepers + AccountKeeper authkeeper.AccountKeeper + AuthzKeeper authzkeeper.Keeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper crisiskeeper.Keeper + UpgradeKeeper upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + EvidenceKeeper evidencekeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + // MonitoringKeeper monitoringpkeeper.Keeper + ICAControllerKeeper icacontrollerkeeper.Keeper + ICAHostKeeper icahostkeeper.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + // ScopedMonitoringKeeper capabilitykeeper.ScopedKeeper + ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper + ScopedICAHostKeeper capabilitykeeper.ScopedKeeper + + ScopedStakeibcKeeper capabilitykeeper.ScopedKeeper + + ScopedRecordsKeeper capabilitykeeper.ScopedKeeper + ScopedIcacallbacksKeeper capabilitykeeper.ScopedKeeper + // this line is used by starport scaffolding # stargate/app/keeperDeclaration + + mm *module.Manager + sm *module.SimulationManager + configurator module.Configurator +} + +// RUN GOSEC +// New returns a reference to an initialized blockchain app +func New( + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + loadLatest bool, + skipUpgradeHeights map[int64]bool, + homePath string, + invCheckPeriod uint, + encodingConfig cosmoscmd.EncodingConfig, + appOpts servertypes.AppOptions, + baseAppOptions ...func(*baseapp.BaseApp), +) cosmoscmd.App { + appCodec := encodingConfig.Marshaler + cdc := encodingConfig.Amino + interfaceRegistry := encodingConfig.InterfaceRegistry + + bApp := baseapp.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + bApp.SetCommitMultiStoreTracer(traceStore) + bApp.SetVersion(Version) + bApp.SetInterfaceRegistry(interfaceRegistry) + + keys := sdk.NewKVStoreKeys( + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, // monitoringptypes.StoreKey, + icacontrollertypes.StoreKey, icahosttypes.StoreKey, + authzkeeper.StoreKey, + // this line is used by starport scaffolding # stargate/app/storeKey + ) + tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + + app := &SovereignApp{ + BaseApp: bApp, + cdc: cdc, + appCodec: appCodec, + interfaceRegistry: interfaceRegistry, + invCheckPeriod: invCheckPeriod, + keys: keys, + tkeys: tkeys, + memKeys: memKeys, + } + + app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) + + // set the BaseApp's parameter store + bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable())) + + // add capability keeper and ScopeToModule for ibc module + app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) + + // grant capabilities for the ibc and ibc-transfer modules + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) + scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) + // this line is used by starport scaffolding # stargate/app/scopedKeeper + + // add keepers + app.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, + ) + + app.AuthzKeeper = authzkeeper.NewKeeper( + keys[authzkeeper.StoreKey], + appCodec, + app.BaseApp.MsgServiceRouter(), + ) + + app.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), + ) + stakingKeeper := stakingkeeper.NewKeeper( + appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), + ) + + app.DistrKeeper = distrkeeper.NewKeeper( + appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper, + &stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), + ) + + app.MintKeeper = mintkeeper.NewKeeper( + appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, + ) + + app.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), + ) + app.CrisisKeeper = crisiskeeper.NewKeeper( + app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, + ) + + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) + app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp) + + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + app.StakingKeeper = *stakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), + ) + + // ... other modules keepers + + // Create IBC Keeper + app.IBCKeeper = ibckeeper.NewKeeper( + appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + ) + + // Create Transfer Keepers + app.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + ) + transferModule := transfer.NewAppModule(app.TransferKeeper) + transferIBCModule := transfer.NewIBCModule(app.TransferKeeper) + + // Create evidence Keeper for to register the IBC light client misbehaviour evidence route + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper, + ) + // If evidence needs to be handled for the app, set routes in router here and seal + app.EvidenceKeeper = *evidenceKeeper + + // TODO(TEST-20): look for all lines that include 'monitoring' in this file! there are a few places this + // is commented out + // scopedMonitoringKeeper := app.CapabilityKeeper.ScopeToModule(monitoringptypes.ModuleName) + // app.MonitoringKeeper = *monitoringpkeeper.NewKeeper( + // appCodec, + // keys[monitoringptypes.StoreKey], + // keys[monitoringptypes.MemStoreKey], + // app.GetSubspace(monitoringptypes.ModuleName), + // app.StakingKeeper, + // app.IBCKeeper.ClientKeeper, + // app.IBCKeeper.ConnectionKeeper, + // app.IBCKeeper.ChannelKeeper, + // &app.IBCKeeper.PortKeeper, + // scopedMonitoringKeeper, + // ) + // monitoringModule := monitoringp.NewAppModule(appCodec, app.MonitoringKeeper) + + // Note: must be above app.StakeibcKeeper + app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( + appCodec, keys[icacontrollertypes.StoreKey], app.GetSubspace(icacontrollertypes.SubModuleName), + app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + scopedICAControllerKeeper, app.MsgServiceRouter(), + ) + + // Register Gov (must be registerd after stakeibc) + govRouter := govtypes.NewRouter() + govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + + app.GovKeeper = govkeeper.NewKeeper( + appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, + &stakingKeeper, govRouter, + ) + + // this line is used by starport scaffolding # stargate/app/keeperDefinition + + // create IBC middleware stacks by combining middleware with base application + app.ICAHostKeeper = icahostkeeper.NewKeeper( + appCodec, keys[icahosttypes.StoreKey], app.GetSubspace(icahosttypes.SubModuleName), + app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, + app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + ) + icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) + + // Create the middleware stacks + + // Stack one contains + // - IBC + // - ICA + // - icacallbacks + // - stakeibc + // - base app + var icamiddlewareStack porttypes.IBCModule + icamiddlewareStack = icacontroller.NewIBCModule(app.ICAControllerKeeper, icamiddlewareStack) + icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) + + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := ibcporttypes.NewRouter() + ibcRouter. + AddRoute(ibctransfertypes.ModuleName, transferIBCModule). + AddRoute(icacontrollertypes.SubModuleName, icamiddlewareStack). + AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) + // this line is used by starport scaffolding # ibc/app/router + app.IBCKeeper.SetRouter(ibcRouter) + + /**** Module Options ****/ + + // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment + // we prefer to be more strict in what arguments the modules expect. + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. + + app.mm = module.NewManager( + genutil.NewAppModule( + app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, + encodingConfig.TxConfig, + ), + auth.NewAppModule(appCodec, app.AccountKeeper, nil), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + capability.NewAppModule(appCodec, *app.CapabilityKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + upgrade.NewAppModule(app.UpgradeKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + ibc.NewAppModule(app.IBCKeeper), + params.NewAppModule(app.ParamsKeeper), + transferModule, + // monitoringModule, + icaModule, + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + // this line is used by starport scaffolding # stargate/app/appModule + ) + + // During begin block slashing happens after distr.BeginBlocker so that + // there is nothing left over in the validator fee pool, so as to keep the + // CanWithdrawInvariant invariant. + // NOTE: staking module is required if HistoricalEntries param > 0 + app.mm.SetOrderBeginBlockers( + upgradetypes.ModuleName, + capabilitytypes.ModuleName, + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + vestingtypes.ModuleName, + ibchost.ModuleName, + ibctransfertypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + govtypes.ModuleName, + crisistypes.ModuleName, + genutiltypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + // monitoringptypes.ModuleName, + icatypes.ModuleName, + authz.ModuleName, + // this line is used by starport scaffolding # stargate/app/beginBlockers + ) + + app.mm.SetOrderEndBlockers( + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + minttypes.ModuleName, + vestingtypes.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + ibchost.ModuleName, + ibctransfertypes.ModuleName, + // monitoringptypes.ModuleName, + icatypes.ModuleName, + authz.ModuleName, + // this line is used by starport scaffolding # stargate/app/endBlockers + ) + + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + app.mm.SetOrderInitGenesis( + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + vestingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + ibchost.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + ibctransfertypes.ModuleName, + feegrant.ModuleName, + // monitoringptypes.ModuleName, + icatypes.ModuleName, + authz.ModuleName, + // this line is used by starport scaffolding # stargate/app/initGenesis + ) + + app.mm.RegisterInvariants(&app.CrisisKeeper) + app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + app.mm.RegisterServices(app.configurator) + app.setupUpgradeHandlers() + + // create the simulation manager and define the order of the modules for deterministic simulations + // app.sm = module.NewSimulationManager( + // auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), + // bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), + // capability.NewAppModule(appCodec, *app.CapabilityKeeper), + // feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + // gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + // mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), + // staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + // distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + // slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), + // params.NewAppModule(app.ParamsKeeper), + // evidence.NewAppModule(app.EvidenceKeeper), + // ibc.NewAppModule(app.IBCKeeper), + // transferModule, + // // monitoringModule, + // stakeibcModule, + // epochsModule, + // interchainQueryModule, + // recordsModule, + // icacallbacksModule, + // this line is used by starport scaffolding # stargate/app/appModule + // ) + // app.sm.RegisterStoreDecoders() + + // initialize stores + app.MountKVStores(keys) + app.MountTransientStores(tkeys) + app.MountMemoryStores(memKeys) + + // initialize BaseApp + app.SetInitChainer(app.InitChainer) + app.SetBeginBlocker(app.BeginBlocker) + + anteHandler, err := ante.NewAnteHandler( + ante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + }, + ) + if err != nil { + panic(err) + } + + app.SetAnteHandler(anteHandler) + app.SetEndBlocker(app.EndBlocker) + + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + tmos.Exit(err.Error()) + } + } + + app.ScopedIBCKeeper = scopedIBCKeeper + app.ScopedTransferKeeper = scopedTransferKeeper + // app.ScopedMonitoringKeeper = scopedMonitoringKeeper + app.ScopedICAControllerKeeper = scopedICAControllerKeeper + app.ScopedICAHostKeeper = scopedICAHostKeeper + // this line is used by starport scaffolding # stargate/app/beforeInitReturn + + return app +} + +// Name returns the name of the App +func (app *SovereignApp) Name() string { return app.BaseApp.Name() } + +// GetBaseApp returns the base app of the application +func (app *SovereignApp) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } + +// GetStakingKeeper implements the TestingApp interface. +func (app *SovereignApp) GetStakingKeeper() stakingkeeper.Keeper { + return app.StakingKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *SovereignApp) GetTransferKeeper() *ibctransferkeeper.Keeper { + return &app.TransferKeeper +} + +// GetIBCKeeper implements the TestingApp interface. +func (app *SovereignApp) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper +} + +// GetScopedIBCKeeper implements the TestingApp interface. +func (app *SovereignApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +// GetTxConfig implements the TestingApp interface. +func (app *SovereignApp) GetTxConfig() client.TxConfig { + cfg := MakeEncodingConfig() + return cfg.TxConfig +} + +// BeginBlocker application updates every begin block +func (app *SovereignApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { + return app.mm.BeginBlock(ctx, req) +} + +// EndBlocker application updates every end block +func (app *SovereignApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { + return app.mm.EndBlock(ctx, req) +} + +// InitChainer application update at chain initialization +func (app *SovereignApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { + var genesisState GenesisState + if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { + panic(err) + } + app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()) + return app.mm.InitGenesis(ctx, app.appCodec, genesisState) +} + +// LoadHeight loads a particular height +func (app *SovereignApp) LoadHeight(height int64) error { + return app.LoadVersion(height) +} + +// ModuleAccountAddrs returns all the app's module account addresses. +func (app *SovereignApp) ModuleAccountAddrs() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range maccPerms { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + return modAccAddrs +} + +// LegacyAmino returns SimApp's amino codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *SovereignApp) LegacyAmino() *codec.LegacyAmino { + return app.cdc +} + +// AppCodec returns an app codec. +// +// NOTE: This is solely to be used for testing purposes as it may be desirable +// for modules to register their own custom testing types. +func (app *SovereignApp) AppCodec() codec.Codec { + return app.appCodec +} + +// InterfaceRegistry returns an InterfaceRegistry +func (app *SovereignApp) InterfaceRegistry() types.InterfaceRegistry { + return app.interfaceRegistry +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *SovereignApp) GetKey(storeKey string) *sdk.KVStoreKey { + return app.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (app *SovereignApp) GetTKey(storeKey string) *sdk.TransientStoreKey { + return app.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (app *SovereignApp) GetMemKey(storeKey string) *sdk.MemoryStoreKey { + return app.memKeys[storeKey] +} + +// GetSubspace returns a param subspace for a given module name. +// +// NOTE: This is solely to be used for testing purposes. +func (app *SovereignApp) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, _ := app.ParamsKeeper.GetSubspace(moduleName) + return subspace +} + +// RegisterAPIRoutes registers all application module routes with the provided +// API server. +func (app *SovereignApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { + clientCtx := apiSvr.ClientCtx + rpc.RegisterRoutes(clientCtx, apiSvr.Router) + // Register legacy tx routes. + authrest.RegisterTxRoutes(clientCtx, apiSvr.Router) + // Register new tx routes from grpc-gateway. + authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new tendermint queries routes from grpc-gateway. + tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register legacy and grpc-gateway routes for all modules. + ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router) + ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) +} + +// RegisterTxService implements the Application.RegisterTxService method. +func (app *SovereignApp) RegisterTxService(clientCtx client.Context) { + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +} + +// RegisterTendermintService implements the Application.RegisterTendermintService method. +func (app *SovereignApp) RegisterTendermintService(clientCtx client.Context) { + tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry) +} + +// GetMaccPerms returns a copy of the module account permissions +func GetMaccPerms() map[string][]string { + dupMaccPerms := make(map[string][]string) + for k, v := range maccPerms { + dupMaccPerms[k] = v + } + return dupMaccPerms +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey sdk.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(crisistypes.ModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName) + paramsKeeper.Subspace(ibchost.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + // paramsKeeper.Subspace(monitoringptypes.ModuleName) + paramsKeeper.Subspace(icacontrollertypes.SubModuleName) + paramsKeeper.Subspace(icahosttypes.SubModuleName) + // this line is used by starport scaffolding # stargate/app/paramSubspace + + return paramsKeeper +} + +// SimulationManager implements the SimulationApp interface +func (app *SovereignApp) SimulationManager() *module.SimulationManager { + return app.sm +} diff --git a/app/sovereign/encoding.go b/app/sovereign/encoding.go new file mode 100644 index 0000000000..60535a84cf --- /dev/null +++ b/app/sovereign/encoding.go @@ -0,0 +1,38 @@ +package app + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/x/auth/tx" +) + +// This data structure (EncodingConfig) is heavily inspired by Quicksilver. https://github.com/ingenuity-build/quicksilver/blob/main/app/encoding.go +type EncodingConfig struct { + InterfaceRegistry types.InterfaceRegistry + Marshaler codec.Codec + TxConfig client.TxConfig + Amino *codec.LegacyAmino +} + +// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. +func MakeEncodingConfig() EncodingConfig { + amino := codec.NewLegacyAmino() + interfaceRegistry := types.NewInterfaceRegistry() + marshaler := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) + + encodingConfig := EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Marshaler: marshaler, + TxConfig: txCfg, + Amino: amino, + } + + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig +} diff --git a/app/sovereign/export.go b/app/sovereign/export.go new file mode 100644 index 0000000000..3c5a7e14d7 --- /dev/null +++ b/app/sovereign/export.go @@ -0,0 +1,201 @@ +package app + +import ( + "encoding/json" + "log" + + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + "github.com/cosmos/cosmos-sdk/x/staking" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +// ExportAppStateAndValidators exports the state of the application for a genesis +// file. +func (app *SovereignApp) ExportAppStateAndValidators( + forZeroHeight bool, jailAllowedAddrs []string, +) (servertypes.ExportedApp, error) { + // as if they could withdraw from the start of the next block + ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + + // We export at last height + 1, because that's the height at which + // Tendermint will start InitChain. + height := app.LastBlockHeight() + 1 + if forZeroHeight { + height = 0 + app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) + } + + genState := app.mm.ExportGenesis(ctx, app.appCodec) + appState, err := json.MarshalIndent(genState, "", " ") + if err != nil { + return servertypes.ExportedApp{}, err + } + + validators, err := staking.WriteValidators(ctx, app.StakingKeeper) + if err != nil { + return servertypes.ExportedApp{}, err + } + return servertypes.ExportedApp{ + AppState: appState, + Validators: validators, + Height: height, + ConsensusParams: app.BaseApp.GetConsensusParams(ctx), + }, nil +} + +// prepare for fresh start at zero height +// NOTE zero height genesis is a temporary feature which will be deprecated +// +// in favour of export at a block height +func (app *SovereignApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { + applyAllowedAddrs := false + + // check if there is a allowed address list + if len(jailAllowedAddrs) > 0 { + applyAllowedAddrs = true + } + + allowedAddrsMap := make(map[string]bool) + + for _, addr := range jailAllowedAddrs { + _, err := sdk.ValAddressFromBech32(addr) + if err != nil { + log.Fatal(err) + } + allowedAddrsMap[addr] = true + } + + /* Just to be safe, assert the invariants on current state. */ + app.CrisisKeeper.AssertInvariants(ctx) + + /* Handle fee distribution state. */ + + // withdraw all validator commission + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + _, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + if err != nil { + panic(err) + } + + return false + }) + + // withdraw all delegator rewards + dels := app.StakingKeeper.GetAllDelegations(ctx) + for _, delegation := range dels { + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) + if err != nil { + panic(err) + } + + delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + panic(err) + } + _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + } + + // clear validator slash events + app.DistrKeeper.DeleteAllValidatorSlashEvents(ctx) + + // clear validator historical rewards + app.DistrKeeper.DeleteAllValidatorHistoricalRewards(ctx) + + // set context height to zero + height := ctx.BlockHeight() + ctx = ctx.WithBlockHeight(0) + + // reinitialize all validators + app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + feePool := app.DistrKeeper.GetFeePool(ctx) + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + app.DistrKeeper.SetFeePool(ctx, feePool) + + app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + return false + }) + + // reinitialize all delegations + for _, del := range dels { + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) + if err != nil { + panic(err) + } + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + panic(err) + } + app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr) + app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr) + } + + // reset context height + ctx = ctx.WithBlockHeight(height) + + /* Handle staking state. */ + + // iterate through redelegations, reset creation height + app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + for i := range red.Entries { + red.Entries[i].CreationHeight = 0 + } + app.StakingKeeper.SetRedelegation(ctx, red) + return false + }) + + // iterate through unbonding delegations, reset creation height + app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + for i := range ubd.Entries { + ubd.Entries[i].CreationHeight = 0 + } + app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + return false + }) + + // Iterate through validators by power descending, reset bond heights, and + // update bond intra-tx counters. + store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) + iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + counter := int16(0) + + for ; iter.Valid(); iter.Next() { + addr := sdk.ValAddress(iter.Key()[1:]) + validator, found := app.StakingKeeper.GetValidator(ctx, addr) + if !found { + panic("expected validator, not found") + } + + validator.UnbondingHeight = 0 + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + validator.Jailed = true + } + + app.StakingKeeper.SetValidator(ctx, validator) + counter++ + } + + iter.Close() + + _, err := app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) + if err != nil { + log.Fatal(err) + } + + /* Handle slashing state. */ + + // reset start height on signing infos + app.SlashingKeeper.IterateValidatorSigningInfos( + ctx, + func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { + info.StartHeight = 0 + app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + return false + }, + ) +} diff --git a/app/sovereign/genesis.go b/app/sovereign/genesis.go new file mode 100644 index 0000000000..340cd801a8 --- /dev/null +++ b/app/sovereign/genesis.go @@ -0,0 +1,20 @@ +package app + +import ( + "encoding/json" +) + +// The genesis state of the blockchain is represented here as a map of raw json +// messages key'd by a identifier string. +// The identifier is used to determine which module genesis information belongs +// to so it may be appropriately routed during init chain. +// Within this application default genesis information is retrieved from +// the ModuleBasicManager which populates json from each BasicModule +// object provided to it during init. +type GenesisState map[string]json.RawMessage + +// NewDefaultGenesisState generates the default state for the application. +func NewDefaultGenesisState() GenesisState { + encCfg := MakeEncodingConfig() + return ModuleBasics.DefaultGenesis(encCfg.Marshaler) +} diff --git a/app/sovereign/upgrades.go b/app/sovereign/upgrades.go new file mode 100644 index 0000000000..734c2b3b2f --- /dev/null +++ b/app/sovereign/upgrades.go @@ -0,0 +1,31 @@ +package app + +import ( + "fmt" + + storetypes "github.com/cosmos/cosmos-sdk/store/types" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func (app *SovereignApp) setupUpgradeHandlers() { + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(fmt.Errorf("Failed to read upgrade info from disk: %w", err)) + } + + if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + return + } + + var storeUpgrades *storetypes.StoreUpgrades + + switch upgradeInfo.Name { + // no store upgrades + case "v3": + storeUpgrades = &storetypes.StoreUpgrades{} + } + + if storeUpgrades != nil { + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades)) + } +} diff --git a/app/sovereign/upgrades/v3/upgrades.go b/app/sovereign/upgrades/v3/upgrades.go new file mode 100644 index 0000000000..bb40c1713a --- /dev/null +++ b/app/sovereign/upgrades/v3/upgrades.go @@ -0,0 +1,26 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +// Note: ensure these values are properly set before running upgrade +var ( + UpgradeName = "v3" +) + +// CreateUpgradeHandler creates an SDK upgrade handler for v3 +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + newVm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return newVm, err + } + return newVm, nil + } +} diff --git a/cmd/interchain-security-sd/main.go b/cmd/interchain-security-sd/main.go new file mode 100644 index 0000000000..4dc2748ad0 --- /dev/null +++ b/cmd/interchain-security-sd/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "os" + + "github.com/cosmos/cosmos-sdk/server" + svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" + app "github.com/cosmos/interchain-security/app/sovereign" + "github.com/tendermint/spm/cosmoscmd" +) + +func main() { + rootCmd, _ := cosmoscmd.NewRootCmd( + app.AppName, + app.AccountAddressPrefix, + app.DefaultNodeHome, + app.AppName, + app.ModuleBasics, + app.New, + // this line is used by starport scaffolding # root/arguments + ) + + if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil { + switch e := err.(type) { + case server.ErrorCode: + os.Exit(e.Code) + + default: + os.Exit(1) + } + } +} diff --git a/consumer/README.md b/consumer/README.md new file mode 100644 index 0000000000..5b95bf4b0c --- /dev/null +++ b/consumer/README.md @@ -0,0 +1,64 @@ +## How to run consumer chain + +### Pre-install + +Binaries: + +- interchain-security-pd - [Interchain security](https://github.com/cosmos/interchain-security) version: v0.2.1 +- consumerd +- hermes(version: v0.15.0) + +### Commands + +```sh +rm -rf /Users/admin/.provider1 +rm -rf /Users/admin/.provider +rm -rf /Users/admin/.consumer1 +rm -rf /Users/admin/.consumer +rm -rf /Users/admin/.sovereign +sh run.sh +``` + +### Genesis modification script for consumer chain + +```sh +# Add ccv section +if ! ./$PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$CONSUMER_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$CONSUMER_HOME"/config/genesis.json "$CONSUMER_HOME"/consumer_section.json > "$CONSUMER_HOME"/genesis_consumer.json && \ + mv "$CONSUMER_HOME"/genesis_consumer.json "$CONSUMER_HOME"/config/genesis.json +``` + +### Initial validator set on consumer chain + +```json + "initial_val_set": [ + { + "pub_key": { + "ed25519": "6s4FU4uSsWNjnqhNc9vhyZBqrLjib+z/mfh1LhvkalE=" + }, + "power": "1" + }, + { + "pub_key": { + "ed25519": "JCFnTza2T2jlkTWxC0kY9lczh7F+jQ/bGyhHFFNr7/w=" + }, + "power": "100" + } + ], +``` + +### Process of execution of soft upgrade from sovereign chain to consumer chain + +1. Start provider chain with two validators and register consumer chain +2. Build normal sovereign chain daemon +3. Start single validator sovereign chain +4. Two provider chain validators with sovereign chain +5. Raise Upgrade proposal on sovereign chain and vote +6. Build consumer chain daemon with upgrade handler for ccv module and relevant modules +7. Once chain halt, restart 3 nodes +8. Ensure blocks are being produced without the first node used for sovereign chain diff --git a/consumer/build_binaries.sh b/consumer/build_binaries.sh new file mode 100644 index 0000000000..43ddcef129 --- /dev/null +++ b/consumer/build_binaries.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +go install ../cmd/interchain-security-sd +go install ../cmd/interchain-security-pd +go install ../cmd/interchain-security-cdd +go install ../cmd/interchain-security-cd diff --git a/consumer/run.sh b/consumer/run.sh new file mode 100644 index 0000000000..28f3feacaa --- /dev/null +++ b/consumer/run.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eux + +bash build_binaries.sh +bash start_provider.sh +bash start_consumer.sh diff --git a/consumer/start_consumer.sh b/consumer/start_consumer.sh new file mode 100644 index 0000000000..cb987ed6c5 --- /dev/null +++ b/consumer/start_consumer.sh @@ -0,0 +1,315 @@ +#!/bin/bash +set -eux + +SOVEREIGN_HOME="$HOME/.sovereign" +CONSUMER_HOME="$HOME/.consumer" +CONSUMER_HOME1="$HOME/.consumer1" +PROVIDER_CHAIN_ID="provider" +CONSUMER_CHAIN_ID="consumer" +MONIKER="consumer" +VALIDATOR="validator" +VALIDATOR1="validator1" +KEYRING="--keyring-backend test" +TX_FLAGS="--gas-adjustment 100 --gas auto" +PROVIDER_BINARY="interchain-security-pd" +SOVEREIGN_BINARY="interchain-security-sd" +CONSUMER_BINARY="interchain-security-cdd" +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +SOVEREIGN_RPC_LADDR="$NODE_IP:26648" +SOVEREIGN_GRPC_ADDR="$NODE_IP:9081" +CONSUMER_RPC_LADDR="$NODE_IP:26638" +CONSUMER_GRPC_ADDR="$NODE_IP:9071" +CONSUMER_RPC_LADDR1="$NODE_IP:26628" +CONSUMER_GRPC_ADDR1="$NODE_IP:9061" +CONSUMER_USER="consumer" +SOVEREIGN_VALIDATOR="sovereign_validator" +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_NODE_ADDRESS="tcp://localhost:26658" + +# Clean start +killall $SOVEREIGN_BINARY &> /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 10000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +################CONSUMER############################ + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + +###########################UPGRADE TO SOVEREIGN CHAIN########################## + +$SOVEREIGN_BINARY tx gov submit-proposal software-upgrade "v07-Theta" --upgrade-height=7 \ +--title="upgrade to consumer chain" --description="upgrade to consumer chain description" \ +--from=$SOVEREIGN_VALIDATOR $KEYRING --chain-id=$CONSUMER_CHAIN_ID \ +--home=$SOVEREIGN_HOME --yes -b block --deposit="100000000stake" + +# Vote yes to proposal +$SOVEREIGN_BINARY tx gov vote 1 yes --from $SOVEREIGN_VALIDATOR --chain-id $CONSUMER_CHAIN_ID --node tcp://$SOVEREIGN_RPC_LADDR \ +--home $SOVEREIGN_HOME -b block -y $KEYRING +sleep 30 + +###########################START BINARIES AGAIN AFTER UPGRADE########################## +$SOVEREIGN_BINARY query gov proposals --node tcp://$SOVEREIGN_RPC_LADDR +$SOVEREIGN_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$SOVEREIGN_BINARY status --node tcp://$CONSUMER_RPC_LADDR +# $SOVEREIGN_BINARY status --node tcp://$CONSUMER_RPC_LADDR1 + +killall $SOVEREIGN_BINARY &> /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/genesis.json +sleep 1 + + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +######################################HERMES################################### + +# Setup Hermes in packet relayer mode +killall hermes 2> /dev/null || true + +tee ~/.hermes/config.toml< ~/.hermes/logs & + +############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 50000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +$CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +$PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} diff --git a/consumer/start_provider.sh b/consumer/start_provider.sh new file mode 100644 index 0000000000..cba04726fd --- /dev/null +++ b/consumer/start_provider.sh @@ -0,0 +1,134 @@ +#!/bin/bash +set -eux + +TOTAL_COINS=100000000000stake +STAKE_COINS=100000000stake +TOTAL_COINS1=120000000000stake +STAKE_COINS1=1000000stake +PROVIDER_BINARY=interchain-security-pd +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_CHAIN_ID=provider +PROVIDER_MONIKER=provider +VALIDATOR=validator +VALIDATOR1=validator1 +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +PROVIDER_DELEGATOR=delegator + +# Clean start +killall $PROVIDER_BINARY &> /dev/null || true + +#######VALIDATOR1####################### +rm -rf $PROVIDER_HOME + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME --chain-id $PROVIDER_CHAIN_ID +jq ".app_state.gov.voting_params.voting_period = \"3s\" | .app_state.staking.params.unbonding_time = \"600s\" | .app_state.provider.params.template_client.trusting_period = \"300s\"" \ + $PROVIDER_HOME/config/genesis.json > \ + $PROVIDER_HOME/edited_genesis.json && mv $PROVIDER_HOME/edited_genesis.json $PROVIDER_HOME/config/genesis.json +sleep 1 + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair.json 2>&1 +sleep 1 +$PROVIDER_BINARY keys add $PROVIDER_DELEGATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair_delegator.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair_delegator.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 + +# Stake 1/1000 user's coins +$PROVIDER_BINARY gentx $VALIDATOR $STAKE_COINS --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME --keyring-backend test --moniker $VALIDATOR +sleep 1 + +###########VALIDATOR 2############################ +rm -rf $PROVIDER_HOME1 + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME1 --chain-id $PROVIDER_CHAIN_ID +cp $PROVIDER_HOME/config/genesis.json $PROVIDER_HOME1/config/genesis.json + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR1 --home $PROVIDER_HOME1 --keyring-backend test --output json > $PROVIDER_HOME1/keypair.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME1/keypair.json) $TOTAL_COINS1 --home $PROVIDER_HOME1 --keyring-backend test +sleep 1 + +####################GENTX AND DISTRIBUTE GENESIS############################## +cp -r $PROVIDER_HOME/config/gentx $PROVIDER_HOME1/config/ + +# Stake 1/1000 user's coins +# $PROVIDER_BINARY gentx $VALIDATOR1 $STAKE_COINS1 --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME1 --keyring-backend test --moniker $VALIDATOR1 +# sleep 1 + +$PROVIDER_BINARY collect-gentxs --home $PROVIDER_HOME1 --gentx-dir $PROVIDER_HOME1/config/gentx/ +sleep 1 + +cp $PROVIDER_HOME1/config/genesis.json $PROVIDER_HOME/config/genesis.json + +####################ADDING PEERS#################### +node=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME) +node1=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME1) +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26656\"/" "$PROVIDER_HOME1"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$node1@localhost:26666\"/" "$PROVIDER_HOME"/config/config.toml + +#################### Start the chain node1 ################### +$PROVIDER_BINARY start \ + --home $PROVIDER_HOME \ + --rpc.laddr tcp://$PROVIDER_RPC_LADDR \ + --grpc.address $PROVIDER_GRPC_ADDR \ + --address tcp://${NODE_IP}:26655 \ + --p2p.laddr tcp://${NODE_IP}:26656 \ + --grpc-web.enable=false \ + --trace \ + &> $PROVIDER_HOME/logs & + +#################### Start the chain node2 ################### +# $PROVIDER_BINARY start \ +# --home $PROVIDER_HOME1 \ +# --rpc.laddr tcp://$PROVIDER_RPC_LADDR1 \ +# --grpc.address $PROVIDER_GRPC_ADDR1 \ +# --address tcp://${NODE_IP}:26665 \ +# --p2p.laddr tcp://${NODE_IP}:26666 \ +# --grpc-web.enable=false \ +# --trace \ +# &> $PROVIDER_HOME1/logs & +sleep 10 + +# Build consumer chain proposal file +tee $PROVIDER_HOME/consumer-proposal.json< 0 { - i -= len(m.TransferChannelId) - copy(dAtA[i:], m.TransferChannelId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.TransferChannelId))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - if len(m.CounterpartyClientId) > 0 { - i -= len(m.CounterpartyClientId) - copy(dAtA[i:], m.CounterpartyClientId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CounterpartyClientId))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.ConnId) > 0 { - i -= len(m.ConnId) - copy(dAtA[i:], m.ConnId) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.ConnId))) - i-- - dAtA[i] = 0x7a - } - if m.UnbondingPeriod != nil { - { - size, err := m.UnbondingPeriod.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x72 - } if m.PreCCV { i-- if m.PreCCV { @@ -802,22 +727,6 @@ func (m *GenesisState) Size() (n int) { if m.PreCCV { n += 2 } - if m.UnbondingPeriod != nil { - l = m.UnbondingPeriod.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.ConnId) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.CounterpartyClientId) - if l > 0 { - n += 2 + l + sovGenesis(uint64(l)) - } - l = len(m.TransferChannelId) - if l > 0 { - n += 2 + l + sovGenesis(uint64(l)) - } return n } @@ -1310,138 +1219,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } } m.PreCCV = bool(v != 0) - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnbondingPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.UnbondingPeriod == nil { - m.UnbondingPeriod = &durationpb.Duration{} - } - if err := m.UnbondingPeriod.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConnId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConnId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CounterpartyClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransferChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index d8485dc6af..9b3cc39fc3 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -161,7 +161,6 @@ func (k Keeper) SendVSCPackets(ctx sdk.Context) { // SendVSCPacketsToChain sends all queued VSC packets to the specified chain func (k Keeper) SendVSCPacketsToChain(ctx sdk.Context, chainID, channelID string) { - // TODO: send init genesis packet if target chain is preCCV? pendingPackets := k.GetPendingVSCPackets(ctx, chainID) for _, data := range pendingPackets { // send packet over IBC diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index ba8f8037b5..9a6874456b 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -70,9 +70,7 @@ type ConsumerAdditionProposal struct { // The number of historical info entries to persist in store. // This param is a part of the cosmos sdk staking module. In the case of // a ccv enabled consumer chain, the ccv module acts as the staking module. - HistoricalEntries int64 `protobuf:"varint,13,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` - ConnId string `protobuf:"bytes,15,opt,name=conn_id,json=connId,proto3" json:"conn_id,omitempty"` - TransferChannelId string `protobuf:"bytes,16,opt,name=transfer_channel_id,json=transferChannelId,proto3" json:"transfer_channel_id,omitempty"` + HistoricalEntries int64 `protobuf:"varint,13,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty"` } func (m *ConsumerAdditionProposal) Reset() { *m = ConsumerAdditionProposal{} } @@ -546,72 +544,69 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1026 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0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42, 0x09, - 0x53, 0x3a, 0x3d, 0xfb, 0x54, 0x08, 0x7c, 0x2d, 0x48, 0xe8, 0x20, 0x56, 0x76, 0x5b, 0xfa, 0x8a, - 0xb0, 0x88, 0x88, 0x94, 0x5a, 0xf1, 0x78, 0x65, 0x1d, 0x3a, 0x7f, 0x54, 0x81, 0xdb, 0xe5, 0x4c, - 0x0e, 0x53, 0x22, 0x0e, 0xa2, 0x88, 0xea, 0x60, 0x3d, 0xc1, 0x33, 0x2e, 0x51, 0x02, 0xef, 0x83, - 0x25, 0x45, 0x55, 0x42, 0x5c, 0xa7, 0xed, 0xec, 0xd6, 0x03, 0xbb, 0x80, 0x6d, 0xd0, 0x88, 0x88, - 0xc4, 0x82, 0x66, 0x5a, 0xec, 0xde, 0x31, 0xb6, 0xc9, 0x2d, 0xb8, 0x0d, 0x96, 0xed, 0xfb, 0xa1, - 0x91, 0xbb, 0x60, 0xcc, 0x35, 0xb3, 0x3e, 0x8e, 0xe0, 0x37, 0xe0, 0x1e, 0x65, 0x54, 0x51, 0x94, - 0x84, 0x31, 0xd1, 0x79, 0xba, 0x8b, 0x6d, 0x67, 0xb7, 0xb1, 0xbf, 0xe3, 0xd1, 0x3e, 0xf6, 0xf4, - 0xd1, 0xbc, 0xe2, 0x40, 0xf9, 0x9e, 0x77, 0x64, 0x14, 0x87, 0x8b, 0x6f, 0xff, 0x6c, 0x55, 0x82, - 0xbb, 0x85, 0x9f, 0xdd, 0x84, 0x0f, 0xc1, 0xca, 0x80, 0x30, 0x22, 0xa9, 0x0c, 0x63, 0x24, 0x63, - 0x77, 0xa9, 0xed, 0xec, 0xae, 0x04, 0x8d, 0x62, 0xef, 0x08, 0xc9, 0x18, 0xb6, 0x40, 0xa3, 0x4f, - 0x19, 0x12, 0x97, 0x56, 0x51, 0x35, 0x0a, 0x60, 0xb7, 0x8c, 0xa0, 0x0b, 0x80, 0xcc, 0xd0, 0x2f, - 0x2c, 0xd4, 0x75, 0x70, 0x6b, 0x45, 0x22,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20, 0x13, 0x24, 0xe3, 0x30, 0x25, 0xca, 0xcc, 0x59, 0x96, 0x10, 0x46, 0x65, - 0x5c, 0xc2, 0xab, 0xf3, 0xc3, 0xb7, 0x0d, 0xe8, 0x85, 0xe6, 0x04, 0x25, 0xa6, 0x88, 0xd2, 0x05, - 0xcd, 0x9b, 0xa3, 0x8c, 0x0a, 0x54, 0x33, 0xfd, 0xf6, 0xf1, 0x0d, 0x88, 0x51, 0x95, 0xbe, 0x00, - 0xdb, 0x29, 0xba, 0x08, 0x33, 0x62, 0x6f, 0x44, 0x0b, 0xcc, 0x10, 0x3e, 0x27, 0x4a, 0x9a, 0x8b, - 0x71, 0x21, 0xd8, 0x4c, 0xd1, 0x45, 0xcf, 0xda, 0x4f, 0xb4, 0xb9, 0x67, 0xad, 0x9d, 0x3e, 0x58, - 0x3f, 0x42, 0x2c, 0x92, 0x31, 0x3a, 0x27, 0x2f, 0x88, 0x42, 0x11, 0x52, 0x08, 0x3e, 0x01, 0x9b, - 0xe5, 0x97, 0x35, 0x3c, 0x23, 0x24, 0xcc, 0x38, 0x4f, 0x42, 0x14, 0x45, 0xa2, 0x98, 0x9b, 0x8d, - 0xd2, 0xfa, 0x9c, 0x90, 0x1e, 0xe7, 0xc9, 0x41, 0x14, 0x09, 0xe8, 0x82, 0x5a, 0x4e, 0x84, 0x1c, - 0x4f, 0x50, 0xb9, 0xec, 0x7c, 0x06, 0xea, 0x26, 0xe6, 0x01, 0x3e, 0x97, 0xf0, 0x01, 0xa8, 0x6b, - 0x12, 0x91, 0x92, 0x48, 0xd7, 0x69, 0x2f, 0xec, 0xd6, 0x83, 0xf1, 0x46, 0x47, 0x81, 0xed, 0x0f, - 0x7d, 0x1a, 0x25, 0xfc, 0x11, 0xd4, 0x8a, 0x23, 0x1a, 0xc7, 0xc6, 0xfe, 0x57, 0xde, 0x1c, 0x3f, - 0x06, 0xde, 0x87, 0x80, 0x41, 0x49, 0xeb, 0x88, 0xf1, 0x07, 0x79, 0xe6, 0xc6, 0x90, 0xf0, 0x87, - 0xd9, 0xa0, 0x5f, 0xde, 0x2a, 0xe8, 0x0c, 0x6f, 0x1c, 0xf3, 0x11, 0x68, 0x1c, 0xd8, 0x63, 0x7f, - 0x4b, 0xa5, 0x7a, 0xff, 0xb5, 0xac, 0x4c, 0xbc, 0x96, 0xc3, 0xd3, 0xb7, 0x57, 0x4d, 0xe7, 0xdd, - 0x55, 0xd3, 0xf9, 0xfb, 0xaa, 0xe9, 0xbc, 0xba, 0x6e, 0x56, 0xde, 0x5d, 0x37, 0x2b, 0xbf, 0x5f, - 0x37, 0x2b, 0x3f, 0x3d, 0x1d, 0x50, 0x15, 0x0f, 0xfb, 0x1e, 0xe6, 0xa9, 0x8f, 0xb9, 0x4c, 0xb9, - 0xf4, 0xc7, 0xe9, 0x3d, 0x1e, 0xfd, 0x60, 0x5d, 0x4c, 0xff, 0x62, 0xa9, 0xcb, 0x8c, 0xc8, 0x7e, - 0xd5, 0xf4, 0xec, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xbe, 0x72, 0xa9, 0x93, 0x09, - 0x00, 0x00, + // 991 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x4d, 0x6f, 0xdb, 0x46, + 0x13, 0xc7, 0xc5, 0xd8, 0xd6, 0xcb, 0xca, 0x79, 0xf1, 0x26, 0x8f, 0x43, 0xf9, 0x09, 0x24, 0x45, + 0xed, 0x41, 0x45, 0x10, 0x12, 0x76, 0x2e, 0x6d, 0xd0, 0x1e, 0x64, 0xa5, 0xa9, 0x0b, 0x34, 0xad, + 0x42, 0x0b, 0x2d, 0xd0, 0x1e, 0x88, 0xe5, 0x72, 0x2d, 0x2e, 0x4c, 0x72, 0x89, 0xdd, 0x15, 0x6b, + 0x7f, 0x83, 0x1e, 0x03, 0xf4, 0x92, 0x63, 0xbe, 0x41, 0xbf, 0x46, 0x8e, 0x39, 0xf6, 0xd4, 0x16, + 0xf6, 0xa7, 0xe8, 0xad, 0xd8, 0x5d, 0x52, 0x6f, 0x71, 0x00, 0x19, 0x45, 0x6f, 0xdc, 0x99, 0xff, + 0xfc, 0x66, 0xc8, 0x99, 0xdd, 0x25, 0x38, 0xa0, 0xa9, 0x24, 0x1c, 0x47, 0x88, 0xa6, 0xbe, 0x20, + 0x78, 0xca, 0xa9, 0x3c, 0x77, 0x31, 0xce, 0xdd, 0x8c, 0xb3, 0x9c, 0x86, 0x84, 0xbb, 0xf9, 0xfe, + 0xec, 0xd9, 0xc9, 0x38, 0x93, 0x0c, 0x7e, 0x74, 0x45, 0x8c, 0x83, 0x71, 0xee, 0xcc, 0x74, 0xf9, + 0xfe, 0xde, 0xbd, 0x09, 0x9b, 0x30, 0xad, 0x77, 0xd5, 0x93, 0x09, 0xdd, 0xeb, 0x4c, 0x18, 0x9b, + 0xc4, 0xc4, 0xd5, 0xab, 0x60, 0x7a, 0xe2, 0x4a, 0x9a, 0x10, 0x21, 0x51, 0x92, 0x15, 0x82, 0xf6, + 0xaa, 0x20, 0x9c, 0x72, 0x24, 0x29, 0x4b, 0x4b, 0x00, 0x0d, 0xb0, 0x8b, 0x19, 0x27, 0x2e, 0x8e, + 0x29, 0x49, 0xa5, 0x2a, 0xcf, 0x3c, 0x15, 0x02, 0x57, 0x09, 0x62, 0x3a, 0x89, 0xa4, 0x31, 0x0b, + 0x57, 0x92, 0x34, 0x24, 0x3c, 0xa1, 0x46, 0x3c, 0x5f, 0x99, 0x80, 0xde, 0xaf, 0x55, 0x60, 0x0f, + 0x59, 0x2a, 0xa6, 0x09, 0xe1, 0x83, 0x30, 0xa4, 0x2a, 0xd9, 0x88, 0xb3, 0x8c, 0x09, 0x14, 0xc3, + 0x7b, 0x60, 0x4b, 0x52, 0x19, 0x13, 0xdb, 0xea, 0x5a, 0xfd, 0x86, 0x67, 0x16, 0xb0, 0x0b, 0x9a, + 0x21, 0x11, 0x98, 0x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(m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -634,22 +629,6 @@ func (m *ConsumerAdditionProposal) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.TransferChannelId) > 0 { - i -= len(m.TransferChannelId) - copy(dAtA[i:], m.TransferChannelId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.TransferChannelId))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } - if len(m.ConnId) > 0 { - i -= len(m.ConnId) - copy(dAtA[i:], m.ConnId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ConnId))) - i-- - dAtA[i] = 0x7a - } if m.HistoricalEntries != 0 { i = encodeVarintProvider(dAtA, i, uint64(m.HistoricalEntries)) i-- @@ -1115,14 +1094,6 @@ func (m *ConsumerAdditionProposal) Size() (n int) { if m.HistoricalEntries != 0 { n += 1 + sovProvider(uint64(m.HistoricalEntries)) } - l = len(m.ConnId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - l = len(m.TransferChannelId) - if l > 0 { - n += 2 + l + sovProvider(uint64(l)) - } return n } @@ -1691,70 +1662,6 @@ func (m *ConsumerAdditionProposal) Unmarshal(dAtA []byte) error { break } } - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConnId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ConnId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransferChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransferChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) From c6803f110ab4739af6d56c057c6f8139c935249b Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Thu, 5 Jan 2023 17:42:13 +0800 Subject: [PATCH 05/12] Resolve hermes start issue for trusted validator set by changing revision height --- consumer/start_consumer.sh | 4 ++-- consumer/start_provider.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/consumer/start_consumer.sh b/consumer/start_consumer.sh index cb987ed6c5..b9e82b98e9 100644 --- a/consumer/start_consumer.sh +++ b/consumer/start_consumer.sh @@ -297,7 +297,7 @@ PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) -$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 50000000stake \ +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 32000000stake \ --from $VALIDATOR \ $KEYRING \ --home $PROVIDER_HOME \ @@ -306,7 +306,7 @@ $PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 50000000stake \ sleep 1 $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} -$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} +# $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} $CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR $CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR diff --git a/consumer/start_provider.sh b/consumer/start_provider.sh index cba04726fd..e2bd305657 100644 --- a/consumer/start_provider.sh +++ b/consumer/start_provider.sh @@ -110,7 +110,7 @@ tee $PROVIDER_HOME/consumer-proposal.json< Date: Fri, 6 Jan 2023 17:53:35 +0800 Subject: [PATCH 06/12] remove intermediary logs --- app/consumer-democracy/app.go | 5 ----- x/ccv/consumer/keeper/genesis.go | 12 ------------ x/ccv/consumer/keeper/validators.go | 2 -- x/ccv/consumer/module.go | 5 ----- 4 files changed, 24 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 296bdf0e14..0832daffb0 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -627,7 +627,6 @@ func New( app.UpgradeKeeper.SetUpgradeHandler( upgradeName, func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) { - fmt.Println("UPGRADING DATA!!!", upgradeName) app.IBCKeeper.ConnectionKeeper.SetParams(ctx, ibcconnectiontypes.DefaultParams()) @@ -643,7 +642,6 @@ func New( stdlog.Println("Failed to get home dir %2", err) } nodeHome := userHomeDir + "/.sovereign/config/genesis.json" - fmt.Println("NodeHome:", nodeHome) appState, _, err := genutiltypes.GenesisStateFromGenFile(nodeHome) if err != nil { return fromVM, fmt.Errorf("failed to unmarshal genesis state: %w", err) @@ -652,9 +650,7 @@ func New( var consumerGenesis = ibcconsumertypes.GenesisState{} appCodec.MustUnmarshalJSON(appState[ibcconsumertypes.ModuleName], &consumerGenesis) - fmt.Println("appState[ibcconsumertypes.ModuleName]", string(appState[ibcconsumertypes.ModuleName])) consumerGenesis.PreCCV = true - fmt.Println("consumerGenesis", consumerGenesis) app.ConsumerKeeper.InitGenesis(ctx, &consumerGenesis) ctx.Logger().Info("start to run module migrations...") @@ -669,7 +665,6 @@ func New( } if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { - fmt.Println("UPGRADING STORAGE!!!", upgradeName) storeUpgrades := store.StoreUpgrades{ Added: []string{ibcconsumertypes.ModuleName}, } diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 8acced3dd1..98fc9ed847 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -17,13 +17,11 @@ import ( // 2. A consumer chain restarts after a client to the provider was created, but the CCV channel handshake is still in progress // 3. A consumer chain restarts after the CCV channel handshake was completed. func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) []abci.ValidatorUpdate { - fmt.Println("consumer.InitGenesis") // PreCCV is true when consumer chain used to be running on non-consumer chain, and when it is in the progress of upgrading // to consumer chain, where consumer chain upgrade is done. if state.PreCCV { k.SetPreCCV(ctx, state) } - fmt.Println("consumer.InitGenesis1") k.SetParams(ctx, state.Params) // TODO: Remove enabled flag and find a better way to setup e2e tests @@ -32,7 +30,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) return nil } - fmt.Println("consumer.InitGenesis2") k.SetPort(ctx, ccv.ConsumerPortID) // Only try to bind to port if it is not already bound, since we may already own @@ -46,11 +43,9 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) } } - fmt.Println("consumer.InitGenesis3") // initialValSet is checked in NewChain case by ValidateGenesis // start a new chain if state.NewChain { - fmt.Println("consumer.InitGenesis4") // create the provider client in InitGenesis for new consumer chain. CCV Handshake must be established with this client id. clientID, err := k.clientKeeper.CreateClient(ctx, state.ProviderClientState, state.ProviderConsensusState) if err != nil { @@ -64,7 +59,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) k.SetHeightValsetUpdateID(ctx, uint64(ctx.BlockHeight()), uint64(0)) } else { - fmt.Println("consumer.InitGenesis5") // chain restarts with the CCV channel established if state.ProviderChannelId != "" { // set provider channel ID @@ -87,27 +81,21 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) if err != nil { panic(fmt.Sprintf("could not set last transmission block height: %v", err)) } - } - fmt.Println("consumer.InitGenesis6") // set pending consumer pending packets // note that the list includes pending mature VSC packet only if the handshake is completed k.AppendPendingPacket(ctx, state.PendingConsumerPackets.List...) - fmt.Println("consumer.InitGenesis7") // set height to valset update id mapping for _, h2v := range state.HeightToValsetUpdateId { k.SetHeightValsetUpdateID(ctx, h2v.Height, h2v.ValsetUpdateId) } - fmt.Println("consumer.InitGenesis8") // set provider client id k.SetProviderClientID(ctx, state.ProviderClientId) - } - fmt.Println("consumer.InitGenesis9", state.InitialValSet) if state.PreCCV { return []abci.ValidatorUpdate{} } diff --git a/x/ccv/consumer/keeper/validators.go b/x/ccv/consumer/keeper/validators.go index dcc41f176b..73f015ca96 100644 --- a/x/ccv/consumer/keeper/validators.go +++ b/x/ccv/consumer/keeper/validators.go @@ -1,7 +1,6 @@ package keeper import ( - "fmt" "time" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -151,7 +150,6 @@ func (k Keeper) DeleteHistoricalInfo(ctx sdk.Context, height int64) { // TrackHistoricalInfo saves the latest historical-info and deletes the oldest // heights that are below pruning height func (k Keeper) TrackHistoricalInfo(ctx sdk.Context) { - fmt.Println("Consumer.BeginBlock.TrackHistoricalInfo") numHistoricalEntries := k.GetHistoricalEntries(ctx) diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index 6d6b0b0efa..55bc29a70f 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -160,7 +160,6 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // Set the VSC ID for the subsequent block to the same value as the current block // Panic if the provider's channel was established and then closed func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { - fmt.Println("Consumer.BeginBlock", am.keeper.IsPreCCV(ctx)) channelID, found := am.keeper.GetProviderChannel(ctx) if found && am.keeper.IsChannelClosed(ctx, channelID) { @@ -175,7 +174,6 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { blockHeight := uint64(ctx.BlockHeight()) vID := am.keeper.GetHeightValsetUpdateID(ctx, blockHeight) am.keeper.SetHeightValsetUpdateID(ctx, blockHeight+1, vID) - fmt.Println("Consumer.BeginBlock.TrackHistoricalInfo", am.keeper.IsPreCCV(ctx)) am.keeper.TrackHistoricalInfo(ctx) } @@ -183,13 +181,11 @@ func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { // EndBlock implements the AppModule interface // Flush PendingChanges to ABCI, send pending packets, write acknowledgements for packets that have finished unbonding. func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { - fmt.Println("Consumer.EndBlock", am.keeper.IsPreCCV(ctx)) if am.keeper.IsPreCCV(ctx) { initialValSet := am.keeper.GetInitialValSet(ctx) // Note: validator set update is only done on consumer chain from first endblocker // on soft fork from existing chain am.keeper.DeletePreCCV(ctx) - fmt.Println("Consumer.EndBlock1.initialValSet", initialValSet) // populate cross chain validators states with initial valset am.keeper.ApplyCCValidatorChanges(ctx, initialValSet) @@ -203,7 +199,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V initialValSet = append(initialValSet, update) } } - fmt.Println("Consumer.EndBlock2.initialValSet", initialValSet) return initialValSet } From 2806d6f41880b40927dd66aaf97eab05f6ffec95 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Fri, 6 Jan 2023 18:01:28 +0800 Subject: [PATCH 07/12] remove further unused codebase --- proto/interchain_security/ccv/consumer/v1/genesis.proto | 4 ---- proto/interchain_security/ccv/provider/v1/provider.proto | 2 -- x/ccv/consumer/ibc_module.go | 1 - x/ccv/consumer/keeper/genesis.go | 2 -- 4 files changed, 9 deletions(-) diff --git a/proto/interchain_security/ccv/consumer/v1/genesis.proto b/proto/interchain_security/ccv/consumer/v1/genesis.proto index b3ba6ddfc3..d5efc7e6bf 100644 --- a/proto/interchain_security/ccv/consumer/v1/genesis.proto +++ b/proto/interchain_security/ccv/consumer/v1/genesis.proto @@ -40,10 +40,6 @@ message GenesisState { interchain_security.ccv.consumer.v1.LastTransmissionBlockHeight last_transmission_block_height = 12 [ (gogoproto.nullable) = false ]; bool preCCV = 13; // flag indicating whether the consumer CCV module starts in pre-CCV state - // google.protobuf.Duration unbonding_period = 14; // the unbonding period on the consumer chain. - // string conn_id = 15; // the ID of the connection end on the consumer chain on top of which the CCV channel will be established. - // string counterparty_client_id = 16; // the ID of the client of the consumer chain on the provider chain. - // string transfer_channel_id = 17; // the ID of a token transfer channel used for the Reward Distribution sub-protocol. } // MaturingVSCPacket defines the genesis information for the diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 81466126dd..87a0058b4c 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -59,8 +59,6 @@ message ConsumerAdditionProposal { // This param is a part of the cosmos sdk staking module. In the case of // a ccv enabled consumer chain, the ccv module acts as the staking module. int64 historical_entries = 13; - // string conn_id = 15; // the ID of the connection end on the consumer chain on top of which the CCV channel will be established. - // string transfer_channel_id = 16; // the ID of a token transfer channel used for the Reward Distribution sub-protocol. } // ConsumerRemovalProposal is a governance proposal on the provider chain to remove (and stop) a consumer chain. diff --git a/x/ccv/consumer/ibc_module.go b/x/ccv/consumer/ibc_module.go index d18edddf90..59e5382040 100644 --- a/x/ccv/consumer/ibc_module.go +++ b/x/ccv/consumer/ibc_module.go @@ -213,7 +213,6 @@ func (am AppModule) OnRecvPacket( errAck := channeltypes.NewErrorAcknowledgement("cannot unmarshal CCV packet data") ack = &errAck } else { - // TODO: add possibility to receive ReplaceValidatorSet if it's the first time switching to consumer chain ack = am.keeper.OnRecvVSCPacket(ctx, packet, data) } diff --git a/x/ccv/consumer/keeper/genesis.go b/x/ccv/consumer/keeper/genesis.go index 98fc9ed847..7347ff38e0 100644 --- a/x/ccv/consumer/keeper/genesis.go +++ b/x/ccv/consumer/keeper/genesis.go @@ -100,10 +100,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state *consumertypes.GenesisState) return []abci.ValidatorUpdate{} } - fmt.Println("consumer.InitGenesis10", state.InitialValSet) // populate cross chain validators states with initial valset k.ApplyCCValidatorChanges(ctx, state.InitialValSet) - fmt.Println("consumer.InitGenesis11") return state.InitialValSet } From c3ae9a4313826c3b2b56793d9faef3cc669ce36e Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Wed, 18 Jan 2023 21:08:10 +0800 Subject: [PATCH 08/12] updates for endblocker test, existing test fixes, get last validators --- app/consumer-democracy/app.go | 4 +- x/ccv/consumer/ibc_module_test.go | 12 +-- x/ccv/consumer/module.go | 4 +- x/ccv/consumer/module_test.go | 119 +++++++++++++++++++++++++++ x/ccv/consumer/types/genesis_test.go | 7 ++ 5 files changed, 136 insertions(+), 10 deletions(-) create mode 100644 x/ccv/consumer/module_test.go diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index 0832daffb0..e2a436db72 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -508,7 +508,7 @@ func New( ccvdistrtypes.ModuleName, slashingtypes.ModuleName, evidencetypes.ModuleName, - ibcconsumertypes.ModuleName, // Note: consumer initiation before staking module + ibcconsumertypes.ModuleName, // Note: consumer beginblocker before staking module ccvstakingtypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, @@ -524,7 +524,7 @@ func New( app.MM.SetOrderEndBlockers( crisistypes.ModuleName, ccvgovtypes.ModuleName, - ibcconsumertypes.ModuleName, // Note: consumer initiation before staking module + ibcconsumertypes.ModuleName, // Note: consumer endblocker before staking module ccvstakingtypes.ModuleName, capabilitytypes.ModuleName, authtypes.ModuleName, diff --git a/x/ccv/consumer/ibc_module_test.go b/x/ccv/consumer/ibc_module_test.go index 67eed2568c..32e02105ec 100644 --- a/x/ccv/consumer/ibc_module_test.go +++ b/x/ccv/consumer/ibc_module_test.go @@ -105,7 +105,7 @@ func TestOnChanOpenInit(t *testing.T) { // Common setup consumerKeeper, ctx, ctrl, mocks := testkeeper.GetConsumerKeeperAndCtx( t, testkeeper.NewInMemKeeperParams(t)) - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) consumerKeeper.SetPort(ctx, ccv.ConsumerPortID) consumerKeeper.SetProviderClientID(ctx, "clientIDToProvider") @@ -154,7 +154,7 @@ func TestOnChanOpenTry(t *testing.T) { consumerKeeper, ctx, ctrl, _ := testkeeper.GetConsumerKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) // No external keeper methods should be called defer ctrl.Finish() - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) // OnOpenTry must error even with correct arguments _, err := consumerModule.OnChanOpenTry( @@ -248,7 +248,7 @@ func TestOnChanOpenAck(t *testing.T) { // Common setup consumerKeeper, ctx, ctrl, mocks := testkeeper.GetConsumerKeeperAndCtx( t, testkeeper.NewInMemKeeperParams(t)) - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) // Instantiate valid params as default. Individual test cases mutate these as needed. params := params{ @@ -298,7 +298,7 @@ func TestOnChanOpenAck(t *testing.T) { func TestOnChanOpenConfirm(t *testing.T) { consumerKeeper, ctx, ctrl, _ := testkeeper.GetConsumerKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) err := consumerModule.OnChanOpenConfirm(ctx, ccv.ConsumerPortID, "channel-1") require.Error(t, err, "OnChanOpenConfirm callback must error on consumer chain") @@ -338,7 +338,7 @@ func TestOnChanCloseInit(t *testing.T) { for _, tc := range testCases { consumerKeeper, ctx, ctrl, _ := testkeeper.GetConsumerKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) if tc.establishedProviderExists { consumerKeeper.SetProviderChannel(ctx, "provider") @@ -366,7 +366,7 @@ func TestOnChanCloseConfirm(t *testing.T) { // No external keeper methods should be called defer ctrl.Finish() - consumerModule := consumer.NewAppModule(consumerKeeper) + consumerModule := consumer.NewAppModule(consumerKeeper, nil) // Nothing happens, no error returned err := consumerModule.OnChanCloseConfirm(ctx, "portID", "channelID") diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index 55bc29a70f..696ca4e12f 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -94,7 +94,7 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { } type StakingKeeper interface { - GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) + GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator) } // AppModule represents the AppModule for this module @@ -193,7 +193,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V for _, val := range initialValSet { initialSetFlag[val.PubKey.String()] = true } - for _, val := range am.sk.GetAllValidators(ctx) { + for _, val := range am.sk.GetLastValidators(ctx) { update := val.ABCIValidatorUpdateZero() if !initialSetFlag[update.PubKey.String()] { initialValSet = append(initialValSet, update) diff --git a/x/ccv/consumer/module_test.go b/x/ccv/consumer/module_test.go new file mode 100644 index 0000000000..0851aa3188 --- /dev/null +++ b/x/ccv/consumer/module_test.go @@ -0,0 +1,119 @@ +package consumer_test + +import ( + "encoding/json" + "testing" + + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/staking/teststaking" + ccvstakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + democracyapp "github.com/cosmos/interchain-security/app/consumer-democracy" + "github.com/cosmos/interchain-security/x/ccv/consumer" + "github.com/cosmos/interchain-security/x/ccv/consumer/types" + "github.com/stretchr/testify/require" + "github.com/tendermint/spm/cosmoscmd" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" +) + +func TestEndBlock(t *testing.T) { + PKs := simapp.CreateTestPubKeys(500) + validator1 := teststaking.NewValidator(t, sdk.ValAddress(PKs[0].Address().Bytes()), PKs[0]) + validator2 := teststaking.NewValidator(t, sdk.ValAddress(PKs[1].Address().Bytes()), PKs[1]) + _ = validator2 + + tmPK1, err := cryptocodec.ToTmPubKeyInterface(PKs[0]) + require.NoError(t, err) + tmValidator1 := tmtypes.NewValidator(tmPK1, 1) + _ = tmValidator1 + + tmPK2, err := cryptocodec.ToTmPubKeyInterface(PKs[1]) + require.NoError(t, err) + tmValidator2 := tmtypes.NewValidator(tmPK2, 1) + _ = tmValidator2 + + tmPK3, err := cryptocodec.ToTmPubKeyInterface(PKs[2]) + require.NoError(t, err) + tmValidator3 := tmtypes.NewValidator(tmPK3, 1) + _ = tmValidator3 + + testCases := []struct { + name string + preCCV bool + sovereignValidators []ccvstakingtypes.Validator + providerValidators []abci.ValidatorUpdate + expValUpdateLen int + }{ + { + name: "case not preCCV", + preCCV: false, + sovereignValidators: []ccvstakingtypes.Validator{validator1}, + providerValidators: []abci.ValidatorUpdate{tmtypes.TM2PB.ValidatorUpdate(tmValidator1)}, + expValUpdateLen: 1, + }, + { + name: "case preCCV - no duplication with sovereign validators", + preCCV: true, + sovereignValidators: []ccvstakingtypes.Validator{validator1, validator2}, + providerValidators: []abci.ValidatorUpdate{tmtypes.TM2PB.ValidatorUpdate(tmValidator3)}, + expValUpdateLen: 3, + }, + { + name: "case preCCV - duplication with sovereign validators", + preCCV: true, + sovereignValidators: []ccvstakingtypes.Validator{validator1, validator2}, + providerValidators: []abci.ValidatorUpdate{tmtypes.TM2PB.ValidatorUpdate(tmValidator2), tmtypes.TM2PB.ValidatorUpdate(tmValidator3)}, + expValUpdateLen: 3, + }, + } + + for _, tc := range testCases { + db := dbm.NewMemDB() + encodingConfig := cosmoscmd.MakeEncodingConfig(democracyapp.ModuleBasics) + appCodec := encodingConfig.Marshaler + app := democracyapp.New(log.NewNopLogger(), db, nil, true, map[int64]bool{}, "", 5, encodingConfig, simapp.EmptyAppOptions{}) + dApp := app.(*democracyapp.App) + ctx := dApp.BaseApp.NewContext(true, tmproto.Header{}) + + genesisState := democracyapp.NewDefaultGenesisState(appCodec) + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + if err != nil { + panic(err) + } + + app.InitChain( + abci.RequestInitChain{ + Validators: []abci.ValidatorUpdate{}, + ConsensusParams: simapp.DefaultConsensusParams, + AppStateBytes: stateBytes, + }, + ) + + dApp.StakingKeeper.SetParams(ctx, ccvstakingtypes.DefaultParams()) + for _, val := range tc.sovereignValidators { + dApp.StakingKeeper.SetValidator(ctx, val) + dApp.StakingKeeper.SetLastValidatorPower(ctx, val.GetOperator(), 1) + } + + dApp.ConsumerKeeper.SetPreCCV(ctx, &types.GenesisState{ + InitialValSet: tc.providerValidators, + PreCCV: tc.preCCV, + }) + consumerModule := consumer.NewAppModule(dApp.ConsumerKeeper, dApp.StakingKeeper) + + valUpdate := consumerModule.EndBlock( + ctx, + abci.RequestEndBlock{}, + ) + + // check returned initial validators are expected values + require.Len(t, valUpdate, tc.expValUpdateLen) + // check preCCV deleted after the execution + require.False(t, dApp.ConsumerKeeper.IsPreCCV(ctx)) + } +} diff --git a/x/ccv/consumer/types/genesis_test.go b/x/ccv/consumer/types/genesis_test.go index c074cba70e..022729baa2 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -100,6 +100,7 @@ func TestValidateInitialGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{}, + false, }, true, }, @@ -118,6 +119,7 @@ func TestValidateInitialGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{}, + false, }, true, }, @@ -136,6 +138,7 @@ func TestValidateInitialGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{}, + false, }, true, }, @@ -154,6 +157,7 @@ func TestValidateInitialGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{Height: 1}, + false, }, true, }, @@ -172,6 +176,7 @@ func TestValidateInitialGenesisState(t *testing.T) { nil, types.ConsumerPackets{List: []types.ConsumerPacket{{}}}, types.LastTransmissionBlockHeight{}, + false, }, true, }, @@ -331,6 +336,7 @@ func TestValidateRestartGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{}, + false, }, true, }, @@ -349,6 +355,7 @@ func TestValidateRestartGenesisState(t *testing.T) { nil, types.ConsumerPackets{}, types.LastTransmissionBlockHeight{}, + false, }, true, }, From 67aa39b7fa795abb1519a5afb9731fdfa34d0c71 Mon Sep 17 00:00:00 2001 From: jstr1121 Date: Thu, 19 Jan 2023 23:27:13 +0800 Subject: [PATCH 09/12] update for slashing sovereign validators for the fault made before consumer chain upgrade height --- app/consumer-democracy/app.go | 1 + app/consumer/app.go | 1 + consumer/start_consumer2.sh | 313 ++++++++++++++++++++++++++++ consumer/start_provider2.sh | 133 ++++++++++++ x/ccv/consumer/keeper/keeper.go | 19 ++ x/ccv/consumer/keeper/validators.go | 92 +++++++- x/ccv/consumer/module.go | 2 + x/ccv/consumer/types/keys.go | 15 +- x/ccv/types/expected_keepers.go | 7 + 9 files changed, 572 insertions(+), 11 deletions(-) create mode 100644 consumer/start_consumer2.sh create mode 100644 consumer/start_provider2.sh diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index e2a436db72..860be9ef07 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -419,6 +419,7 @@ func New( &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper, + app.StakingKeeper, app.SlashingKeeper, app.BankKeeper, app.AccountKeeper, diff --git a/app/consumer/app.go b/app/consumer/app.go index ce343a9f52..c44f266d9b 100644 --- a/app/consumer/app.go +++ b/app/consumer/app.go @@ -334,6 +334,7 @@ func New( &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper, + nil, app.SlashingKeeper, app.BankKeeper, app.AccountKeeper, diff --git a/consumer/start_consumer2.sh b/consumer/start_consumer2.sh new file mode 100644 index 0000000000..38238c569c --- /dev/null +++ b/consumer/start_consumer2.sh @@ -0,0 +1,313 @@ +#!/bin/bash +set -eux + +SOVEREIGN_HOME="$HOME/.sovereign" +CONSUMER_HOME="$HOME/.consumer" +CONSUMER_HOME1="$HOME/.consumer1" +PROVIDER_CHAIN_ID="provider" +CONSUMER_CHAIN_ID="consumer" +MONIKER="consumer" +VALIDATOR="validator" +VALIDATOR1="validator1" +KEYRING="--keyring-backend test" +TX_FLAGS="--gas-adjustment 100 --gas auto" +PROVIDER_BINARY="interchain-security-pd" +SOVEREIGN_BINARY="interchain-security-sd" +CONSUMER_BINARY="interchain-security-cdd" +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +SOVEREIGN_RPC_LADDR="$NODE_IP:26648" +SOVEREIGN_GRPC_ADDR="$NODE_IP:9081" +CONSUMER_RPC_LADDR="$NODE_IP:26638" +CONSUMER_GRPC_ADDR="$NODE_IP:9071" +CONSUMER_RPC_LADDR1="$NODE_IP:26628" +CONSUMER_GRPC_ADDR1="$NODE_IP:9061" +CONSUMER_USER="consumer" +SOVEREIGN_VALIDATOR="sovereign_validator" +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_NODE_ADDRESS="tcp://localhost:26658" + +# Clean start +killall $SOVEREIGN_BINARY &> /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 10000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +################CONSUMER############################ + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + +###########################UPGRADE TO SOVEREIGN CHAIN########################## + +$SOVEREIGN_BINARY tx gov submit-proposal software-upgrade "v07-Theta" --upgrade-height=7 \ +--title="upgrade to consumer chain" --description="upgrade to consumer chain description" \ +--from=$SOVEREIGN_VALIDATOR $KEYRING --chain-id=$CONSUMER_CHAIN_ID \ +--home=$SOVEREIGN_HOME --yes -b block --deposit="100000000stake" + +# Vote yes to proposal +$SOVEREIGN_BINARY tx gov vote 1 yes --from $SOVEREIGN_VALIDATOR --chain-id $CONSUMER_CHAIN_ID --node tcp://$SOVEREIGN_RPC_LADDR \ +--home $SOVEREIGN_HOME -b block -y $KEYRING +sleep 30 + +###########################START BINARIES AGAIN AFTER UPGRADE########################## +$SOVEREIGN_BINARY query gov proposals --node tcp://$SOVEREIGN_RPC_LADDR +$SOVEREIGN_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$SOVEREIGN_BINARY status --node tcp://$CONSUMER_RPC_LADDR +# $SOVEREIGN_BINARY status --node tcp://$CONSUMER_RPC_LADDR1 + +killall $SOVEREIGN_BINARY &> /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/genesis.json +sleep 1 + + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +######################################HERMES################################### + +# Setup Hermes in packet relayer mode +killall hermes 2> /dev/null || true + +tee ~/.hermes/config.toml< ~/.hermes/logs & + +############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 50000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +$CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +$PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} diff --git a/consumer/start_provider2.sh b/consumer/start_provider2.sh new file mode 100644 index 0000000000..613f7ae597 --- /dev/null +++ b/consumer/start_provider2.sh @@ -0,0 +1,133 @@ +#!/bin/bash +set -eux + +TOTAL_COINS=100000000000stake +STAKE_COINS=100000000stake +TOTAL_COINS1=120000000000stake +STAKE_COINS1=1000000stake +PROVIDER_BINARY=interchain-security-pd +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_CHAIN_ID=provider +PROVIDER_MONIKER=provider +VALIDATOR=validator +VALIDATOR1=validator1 +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +PROVIDER_DELEGATOR=delegator + +# Clean start +killall $PROVIDER_BINARY &> /dev/null || true + +#######VALIDATOR1####################### +rm -rf $PROVIDER_HOME + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME --chain-id $PROVIDER_CHAIN_ID +jq ".app_state.gov.voting_params.voting_period = \"3s\" | .app_state.staking.params.unbonding_time = \"11600s\" | .app_state.provider.params.template_client.trusting_period = \"11300s\"" \ $PROVIDER_HOME/config/genesis.json > \ + $PROVIDER_HOME/edited_genesis.json && mv $PROVIDER_HOME/edited_genesis.json $PROVIDER_HOME/config/genesis.json +sleep 1 + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair.json 2>&1 +sleep 1 +$PROVIDER_BINARY keys add $PROVIDER_DELEGATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair_delegator.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair_delegator.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 + +# Stake 1/1000 user's coins +$PROVIDER_BINARY gentx $VALIDATOR $STAKE_COINS --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME --keyring-backend test --moniker $VALIDATOR +sleep 1 + +###########VALIDATOR 2############################ +rm -rf $PROVIDER_HOME1 + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME1 --chain-id $PROVIDER_CHAIN_ID +cp $PROVIDER_HOME/config/genesis.json $PROVIDER_HOME1/config/genesis.json + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR1 --home $PROVIDER_HOME1 --keyring-backend test --output json > $PROVIDER_HOME1/keypair.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME1/keypair.json) $TOTAL_COINS1 --home $PROVIDER_HOME1 --keyring-backend test +sleep 1 + +####################GENTX AND DISTRIBUTE GENESIS############################## +cp -r $PROVIDER_HOME/config/gentx $PROVIDER_HOME1/config/ + +# Stake 1/1000 user's coins +# $PROVIDER_BINARY gentx $VALIDATOR1 $STAKE_COINS1 --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME1 --keyring-backend test --moniker $VALIDATOR1 +# sleep 1 + +$PROVIDER_BINARY collect-gentxs --home $PROVIDER_HOME1 --gentx-dir $PROVIDER_HOME1/config/gentx/ +sleep 1 + +cp $PROVIDER_HOME1/config/genesis.json $PROVIDER_HOME/config/genesis.json + +####################ADDING PEERS#################### +node=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME) +node1=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME1) +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26656\"/" "$PROVIDER_HOME1"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$node1@localhost:26666\"/" "$PROVIDER_HOME"/config/config.toml + +#################### Start the chain node1 ################### +$PROVIDER_BINARY start \ + --home $PROVIDER_HOME \ + --rpc.laddr tcp://$PROVIDER_RPC_LADDR \ + --grpc.address $PROVIDER_GRPC_ADDR \ + --address tcp://${NODE_IP}:26655 \ + --p2p.laddr tcp://${NODE_IP}:26656 \ + --grpc-web.enable=false \ + --trace \ + &> $PROVIDER_HOME/logs & + +#################### Start the chain node2 ################### +# $PROVIDER_BINARY start \ +# --home $PROVIDER_HOME1 \ +# --rpc.laddr tcp://$PROVIDER_RPC_LADDR1 \ +# --grpc.address $PROVIDER_GRPC_ADDR1 \ +# --address tcp://${NODE_IP}:26665 \ +# --p2p.laddr tcp://${NODE_IP}:26666 \ +# --grpc-web.enable=false \ +# --trace \ +# &> $PROVIDER_HOME1/logs & +sleep 10 + +# Build consumer chain proposal file +tee $PROVIDER_HOME/consumer-proposal.json< Date: Tue, 31 Jan 2023 22:25:47 +0800 Subject: [PATCH 10/12] resolve comments on github and slack communication --- consumer/build_binaries.sh | 6 - .../README.md | 28 +- .../build_binaries.sh | 6 + .../start_consumer.sh | 359 ++++++++++++++++++ .../start_provider.sh | 134 +++++++ .../hermes-0.15.0}/start_consumer.sh | 13 +- .../hermes-0.15.0}/start_provider.sh | 0 .../hermes-1.2.0/start_consumer.sh | 0 .../hermes-1.2.0/start_provider.sh | 0 .../sovereign_consumer_upgrade_local}/run.sh | 0 .../start_consumer.sh | 359 ++++++++++++++++++ .../start_provider.sh | 134 +++++++ x/ccv/consumer/keeper/validators.go | 48 +-- x/ccv/consumer/module.go | 10 +- x/ccv/types/expected_keepers.go | 5 + 15 files changed, 1025 insertions(+), 77 deletions(-) delete mode 100644 consumer/build_binaries.sh rename {consumer => tests/sovereign_consumer_upgrade_local}/README.md (72%) create mode 100644 tests/sovereign_consumer_upgrade_local/build_binaries.sh create mode 100644 tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_consumer.sh create mode 100644 tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_provider.sh rename {consumer => tests/sovereign_consumer_upgrade_local/hermes-0.15.0}/start_consumer.sh (99%) rename {consumer => tests/sovereign_consumer_upgrade_local/hermes-0.15.0}/start_provider.sh (100%) rename consumer/start_consumer2.sh => tests/sovereign_consumer_upgrade_local/hermes-1.2.0/start_consumer.sh (100%) rename consumer/start_provider2.sh => tests/sovereign_consumer_upgrade_local/hermes-1.2.0/start_provider.sh (100%) rename {consumer => tests/sovereign_consumer_upgrade_local}/run.sh (100%) create mode 100644 tests/sovereign_consumer_upgrade_local/start_consumer.sh create mode 100644 tests/sovereign_consumer_upgrade_local/start_provider.sh diff --git a/consumer/build_binaries.sh b/consumer/build_binaries.sh deleted file mode 100644 index 43ddcef129..0000000000 --- a/consumer/build_binaries.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -go install ../cmd/interchain-security-sd -go install ../cmd/interchain-security-pd -go install ../cmd/interchain-security-cdd -go install ../cmd/interchain-security-cd diff --git a/consumer/README.md b/tests/sovereign_consumer_upgrade_local/README.md similarity index 72% rename from consumer/README.md rename to tests/sovereign_consumer_upgrade_local/README.md index 5b95bf4b0c..05a841f80b 100644 --- a/consumer/README.md +++ b/tests/sovereign_consumer_upgrade_local/README.md @@ -10,6 +10,8 @@ Binaries: ### Commands +Copy `start_consumer.sh`, `start_provider.sh` from one of the directories and execute following commands. + ```sh rm -rf /Users/admin/.provider1 rm -rf /Users/admin/.provider @@ -33,32 +35,14 @@ jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$CONSUMER_HOME"/config/genesis mv "$CONSUMER_HOME"/genesis_consumer.json "$CONSUMER_HOME"/config/genesis.json ``` -### Initial validator set on consumer chain - -```json - "initial_val_set": [ - { - "pub_key": { - "ed25519": "6s4FU4uSsWNjnqhNc9vhyZBqrLjib+z/mfh1LhvkalE=" - }, - "power": "1" - }, - { - "pub_key": { - "ed25519": "JCFnTza2T2jlkTWxC0kY9lczh7F+jQ/bGyhHFFNr7/w=" - }, - "power": "100" - } - ], -``` - ### Process of execution of soft upgrade from sovereign chain to consumer chain -1. Start provider chain with two validators and register consumer chain +1. Start provider chain and register consumer chain 2. Build normal sovereign chain daemon 3. Start single validator sovereign chain -4. Two provider chain validators with sovereign chain +4. Provider chain validator with sovereign chain 5. Raise Upgrade proposal on sovereign chain and vote 6. Build consumer chain daemon with upgrade handler for ccv module and relevant modules -7. Once chain halt, restart 3 nodes +7. Once chain halt, restart 2 nodes to move from sovereign chain to consumer chain 8. Ensure blocks are being produced without the first node used for sovereign chain +9. Execute delegation on provider chain and ensure consumer chain validators' voting power changes diff --git a/tests/sovereign_consumer_upgrade_local/build_binaries.sh b/tests/sovereign_consumer_upgrade_local/build_binaries.sh new file mode 100644 index 0000000000..f20cc28b4a --- /dev/null +++ b/tests/sovereign_consumer_upgrade_local/build_binaries.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +go install ../../cmd/interchain-security-sd +go install ../../cmd/interchain-security-pd +go install ../../cmd/interchain-security-cdd +go install ../../cmd/interchain-security-cd diff --git a/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_consumer.sh b/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_consumer.sh new file mode 100644 index 0000000000..3ca098f3d3 --- /dev/null +++ b/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_consumer.sh @@ -0,0 +1,359 @@ +#!/bin/bash +set -eux + +SOVEREIGN_HOME="$HOME/.sovereign" +CONSUMER_HOME="$HOME/.consumer" +CONSUMER_HOME1="$HOME/.consumer1" +PROVIDER_CHAIN_ID="provider" +CONSUMER_CHAIN_ID="consumer" +MONIKER="consumer" +VALIDATOR="validator" +VALIDATOR1="validator1" +KEYRING="--keyring-backend test" +TX_FLAGS="--gas-adjustment 100 --gas auto" +PROVIDER_BINARY="interchain-security-pd" +SOVEREIGN_BINARY="interchain-security-sd" +CONSUMER_BINARY="interchain-security-cdd" +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +SOVEREIGN_RPC_LADDR="$NODE_IP:26648" +SOVEREIGN_GRPC_ADDR="$NODE_IP:9081" +CONSUMER_RPC_LADDR="$NODE_IP:26638" +CONSUMER_GRPC_ADDR="$NODE_IP:9071" +CONSUMER_RPC_LADDR1="$NODE_IP:26628" +CONSUMER_GRPC_ADDR1="$NODE_IP:9061" +CONSUMER_USER="consumer" +SOVEREIGN_VALIDATOR="sovereign_validator" +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_NODE_ADDRESS="tcp://localhost:26658" + +# Clean start +killall $SOVEREIGN_BINARY &> /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 11000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +################CONSUMER############################ + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + +######################################HERMES################################### + +# Setup Hermes in packet relayer mode +killall hermes 2> /dev/null || true + +tee ~/.hermes/config.toml< ~/.hermes/logs & + +# Build consumer chain proposal file +tee $PROVIDER_HOME/consumer-proposal.json< /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/genesis.json +sleep 1 + + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +# # create channel between consumer and provider between provider port and consumer port +# hermes query clients consumer +# hermes query clients provider +# hermes query client consensus consumer 07-tendermint-1 +# hermes query client consensus provider 07-tendermint-1 +hermes create connection $CONSUMER_CHAIN_ID --client-a 07-tendermint-1 --client-b 07-tendermint-1 +hermes create channel $CONSUMER_CHAIN_ID --port-a consumer --port-b provider -o ordered --channel-version 1 connection-1 + +# ############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 32000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +# $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +# $CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +# $PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} diff --git a/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_provider.sh b/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_provider.sh new file mode 100644 index 0000000000..149cf32f80 --- /dev/null +++ b/tests/sovereign_consumer_upgrade_local/hermes-0.15.0-old-connection/start_provider.sh @@ -0,0 +1,134 @@ +#!/bin/bash +set -eux + +TOTAL_COINS=100000000000stake +STAKE_COINS=100000000stake +TOTAL_COINS1=120000000000stake +STAKE_COINS1=1000000stake +PROVIDER_BINARY=interchain-security-pd +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_CHAIN_ID=provider +PROVIDER_MONIKER=provider +VALIDATOR=validator +VALIDATOR1=validator1 +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +PROVIDER_DELEGATOR=delegator + +# Clean start +killall $PROVIDER_BINARY &> /dev/null || true + +#######VALIDATOR1####################### +rm -rf $PROVIDER_HOME + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME --chain-id $PROVIDER_CHAIN_ID +jq ".app_state.gov.voting_params.voting_period = \"3s\" | .app_state.staking.params.unbonding_time = \"600s\" | .app_state.provider.params.template_client.trusting_period = \"300s\"" \ + $PROVIDER_HOME/config/genesis.json > \ + $PROVIDER_HOME/edited_genesis.json && mv $PROVIDER_HOME/edited_genesis.json $PROVIDER_HOME/config/genesis.json +sleep 1 + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair.json 2>&1 +sleep 1 +$PROVIDER_BINARY keys add $PROVIDER_DELEGATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair_delegator.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair_delegator.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 + +# Stake 1/1000 user's coins +$PROVIDER_BINARY gentx $VALIDATOR $STAKE_COINS --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME --keyring-backend test --moniker $VALIDATOR +sleep 1 + +###########VALIDATOR 2############################ +rm -rf $PROVIDER_HOME1 + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME1 --chain-id $PROVIDER_CHAIN_ID +cp $PROVIDER_HOME/config/genesis.json $PROVIDER_HOME1/config/genesis.json + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR1 --home $PROVIDER_HOME1 --keyring-backend test --output json > $PROVIDER_HOME1/keypair.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME1/keypair.json) $TOTAL_COINS1 --home $PROVIDER_HOME1 --keyring-backend test +sleep 1 + +####################GENTX AND DISTRIBUTE GENESIS############################## +cp -r $PROVIDER_HOME/config/gentx $PROVIDER_HOME1/config/ + +# Stake 1/1000 user's coins +# $PROVIDER_BINARY gentx $VALIDATOR1 $STAKE_COINS1 --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME1 --keyring-backend test --moniker $VALIDATOR1 +# sleep 1 + +$PROVIDER_BINARY collect-gentxs --home $PROVIDER_HOME1 --gentx-dir $PROVIDER_HOME1/config/gentx/ +sleep 1 + +cp $PROVIDER_HOME1/config/genesis.json $PROVIDER_HOME/config/genesis.json + +####################ADDING PEERS#################### +node=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME) +node1=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME1) +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26656\"/" "$PROVIDER_HOME1"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$node1@localhost:26666\"/" "$PROVIDER_HOME"/config/config.toml + +#################### Start the chain node1 ################### +$PROVIDER_BINARY start \ + --home $PROVIDER_HOME \ + --rpc.laddr tcp://$PROVIDER_RPC_LADDR \ + --grpc.address $PROVIDER_GRPC_ADDR \ + --address tcp://${NODE_IP}:26655 \ + --p2p.laddr tcp://${NODE_IP}:26656 \ + --grpc-web.enable=false \ + --trace \ + &> $PROVIDER_HOME/logs & + +#################### Start the chain node2 ################### +# $PROVIDER_BINARY start \ +# --home $PROVIDER_HOME1 \ +# --rpc.laddr tcp://$PROVIDER_RPC_LADDR1 \ +# --grpc.address $PROVIDER_GRPC_ADDR1 \ +# --address tcp://${NODE_IP}:26665 \ +# --p2p.laddr tcp://${NODE_IP}:26666 \ +# --grpc-web.enable=false \ +# --trace \ +# &> $PROVIDER_HOME1/logs & +sleep 10 + +# # Build consumer chain proposal file +# tee $PROVIDER_HOME/consumer-proposal.json< /dev/null || true tee ~/.hermes/config.toml< /dev/null || true +killall $CONSUMER_BINARY &> /dev/null || true +rm -rf $CONSUMER_HOME +rm -rf $CONSUMER_HOME1 +rm -rf $SOVEREIGN_HOME + +################SOVEREIGN############################ +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $SOVEREIGN_HOME +sleep 1 + +# Create user account keypair +$SOVEREIGN_BINARY keys add $CONSUMER_USER $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/consumer_keypair.json 2>&1 +$SOVEREIGN_BINARY keys add $SOVEREIGN_VALIDATOR $KEYRING --home $SOVEREIGN_HOME --output json > $SOVEREIGN_HOME/sovereign_validator_keypair.json 2>&1 + +# Add account in genesis (required by Hermes) +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/consumer_keypair.json) 1000000000stake --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY add-genesis-account $(jq -r .address $SOVEREIGN_HOME/sovereign_validator_keypair.json) 1000000000000stake --home $SOVEREIGN_HOME + +# generate genesis for sovereign chain +$SOVEREIGN_BINARY gentx $SOVEREIGN_VALIDATOR 11000000000stake $KEYRING --chain-id=$CONSUMER_CHAIN_ID --home $SOVEREIGN_HOME +$SOVEREIGN_BINARY collect-gentxs --home $SOVEREIGN_HOME +sed -i '' 's/"voting_period": "172800s"/"voting_period": "20s"/g' $SOVEREIGN_HOME/config/genesis.json + +################CONSUMER############################ + +# Build genesis file and node directory structure +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME +sleep 1 + +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME/config/priv_validator_key.json $CONSUMER_HOME/config/priv_validator_key.json +cp $PROVIDER_HOME/config/node_key.json $CONSUMER_HOME/config/node_key.json + +#######CHAIN2####### +$SOVEREIGN_BINARY init --chain-id $CONSUMER_CHAIN_ID $MONIKER --home $CONSUMER_HOME1 +sleep 1 +#copy genesis +cp $SOVEREIGN_HOME/config/genesis.json $CONSUMER_HOME1/config/genesis.json + +# Copy validator key files +cp $PROVIDER_HOME1/config/priv_validator_key.json $CONSUMER_HOME1/config/priv_validator_key.json +cp $PROVIDER_HOME1/config/node_key.json $CONSUMER_HOME1/config/node_key.json + +##########SET CONFIG.TOML##################### +# Set default client port +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${SOVEREIGN_RPC_LADDR}\"/" $SOVEREIGN_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR}\"/" $CONSUMER_HOME/config/client.toml +sed -i -r "/node =/ s/= .*/= \"tcp:\/\/${CONSUMER_RPC_LADDR1}\"/" $CONSUMER_HOME1/config/client.toml +sovereign=$($SOVEREIGN_BINARY tendermint show-node-id --home $SOVEREIGN_HOME) +node=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME) +node1=$($SOVEREIGN_BINARY tendermint show-node-id --home $CONSUMER_HOME1) + +# sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636,$node1@localhost:26626\"/" "$SOVEREIGN_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node1@localhost:26626\"/" "$CONSUMER_HOME"/config/config.toml +# sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646,$node@localhost:26636\"/" "$CONSUMER_HOME1"/config/config.toml + +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26636\"/" "$SOVEREIGN_HOME"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$sovereign@localhost:26646\"/" "$CONSUMER_HOME"/config/config.toml + +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1318\"/" "$CONSUMER_HOME"/config/app.toml +sed -i -r "118s/.*/address = \"tcp:\/\/0.0.0.0:1319\"/" "$CONSUMER_HOME1"/config/app.toml + +# Start the chain +$SOVEREIGN_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$SOVEREIGN_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $SOVEREIGN_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 10 + +######################################HERMES################################### + +# Setup Hermes in packet relayer mode +killall hermes 2> /dev/null || true + +tee ~/.hermes/config.toml< ~/.hermes/logs & + +# Build consumer chain proposal file +tee $PROVIDER_HOME/consumer-proposal.json< /dev/null || true + +# Add ccv section to SOVEREIGN_HOME genesis to be used on upgrade handler +if ! $PROVIDER_BINARY q provider consumer-genesis "$CONSUMER_CHAIN_ID" --node "$PROVIDER_NODE_ADDRESS" --output json > "$SOVEREIGN_HOME"/consumer_section.json; +then + echo "Failed to get consumer genesis for the chain-id '$CONSUMER_CHAIN_ID'! Finalize genesis failed. For more details please check the log file in output directory." + exit 1 +fi + +jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' "$SOVEREIGN_HOME"/config/genesis.json "$SOVEREIGN_HOME"/consumer_section.json > "$SOVEREIGN_HOME"/genesis_consumer.json && \ + mv "$SOVEREIGN_HOME"/genesis_consumer.json "$SOVEREIGN_HOME"/config/genesis.json + +# Modify genesis params +jq ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"70\" | .app_state.tokenfactory.paused = { \"paused\": false }" \ + $SOVEREIGN_HOME/config/genesis.json > \ + $SOVEREIGN_HOME/edited_genesis.json && mv $SOVEREIGN_HOME/edited_genesis.json $SOVEREIGN_HOME/config/genesis.json +sleep 1 + + +$CONSUMER_BINARY start \ + --home $SOVEREIGN_HOME \ + --rpc.laddr tcp://${SOVEREIGN_RPC_LADDR} \ + --grpc.address ${SOVEREIGN_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26645 \ + --p2p.laddr tcp://${NODE_IP}:26646 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $SOVEREIGN_HOME/logs & + +$CONSUMER_BINARY start \ + --home $CONSUMER_HOME \ + --rpc.laddr tcp://${CONSUMER_RPC_LADDR} \ + --grpc.address ${CONSUMER_GRPC_ADDR} \ + --address tcp://${NODE_IP}:26635 \ + --p2p.laddr tcp://${NODE_IP}:26636 \ + --grpc-web.enable=false \ + --log_level trace \ + --trace \ + &> $CONSUMER_HOME/logs & + +# $CONSUMER_BINARY start \ +# --home $CONSUMER_HOME1 \ +# --rpc.laddr tcp://${CONSUMER_RPC_LADDR1} \ +# --grpc.address ${CONSUMER_GRPC_ADDR1} \ +# --address tcp://${NODE_IP}:26625 \ +# --p2p.laddr tcp://${NODE_IP}:26626 \ +# --grpc-web.enable=false \ +# --log_level trace \ +# --trace \ +# &> $CONSUMER_HOME1/logs & +sleep 30 + +# # create channel between consumer and provider between provider port and consumer port +# hermes query clients consumer +# hermes query clients provider +# hermes query client consensus consumer 07-tendermint-1 +# hermes query client consensus provider 07-tendermint-1 +hermes create connection $CONSUMER_CHAIN_ID --client-a 07-tendermint-1 --client-b 07-tendermint-1 +hermes create channel $CONSUMER_CHAIN_ID --port-a consumer --port-b provider -o ordered --channel-version 1 connection-1 + +# ############################################################ + +PROVIDER_VALIDATOR_ADDRESS=$(jq -r .address $PROVIDER_HOME/keypair.json) +DELEGATIONS=$($PROVIDER_BINARY q staking delegations $PROVIDER_VALIDATOR_ADDRESS --home $PROVIDER_HOME --node tcp://${PROVIDER_RPC_LADDR} -o json) +OPERATOR_ADDR=$(echo $DELEGATIONS | jq -r .delegation_responses[0].delegation.validator_address) + +$PROVIDER_BINARY tx staking delegate $OPERATOR_ADDR 32000000stake \ + --from $VALIDATOR \ + $KEYRING \ + --home $PROVIDER_HOME \ + --node tcp://${PROVIDER_RPC_LADDR} \ + --chain-id $PROVIDER_CHAIN_ID -y -b block +sleep 1 + +$PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR} +# $PROVIDER_BINARY status --node=tcp://${PROVIDER_RPC_LADDR1} + +$CONSUMER_BINARY status --node tcp://$SOVEREIGN_RPC_LADDR +$CONSUMER_BINARY status --node tcp://$CONSUMER_RPC_LADDR + +# $CONSUMER_BINARY query staking params --node=tcp://$CONSUMER_RPC_LADDR +# $PROVIDER_BINARY query staking params --node=tcp://${PROVIDER_RPC_LADDR} diff --git a/tests/sovereign_consumer_upgrade_local/start_provider.sh b/tests/sovereign_consumer_upgrade_local/start_provider.sh new file mode 100644 index 0000000000..149cf32f80 --- /dev/null +++ b/tests/sovereign_consumer_upgrade_local/start_provider.sh @@ -0,0 +1,134 @@ +#!/bin/bash +set -eux + +TOTAL_COINS=100000000000stake +STAKE_COINS=100000000stake +TOTAL_COINS1=120000000000stake +STAKE_COINS1=1000000stake +PROVIDER_BINARY=interchain-security-pd +PROVIDER_HOME="$HOME/.provider" +PROVIDER_HOME1="$HOME/.provider1" +PROVIDER_CHAIN_ID=provider +PROVIDER_MONIKER=provider +VALIDATOR=validator +VALIDATOR1=validator1 +NODE_IP="localhost" +PROVIDER_RPC_LADDR="$NODE_IP:26658" +PROVIDER_GRPC_ADDR="$NODE_IP:9091" +PROVIDER_RPC_LADDR1="$NODE_IP:26668" +PROVIDER_GRPC_ADDR1="$NODE_IP:9101" +PROVIDER_DELEGATOR=delegator + +# Clean start +killall $PROVIDER_BINARY &> /dev/null || true + +#######VALIDATOR1####################### +rm -rf $PROVIDER_HOME + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME --chain-id $PROVIDER_CHAIN_ID +jq ".app_state.gov.voting_params.voting_period = \"3s\" | .app_state.staking.params.unbonding_time = \"600s\" | .app_state.provider.params.template_client.trusting_period = \"300s\"" \ + $PROVIDER_HOME/config/genesis.json > \ + $PROVIDER_HOME/edited_genesis.json && mv $PROVIDER_HOME/edited_genesis.json $PROVIDER_HOME/config/genesis.json +sleep 1 + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair.json 2>&1 +sleep 1 +$PROVIDER_BINARY keys add $PROVIDER_DELEGATOR --home $PROVIDER_HOME --keyring-backend test --output json > $PROVIDER_HOME/keypair_delegator.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME/keypair_delegator.json) $TOTAL_COINS --home $PROVIDER_HOME --keyring-backend test +sleep 1 + +# Stake 1/1000 user's coins +$PROVIDER_BINARY gentx $VALIDATOR $STAKE_COINS --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME --keyring-backend test --moniker $VALIDATOR +sleep 1 + +###########VALIDATOR 2############################ +rm -rf $PROVIDER_HOME1 + +$PROVIDER_BINARY init $PROVIDER_MONIKER --home $PROVIDER_HOME1 --chain-id $PROVIDER_CHAIN_ID +cp $PROVIDER_HOME/config/genesis.json $PROVIDER_HOME1/config/genesis.json + +# Create account keypair +$PROVIDER_BINARY keys add $VALIDATOR1 --home $PROVIDER_HOME1 --keyring-backend test --output json > $PROVIDER_HOME1/keypair.json 2>&1 +sleep 1 + +# Add stake to user +$PROVIDER_BINARY add-genesis-account $(jq -r .address $PROVIDER_HOME1/keypair.json) $TOTAL_COINS1 --home $PROVIDER_HOME1 --keyring-backend test +sleep 1 + +####################GENTX AND DISTRIBUTE GENESIS############################## +cp -r $PROVIDER_HOME/config/gentx $PROVIDER_HOME1/config/ + +# Stake 1/1000 user's coins +# $PROVIDER_BINARY gentx $VALIDATOR1 $STAKE_COINS1 --chain-id $PROVIDER_CHAIN_ID --home $PROVIDER_HOME1 --keyring-backend test --moniker $VALIDATOR1 +# sleep 1 + +$PROVIDER_BINARY collect-gentxs --home $PROVIDER_HOME1 --gentx-dir $PROVIDER_HOME1/config/gentx/ +sleep 1 + +cp $PROVIDER_HOME1/config/genesis.json $PROVIDER_HOME/config/genesis.json + +####################ADDING PEERS#################### +node=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME) +node1=$($PROVIDER_BINARY tendermint show-node-id --home $PROVIDER_HOME1) +sed -i -r "/persistent_peers =/ s/= .*/= \"$node@localhost:26656\"/" "$PROVIDER_HOME1"/config/config.toml +sed -i -r "/persistent_peers =/ s/= .*/= \"$node1@localhost:26666\"/" "$PROVIDER_HOME"/config/config.toml + +#################### Start the chain node1 ################### +$PROVIDER_BINARY start \ + --home $PROVIDER_HOME \ + --rpc.laddr tcp://$PROVIDER_RPC_LADDR \ + --grpc.address $PROVIDER_GRPC_ADDR \ + --address tcp://${NODE_IP}:26655 \ + --p2p.laddr tcp://${NODE_IP}:26656 \ + --grpc-web.enable=false \ + --trace \ + &> $PROVIDER_HOME/logs & + +#################### Start the chain node2 ################### +# $PROVIDER_BINARY start \ +# --home $PROVIDER_HOME1 \ +# --rpc.laddr tcp://$PROVIDER_RPC_LADDR1 \ +# --grpc.address $PROVIDER_GRPC_ADDR1 \ +# --address tcp://${NODE_IP}:26665 \ +# --p2p.laddr tcp://${NODE_IP}:26666 \ +# --grpc-web.enable=false \ +# --trace \ +# &> $PROVIDER_HOME1/logs & +sleep 10 + +# # Build consumer chain proposal file +# tee $PROVIDER_HOME/consumer-proposal.json< Date: Tue, 21 Feb 2023 23:20:07 +0800 Subject: [PATCH 11/12] update sovereign app to use v4 ibc from v3 & resolve consumer module merge conflict fix issue --- app/sovereign/app.go | 40 +++--- x/ccv/consumer/module.go | 5 - x/ccv/consumer/types/genesis.pb.go | 211 +++++++---------------------- 3 files changed, 70 insertions(+), 186 deletions(-) diff --git a/app/sovereign/app.go b/app/sovereign/app.go index 73ca49b716..66e8503009 100644 --- a/app/sovereign/app.go +++ b/app/sovereign/app.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" @@ -70,16 +70,16 @@ import ( upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - "github.com/cosmos/ibc-go/v3/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v3/modules/core" - ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/cosmos/ibc-go/v4/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v4/modules/core" + ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" + ibcporttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" "github.com/spf13/cast" "github.com/tendermint/spm/cosmoscmd" abci "github.com/tendermint/tendermint/abci/types" @@ -93,14 +93,14 @@ import ( mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" + ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types" ) const ( @@ -426,7 +426,7 @@ func New( // - stakeibc // - base app var icamiddlewareStack porttypes.IBCModule - icamiddlewareStack = icacontroller.NewIBCModule(app.ICAControllerKeeper, icamiddlewareStack) + icamiddlewareStack = icacontroller.NewIBCMiddleware(icamiddlewareStack, app.ICAControllerKeeper) icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) // Create static IBC router, add transfer route, then set and seal it diff --git a/x/ccv/consumer/module.go b/x/ccv/consumer/module.go index 2caed6a77f..988d74ed19 100644 --- a/x/ccv/consumer/module.go +++ b/x/ccv/consumer/module.go @@ -199,11 +199,6 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V return initialValSet } - // distribution transmission - err := am.keeper.DistributeToProviderValidatorSet(ctx) - if err != nil { - panic(err) - } // Execute EndBlock logic for the Reward Distribution sub-protocol am.keeper.EndBlockRD(ctx) diff --git a/x/ccv/consumer/types/genesis.pb.go b/x/ccv/consumer/types/genesis.pb.go index 56005a0434..47253f25a1 100644 --- a/x/ccv/consumer/types/genesis.pb.go +++ b/x/ccv/consumer/types/genesis.pb.go @@ -170,7 +170,6 @@ func (m *GenesisState) GetLastTransmissionBlockHeight() LastTransmissionBlockHei return LastTransmissionBlockHeight{} } -<<<<<<< HEAD func (m *GenesisState) GetPreCCV() bool { if m != nil { return m.PreCCV @@ -178,62 +177,6 @@ func (m *GenesisState) GetPreCCV() bool { return false } -// MaturingVSCPacket defines the genesis information for the -// unbonding VSC packet -type MaturingVSCPacket struct { - VscId uint64 `protobuf:"varint,1,opt,name=vscId,proto3" json:"vscId,omitempty"` - MaturityTime uint64 `protobuf:"varint,2,opt,name=maturity_time,json=maturityTime,proto3" json:"maturity_time,omitempty"` -} - -func (m *MaturingVSCPacket) Reset() { *m = MaturingVSCPacket{} } -func (m *MaturingVSCPacket) String() string { return proto.CompactTextString(m) } -func (*MaturingVSCPacket) ProtoMessage() {} -func (*MaturingVSCPacket) Descriptor() ([]byte, []int) { - return fileDescriptor_2db73a6057a27482, []int{1} -} -func (m *MaturingVSCPacket) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MaturingVSCPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MaturingVSCPacket.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MaturingVSCPacket) XXX_Merge(src proto.Message) { - xxx_messageInfo_MaturingVSCPacket.Merge(m, src) -} -func (m *MaturingVSCPacket) XXX_Size() int { - return m.Size() -} -func (m *MaturingVSCPacket) XXX_DiscardUnknown() { - xxx_messageInfo_MaturingVSCPacket.DiscardUnknown(m) -} - -var xxx_messageInfo_MaturingVSCPacket proto.InternalMessageInfo - -func (m *MaturingVSCPacket) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *MaturingVSCPacket) GetMaturityTime() uint64 { - if m != nil { - return m.MaturityTime - } - return 0 -} - -======= ->>>>>>> 558516f90cf7f111ebf8bfa1fadafaa99c50e502 // HeightValsetUpdateID defines the genesis information for the mapping // of each block height to a valset update id type HeightToValsetUpdateID struct { @@ -345,110 +288,56 @@ func init() { } var fileDescriptor_2db73a6057a27482 = []byte{ -<<<<<<< HEAD - // 800 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6f, 0xf3, 0x34, - 0x18, 0x6e, 0xf8, 0xfa, 0x95, 0xd6, 0xdb, 0xf8, 0x36, 0x6f, 0x54, 0x61, 0x15, 0xa1, 0x74, 0x97, - 0x4a, 0x40, 0xa2, 0x0e, 0x84, 0x10, 0x48, 0x08, 0xd6, 0x49, 0x50, 0x09, 0xc6, 0xd4, 0x76, 0x3d, - 0xec, 0x12, 0xb9, 0x8e, 0x49, 0xac, 0x25, 0x76, 0x14, 0x3b, 0x19, 0x3b, 0x70, 0xe1, 0xca, 0x85, - 0x3f, 0x6b, 0xc7, 0x1d, 0x39, 0x21, 0xb4, 0xfd, 0x13, 0x1c, 0x51, 0x6c, 0xa7, 0x3f, 0xb6, 0x22, - 0x7a, 0xb3, 0xfd, 0xbe, 0xcf, 0xf3, 0xbc, 0xbf, 0xfc, 0x82, 0x01, 0x65, 0x92, 0x64, 0x38, 0x42, - 0x94, 0xf9, 0x82, 0xe0, 0x3c, 0xa3, 0xf2, 0xce, 0xc3, 0xb8, 0xf0, 0x30, 0x67, 0x22, 0x4f, 0x48, - 0xe6, 0x15, 0x03, 0x2f, 0x24, 0x8c, 0x08, 0x2a, 0xdc, 0x34, 0xe3, 0x92, 0xc3, 0x93, 0x0d, 0x10, - 0x17, 0xe3, 0xc2, 0xad, 0x20, 0x6e, 0x31, 0x38, 0x76, 0x42, 0xce, 0xc3, 0x98, 0x78, 0x0a, 0x32, - 0xcf, 0x7f, 0xf6, 0x82, 0x3c, 0x43, 0x92, 0x72, 0xa6, 0x49, 0x8e, 0x3d, 0x3a, 0xc7, 0x5e, 0x4c, - 0xc3, 0x48, 0xe2, 0x98, 0x12, 0x26, 0x85, 0x27, 0x09, 0x0b, 0x48, 0x96, 0x50, 0x26, 0x4b, 0xc9, - 0xe5, 0xcd, 0x00, 0x3e, 0x2c, 0x01, 0x98, 0x67, 0xc4, 0xc3, 0x11, 0x62, 0x8c, 0xc4, 0xa5, 0x97, - 0x39, 0x1a, 0x97, 0xa3, 0x90, 0x87, 0x5c, 0x1d, 0xbd, 0xf2, 0x64, 0x5e, 0x4f, 0xb7, 0xc9, 0x70, - 0x11, 0xba, 0xc6, 0x74, 0x56, 0x82, 0x41, 0x73, 0x4c, 0x3d, 0x79, 0x97, 0x12, 0x93, 0x7f, 0xef, - 0x9f, 0x26, 0xd8, 0xfd, 0x4e, 0x57, 0x64, 0x22, 0x91, 0x24, 0x70, 0x04, 0x1a, 0x29, 0xca, 0x50, - 0x22, 0x6c, 0xab, 0x6b, 0xf5, 0x77, 0x4e, 0x3f, 0x72, 0xb7, 0xa8, 0x90, 0x7b, 0xa9, 0x20, 0x67, - 0xf5, 0xfb, 0xbf, 0x3e, 0xa8, 0x8d, 0x0d, 0x01, 0xfc, 0x18, 0xc0, 0x34, 0xe3, 0x05, 0x0d, 0x48, - 0xe6, 0xeb, 0xc2, 0xf8, 0x34, 0xb0, 0xdf, 0xea, 0x5a, 0xfd, 0xd6, 0x78, 0xbf, 0xb2, 0x0c, 0x95, - 0x61, 0x14, 0x40, 0x17, 0x1c, 0x2e, 0xbd, 0x75, 0x29, 0x4a, 0xf7, 0x57, 0xca, 0xfd, 0x60, 0xe1, - 0xae, 0x2d, 0xa3, 0x00, 0x76,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68, 0xa6, 0x7c, 0xa6, 0x48, - 0xb4, 0xe6, 0xe8, 0xdc, 0xa8, 0xb6, 0xa3, 0x4d, 0xd6, 0x00, 0xfe, 0x66, 0x81, 0xf7, 0x79, 0x2e, - 0x85, 0x44, 0x2c, 0x28, 0x6b, 0x17, 0xf0, 0x5b, 0x26, 0x69, 0x42, 0x7c, 0x11, 0x23, 0x11, 0x51, - 0x16, 0xda, 0x40, 0x85, 0xf0, 0xc5, 0x56, 0x21, 0xfc, 0xb4, 0x64, 0x3a, 0x37, 0x44, 0x46, 0xbf, - 0xc3, 0x5f, 0x9a, 0x26, 0x46, 0x02, 0x4a, 0x60, 0xa7, 0x44, 0xeb, 0x57, 0x6c, 0x8b, 0x26, 0xee, - 0xa8, 0x31, 0xf9, 0x6c, 0x2b, 0xf9, 0xa1, 0x39, 0x9b, 0x5e, 0x55, 0xa9, 0x1b, 0xee, 0x67, 0x56, - 0xf8, 0xbb, 0x05, 0x9c, 0x18, 0x09, 0xe9, 0xcb, 0x0c, 0x31, 0x91, 0x50, 0x21, 0x28, 0x67, 0xfe, - 0x3c, 0xe6, 0xf8, 0xc6, 0xd7, 0xd5, 0xb2, 0x77, 0x95, 0xf8, 0x37, 0x5b, 0x89, 0xff, 0x80, 0x84, - 0x9c, 0xae, 0x30, 0x9d, 0x95, 0x44, 0xba, 0x27, 0x55, 0x0d, 0xe2, 0xff, 0x76, 0x81, 0x6d, 0xd0, - 0x48, 0x33, 0x32, 0x1c, 0xce, 0xec, 0x3d, 0xf5, 0x4b, 0xcd, 0xad, 0x77, 0x01, 0x0e, 0x5e, 0xcc, - 0x26, 0x3c, 0x02, 0xaf, 0x0b, 0x81, 0x47, 0x81, 0xda, 0x3e, 0xf5, 0xb1, 0xbe, 0xc0, 0x13, 0xb0, - 0xa7, 0xa7, 0x55, 0xde, 0xf9, 0x65, 0x7d, 0xd5, 0x12, 0xa9, 0x8f, 0x77, 0xab, 0xc7, 0x29, 0x4d, - 0x48, 0xef, 0x1a, 0xb4, 0x37, 0x0f, 0x4a, 0x19, 0x81, 0x49, 0x5b, 0xb3, 0x9a, 0x1b, 0xec, 0x83, - 0xfd, 0x17, 0x73, 0xa9, 0x99, 0xdf, 0x29, 0xd6, 0x86, 0xa9, 0x77, 0x05, 0x0e, 0x37, 0x4c, 0x00, - 0xfc, 0x1a, 0x74, 0x8a, 0xea, 0x2b, 0xac, 0xac, 0x01, 0x14, 0x04, 0x19, 0x11, 0x7a, 0x83, 0xb6, - 0xc6, 0xef, 0x2d, 0x5c, 0x16, 0x3f, 0xfb, 0x5b, 0xed, 0x70, 0x36, 0xbd, 0x7f, 0x74, 0xac, 0x87, - 0x47, 0xc7, 0xfa, 0xfb, 0xd1, 0xb1, 0xfe, 0x78, 0x72, 0x6a, 0x0f, 0x4f, 0x4e, 0xed, 0xcf, 0x27, - 0xa7, 0x76, 0xfd, 0x65, 0x48, 0x65, 0x94, 0xcf, 0x5d, 0xcc, 0x13, 0x0f, 0x73, 0x91, 0x70, 0xe1, - 0x2d, 0x5b, 0xf5, 0xc9, 0x62, 0xf5, 0xff, 0xb2, 0xbe, 0xfc, 0xd5, 0x66, 0x9f, 0x37, 0xd4, 0x6a, - 0xff, 0xf4, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x7c, 0x6e, 0x21, 0x0f, 0x07, 0x00, 0x00, -======= - // 773 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xcf, 0x6f, 0xdb, 0x36, - 0x14, 0xb6, 0x92, 0xcc, 0xb3, 0x99, 0x6c, 0xc9, 0x98, 0xcd, 0xd0, 0x6c, 0x4c, 0xf3, 0xb2, 0x1d, - 0x0c, 0x6c, 0x93, 0x60, 0x0f, 0x18, 0x86, 0x15, 0x28, 0xda, 0x24, 0x40, 0x6b, 0x20, 0x6d, 0x03, - 0x3b, 0xf1, 0x21, 0x17, 0x81, 0xa6, 0x58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 0x53, 0x03, - 0x5b, 0xcf, 0xf4, 0xdc, 0x86, 0x12, 0x49, 0x02, 0xfb, 0xa0, 0x3a, 0x41, 0x29, 0x4a, 0x84, 0x6d, - 0xb5, 0xad, 0xce, 0x66, 0xef, 0x4f, 0x77, 0x85, 0x39, 0xba, 0xc7, 0x2a, 0x65, 0x7f, 0xe3, 0xea, - 0xe6, 0xd7, 0xca, 0xc0, 0x10, 0xc0, 0xbf, 0x00, 0x9c, 0xa4, 0x3c, 0xa7, 0x01, 0x49, 0x7d, 0xdd, - 0xa7, 0x4f, 0x03, 0x7b, 0xad, 0x6d, 0x75, 0xea, 0x83, 0x9d, 0x32, 0x72, 0xa0, 0x02, 0xfd, 0x00, - 0xba, 0x60, 0x77, 0x86, 0xd6, 0x9d, 0x15, 0xf0, 0x75, 0x05, 0xff, 0x61, 0x0a, 0xd7, 0x91, 0x7e, - 0x00, 0x5b, 0xa0, 0xce, 0xc8, 0x85, 0xaf, 0x0a, 0xb3, 0x37, 0xda, 0x56, 0xa7, 0x36, 0xa8, 0x31, - 0x72, 0x71, 0x50, 0xec, 0xa1, 0x0f, 0x7e, 0xfa, 0x52, 0x5a, 0x14, 0xed, 0xd9, 0xdf, 0x94, 0x4d, - 0x8d, 0xb1, 0x3b, 0x6f, 0x80, 0x3b, 0x37, 0xf2, 0xbc, 0xeb, 0xea, 0xaa, 0xd4, 0x44, 0x06, 0xbb, - 0x8b, 0xa5, 0xea, 0x31, 0x45, 0xc0, 0x9e, 0x09, 0x70, 0x26, 0x08, 0x13, 0x99, 0x30, 0x1a, 0x55, - 0xa5, 0xe1, 0x7e, 0x55, 0xa3, 0x4c, 0xd3, 0x32, 0x8d, 0xa9, 0xcc, 0xc2, 0x39, 0x0c, 0xc1, 0x4e, - 0x82, 0x64, 0x96, 0x52, 0x16, 0xfa, 0x13, 0x84, 0xcf, 0x89, 0x14, 0xf6, 0xb7, 0xed, 0xf5, 0xce, - 0x66, 0xef, 0xdf, 0x95, 0xac, 0x79, 0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, 0x13, 0x09, - 0x15, 0x82, 0x72, 0xe6, 0x8f, 0x63, 0x8e, 0xcf, 0x7d, 0x3d, 0x2b, 0x7b, 0x4b, 0x49, 0x3f, 0x59, - 0xa9, 0xf3, 0x23, 0x24, 0xe4, 0xc9, 0x1c, 0xd3, 0x7e, 0x41, 0xa4, 0x1d, 0x29, 0x27, 0x10, 0x3f, - 0x0c, 0xd9, 0x3b, 0x03, 0x8d, 0xe5, 0xf6, 0xc1, 0x06, 0xa8, 0x9a, 0x72, 0x8a, 0x97, 0x66, 0x63, - 0x60, 0x76, 0xb0, 0x03, 0x76, 0xee, 0xdd, 0x96, 0x35, 0x85, 0xf8, 0x3e, 0x5f, 0xb0, 0x78, 0xef, - 0x14, 0xec, 0x2e, 0xf1, 0x05, 0x3e, 0x06, 0xad, 0xbc, 0xbc, 0xa0, 0x73, 0x7f, 0x4e, 0x14, 0x04, - 0x29, 0x11, 0xfa, 0x5d, 0xab, 0x0f, 0x7e, 0x9e, 0x42, 0xa6, 0xff, 0xb7, 0xa7, 0x1a, 0xb0, 0x7f, - 0x72, 0x75, 0xeb, 0x58, 0xd7, 0xb7, 0x8e, 0xf5, 0xe9, 0xd6, 0xb1, 0x3e, 0xdc, 0x39, 0x95, 0xeb, - 0x3b, 0xa7, 0xf2, 0xf1, 0xce, 0xa9, 0x9c, 0xfd, 0x1f, 0x52, 0x19, 0x65, 0x63, 0x17, 0xf3, 0xc4, - 0xc3, 0x5c, 0x24, 0x5c, 0x78, 0xb3, 0x11, 0xfe, 0x3d, 0xfd, 0x34, 0xbc, 0x59, 0xfc, 0x38, 0xa8, - 0x97, 0x7f, 0x5c, 0x55, 0x0f, 0xee, 0x3f, 0x9f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x5a, 0x50, - 0x50, 0xcb, 0x06, 0x00, 0x00, ->>>>>>> 558516f90cf7f111ebf8bfa1fadafaa99c50e502 + // 782 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00,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e3, 0xaf, 0x07, 0xaf, 0x71, + 0xf9, 0x55, 0x4c, 0x55, 0x52, 0x2c, 0x7c, 0xcc, 0xb3, 0x00, 0x73, 0x99, 0x71, 0x19, 0xac, 0x5a, + 0xfb, 0xd9, 0xf2, 0xca, 0xf8, 0x75, 0xf3, 0xd2, 0xd0, 0x37, 0xc2, 0xa2, 0xa9, 0x0f, 0xe2, 0xcf, + 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xab, 0x08, 0x12, 0x9c, 0xe3, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { From 62da0d29ab83fdf60e75b4990dff1a10ae3f9d81 Mon Sep 17 00:00:00 2001 From: jstr1121 <118450565+jstr1121@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:21:53 +0800 Subject: [PATCH 12/12] Update app/sovereign/upgrades/v3/upgrades.go Co-authored-by: yaruwangway <69694322+yaruwangway@users.noreply.github.com> --- app/sovereign/upgrades/v3/upgrades.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/sovereign/upgrades/v3/upgrades.go b/app/sovereign/upgrades/v3/upgrades.go index bb40c1713a..39cfa318f1 100644 --- a/app/sovereign/upgrades/v3/upgrades.go +++ b/app/sovereign/upgrades/v3/upgrades.go @@ -18,9 +18,6 @@ func CreateUpgradeHandler( ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { newVm, err := mm.RunMigrations(ctx, configurator, vm) - if err != nil { - return newVm, err - } - return newVm, nil + return newVm, err } }