Skip to content

Commit

Permalink
Merge branch 'main' into fix/add_error_message
Browse files Browse the repository at this point in the history
  • Loading branch information
da1suk8 authored Oct 21, 2022
2 parents 4f29717 + 1e53873 commit d3bc33e
Show file tree
Hide file tree
Showing 135 changed files with 4,715 additions and 1,968 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- uses: ./.github/actions/generate-swagger
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -51,7 +51,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -78,7 +78,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/sims_normal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -39,7 +39,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -57,7 +57,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand All @@ -75,7 +75,7 @@ jobs:
needs: [build, install-runsim]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
go-version: 1.18
- name: Unshallow
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
install-tparse:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- name: Display go version
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
- run: sudo apt update && sudo apt install -y ${{ matrix.package }} qemu-user-binfmt
if: "matrix.package != ''"
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- uses: technote-space/[email protected]
Expand All @@ -65,7 +65,7 @@ jobs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/[email protected].0
# - uses: actions/[email protected].1
# with:
# go-version: 1.18
# - name: Display go version
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
part: ["00", "01", "02", "03"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- uses: technote-space/[email protected]
Expand Down Expand Up @@ -198,7 +198,7 @@ jobs:
part: ["00", "01", "02", "03"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected].0
- uses: actions/[email protected].1
with:
go-version: 1.18
- uses: technote-space/[email protected]
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/ibc) [\#651](https://github.com/line/lbm-sdk/pull/651) feat: update x/ibc to support github.com/cosmos/[email protected]
* (config) [\#665](https://github.com/line/lbm-sdk/pull/665) remove bech32-cache-size
* (x/foundation) [\#709](https://github.com/line/lbm-sdk/pull/709) add `gov mint` for x/foundation proposal
* (iavl) [\#738](https://github.com/line/lbm-sdk/pull/738) bump github.com/cosmos/iavl from v0.17.3 to v0.19.3

### Improvements

Expand Down Expand Up @@ -84,6 +85,9 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/bank) [\#716](https://github.com/line/lbm-sdk/pull/716) remove useless DenomMetadata key function
* (x/foundation) [\#704](https://github.com/line/lbm-sdk/pull/704) update x/foundation params
* (x/wasm) [\#695](https://github.com/line/lbm-sdk/pull/695) fix to prevent external filesystem dependency of simulation
* (x/foundation) [\#729](https://github.com/line/lbm-sdk/pull/729) add UpdateParams to x/foundation
* (amino) [\#736](https://github.com/line/lbm-sdk/pull/736) apply the missing amino codec registratoin of cosmos-sdk
* (x/foundation) [\#744](https://github.com/line/lbm-sdk/pull/744) revisit foundation operator
* (store,x/wasm) [\#742](https://github.com/line/lbm-sdk/pull/742) fix to add error message in GetByteCode()

### Bug Fixes
Expand All @@ -105,8 +109,15 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (global) [\#694](https://github.com/line/lbm-sdk/pull/694) replace deprecated functions since go 1.16 or 1.17
* (x/bankplus) [\#705](https://github.com/line/lbm-sdk/pull/705) add missing blockedAddr checking in bankplus
* (x/foundation) [\#712](https://github.com/line/lbm-sdk/pull/712) fix x/foundation EndBlocker
* (x/feegrant) [\#720](https://github.com/line/lbm-sdk/pull/720) remove potential runtime panic in x/feegrant
* (baseapp) [\#724](https://github.com/line/lbm-sdk/pull/724) add checking pubkey type from validator params
* (x/staking) [\#726](https://github.com/line/lbm-sdk/pull/726) check allowedList size in StakeAuthorization.Accept()
* (x/staking) [\#728](https://github.com/line/lbm-sdk/pull/728) fix typo in unbondingToUnbonded() panic
* (crypto) [\#731](https://github.com/line/lbm-sdk/pull/731) remove VRFProve function
* (x/foundation) [\#732](https://github.com/line/lbm-sdk/pull/732) add verification on accounts into x/foundation Grants cli
* (x/foundation) [\#730](https://github.com/line/lbm-sdk/pull/730) prune stale x/foundation proposals at voting period end
* (cli) [\#734](https://github.com/line/lbm-sdk/pull/734) add restrictions on the number of args in the CLIs
* (client) [\#737](https://github.com/line/lbm-sdk/pull/737) check multisig key list to prevent unexpected key deletion

### Breaking Changes
* (proto) [\#564](https://github.com/line/lbm-sdk/pull/564) change gRPC path to original cosmos path
Expand All @@ -131,3 +142,4 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (docs) [\#483](https://github.com/line/lbm-sdk/pull/483) update documents on x/stakingplus
* (docs) [\#490](https://github.com/line/lbm-sdk/pull/490) update documents on x/consortium
* (docs) [\#602](https://github.com/line/lbm-sdk/pull/602) update outdated events in specs
* (docs) [\#721](https://github.com/line/lbm-sdk/pull/721) update x/foundation specification
9 changes: 9 additions & 0 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ func TestGetBlockRentionHeight(t *testing.T) {
commitHeight: 499000,
expected: 0,
},
"iavl disable fast node": {
bapp: NewBaseApp(
name, logger, db, nil,
SetIAVLDisableFastNode(true),
),
maxAgeBlocks: 0,
commitHeight: 499000,
expected: 0,
},
}

for name, tc := range testCases {
Expand Down
11 changes: 6 additions & 5 deletions baseapp/baseapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
dbm "github.com/tendermint/tm-db"

"github.com/line/lbm-sdk/codec"
"github.com/line/lbm-sdk/codec/legacy"
"github.com/line/lbm-sdk/snapshots"
snapshottypes "github.com/line/lbm-sdk/snapshots/types"
"github.com/line/lbm-sdk/store/rootmulti"
Expand Down Expand Up @@ -91,10 +92,10 @@ func registerTestCodec(cdc *codec.LegacyAmino) {

// register test types
cdc.RegisterConcrete(&txTest{}, "cosmos-sdk/baseapp/txTest", nil)
cdc.RegisterConcrete(&msgCounter{}, "cosmos-sdk/baseapp/msgCounter", nil)
cdc.RegisterConcrete(&msgCounter2{}, "cosmos-sdk/baseapp/msgCounter2", nil)
cdc.RegisterConcrete(&msgKeyValue{}, "cosmos-sdk/baseapp/msgKeyValue", nil)
cdc.RegisterConcrete(&msgNoRoute{}, "cosmos-sdk/baseapp/msgNoRoute", nil)
legacy.RegisterAminoMsg(cdc, &msgCounter{}, "cosmos-sdk/baseapp/msgCounter")
legacy.RegisterAminoMsg(cdc, &msgCounter2{}, "cosmos-sdk/baseapp/msgCounter2")
legacy.RegisterAminoMsg(cdc, &msgKeyValue{}, "cosmos-sdk/baseapp/msgKeyValue")
legacy.RegisterAminoMsg(cdc, &msgNoRoute{}, "cosmos-sdk/baseapp/msgNoRoute")
}

// aminoTxEncoder creates a amino TxEncoder for testing purposes.
Expand Down Expand Up @@ -1257,7 +1258,7 @@ func TestRunInvalidTransaction(t *testing.T) {
// new codec so we can encode the tx, but we shouldn't be able to decode
newCdc := codec.NewLegacyAmino()
registerTestCodec(newCdc)
newCdc.RegisterConcrete(&msgNoDecode{}, "cosmos-sdk/baseapp/msgNoDecode", nil)
legacy.RegisterAminoMsg(newCdc, &msgNoDecode{}, "cosmos-sdk/baseapp/msgNoDecode")

txBytes, err := newCdc.Marshal(tx)
require.NoError(t, err)
Expand Down
5 changes: 5 additions & 0 deletions baseapp/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ func SetIAVLCacheSize(size int) func(*BaseApp) {
return func(bapp *BaseApp) { bapp.cms.SetIAVLCacheSize(size) }
}

// SetIAVLDisableFastNode enables(false)/disables(true) fast node usage from the IAVL store.
func SetIAVLDisableFastNode(disable bool) func(*BaseApp) {
return func(bapp *BaseApp) { bapp.cms.SetIAVLDisableFastNode(disable) }
}

// SetInterBlockCache provides a BaseApp option function that sets the
// inter-block cache.
func SetInterBlockCache(cache sdk.MultiStorePersistentCache) func(*BaseApp) {
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33584,11 +33584,6 @@ paths:
description: info is the FoundationInfo for the foundation.
type: object
properties:
operator:
type: string
description: >-
operator is the account address of the foundation's
operator.
version:
type: string
format: uint64
Expand Down Expand Up @@ -68691,9 +68686,6 @@ definitions:
lbm.foundation.v1.FoundationInfo:
type: object
properties:
operator:
type: string
description: operator is the account address of the foundation's operator.
version:
type: string
format: uint64
Expand Down Expand Up @@ -69116,9 +69108,6 @@ definitions:
description: info is the FoundationInfo for the foundation.
type: object
properties:
operator:
type: string
description: operator is the account address of the foundation's operator.
version:
type: string
format: uint64
Expand Down
45 changes: 34 additions & 11 deletions client/keys/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"math"
"sort"

bip39 "github.com/cosmos/go-bip39"
"github.com/cosmos/go-bip39"
"github.com/spf13/cobra"

"github.com/line/lbm-sdk/client"
Expand Down Expand Up @@ -95,15 +95,17 @@ func runAddCmdPrepare(cmd *cobra.Command, args []string) error {

/*
input
- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password
- bip39 mnemonic
- bip39 passphrase
- bip44 path
- local encryption password
output
- armor encrypted private key (saved to file)
- armor encrypted private key (saved to file)
*/
func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *bufio.Reader) error {
var err error
var multisigThreshold int

name := args[0]
interactive, _ := cmd.Flags().GetBool(flagInteractive)
Expand All @@ -118,6 +120,18 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
if err != nil {
return err
}
multisigKeys, _ := cmd.Flags().GetStringSlice(flagMultisig)
if len(multisigKeys) != 0 {
multisigThreshold, _ = cmd.Flags().GetInt(flagMultiSigThreshold)
if err = validateMultisigThreshold(multisigThreshold, len(multisigKeys)); err != nil {
return err
}

err = verifyMultisigTarget(kb, multisigKeys, name)
if err != nil {
return err
}
}

if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun {
// use in memory keybase
Expand All @@ -141,13 +155,8 @@ func runAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf
}
}

multisigKeys, _ := cmd.Flags().GetStringSlice(flagMultisig)
if len(multisigKeys) != 0 {
pks := make([]cryptotypes.PubKey, len(multisigKeys))
multisigThreshold, _ := cmd.Flags().GetInt(flagMultiSigThreshold)
if err := validateMultisigThreshold(multisigThreshold, len(multisigKeys)); err != nil {
return err
}

for i, keyname := range multisigKeys {
k, err := kb.Key(keyname)
Expand Down Expand Up @@ -327,3 +336,17 @@ func printCreate(cmd *cobra.Command, info keyring.Info, showMnemonic bool, mnemo

return nil
}

func verifyMultisigTarget(kb keyring.Keyring, multisigKeys []string, newkey string) error {
if _, err := kb.Key(newkey); err == nil {
return errors.New("you cannot specify a new key as one of the names of the keys that make up a multisig")
}

for _, k := range multisigKeys {
if _, err := kb.Key(k); err != nil {
return errors.New("part of the multisig target key does not exist")
}
}

return nil
}
Loading

0 comments on commit d3bc33e

Please sign in to comment.