Skip to content

Commit

Permalink
Use ReadFileWithSizeLimit on x/distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
tnasu committed Oct 7, 2022
1 parent 741d0a8 commit 7b4bb6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (x/foundation) [\#686](https://github.com/line/lbm-sdk/pull/686) remove `Minthreshold` and `MinPercentage` from x/foundation config
* (x/foundation) [\#693](https://github.com/line/lbm-sdk/pull/693) add pool to the state of x/foundation
* (x/wasm) [\#696](https://github.com/line/lbm-sdk/pull/696) x/wasm - add checking a wasm file size before reading it
* (x/distribution) [\#696](https://github.com/line/lbm-sdk/pull/696) x/distribution - add checking a proposal file size before reading it

### Bug Fixes
* (x/wasm) [\#453](https://github.com/line/lbm-sdk/pull/453) modify wasm grpc query api path
Expand Down
8 changes: 5 additions & 3 deletions x/distribution/client/cli/utils.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
package cli

import (
"os"

"github.com/line/lbm-sdk/codec"
"github.com/line/lbm-sdk/internal/os"
"github.com/line/lbm-sdk/x/distribution/types"
)

// ParseCommunityPoolSpendProposalWithDeposit reads and parses a CommunityPoolSpendProposalWithDeposit from a file.
func ParseCommunityPoolSpendProposalWithDeposit(cdc codec.JSONCodec, proposalFile string) (types.CommunityPoolSpendProposalWithDeposit, error) {
proposal := types.CommunityPoolSpendProposalWithDeposit{}

contents, err := os.ReadFile(proposalFile)
// 2M size limit is enough for a proposal.
// Check the proposals:
// https://hubble.figment.io/cosmos/chains/cosmoshub-4/governance
contents, err := os.ReadFileWithSizeLimit(proposalFile, 2*1024*1024)
if err != nil {
return proposal, err
}
Expand Down

0 comments on commit 7b4bb6e

Please sign in to comment.