Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge wasmd v0.27.0 #570

Merged
merged 144 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
8e5f86d
Important: add iterator feature support
ethanfrey Sep 22, 2021
51db87b
Fix inconsistent return of contractAddress from keeper/init()
assafmo Sep 22, 2021
5eaa33d
Handle contract info query
alpe Sep 27, 2021
7596bc4
Implement tx counter for transaction info
alpe Sep 27, 2021
eba1387
Treat all contracts as pinned for gas costs in reply
ethanfrey Oct 7, 2021
40a4f52
Adjust gas prices in tests
ethanfrey Oct 7, 2021
566713c
Query all pinned code ids
alpe Oct 7, 2021
a488fab
Upgrade wasmvm-v1.0.0-soon2
alpe Oct 7, 2021
f985d50
Benchmarks for gas pricing
ethanfrey Oct 8, 2021
c1d2cb5
Update gas costs
alpe Oct 8, 2021
4e90a9b
fix: fix build error
shiki-tak Jun 8, 2022
7ff106e
remove unused flags from cmd prompt
fkneeland-figure Oct 14, 2021
43d8345
Add golangci lint check on pull requests
fkneeland-figure Oct 25, 2021
5e4eb96
Fix message representation for signing
alpe Oct 25, 2021
d247e9c
Add linter name and minor golint related updates
alpe Oct 25, 2021
763762e
Fixed wrong error message when lastCodeID value is incorrect
fkneeland-figure Oct 26, 2021
c62d0d9
Disable false positive
alpe Oct 26, 2021
c2b8b3c
Open read access to sequences
alpe Nov 5, 2021
aa6e12a
Limit simulation gas
alpe Nov 17, 2021
95f7d37
fix: build error
shiki-tak Jun 9, 2022
ac0957c
Return NoSuchContract system error instead of sdk error in ContractIn…
maurolacy Dec 16, 2021
0aa7bff
Implement PinCode and UnpinCode proposal client handlers (#707)
orkunkl Dec 23, 2021
dbf864e
Upgrade wasmvm to v1.0.0-beta5
alpe Jan 4, 2022
68a1a39
Upgrade to cosmos-sdk v0.45.0
alpe Jan 20, 2022
06c83fe
Proper systemerror follow-up
maurolacy Jan 20, 2022
86d0a86
Failing test showing it was not currently pinned
ethanfrey Jan 20, 2022
c2c461e
And properly pin it on governance vote
ethanfrey Jan 20, 2022
fa95a2f
Require --no-admin flag if no admin set
ethanfrey Jan 20, 2022
e1d1e12
Fix tests, handle genesis init as well
ethanfrey Jan 20, 2022
0fb3d3e
Fixed error message capitalization
ethanfrey Jan 21, 2022
d1e6f74
Add new proto types for the sudo an execute proposals
ethanfrey Jan 21, 2022
dde48d8
Compile proto files
shiki-tak Jun 14, 2022
a539857
Registered new proposal types
ethanfrey Jan 21, 2022
c612791
fix: remove unnecessary print
shiki-tak Jun 14, 2022
b3ec5ec
Wire up proposal handlers
ethanfrey Jan 21, 2022
ee96128
Wire up cli for exec and sudo proposal
ethanfrey Jan 21, 2022
ba93d96
Add rest routes for proposals;
ethanfrey Jan 24, 2022
72266ee
Add tests for Rest client
ethanfrey Jan 24, 2022
f9be9b2
Test execute and sudo proposal handlers
ethanfrey Jan 24, 2022
12faa2d
Remove RunAs from Migrate proposal
ethanfrey Jan 24, 2022
d13503b
fix tests
ethanfrey Jan 24, 2022
21163d8
Allow sending tokens along with governance wasm_execute proposal
ethanfrey Jan 24, 2022
5b639c7
Update documentation
ethanfrey Jan 24, 2022
275e1c5
Minor integration support
alpe Jan 28, 2022
0ccbd77
add missing colons in String of some proposals
loloicci Feb 10, 2022
a8c5282
Replace custom codec with sdk codec
alpe Feb 21, 2022
a5acf9f
Redact errors returned in reply
ethanfrey Feb 23, 2022
d672287
Fix lint error, failing test
ethanfrey Feb 23, 2022
abc8088
Fix submessage tests
ethanfrey Feb 23, 2022
fe5cf17
Adjust error string
ethanfrey Mar 2, 2022
3308c2d
Handle nil logger again
ethanfrey Mar 2, 2022
1e77542
Revert "Handle nil logger again"
alpe Mar 2, 2022
e485eb5
Fix test setup and assertions
alpe Mar 2, 2022
6225729
Add no admin flag for gov
alpe Mar 2, 2022
809883d
Relaxed address strength restrictions for legacy 20 byte addresses
iramiller Mar 3, 2022
ee91fa3
Make utils methods public
pinosu Mar 3, 2022
62e2ba7
Mark a whole lot of tests to skip on m1 as they core dump
ethanfrey Mar 7, 2022
b5362ba
Redact query errors
ethanfrey Mar 7, 2022
7684efc
Add deny list for some grpc queries
ethanfrey Mar 7, 2022
e24b4c4
fix: build error
shiki-tak Jun 15, 2022
e395e2f
Make type conversion helpers public
alpe Mar 9, 2022
cd78988
cleanup from PR comments
ethanfrey Mar 9, 2022
3a7a96e
fix: rename path
shiki-tak Jun 15, 2022
324b727
Improve how we redact query errors
ethanfrey Mar 9, 2022
ce654a8
Skip a few more tests on m1
ethanfrey Mar 9, 2022
d21ed2a
Ensure SystemError is consistently unredacted
ethanfrey Mar 9, 2022
cebe17d
fix: close iterators
albertchon Mar 22, 2022
7ca8673
Use callback pattern for contract state iterator
alpe Mar 25, 2022
b689f00
Add more tests for event edge cases
alpe Apr 6, 2022
35e17c4
fix: build error
shiki-tak Jun 16, 2022
596bf38
Unpack contract details from genesis
alpe Apr 12, 2022
1672d37
Revisit gov params doc and tests
alpe Apr 13, 2022
9beb9db
Add missing sudo and execute to codec
the-frey Apr 17, 2022
e874cf6
Add a basic validation test
the-frey Apr 17, 2022
5d9946d
Disable stargate queries
webmaster128 Apr 14, 2022
aca49b5
Remove dead code to make linter happy
webmaster128 Apr 21, 2022
e4a9894
Add ExecuteContractProposal test
the-frey Apr 21, 2022
6be179a
Make MaxLabelSize a var not const
ethanfrey Apr 27, 2022
606ba24
Add and test JSON object matcher
webmaster128 Apr 27, 2022
64da1eb
fix: fix import
shiki-tak Jun 16, 2022
81823ed
Make IsJSONObjectWithTopLevelKey public
webmaster128 Apr 27, 2022
930c4c0
Add WasmSnapshotter
assafmo Apr 25, 2022
1e31d3c
Make snapshot from keeper
ethanfrey Apr 27, 2022
de4689a
Rough draft of the restore method using multistore
ethanfrey Apr 27, 2022
4e2e7c4
properly register the snapshot manager
ethanfrey Apr 27, 2022
a8ce0cc
Move snapshotter to keeper and implement
ethanfrey Apr 27, 2022
69cd2b3
Add compression to snapshot wasm bytecode
ethanfrey Apr 27, 2022
713a951
Put GzipIt and Uncompress logic in a common folder
ethanfrey Apr 27, 2022
0f3fb97
Fix linting errors
ethanfrey Apr 27, 2022
6c33a30
Avoid sending duplicate wasm codes over the wire
ethanfrey Apr 27, 2022
1689a19
Properly handle when a message not for this extension arrives
ethanfrey Apr 27, 2022
34df544
Start testing snapshots
ethanfrey Apr 27, 2022
a3c98e1
Basic tend to end test for no errors
ethanfrey Apr 27, 2022
516d24d
Address @giansalex PR comments
ethanfrey Apr 27, 2022
e0ea888
Updates inspired by @giansalex branch
ethanfrey Apr 28, 2022
6cc82c5
Cannot commit in my test cases to load from proper height
ethanfrey Apr 28, 2022
8432d2b
SRemove loading history until I can fix tests here
ethanfrey Apr 28, 2022
100e4b6
Cleanup from Simon's comments
ethanfrey Apr 28, 2022
a974edd
Consolidate MaxWasmSize constraints into a single var
alpe Apr 29, 2022
febb194
fix: allow no admin in instantiation through proposal
jhernandezb May 2, 2022
5eb0a99
Add instantiate-nobody flag to cli store cmd (#827)
jhernandezb May 3, 2022
9359d65
Add MsgStoreCode and MsgInstantiateContract support to simulations
pinosu May 3, 2022
1a93cf4
Add snapshotter integration tests and minor cleanup
alpe May 3, 2022
de133ca
Minor test update
alpe May 3, 2022
01030e6
Fix linter warnings
alpe May 3, 2022
e4ed0e6
Delete duplicate testdata from simulation
pinosu May 3, 2022
0abdd6a
fix: build error
shiki-tak Jun 17, 2022
fef78a9
Fix contract path in simulations
alpe May 4, 2022
364346e
Add instantiate permission to CodeInfoResponse
jhernandezb May 5, 2022
d2c0bf8
chore: comment out snapshotter
shiki-tak Jun 17, 2022
f9573e6
Minor godoc update
alpe May 6, 2022
bd104e1
Bump wasmvm to v1.0.0-rc.0
alpe May 6, 2022
f2fc24a
Add libwasm-version query command
jhernandezb May 9, 2022
44e8e5d
add UpdateInstantiateConfig gov proposal
jhernandezb Apr 1, 2022
e8a1a61
update UpdateInstantiateConfigProposal proto definition
jhernandezb May 4, 2022
9456862
add to EnableAllProposals
jhernandezb May 5, 2022
a85ff59
add tests
jhernandezb May 5, 2022
feea968
fix: fix test error
shiki-tak Jun 17, 2022
2894e75
Add handlers
jhernandezb May 5, 2022
83cdcc3
add code-info query command
jhernandezb May 6, 2022
4e8029e
fix missing gov registration type
jhernandezb May 6, 2022
8e0ef5c
address code review comments
jhernandezb May 6, 2022
b360591
fix error message
jhernandezb May 6, 2022
f7f39aa
update proto field name
jhernandezb May 9, 2022
e003aae
Add compare logic for stricter AccessConfig
ethanfrey May 9, 2022
3e4ba9b
Enforce permission less permissive than default
ethanfrey May 9, 2022
cb271f2
Add a few more tests as requested in review
ethanfrey May 10, 2022
f4bb19c
Use LibwasmvmVersion from wasmvm root
webmaster128 May 16, 2022
78dcab0
Adapt codebase to new IBC3ChannelOpenResponse return value
webmaster128 May 16, 2022
bae4439
fix: test error
shiki-tak Jun 17, 2022
8544575
Use wasmvm import consistently
webmaster128 May 16, 2022
85751fa
Prepare release notes for 0.27
ethanfrey May 17, 2022
77cc9aa
Create query stack size limit
webmaster128 May 19, 2022
73ea0c2
fix: fix test error
shiki-tak Jun 21, 2022
f4f534a
fix: lint error
shiki-tak Jun 21, 2022
8fe027e
chore: update wasmvm version
shiki-tak Jun 21, 2022
a5775f3
Merge branch 'main' of github.com:line/lbm-sdk into issues/555
shiki-tak Jun 21, 2022
f38b645
chore: coverage up
shiki-tak Jun 27, 2022
cce1ef5
fix: change ContractAddrLen
shiki-tak Jul 7, 2022
c1d3995
fix: fix protobuf path
shiki-tak Jul 7, 2022
18ae5e2
fix: apply review
shiki-tak Jul 7, 2022
d704996
fix: fix typo & missing commit
shiki-tak Jul 7, 2022
7955f0b
chore: adjust gas
shiki-tak Jul 7, 2022
dba039e
chore: update go.mod
shiki-tak Jul 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions x/wasm/keeper/query_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"

channeltypes "github.com/line/lbm-sdk/x/ibc/core/04-channel/types"
"github.com/line/lbm-sdk/x/wasm/types"
Expand Down Expand Up @@ -290,18 +289,9 @@ func IBCQuerier(wasm contractMetaDataSource, channelKeeper types.ChannelKeeper)
}
}

