Supply by denom Migrations (#8780)

* Add back supply proto

* Add migration for supply

* Fix lint

* Update x/bank/spec/01_state.md

* Fix test

* Proto gen

* Update x/bank/spec/01_state.md

* Make proto gen

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
This commit is contained in:
Amaury 2021-03-05 15:11:19 +01:00 committed by GitHub
parent e17953ab11
commit 6520997668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 364 additions and 52 deletions

View File

@ -80,6 +80,7 @@
- [Output](#cosmos.bank.v1beta1.Output)
- [Params](#cosmos.bank.v1beta1.Params)
- [SendEnabled](#cosmos.bank.v1beta1.SendEnabled)
- [Supply](#cosmos.bank.v1beta1.Supply)
- [cosmos/bank/v1beta1/genesis.proto](#cosmos/bank/v1beta1/genesis.proto)
- [Balance](#cosmos.bank.v1beta1.Balance)
@ -1560,6 +1561,23 @@ sendable).
<a name="cosmos.bank.v1beta1.Supply"></a>
### Supply
Supply represents a struct that passively keeps track of the total supply
amounts in the network.
This message is deprecated now that supply is indexed by denom.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `total` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | |
<!-- end messages -->
<!-- end enums -->

View File

@ -43,6 +43,21 @@ message Output {
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
// Supply represents a struct that passively keeps track of the total supply
// amounts in the network.
// This message is deprecated now that supply is indexed by denom.
message Supply {
option deprecated = true;
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "*github.com/cosmos/cosmos-sdk/x/bank/exported.SupplyI";
repeated cosmos.base.v1beta1.Coin total = 1
[(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"];
}
// DenomUnit represents a struct that describes a given
// denomination unit of the basic token.
message DenomUnit {

View File

@ -17,5 +17,5 @@ func NewMigrator(keeper BaseKeeper) Migrator {
// Migrate1to2 migrates from version 1 to 2.
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v042.MigrateStore(ctx, m.keeper.storeKey)
return v042.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc)
}

View File

@ -84,7 +84,8 @@ func queryTotalSupply(ctx sdk.Context, req abci.RequestQuery, k Keeper, legacyQu
return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error())
}
//TODO: pagenate
// TODO: paginate
// https://github.com/cosmos/cosmos-sdk/issues/8761
totalSupply := k.GetTotalSupply(ctx)
start, end := client.Paginate(len(totalSupply), params.Page, params.Limit, 100)

View File

@ -1,6 +1,7 @@
package v042
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040"
@ -8,14 +9,38 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank/types"
)
// MigrateStore performs in-place store migrations from v0.40 to v0.42. The
// migration includes:
//
// - Change addresses to be length-prefixed.
// - Change balances prefix to 1 byte
func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error {
store := ctx.KVStore(storeKey)
// migrateSupply migrates the supply to be stored by denom key instead in a
// single blob.
// ref: https://github.com/cosmos/cosmos-sdk/issues/7092
func migrateSupply(store sdk.KVStore, cdc codec.BinaryMarshaler) error {
// Old supply was stored as a single blob under the SupplyKey.
var oldSupply types.Supply // nolint:staticcheck
err := cdc.UnmarshalBinaryBare(store.Get(v040bank.SupplyKey), &oldSupply)
if err != nil {
return err
}
// We delete the single key holding the whole blob.
store.Delete(v040bank.SupplyKey)
// We add a new key for each denom
supplyStore := prefix.NewStore(store, types.SupplyKey)
for i := range oldSupply.Total {
coin := oldSupply.Total[i]
coinBz, err := cdc.MarshalBinaryBare(&coin)
if err != nil {
return err
}
supplyStore.Set([]byte(coin.Denom), coinBz)
}
return nil
}
// migrateBalanceKeys migrate the balances keys to cater for variable-length
// addresses.
func migrateBalanceKeys(store sdk.KVStore) {
// old key is of format:
// prefix ("balances") || addrBytes (20 bytes) || denomBytes
// new key is of format
@ -34,6 +59,17 @@ func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error {
store.Set(newStoreKey, oldStoreIter.Value())
oldStore.Delete(oldStoreIter.Key())
}
return nil
}
// MigrateStore performs in-place store migrations from v0.40 to v0.42. The
// migration includes:
//
// - Change addresses to be length-prefixed.
// - Change balances prefix to 1 byte
// - Change supply to be indexed by denom
func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey, cdc codec.BinaryMarshaler) error {
store := ctx.KVStore(storeKey)
migrateBalanceKeys(store)
return migrateSupply(store, cdc)
}

View File

@ -5,6 +5,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/store/prefix"
"github.com/cosmos/cosmos-sdk/testutil"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -13,7 +15,35 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank/types"
)
func TestStoreMigration(t *testing.T) {
func TestSupplyMigration(t *testing.T) {
encCfg := simapp.MakeTestEncodingConfig()
bankKey := sdk.NewKVStoreKey("bank")
ctx := testutil.DefaultContext(bankKey, sdk.NewTransientStoreKey("transient_test"))
store := ctx.KVStore(bankKey)
oldFooCoin := sdk.NewCoin("foo", sdk.NewInt(100))
oldBarCoin := sdk.NewCoin("bar", sdk.NewInt(200))
// Old supply was stored as a single blob under the `SupplyKey`.
oldSupply := types.Supply{Total: sdk.NewCoins(oldFooCoin, oldBarCoin)}
store.Set(v040bank.SupplyKey, encCfg.Marshaler.MustMarshalBinaryBare(&oldSupply))
// Run migration.
err := v042bank.MigrateStore(ctx, bankKey, encCfg.Marshaler)
require.NoError(t, err)
// New supply is indexed by denom.
var newFooCoin, newBarCoin sdk.Coin
supplyStore := prefix.NewStore(store, types.SupplyKey)
encCfg.Marshaler.MustUnmarshalBinaryBare(supplyStore.Get([]byte("foo")), &newFooCoin)
encCfg.Marshaler.MustUnmarshalBinaryBare(supplyStore.Get([]byte("bar")), &newBarCoin)
require.Equal(t, oldFooCoin, newFooCoin)
require.Equal(t, oldBarCoin, newBarCoin)
}
func TestBalanceKeysMigration(t *testing.T) {
encCfg := simapp.MakeTestEncodingConfig()
bankKey := sdk.NewKVStoreKey("bank")
ctx := testutil.DefaultContext(bankKey, sdk.NewTransientStoreKey("transient_test"))
store := ctx.KVStore(bankKey)
@ -25,7 +55,7 @@ func TestStoreMigration(t *testing.T) {
oldKey := append(append(v040bank.BalancesPrefix, addr...), denom...)
store.Set(oldKey, value)
err := v042bank.MigrateStore(ctx, bankKey)
err := v042bank.MigrateStore(ctx, bankKey, encCfg.Marshaler)
require.NoError(t, err)
newKey := append(types.CreateAccountBalancesPrefix(addr), denom...)

View File

@ -4,8 +4,9 @@ order: 1
# State
The `x/bank` module keeps state of two primary objects, account balances and the
The `x/bank` module keeps state of three primary objects, account balances, denom metadata and the
total supply of all balances.
- Supply: `0x0 -> ProtocolBuffer(Supply)`
- Supply: `0x0 | byte(denom) -> ProtocolBuffer(coin)`
- Denom Metadata: `0x1 | byte(denom) -> ProtocolBuffer(Metadata)`
- Balances: `0x2 | byte(address length) | []byte(address) | []byte(balance.Denom) -> ProtocolBuffer(balance)`

View File

@ -209,6 +209,48 @@ func (m *Output) XXX_DiscardUnknown() {
var xxx_messageInfo_Output proto.InternalMessageInfo
// Supply represents a struct that passively keeps track of the total supply
// amounts in the network.
// This message is deprecated now that supply is indexed by denom.
//
// Deprecated: Do not use.
type Supply struct {
Total github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=total,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"total"`
}
func (m *Supply) Reset() { *m = Supply{} }
func (m *Supply) String() string { return proto.CompactTextString(m) }
func (*Supply) ProtoMessage() {}
func (*Supply) Descriptor() ([]byte, []int) {
return fileDescriptor_dd052eee12edf988, []int{4}
}
func (m *Supply) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *Supply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_Supply.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 *Supply) XXX_Merge(src proto.Message) {
xxx_messageInfo_Supply.Merge(m, src)
}
func (m *Supply) XXX_Size() int {
return m.Size()
}
func (m *Supply) XXX_DiscardUnknown() {
xxx_messageInfo_Supply.DiscardUnknown(m)
}
var xxx_messageInfo_Supply proto.InternalMessageInfo
// DenomUnit represents a struct that describes a given
// denomination unit of the basic token.
type DenomUnit struct {
@ -228,7 +270,7 @@ func (m *DenomUnit) Reset() { *m = DenomUnit{} }
func (m *DenomUnit) String() string { return proto.CompactTextString(m) }
func (*DenomUnit) ProtoMessage() {}
func (*DenomUnit) Descriptor() ([]byte, []int) {
return fileDescriptor_dd052eee12edf988, []int{4}
return fileDescriptor_dd052eee12edf988, []int{5}
}
func (m *DenomUnit) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -300,7 +342,7 @@ func (m *Metadata) Reset() { *m = Metadata{} }
func (m *Metadata) String() string { return proto.CompactTextString(m) }
func (*Metadata) ProtoMessage() {}
func (*Metadata) Descriptor() ([]byte, []int) {
return fileDescriptor_dd052eee12edf988, []int{5}
return fileDescriptor_dd052eee12edf988, []int{6}
}
func (m *Metadata) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
@ -376,6 +418,7 @@ func init() {
proto.RegisterType((*SendEnabled)(nil), "cosmos.bank.v1beta1.SendEnabled")
proto.RegisterType((*Input)(nil), "cosmos.bank.v1beta1.Input")
proto.RegisterType((*Output)(nil), "cosmos.bank.v1beta1.Output")
proto.RegisterType((*Supply)(nil), "cosmos.bank.v1beta1.Supply")
proto.RegisterType((*DenomUnit)(nil), "cosmos.bank.v1beta1.DenomUnit")
proto.RegisterType((*Metadata)(nil), "cosmos.bank.v1beta1.Metadata")
}
@ -383,41 +426,44 @@ func init() {
func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) }
var fileDescriptor_dd052eee12edf988 = []byte{
// 537 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x8f, 0xd3, 0x30,
0x18, 0x8d, 0xaf, 0x3f, 0xe8, 0xb9, 0xb0, 0x98, 0x0a, 0xe5, 0x2a, 0x91, 0x84, 0x48, 0x48, 0x3d,
0x09, 0x5a, 0x0e, 0xb6, 0x2e, 0x48, 0x3d, 0x10, 0x62, 0x40, 0xa0, 0x20, 0x84, 0x04, 0x43, 0xe5,
0xd4, 0xbe, 0x62, 0x5d, 0x6c, 0x47, 0xb5, 0x8b, 0xae, 0xff, 0x01, 0x13, 0x30, 0x32, 0xde, 0xcc,
0x3f, 0xc2, 0x8d, 0x27, 0xb1, 0x30, 0x15, 0xd4, 0x2e, 0xcc, 0xf7, 0x17, 0x20, 0xdb, 0x69, 0x9b,
0x93, 0x0a, 0x33, 0x53, 0xbf, 0xf7, 0x7d, 0xcf, 0xef, 0x7b, 0x7e, 0x4d, 0x02, 0x83, 0x91, 0x54,
0x5c, 0xaa, 0x5e, 0x8a, 0xc5, 0x71, 0xef, 0xfd, 0x41, 0x4a, 0x35, 0x3e, 0xb0, 0xa0, 0x9b, 0x4f,
0xa4, 0x96, 0xe8, 0xba, 0x9b, 0x77, 0x6d, 0xab, 0x98, 0xb7, 0x5b, 0x63, 0x39, 0x96, 0x76, 0xde,
0x33, 0x95, 0xa3, 0xb6, 0xf7, 0x1c, 0x75, 0xe8, 0x06, 0xc5, 0x39, 0x37, 0xda, 0x6c, 0x51, 0x74,
0xbd, 0x65, 0x24, 0x99, 0x70,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 0xfe, 0xb4, 0x6e, 0x5f, 0xd8, 0x07, 0x7f, 0x02, 0x00, 0x00, 0xff,
0xff, 0x42, 0x5b, 0x8d, 0xc8, 0x38, 0x04, 0x00, 0x00,
// 587 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6f, 0xd3, 0x40,
0x14, 0xf6, 0x35, 0x8d, 0x49, 0x2f, 0xb0, 0x1c, 0x15, 0x72, 0x2b, 0x61, 0x1b, 0x4b, 0x48, 0x29,
0xa2, 0x0e, 0x05, 0xb1, 0x64, 0x41, 0x4a, 0x41, 0xa8, 0x03, 0x02, 0xb9, 0x42, 0x48, 0x30, 0x44,
0xe7, 0xdc, 0x35, 0x58, 0xb5, 0xef, 0xac, 0xdc, 0x19, 0xd5, 0xff, 0x01, 0x13, 0x30, 0x32, 0x76,
0x66, 0x62, 0xe0, 0x7f, 0xa0, 0x63, 0x05, 0x0b, 0x53, 0x40, 0xc9, 0xc2, 0xdc, 0xbf, 0x00, 0xdd,
0x9d, 0xf3, 0xa3, 0x52, 0x40, 0x0c, 0x0c, 0x4c, 0x79, 0xdf, 0x7b, 0xdf, 0xfb, 0xde, 0xd3, 0x77,
0xcf, 0x81, 0x6e, 0x9f, 0x8b, 0x8c, 0x8b, 0x76, 0x8c, 0xd9, 0x61, 0xfb, 0xd5, 0x4e, 0x4c, 0x25,
0xde, 0xd1, 0x20, 0xcc, 0x87, 0x5c, 0x72, 0x74, 0xd9, 0xd4, 0x43, 0x9d, 0xaa, 0xea, 0x9b, 0xeb,
0x03, 0x3e, 0xe0, 0xba, 0xde, 0x56, 0x91, 0xa1, 0x6e, 0x6e, 0x18, 0x6a, 0xcf, 0x14, 0xaa, 0x3e,
0x53, 0x9a, 0x4f, 0x11, 0x74, 0x36, 0xa5, 0xcf, 0x13, 0x66, 0xea, 0xc1, 0x57, 0x00, 0xed, 0x27,
0x78, 0x88, 0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, 0xcc, 0x53, 0xc7, 0xd6, 0xd9, 0x0a, 0x75, 0x77, 0x4f, 0xc6, 0x2e, 0x38,
0x1d, 0xbb, 0xe0, 0xc7, 0xd8, 0x05, 0xef, 0x26, 0xae, 0x75, 0x3a, 0x71, 0xad, 0x6f, 0x13, 0xd7,
0x7a, 0xbe, 0xf5, 0x37, 0xa6, 0xeb, 0x97, 0x8b, 0x6d, 0xfd, 0x1f, 0x73, 0xe7, 0x57, 0x00, 0x00,
0x00, 0xff, 0xff, 0xe7, 0x1c, 0xc1, 0x93, 0xeb, 0x04, 0x00, 0x00,
}
func (this *SendEnabled) Equal(that interface{}) bool {
@ -447,6 +493,35 @@ func (this *SendEnabled) Equal(that interface{}) bool {
}
return true
}
func (this *Supply) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Supply)
if !ok {
that2, ok := that.(Supply)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len(this.Total) != len(that1.Total) {
return false
}
for i := range this.Total {
if !this.Total[i].Equal(&that1.Total[i]) {
return false
}
}
return true
}
func (m *Params) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -622,6 +697,43 @@ func (m *Output) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *Supply) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Supply) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *Supply) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Total) > 0 {
for iNdEx := len(m.Total) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Total[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintBank(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *DenomUnit) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -821,6 +933,21 @@ func (m *Output) Size() (n int) {
return n
}
func (m *Supply) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Total) > 0 {
for _, e := range m.Total {
l = e.Size()
n += 1 + l + sovBank(uint64(l))
}
}
return n
}
func (m *DenomUnit) Size() (n int) {
if m == nil {
return 0
@ -1322,6 +1449,90 @@ func (m *Output) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *Supply) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBank
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Supply: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Supply: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowBank
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthBank
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthBank
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Total = append(m.Total, types.Coin{})
if err := m.Total[len(m.Total)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipBank(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthBank
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *DenomUnit) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0