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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
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.20241030192608-020d4a9bb21c
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.41
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.3.9-0.20240926181940-e9348a908b27 h1:I
github.com/sei-protocol/sei-tendermint v0.3.9-0.20240926181940-e9348a908b27/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.20241030192608-020d4a9bb21c h1:byFrp4tO+F6OOnqTVWDCp0DhkFo5/Q+BJumNpnrUAus=
github.com/sei-protocol/sei-wasmd v0.2.5-0.20241030192608-020d4a9bb21c/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 @@ -79,7 +79,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