Skip to content

Commit

Permalink
Merge pull request #385 from agoric-labs/8989-rm-lien
Browse files Browse the repository at this point in the history
refactor: remove lien mechanism support
  • Loading branch information
JimLarson authored Mar 5, 2024
2 parents 0d5eab2 + b3b9528 commit 9c20eac
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 492 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG-Agoric.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog (Agoric fork)

## Unreleased

### API Breaking Changes

* (auth, bank) Agoric/agoric-sdk#8989 Remove deprecated lien support

## `v0.46.16-alpha.agoric.2` - 2024-02-08

* Agoric/agoric-sdk#8871 Have `tx gov submit-proposal` accept either new or legacy syntax
Expand Down
20 changes: 10 additions & 10 deletions x/auth/keeper/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

// NewAccountWithAddress implements AccountKeeperI.
func (ak accountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) types.AccountI {
func (ak AccountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddress) types.AccountI {
acc := ak.proto()
err := acc.SetAddress(addr)
if err != nil {
Expand All @@ -17,7 +17,7 @@ func (ak accountKeeper) NewAccountWithAddress(ctx sdk.Context, addr sdk.AccAddre
}

// NewAccount sets the next account number to a given account interface
func (ak accountKeeper) NewAccount(ctx sdk.Context, acc types.AccountI) types.AccountI {
func (ak AccountKeeper) NewAccount(ctx sdk.Context, acc types.AccountI) types.AccountI {
if err := acc.SetAccountNumber(ak.GetNextAccountNumber(ctx)); err != nil {
panic(err)
}
Expand All @@ -26,19 +26,19 @@ func (ak accountKeeper) NewAccount(ctx sdk.Context, acc types.AccountI) types.Ac
}

// HasAccount implements AccountKeeperI.
func (ak accountKeeper) HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
func (ak AccountKeeper) HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool {
store := ctx.KVStore(ak.key)
return store.Has(types.AddressStoreKey(addr))
}

// HasAccountAddressByID checks account address exists by id.
func (ak accountKeeper) HasAccountAddressByID(ctx sdk.Context, id uint64) bool {
func (ak AccountKeeper) HasAccountAddressByID(ctx sdk.Context, id uint64) bool {
store := ctx.KVStore(ak.key)
return store.Has(types.AccountNumberStoreKey(id))
}

// GetAccount implements AccountKeeperI.
func (ak accountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI {
func (ak AccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI {
store := ctx.KVStore(ak.key)
bz := store.Get(types.AddressStoreKey(addr))
if bz == nil {
Expand All @@ -49,7 +49,7 @@ func (ak accountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.A
}

// GetAccountAddressById returns account address by id.
func (ak accountKeeper) GetAccountAddressByID(ctx sdk.Context, id uint64) string {
func (ak AccountKeeper) GetAccountAddressByID(ctx sdk.Context, id uint64) string {
store := ctx.KVStore(ak.key)
bz := store.Get(types.AccountNumberStoreKey(id))
if bz == nil {
Expand All @@ -59,7 +59,7 @@ func (ak accountKeeper) GetAccountAddressByID(ctx sdk.Context, id uint64) string
}

// GetAllAccounts returns all accounts in the accountKeeper.
func (ak accountKeeper) GetAllAccounts(ctx sdk.Context) (accounts []types.AccountI) {
func (ak AccountKeeper) GetAllAccounts(ctx sdk.Context) (accounts []types.AccountI) {
ak.IterateAccounts(ctx, func(acc types.AccountI) (stop bool) {
accounts = append(accounts, acc)
return false
Expand All @@ -69,7 +69,7 @@ func (ak accountKeeper) GetAllAccounts(ctx sdk.Context) (accounts []types.Accoun
}

// SetAccount implements AccountKeeperI.
func (ak accountKeeper) SetAccount(ctx sdk.Context, acc types.AccountI) {
func (ak AccountKeeper) SetAccount(ctx sdk.Context, acc types.AccountI) {
addr := acc.GetAddress()
store := ctx.KVStore(ak.key)

Expand All @@ -84,7 +84,7 @@ func (ak accountKeeper) SetAccount(ctx sdk.Context, acc types.AccountI) {

// RemoveAccount removes an account for the account mapper store.
// NOTE: this will cause supply invariant violation if called
func (ak accountKeeper) RemoveAccount(ctx sdk.Context, acc types.AccountI) {
func (ak AccountKeeper) RemoveAccount(ctx sdk.Context, acc types.AccountI) {
addr := acc.GetAddress()
store := ctx.KVStore(ak.key)
store.Delete(types.AddressStoreKey(addr))
Expand All @@ -93,7 +93,7 @@ func (ak accountKeeper) RemoveAccount(ctx sdk.Context, acc types.AccountI) {

// IterateAccounts iterates over all the stored accounts and performs a callback function.
// Stops iteration when callback returns true.
func (ak accountKeeper) IterateAccounts(ctx sdk.Context, cb func(account types.AccountI) (stop bool)) {
func (ak AccountKeeper) IterateAccounts(ctx sdk.Context, cb func(account types.AccountI) (stop bool)) {
store := ctx.KVStore(ak.key)
iterator := sdk.KVStorePrefixIterator(store, types.AddressStoreKeyPrefix)

Expand Down
4 changes: 2 additions & 2 deletions x/auth/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
//
// CONTRACT: old coins from the FeeCollectionKeeper need to be transferred through
// a genesis port script to the new fee collector account
func (ak accountKeeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
func (ak AccountKeeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
ak.SetParams(ctx, data.Params)

accounts, err := types.UnpackAccounts(data.Accounts)
Expand All @@ -27,7 +27,7 @@ func (ak accountKeeper) InitGenesis(ctx sdk.Context, data types.GenesisState) {
}

// ExportGenesis returns a GenesisState for a given context and keeper
func (ak accountKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
func (ak AccountKeeper) ExportGenesis(ctx sdk.Context) *types.GenesisState {
params := ak.GetParams(ctx)

var genAccounts types.GenesisAccounts
Expand Down
20 changes: 10 additions & 10 deletions x/auth/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/types"
)

var _ types.QueryServer = accountKeeper{}
var _ types.QueryServer = AccountKeeper{}

func (ak accountKeeper) AccountAddressByID(c context.Context, req *types.QueryAccountAddressByIDRequest) (*types.QueryAccountAddressByIDResponse, error) {
func (ak AccountKeeper) AccountAddressByID(c context.Context, req *types.QueryAccountAddressByIDRequest) (*types.QueryAccountAddressByIDResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
Expand All @@ -37,7 +37,7 @@ func (ak accountKeeper) AccountAddressByID(c context.Context, req *types.QueryAc
return &types.QueryAccountAddressByIDResponse{AccountAddress: address}, nil
}

func (ak accountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequest) (*types.QueryAccountsResponse, error) {
func (ak AccountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequest) (*types.QueryAccountsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand Down Expand Up @@ -65,7 +65,7 @@ func (ak accountKeeper) Accounts(c context.Context, req *types.QueryAccountsRequ
}

// Account returns account details based on address
func (ak accountKeeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) {
func (ak AccountKeeper) Account(c context.Context, req *types.QueryAccountRequest) (*types.QueryAccountResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
Expand Down Expand Up @@ -93,7 +93,7 @@ func (ak accountKeeper) Account(c context.Context, req *types.QueryAccountReques
}

// Params returns parameters of auth module
func (ak accountKeeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
func (ak AccountKeeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -104,7 +104,7 @@ func (ak accountKeeper) Params(c context.Context, req *types.QueryParamsRequest)
}

// ModuleAccounts returns all the existing Module Accounts
func (ak accountKeeper) ModuleAccounts(c context.Context, req *types.QueryModuleAccountsRequest) (*types.QueryModuleAccountsResponse, error) {
func (ak AccountKeeper) ModuleAccounts(c context.Context, req *types.QueryModuleAccountsRequest) (*types.QueryModuleAccountsResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand Down Expand Up @@ -136,7 +136,7 @@ func (ak accountKeeper) ModuleAccounts(c context.Context, req *types.QueryModule
}

// ModuleAccountByName returns module account by module name
func (ak accountKeeper) ModuleAccountByName(c context.Context, req *types.QueryModuleAccountByNameRequest) (*types.QueryModuleAccountByNameResponse, error) {
func (ak AccountKeeper) ModuleAccountByName(c context.Context, req *types.QueryModuleAccountByNameRequest) (*types.QueryModuleAccountByNameResponse, error) {
if req == nil {
return nil, status.Errorf(codes.InvalidArgument, "empty request")
}
Expand All @@ -161,7 +161,7 @@ func (ak accountKeeper) ModuleAccountByName(c context.Context, req *types.QueryM
}

// Bech32Prefix returns the keeper internally stored bech32 prefix.
func (ak accountKeeper) Bech32Prefix(ctx context.Context, req *types.Bech32PrefixRequest) (*types.Bech32PrefixResponse, error) {
func (ak AccountKeeper) Bech32Prefix(ctx context.Context, req *types.Bech32PrefixRequest) (*types.Bech32PrefixResponse, error) {
bech32Prefix, err := ak.getBech32Prefix()
if err != nil {
return nil, err
Expand All @@ -172,7 +172,7 @@ func (ak accountKeeper) Bech32Prefix(ctx context.Context, req *types.Bech32Prefi

// AddressBytesToString converts an address from bytes to string, using the
// keeper's bech32 prefix.
func (ak accountKeeper) AddressBytesToString(ctx context.Context, req *types.AddressBytesToStringRequest) (*types.AddressBytesToStringResponse, error) {
func (ak AccountKeeper) AddressBytesToString(ctx context.Context, req *types.AddressBytesToStringRequest) (*types.AddressBytesToStringResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand All @@ -191,7 +191,7 @@ func (ak accountKeeper) AddressBytesToString(ctx context.Context, req *types.Add

// AddressStringToBytes converts an address from string to bytes, using the
// keeper's bech32 prefix.
func (ak accountKeeper) AddressStringToBytes(ctx context.Context, req *types.AddressStringToBytesRequest) (*types.AddressStringToBytesResponse, error) {
func (ak AccountKeeper) AddressStringToBytes(ctx context.Context, req *types.AddressStringToBytesRequest) (*types.AddressStringToBytesResponse, error) {
if req == nil {
return nil, status.Error(codes.InvalidArgument, "empty request")
}
Expand Down
Loading

0 comments on commit 9c20eac

Please sign in to comment.