var queryDenyList = []string{
"/lbm.tx.",
"/lbm.base.ostracon.",
}

func StargateQuerier(queryRouter GRPCQueryRouter) func(ctx sdk.Context, request *wasmvmtypes.StargateQuery) ([]byte, error) {
return func(ctx sdk.Context, msg *wasmvmtypes.StargateQuery) ([]byte, error) {
for _, b := range queryDenyList {
if strings.HasPrefix(msg.Path, b) {
return nil, wasmvmtypes.UnsupportedRequest{Kind: "path is not allowed from the contract"}
}
}
return nil, wasmvmtypes.UnsupportedRequest{Kind: "Stargate queries are disabled."}

route := queryRouter.Route(msg.Path)
if route == nil {
Expand Down
57 changes: 25 additions & 32 deletions x/wasm/keeper/reflect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,34 +356,6 @@ func TestReflectStargateQuery(t *testing.T) {
require.Equal(t, len(expectedBalance), len(simpleBalance.Amount))
assert.Equal(t, simpleBalance.Amount[0].Amount, expectedBalance[0].Amount.String())
assert.Equal(t, simpleBalance.Amount[0].Denom, expectedBalance[0].Denom)

// now, try to build a protobuf query
protoQuery := banktypes.QueryAllBalancesRequest{
Address: creator.String(),
}
protoQueryBin, err := proto.Marshal(&protoQuery)
protoRequest := wasmvmtypes.QueryRequest{
Stargate: &wasmvmtypes.StargateQuery{
Path: "/lbm.bank.v1.Query/AllBalances",
Data: protoQueryBin,
},
}
protoQueryBz, err := json.Marshal(ReflectQueryMsg{
Chain: &ChainQuery{Request: &protoRequest},
})
require.NoError(t, err)

// make a query on the chain
protoRes, err := keeper.QuerySmart(ctx, contractAddr, protoQueryBz)
require.NoError(t, err)
var protoChain ChainResponse
mustParse(t, protoRes, &protoChain)

// unmarshal raw protobuf response
var protoResult banktypes.QueryAllBalancesResponse
err = proto.Unmarshal(protoChain.Data, &protoResult)
require.NoError(t, err)
assert.Equal(t, expectedBalance, protoResult.Balances)
}

func TestReflectInvalidStargateQuery(t *testing.T) {
Expand All @@ -409,10 +381,14 @@ func TestReflectInvalidStargateQuery(t *testing.T) {
require.NotEmpty(t, contractAddr)

// now, try to build a protobuf query
protoQuery := banktypes.QueryAllBalancesRequest{
Address: creator.String(),
}
protoQueryBin, err := proto.Marshal(&protoQuery)
protoRequest := wasmvmtypes.QueryRequest{
Stargate: &wasmvmtypes.StargateQuery{
Path: "/lbm.tx.v1.Service/GetTx",
Data: []byte{},
Path: "/lbm.bank.v1.Query/AllBalances",
Data: protoQueryBin,
},
}
protoQueryBz, err := json.Marshal(ReflectQueryMsg{
Expand All @@ -423,7 +399,24 @@ func TestReflectInvalidStargateQuery(t *testing.T) {
// make a query on the chain, should be blacklisted
_, err = keeper.QuerySmart(ctx, contractAddr, protoQueryBz)
require.Error(t, err)
require.Contains(t, err.Error(), "path is not allowed from the contract")
require.Contains(t, err.Error(), "Stargate queries are disabled")

// now, try to build a protobuf query
protoRequest = wasmvmtypes.QueryRequest{
Stargate: &wasmvmtypes.StargateQuery{
Path: "/cosmos.tx.v1beta1.Service/GetTx",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cosmos -> lbm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cosmos ok becase it is the following proto file?
https://github.com/line/lbm-sdk/blob/main/proto/cosmos/tx/v1beta1/service.proto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loloicci, This proto path was changes in #564 .

Data: []byte{},
},
}
protoQueryBz, err = json.Marshal(ReflectQueryMsg{
Chain: &ChainQuery{Request: &protoRequest},
})
require.NoError(t, err)

// make a query on the chain, should be blacklisted
_, err = keeper.QuerySmart(ctx, contractAddr, protoQueryBz)
require.Error(t, err)
require.Contains(t, err.Error(), "Stargate queries are disabled")

// and another one
protoRequest = wasmvmtypes.QueryRequest{
Expand All @@ -440,7 +433,7 @@ func TestReflectInvalidStargateQuery(t *testing.T) {
// make a query on the chain, should be blacklisted
_, err = keeper.QuerySmart(ctx, contractAddr, protoQueryBz)
require.Error(t, err)
require.Contains(t, err.Error(), "path is not allowed from the contract")
require.Contains(t, err.Error(), "Stargate queries are disabled")
}

type reflectState struct {
Expand Down
2 changes: 1 addition & 1 deletion x/wasm/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (p SudoContractProposal) ValidateBasic() error {
if err := validateProposalCommons(p.Title, p.Description); err != nil {
return err
}
if _, err := sdk.AccAddressFromHex(p.Contract); err != nil {
if err := sdk.ValidateAccAddress(p.Contract); err != nil {
return sdkerrors.Wrap(err, "contract")
}
if err := p.Msg.ValidateBasic(); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions x/wasm/types/test_fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ func MigrateContractProposalFixture(mutators ...func(p *MigrateContractProposal)

func SudoContractProposalFixture(mutators ...func(p *SudoContractProposal)) *SudoContractProposal {
const (
contractAddr = "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4"
contractAddr = "link1hcttwju93d5m39467gjcq63p5kc4fdcn30dgd8"
anyAddress = "link1qyqszqgpqyqszqgpqyqszqgpqyqszqgp8apuk5"
)

p := &SudoContractProposal{
Expand Down