Skip to content

Commit

Permalink
fix: remove legacy codes of wasm (#640)
Browse files Browse the repository at this point in the history
* remove unused interface and struct in wasm (QueryRouter, Router)

Signed-off-by: zemyblue <[email protected]>

* remove duplicated Event in the wasm proposal handler

Signed-off-by: zemyblue <[email protected]>

* chore: add changelog

Signed-off-by: zemyblue <[email protected]>

* fix: lint error

Signed-off-by: zemyblue <[email protected]>

* chore: remove the message types event of governance process.

Signed-off-by: zemyblue <[email protected]>

Signed-off-by: zemyblue <[email protected]>
  • Loading branch information
zemyblue authored Aug 22, 2022
1 parent 9c2b632 commit 86ccc34
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 248 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (client) [\#565](https://github.com/line/lbm-sdk/pull/565) fix the data race problem in `TestQueryABCIHeight`
* (x/token) [\#589](https://github.com/line/lbm-sdk/pull/589) fix naming collision in x/token enums
* (x/token) [\#599](https://github.com/line/lbm-sdk/pull/599) fix the order of events
* (x/wasm) [\#640](https://github.com/line/lbm-sdk/pull/640) remove legacy codes of wasm
* (amino) [\#635](https://github.com/line/lbm-sdk/pull/635) change some minor things that haven't been fixed in #549

### Breaking Changes
Expand Down
3 changes: 0 additions & 3 deletions x/wasm/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,4 @@ type (
CustomQuerier = keeper.CustomQuerier
QueryPlugins = keeper.QueryPlugins
Option = keeper.Option

EncodeHandler = types.EncodeHandler
EncodeQuerier = types.EncodeQuerier
)
4 changes: 0 additions & 4 deletions x/wasm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) (
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender),
))
ctx.EventManager().EmitEvent(sdk.NewEvent(
types.EventTypeUpdateAdmin,
sdk.NewAttribute(types.AttributeKeyContractAddr, msg.Contract),
))

if err := m.keeper.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil {
return nil, err
Expand Down
52 changes: 1 addition & 51 deletions x/wasm/keeper/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package keeper

import (
"encoding/hex"
"strconv"
"strings"

sdk "github.com/line/lbm-sdk/types"
sdkerrors "github.com/line/lbm-sdk/types/errors"
Expand Down Expand Up @@ -182,17 +180,7 @@ func handleUpdateAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p typ
return sdkerrors.Wrap(err, "run as address")
}

if err := k.UpdateContractAdmin(ctx, contractAddr, nil, newAdminAddr); err != nil {
return err
}

ourEvent := sdk.NewEvent(
types.EventTypeUpdateAdmin,
sdk.NewAttribute(types.AttributeKeyContractAddr, p.Contract),
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
)
ctx.EventManager().EmitEvent(ourEvent)
return nil
return k.UpdateContractAdmin(ctx, contractAddr, nil, newAdminAddr)
}

func handleClearAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.ClearAdminProposal) error {
Expand All @@ -207,13 +195,6 @@ func handleClearAdminProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type
if err := k.ClearContractAdmin(ctx, contractAddr, nil); err != nil {
return err
}

ourEvent := sdk.NewEvent(
types.EventTypeClearAdmin,
sdk.NewAttribute(types.AttributeKeyContractAddr, p.Contract),
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
)
ctx.EventManager().EmitEvent(ourEvent)
return nil
}

Expand All @@ -226,22 +207,6 @@ func handlePinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p types.
return sdkerrors.Wrapf(err, "code id: %d", v)
}
}
s := make([]string, len(p.CodeIDs))
for _, v := range p.CodeIDs {
ourEvent := sdk.NewEvent(
types.EventTypePinCode,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(v, 10)),
)
ctx.EventManager().EmitEvent(ourEvent)
}

ourEvent := sdk.NewEvent(
types.EventTypePinCode,
sdk.NewAttribute(types.AttributeKeyCodeIDs, strings.Join(s, ",")),
)
ctx.EventManager().EmitEvent(ourEvent)

return nil
}

Expand All @@ -254,21 +219,6 @@ func handleUnpinCodesProposal(ctx sdk.Context, k types.ContractOpsKeeper, p type
return sdkerrors.Wrapf(err, "code id: %d", v)
}
}
s := make([]string, len(p.CodeIDs))
for _, v := range p.CodeIDs {
ourEvent := sdk.NewEvent(
types.EventTypeUnpinCode,
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
sdk.NewAttribute(types.AttributeKeyCodeID, strconv.FormatUint(v, 10)),
)
ctx.EventManager().EmitEvent(ourEvent)
}

ourEvent := sdk.NewEvent(
types.EventTypeUnpinCode,
sdk.NewAttribute(types.AttributeKeyCodeIDs, strings.Join(s, ",")),
)
ctx.EventManager().EmitEvent(ourEvent)

return nil
}
Expand Down
2 changes: 0 additions & 2 deletions x/wasm/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const (
EventTypeInstantiate = "instantiate"
EventTypeExecute = "execute"
EventTypeMigrate = "migrate"
EventTypeUpdateAdmin = "update_admin"
EventTypeClearAdmin = "clear_admin"
EventTypeUpdateContractStatus = "update_contract_status"
EventTypePinCode = "pin_code"
EventTypeUnpinCode = "unpin_code"
Expand Down
65 changes: 0 additions & 65 deletions x/wasm/types/querier_router.go

This file was deleted.

29 changes: 0 additions & 29 deletions x/wasm/types/querier_router_test.go

This file was deleted.

67 changes: 0 additions & 67 deletions x/wasm/types/router.go

This file was deleted.

27 changes: 0 additions & 27 deletions x/wasm/types/router_test.go

This file was deleted.

0 comments on commit 86ccc34

Please sign in to comment.