Skip to content

Commit

Permalink
implicit memory aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Aug 24, 2023
1 parent 2161113 commit fcecbf6
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions x/wasm/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func InitGenesis(ctx sdk.Context, keeper *Keeper, data types.GenesisState) ([]ab

var maxContractID int
for i, contract := range data.Contracts {
contract := contract
contractAddr, err := sdk.AccAddressFromBech32(contract.ContractAddress)
if err != nil {
return nil, errorsmod.Wrapf(err, "address in contract number %d", i)
Expand Down
2 changes: 2 additions & 0 deletions x/wasm/keeper/handler_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ func TestIBCRawPacketHandler(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
capturedPacket = nil
// when
Expand Down Expand Up @@ -386,6 +387,7 @@ func TestBurnCoinMessageHandlerIntegration(t *testing.T) {
}
parentCtx := ctx
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
ctx, _ = parentCtx.CacheContext()
k.wasmVM = &wasmtesting.MockWasmer{ExecuteFn: func(codeID wasmvm.Checksum, env wasmvmtypes.Env, info wasmvmtypes.MessageInfo, executeMsg []byte, store wasmvm.KVStore, goapi wasmvm.GoAPI, querier wasmvm.Querier, gasMeter wasmvm.GasMeter, gasLimit uint64, deserCost wasmvmtypes.UFraction) (*wasmvmtypes.Response, uint64, error) {
Expand Down
1 change: 1 addition & 0 deletions x/wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ func TestInstantiateWithPermissions(t *testing.T) {
},
}
for msg, spec := range specs {
spec := spec
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, AvailableCapabilities)
accKeeper, bankKeeper, keeper := keepers.AccountKeeper, keepers.BankKeeper, keepers.ContractKeeper
Expand Down
3 changes: 3 additions & 0 deletions x/wasm/keeper/msg_server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ func TestUpdateParams(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
err := wasmApp.WasmKeeper.SetParams(ctx, types.DefaultParams())
require.NoError(t, err)
Expand Down Expand Up @@ -215,6 +216,7 @@ func TestAddCodeUploadParamsAddresses(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
err := wasmApp.WasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: spec.uploadConfig,
Expand Down Expand Up @@ -311,6 +313,7 @@ func TestRemoveCodeUploadParamsAddresses(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
err := wasmApp.WasmKeeper.SetParams(ctx, types.Params{
CodeUploadAccess: spec.uploadConfig,
Expand Down
1 change: 1 addition & 0 deletions x/wasm/keeper/proposal_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ func TestAdminProposals(t *testing.T) {
},
}
for msg, spec := range specs {
spec := spec
t.Run(msg, func(t *testing.T) {
ctx, keepers := CreateTestInput(t, false, "staking")
wasmKeeper := keepers.WasmKeeper
Expand Down
3 changes: 3 additions & 0 deletions x/wasm/keeper/querier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ func TestQueryContractHistory(t *testing.T) {
},
}
for msg, spec := range specs {
spec := spec
t.Run(msg, func(t *testing.T) {
xCtx, _ := ctx.CacheContext()

Expand Down Expand Up @@ -520,6 +521,7 @@ func TestQueryCodeList(t *testing.T) {
}

for msg, spec := range specs {
spec := spec
t.Run(msg, func(t *testing.T) {
xCtx, _ := ctx.CacheContext()

Expand Down Expand Up @@ -596,6 +598,7 @@ func TestQueryContractInfo(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
xCtx, _ := ctx.CacheContext()
k.mustStoreContractInfo(xCtx, contractAddr, &spec.stored)
Expand Down
1 change: 1 addition & 0 deletions x/wasm/keeper/query_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ func TestDistributionQuerier(t *testing.T) {
},
}
for name, spec := range specs {
spec := spec
t.Run(name, func(t *testing.T) {
mock := distrKeeperMock{GetDelegatorWithdrawAddrFn: spec.mockFn}
q := keeper.DistributionQuerier(mock)
Expand Down
1 change: 1 addition & 0 deletions x/wasm/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ code_ids:
},
}
for msg, spec := range specs {
spec := spec
t.Run(msg, func(t *testing.T) {
v, err := yaml.Marshal(&spec.src)
require.NoError(t, err)
Expand Down

0 comments on commit fcecbf6

Please sign in to comment.