From 7b7d2f8b4e431fffe9eb1a1fadb3c84ac0b12a66 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Sat, 7 Aug 2021 03:06:03 -0700 Subject: [PATCH] feat: gov params for permissioned eco credits (#425) Closes: #425 Add new gov params for permissioned credit creation Fix error in app/regen/cmd/genaccounts.go - couldn't compile due to error of cdc casting to itself --- CHANGELOG.md | 1 + app/regen/cmd/genaccounts.go | 3 +- docs/modules/ecocredit/protobuf.md | 2 + go.mod | 2 +- go.sum | 4 +- proto/regen/ecocredit/v1alpha1/types.proto | 16 +- x/ecocredit/params.go | 35 +++- x/ecocredit/params_test.go | 134 +++++++++++++++ x/ecocredit/server/msg_server.go | 33 ++++ x/ecocredit/server/testsuite/suite.go | 69 ++++++++ x/ecocredit/types.pb.go | 186 ++++++++++++++++----- 11 files changed, 433 insertions(+), 52 deletions(-) create mode 100644 x/ecocredit/params_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index fe1347b2d1..db51f91f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * add dates as top level fields in credit batches (#393) * add project location as field in credit batches (#394) * use dec wrapper for decimal operations (#435) +* add params for an allowlist of permissioned credit designers (#425) ## [1.0.0] - 2021-04-13 diff --git a/app/regen/cmd/genaccounts.go b/app/regen/cmd/genaccounts.go index 9bb94d84df..5d5967b3b7 100644 --- a/app/regen/cmd/genaccounts.go +++ b/app/regen/cmd/genaccounts.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" sdk "github.com/cosmos/cosmos-sdk/types" @@ -116,7 +115,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa } cdc := clientCtx.Codec - authGenState := authtypes.GetGenesisStateFromAppState(cdc.(codec.Codec), appState) + authGenState := authtypes.GetGenesisStateFromAppState(cdc, appState) accs, err := authtypes.UnpackAccounts(authGenState.Accounts) if err != nil { diff --git a/docs/modules/ecocredit/protobuf.md b/docs/modules/ecocredit/protobuf.md index a1a1286315..d4411632ae 100644 --- a/docs/modules/ecocredit/protobuf.md +++ b/docs/modules/ecocredit/protobuf.md @@ -240,6 +240,8 @@ use with the x/params module. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | credit_class_fee | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | credit_class_fee is the fixed fee charged on creation of a new credit class | +| allowed_class_designers | [string](#string) | repeated | allowed_class_designers is an allowlist defining the addresses with the required permissions to create credit classes | +| allowlist_enabled | [bool](#bool) | | allowlist_enabled is a param that enables/disables the allowlist for credit creation | diff --git a/go.mod b/go.mod index 9e01df239c..415f10433b 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/tendermint/tendermint v0.34.11 github.com/tendermint/tm-db v0.6.4 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect - google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f // indirect + google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67 // indirect ) replace google.golang.org/grpc => google.golang.org/grpc v1.33.2 diff --git a/go.sum b/go.sum index 42a500788b..9e816fff80 100644 --- a/go.sum +++ b/go.sum @@ -1234,8 +1234,8 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f h1:YORWxaStkWBnWgELOHTmDrqNlFXuVGEbhwbB5iK94bQ= -google.golang.org/genproto v0.0.0-20210722135532-667f2b7c528f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67 h1:VmMSf20ssFK0+u1dscyTH9bU4/M4y+X/xNfkvD6kGtM= +google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/proto/regen/ecocredit/v1alpha1/types.proto b/proto/regen/ecocredit/v1alpha1/types.proto index d540a0b2f4..506096205a 100644 --- a/proto/regen/ecocredit/v1alpha1/types.proto +++ b/proto/regen/ecocredit/v1alpha1/types.proto @@ -71,12 +71,22 @@ message BatchInfo { // use with the x/params module. message Params { // credit_class_fee is the fixed fee charged on creation of a new credit class - repeated cosmos.base.v1beta1.Coin credit_class_fee = 1 - [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; + repeated cosmos.base.v1beta1.Coin credit_class_fee = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + + // allowed_class_designers is an allowlist defining the addresses with + // the required permissions to create credit classes + repeated string allowed_class_designers = 2; + + // allowlist_enabled is a param that enables/disables the allowlist for credit + // creation + bool allowlist_enabled = 3; } // GenesisState defines the state of the ecocredit module that is needed at genesis message GenesisState { // Params contains the updateable global parameters for use with the x/params module Params params = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"params\""]; -} \ No newline at end of file +} diff --git a/x/ecocredit/params.go b/x/ecocredit/params.go index 5379c8883b..b01c2d09b3 100644 --- a/x/ecocredit/params.go +++ b/x/ecocredit/params.go @@ -11,6 +11,8 @@ var ( // TODO: Decide a sensible default value DefaultCreditClassFeeTokens = sdk.NewInt(10000) KeyCreditClassFee = []byte("CreditClassFee") + KeyAllowedClassDesigners = []byte("AllowedClassDesigners") + KeyAllowlistEnabled = []byte("AllowlistEnabled") ) func ParamKeyTable() paramtypes.KeyTable { @@ -21,6 +23,8 @@ func ParamKeyTable() paramtypes.KeyTable { func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyCreditClassFee, &p.CreditClassFee, validateCreditClassFee), + paramtypes.NewParamSetPair(KeyAllowedClassDesigners, &p.AllowedClassDesigners, validateAllowlistCreditDesigners), + paramtypes.NewParamSetPair(KeyAllowlistEnabled, &p.AllowlistEnabled, validateAllowlistEnabled), } } @@ -37,12 +41,37 @@ func validateCreditClassFee(i interface{}) error { return nil } -func NewParams(creditClassFee sdk.Coins) Params { +func validateAllowlistCreditDesigners(i interface{}) error { + v, ok := i.([]string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + for _, sAddr := range v { + _, err := sdk.AccAddressFromBech32(sAddr) + if err != nil { + return err + } + } + return nil +} + +func validateAllowlistEnabled(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} + +func NewParams(creditClassFee sdk.Coins, allowlist []string, allowlistEnabled bool) Params { return Params{ - CreditClassFee: creditClassFee, + CreditClassFee: creditClassFee, + AllowedClassDesigners: allowlist, + AllowlistEnabled: allowlistEnabled, } } func DefaultParams() Params { - return NewParams(sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultCreditClassFeeTokens))) + return NewParams(sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultCreditClassFeeTokens)), []string{}, false) } diff --git a/x/ecocredit/params_test.go b/x/ecocredit/params_test.go new file mode 100644 index 0000000000..38cc44e4bb --- /dev/null +++ b/x/ecocredit/params_test.go @@ -0,0 +1,134 @@ +package ecocredit + +import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "testing" +) + +func TestDefaultParams(t *testing.T) { + expected := Params{ + CreditClassFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultCreditClassFeeTokens)), + AllowedClassDesigners: []string{}, + AllowlistEnabled: false, + } + df := DefaultParams() + + require.Equal(t, df.String(), expected.String()) +} + +func Test_validateAllowlistCreditCreators(t *testing.T) { + + genAddrs := make([]string, 0, 3) + for i := 0; i < 3; i++ { + genAddrs = append(genAddrs, sdk.MustBech32ifyAddressBytes(sdk.Bech32MainPrefix, []byte(fmt.Sprintf("testaddr-%d", i)))) + } + + tests := []struct { + name string + args interface{} + wantErr bool + }{ + { + name: "valid creator list", + args: genAddrs, + wantErr: false, + }, + { + name: "invalid creator list", + args: []string{"bogus", "superbogus", "megabogus"}, + wantErr: true, + }, + { + name: "mix of invalid/valid", + args: []string{"bogus", genAddrs[0]}, + wantErr: true, + }, + { + name: "wrong type", + args: []int{1, 2, 3, 4, 5}, + wantErr: true, + }, + { + name: "not even an array", + args: "bruh", + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := validateAllowlistCreditDesigners(tt.args); (err != nil) != tt.wantErr { + t.Errorf("validateAllowlistCreditCreators() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_validateAllowlistEnabled(t *testing.T) { + + tests := []struct { + name string + args interface{} + wantErr bool + }{ + { + name: "valid boolean value", + args: true, + wantErr: false, + }, + { + name: "valid boolean v2", + args: false, + wantErr: false, + }, + { + name: "invalid type", + args: []string{"lol", "rofl"}, + wantErr: true, + }, + { + name: "seems valid but its not", + args: 0, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := validateAllowlistEnabled(tt.args); (err != nil) != tt.wantErr { + t.Errorf("validateAllowlistEnabled() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +func Test_validateCreditClassFee(t *testing.T) { + tests := []struct { + name string + args interface{} + wantErr bool + }{ + { + name: "valid credit fee", + args: sdk.NewCoins(sdk.NewCoin("regen", sdk.NewInt(45)), sdk.NewCoin("osmo", sdk.NewInt(32))), + wantErr: false, + }, + { + name: "no fee is valid", + args: sdk.NewCoins(), + wantErr: false, + }, + { + name: "invalid type", + args: 45, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if err := validateCreditClassFee(tt.args); (err != nil) != tt.wantErr { + t.Errorf("validateCreditClassFee() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/x/ecocredit/server/msg_server.go b/x/ecocredit/server/msg_server.go index 3fbbb349d1..72a55a047c 100644 --- a/x/ecocredit/server/msg_server.go +++ b/x/ecocredit/server/msg_server.go @@ -30,6 +30,16 @@ func (s serverImpl) CreateClass(goCtx context.Context, req *ecocredit.MsgCreateC return nil, err } + if s.allowlistEnabled(ctx.Context) { + allowListed, err := s.isDesignerAllowListed(ctx.Context, designerAddress) + if err != nil { + return nil, err + } + if !allowListed { + return nil, fmt.Errorf("%s is not allowed to create credit classes", designerAddress.String()) + } + } + err = s.chargeCreditClassFee(ctx.Context, designerAddress) if err != nil { return nil, err @@ -463,3 +473,26 @@ func subtractTradableBalanceAndSupply(store sdk.KVStore, holder string, batchDen return nil } + +// Checks if the given address is in the allowlist of credit class designers +func (s serverImpl) isDesignerAllowListed(ctx sdk.Context, addr sdk.Address) (bool, error) { + var params ecocredit.Params + s.paramSpace.GetParamSet(ctx, ¶ms) + for _, sAddr := range params.AllowedClassDesigners { + allowListedAddr, err := sdk.AccAddressFromBech32(sAddr) + if err != nil { + return false, err + } + if addr.Equals(allowListedAddr) { + return true, nil + } + } + return false, nil +} + +// Checks if the allowlist of credit class designers is enabled +func (s serverImpl) allowlistEnabled(ctx sdk.Context) bool { + var params ecocredit.Params + s.paramSpace.GetParamSet(ctx, ¶ms) + return params.AllowlistEnabled +} diff --git a/x/ecocredit/server/testsuite/suite.go b/x/ecocredit/server/testsuite/suite.go index 2c43f35b20..614aac9b2a 100644 --- a/x/ecocredit/server/testsuite/suite.go +++ b/x/ecocredit/server/testsuite/suite.go @@ -620,4 +620,73 @@ func (s *IntegrationTestSuite) TestScenario() { } }) } + + /**** TEST ALLOWLIST CREDIT DESIGNERS ****/ + allowlistCases := []struct { + name string + designerAcc sdk.AccAddress + allowlist []string + allowlistEnabled bool + wantErr bool + }{ + { + name: "valid allowlist and enabled", + allowlist: []string{s.signers[0].String()}, + designerAcc: s.signers[0], + allowlistEnabled: true, + wantErr: false, + }, + { + name: "valid multi addrs in allowlist", + allowlist: []string{s.signers[0].String(), s.signers[1].String(), s.signers[2].String()}, + designerAcc: s.signers[0], + allowlistEnabled: true, + wantErr: false, + }, + { + name: "designer is not part of the allowlist", + allowlist: []string{s.signers[0].String()}, + designerAcc: s.signers[1], + allowlistEnabled: true, + wantErr: true, + }, + { + name: "valid allowlist but disabled - anyone can create credits", + allowlist: []string{s.signers[0].String()}, + designerAcc: s.signers[0], + allowlistEnabled: false, + wantErr: false, + }, + { + name: "empty and enabled allowlist - nobody can create credits", + allowlist: []string{}, + designerAcc: s.signers[0], + allowlistEnabled: true, + wantErr: true, + }, + } + + for _, tc := range allowlistCases { + tc := tc + s.Run(tc.name, func() { + s.paramSpace.Set(s.sdkCtx, ecocredit.KeyAllowedClassDesigners, tc.allowlist) + s.paramSpace.Set(s.sdkCtx, ecocredit.KeyAllowlistEnabled, tc.allowlistEnabled) + + // fund the designer account + s.Require().NoError(fundAccount(s.bankKeeper, s.sdkCtx, tc.designerAcc, sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)))) + + createClsRes, err = s.msgClient.CreateClass(s.ctx, &ecocredit.MsgCreateClass{ + Designer: tc.designerAcc.String(), + Issuers: []string{issuer1, issuer2}, + Metadata: nil, + }) + if tc.wantErr { + s.Require().Error(err) + s.Require().Nil(createClsRes) + } else { + s.Require().NoError(err) + s.Require().NotNil(createClsRes) + } + }) + } } diff --git a/x/ecocredit/types.pb.go b/x/ecocredit/types.pb.go index e4d8aacd8b..dd57d4187a 100644 --- a/x/ecocredit/types.pb.go +++ b/x/ecocredit/types.pb.go @@ -235,6 +235,12 @@ func (m *BatchInfo) GetProjectLocation() string { type Params struct { // credit_class_fee is the fixed fee charged on creation of a new credit class CreditClassFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=credit_class_fee,json=creditClassFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"credit_class_fee"` + // allowed_class_designers is an allowlist defining the addresses with + // the required permissions to create credit classes + AllowedClassDesigners []string `protobuf:"bytes,2,rep,name=allowed_class_designers,json=allowedClassDesigners,proto3" json:"allowed_class_designers,omitempty"` + // allowlist_enabled is a param that enables/disables the allowlist for credit + // creation + AllowlistEnabled bool `protobuf:"varint,3,opt,name=allowlist_enabled,json=allowlistEnabled,proto3" json:"allowlist_enabled,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -277,6 +283,20 @@ func (m *Params) GetCreditClassFee() github_com_cosmos_cosmos_sdk_types.Coins { return nil } +func (m *Params) GetAllowedClassDesigners() []string { + if m != nil { + return m.AllowedClassDesigners + } + return nil +} + +func (m *Params) GetAllowlistEnabled() bool { + if m != nil { + return m.AllowlistEnabled + } + return false +} + // GenesisState defines the state of the ecocredit module that is needed at genesis type GenesisState struct { // Params contains the updateable global parameters for use with the x/params module @@ -335,47 +355,51 @@ func init() { } var fileDescriptor_5342f4dcaeff1a84 = []byte{ - // 640 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcb, 0x6e, 0xd3, 0x40, - 0x14, 0x8d, 0x49, 0x49, 0xe2, 0x49, 0xa1, 0xc5, 0x85, 0xd6, 0x0d, 0x92, 0x1d, 0x59, 0x2c, 0xb2, - 0xe9, 0x98, 0x94, 0x05, 0x52, 0x77, 0xb8, 0x55, 0x51, 0x05, 0x02, 0x64, 0xba, 0x62, 0x63, 0x4d, - 0xec, 0x5b, 0xd7, 0xd4, 0x9e, 0x89, 0x3c, 0x93, 0x42, 0x57, 0x7c, 0x01, 0x52, 0xd7, 0x7c, 0x02, - 0x5f, 0xd2, 0x65, 0x97, 0xac, 0x5c, 0xd4, 0xfe, 0x81, 0xbf, 0x00, 0x79, 0xc6, 0xee, 0x23, 0x12, - 0x42, 0x62, 0x95, 0x39, 0x77, 0xee, 0x39, 0x3e, 0x57, 0x77, 0x4e, 0xd0, 0xb3, 0x1c, 0x62, 0xa0, - 0x2e, 0x84, 0x2c, 0xcc, 0x21, 0x4a, 0x84, 0x7b, 0x3c, 0x26, 0xe9, 0xf4, 0x90, 0x8c, 0x5d, 0x71, - 0x32, 0x05, 0x8e, 0xa7, 0x39, 0x13, 0xcc, 0x30, 0x65, 0x17, 0xbe, 0xee, 0xc2, 0x4d, 0xd7, 0xc0, - 0x0a, 0x19, 0xcf, 0x18, 0x77, 0x27, 0x84, 0x83, 0x7b, 0x3c, 0x9e, 0x80, 0x20, 0x63, 0x37, 0x64, - 0x09, 0x55, 0xcc, 0xc1, 0xe3, 0x98, 0xc5, 0x4c, 0x1e, 0xdd, 0xea, 0x54, 0x57, 0xed, 0x98, 0xb1, - 0x38, 0x05, 0x57, 0xa2, 0xc9, 0xec, 0x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, 0x02, 0x38, 0x01, 0x5a, 0x7c, 0x0d, 0x14, 0x78, 0xc2, 0x3f, 0x8a, 0x6a, - 0xb0, 0xf7, 0xa8, 0x33, 0x95, 0x86, 0xe4, 0xeb, 0xec, 0x6f, 0x0e, 0xf1, 0xdf, 0xf2, 0x8b, 0x95, - 0x71, 0xef, 0x49, 0xe5, 0xa1, 0x2c, 0xec, 0x07, 0xf5, 0xd0, 0xb2, 0xea, 0xf8, 0xb5, 0x8c, 0xf7, - 0xe6, 0xec, 0xd2, 0xd2, 0xce, 0x2f, 0x2d, 0xed, 0xf7, 0xa5, 0xa5, 0x9d, 0x5e, 0x59, 0xad, 0xf3, - 0x2b, 0xab, 0xf5, 0xeb, 0xca, 0x6a, 0x7d, 0x1a, 0xdf, 0x32, 0x2d, 0x3f, 0xb2, 0x41, 0x41, 0x7c, - 0x61, 0xf9, 0x51, 0x8d, 0x52, 0x88, 0x62, 0xc8, 0xdd, 0xaf, 0x37, 0xff, 0x30, 0x93, 0x8e, 0x5c, - 0xd6, 0x8b, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xc2, 0x5a, 0x98, 0x7b, 0x04, 0x00, 0x00, + // 692 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4e, 0xdb, 0x4a, + 0x14, 0x8e, 0x09, 0x37, 0x3f, 0x13, 0xee, 0x25, 0x98, 0x0b, 0x31, 0xb9, 0x52, 0x1c, 0x59, 0x77, + 0x11, 0xa9, 0x62, 0xdc, 0x50, 0xa9, 0x95, 0xd8, 0xd5, 0x50, 0x2a, 0xd4, 0xaa, 0xad, 0x5c, 0x56, + 0xdd, 0x58, 0x63, 0xfb, 0x60, 0x5c, 0xec, 0x99, 0xc8, 0x33, 0x81, 0xf2, 0x10, 0x95, 0x58, 0xf7, + 0x11, 0xfa, 0x24, 0x2c, 0x59, 0x76, 0x65, 0x2a, 0xe8, 0x13, 0xe4, 0x09, 0x2a, 0xcf, 0xd8, 0xe1, + 0x47, 0xaa, 0x2a, 0x75, 0xe5, 0xf9, 0xce, 0x39, 0xdf, 0x37, 0x73, 0xfe, 0x8c, 0xfe, 0xcf, 0x20, + 0x02, 0x6a, 0x43, 0xc0, 0x82, 0x0c, 0xc2, 0x58, 0xd8, 0x27, 0x63, 0x92, 0x4c, 0x8e, 0xc8, 0xd8, + 0x16, 0x67, 0x13, 0xe0, 0x78, 0x92, 0x31, 0xc1, 0x74, 0x43, 0x46, 0xe1, 0x79, 0x14, 0xae, 0xa2, + 0xfa, 0x83, 0x80, 0xf1, 0x94, 0x71, 0xdb, 0x27, 0x1c, 0xec, 0x93, 0xb1, 0x0f, 0x82, 0x8c, 0xed, + 0x80, 0xc5, 0x54, 0x31, 0xfb, 0xff, 0x46, 0x2c, 0x62, 0xf2, 0x68, 0x17, 0xa7, 0xd2, 0x6a, 0x46, + 0x8c, 0x45, 0x09, 0xd8, 0x12, 0xf9, 0xd3, 0x43, 0x5b, 0xc4, 0x29, 0x70, 0x41, 0xd2, 0x89, 0x0a, + 0xb0, 0x3e, 0x6b, 0xa8, 0xbd, 0x93, 0x10, 0xce, 0xf7, 0xe9, 0x21, 0xd3, 0x31, 0x6a, 0x05, 0x05, + 0xf0, 0xe2, 0xd0, 0xd0, 0x86, 0xda, 0xa8, 0xed, 0xac, 0xce, 0x72, 0x73, 0xf9, 0x8c, 0xa4, 0xc9, + 0xb6, 0x55, 0x79, 0x2c, 0xb7, 0x29, 0x8f, 0xfb, 0xa1, 0xde, 0x47, 0xad, 0x10, 0x78, 0x1c, 0x51, + 0xc8, 0x8c, 0x85, 0x22, 0xde, 0x9d, 0x63, 0xdd, 0x40, 0xcd, 0x98, 0xf3, 0x29, 0x64, 0xdc, 0xa8, + 0x0f, 0xeb, 0xa3, 0xb6, 0x5b, 0xc1, 0x82, 0x95, 0x82, 0x20, 0x21, 0x11, 0xc4, 0x58, 0x1c, 0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cd, 0xbf, 0xcb, 0xd2, 0x4a, 0xab, 0xe5, + 0x96, 0x32, 0xce, 0xab, 0x8b, 0xeb, 0x81, 0x76, 0x79, 0x3d, 0xd0, 0xbe, 0x5f, 0x0f, 0xb4, 0xf3, + 0x9b, 0x41, 0xed, 0xf2, 0x66, 0x50, 0xfb, 0x76, 0x33, 0xa8, 0x7d, 0x18, 0xdf, 0xa9, 0x8c, 0xbc, + 0x64, 0x93, 0x82, 0x38, 0x65, 0xd9, 0x71, 0x89, 0x12, 0x08, 0x23, 0xc8, 0xec, 0x4f, 0xb7, 0xff, + 0x31, 0xbf, 0x21, 0x47, 0xe2, 0xc9, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x21, 0xaf, 0x80, + 0xe1, 0x04, 0x00, 0x00, } func (m *ClassInfo) Marshal() (dAtA []byte, err error) { @@ -543,6 +567,25 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.AllowlistEnabled { + i-- + if m.AllowlistEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.AllowedClassDesigners) > 0 { + for iNdEx := len(m.AllowedClassDesigners) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedClassDesigners[iNdEx]) + copy(dAtA[i:], m.AllowedClassDesigners[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AllowedClassDesigners[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } if len(m.CreditClassFee) > 0 { for iNdEx := len(m.CreditClassFee) - 1; iNdEx >= 0; iNdEx-- { { @@ -688,6 +731,15 @@ func (m *Params) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } + if len(m.AllowedClassDesigners) > 0 { + for _, s := range m.AllowedClassDesigners { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.AllowlistEnabled { + n += 2 + } return n } @@ -1305,6 +1357,58 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedClassDesigners", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedClassDesigners = append(m.AllowedClassDesigners, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowlistEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowlistEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:])