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

Wasmd precompile: QuerySmart to always use cached ctx #1908

Merged
merged 13 commits into from
Nov 7, 2024
Merged
2 changes: 1 addition & 1 deletion contracts/test/ERC20toCW20PointerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe("ERC20 to CW20 Pointer", function () {
});

describe("transfer()", function () {
it.only("should transfer", async function () {
it("should transfer", async function () {
let sender = accounts[0];
let recipient = accounts[1];

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ require (
)

replace (
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.4
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.5-0.20241107175838-0d53ba130a0e
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.44
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1359,8 +1359,8 @@ github.com/sei-protocol/sei-tendermint v0.4.3 h1:/Nx3Q309B4N61P3e6ScYiVuHgBRdapc
github.com/sei-protocol/sei-tendermint v0.4.3/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
github.com/sei-protocol/sei-wasmd v0.2.4 h1:W++xiJ1P57BhBW8TGk8vfPRJlWXr1vp2kQCvSc8Qpaw=
github.com/sei-protocol/sei-wasmd v0.2.4/go.mod h1:fKHnK3Nms+BZeGvXeIC3SEzUDfkB7/tYOf95kVOhiO4=
github.com/sei-protocol/sei-wasmd v0.2.5-0.20241107175838-0d53ba130a0e h1:/w3VQZBOzCUQNDLFdAPm3nguyD7l2K6453E+U++2p40=
github.com/sei-protocol/sei-wasmd v0.2.5-0.20241107175838-0d53ba130a0e/go.mod h1:fKHnK3Nms+BZeGvXeIC3SEzUDfkB7/tYOf95kVOhiO4=
github.com/sei-protocol/tm-db v0.0.4 h1:7Y4EU62Xzzg6wKAHEotm7SXQR0aPLcGhKHkh3qd0tnk=
github.com/sei-protocol/tm-db v0.0.4/go.mod h1:PWsIWOTwdwC7Ow/GUvx8HgUJTO691pBuorIQD8JvwAs=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
Expand Down
2 changes: 1 addition & 1 deletion precompiles/common/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type WasmdKeeper interface {
}

type WasmdViewKeeper interface {
QuerySmart(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
QuerySmartSafe(ctx sdk.Context, contractAddr sdk.AccAddress, req []byte) ([]byte, error)
}

type StakingKeeper interface {
Expand Down
4 changes: 2 additions & 2 deletions precompiles/pointer/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
if err != nil {
return nil, 0, err
}
res, err := p.wasmdKeeper.QuerySmart(ctx, cwAddress, []byte("{\"token_info\":{}}"))
res, err := p.wasmdKeeper.QuerySmartSafe(ctx, cwAddress, []byte("{\"token_info\":{}}"))

Check warning on line 137 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L137

Added line #L137 was not covered by tests
if err != nil {
return nil, 0, err
}
Expand Down Expand Up @@ -165,7 +165,7 @@
if err != nil {
return nil, 0, err
}
res, err := p.wasmdKeeper.QuerySmart(ctx, cwAddress, []byte("{\"contract_info\":{}}"))
res, err := p.wasmdKeeper.QuerySmartSafe(ctx, cwAddress, []byte("{\"contract_info\":{}}"))

Check warning on line 168 in precompiles/pointer/pointer.go

View check run for this annotation

Codecov / codecov/patch

precompiles/pointer/pointer.go#L168

Added line #L168 was not covered by tests
if err != nil {
return nil, 0, err
}
Expand Down
3 changes: 1 addition & 2 deletions precompiles/wasmd/wasmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,7 @@ func (p PrecompileExecutor) query(ctx sdk.Context, method *abi.Method, args []in
rerr = err
return
}

res, err := p.wasmdViewKeeper.QuerySmart(ctx, contractAddr, req)
res, err := p.wasmdViewKeeper.QuerySmartSafe(ctx, contractAddr, req)
if err != nil {
rerr = err
return
Expand Down
Loading