terra-money / alliance

🤝 Alliance chain with x/alliance module
Other
50 stars 34 forks source link

fix: bank msg server interface error #315

Closed javiersuweijie closed 8 months ago

javiersuweijie commented 8 months ago

Bank module's MsgServer requires the Keeper to be of the BaseKeeper type. However, in alliance, we re-implemented the bank keeper thus the type check fails.

msgServer.Send() {
    if base, ok := k.Keeper.(BaseKeeper); ok {
        from, err = base.ak.AddressCodec().StringToBytes(msg.FromAddress)
        if err != nil {
            return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid from address: %s", err)
        }
        to, err = base.ak.AddressCodec().StringToBytes(msg.ToAddress)
        if err != nil {
            return nil, sdkerrors.ErrInvalidAddress.Wrapf("invalid to address: %s", err)
        }
    } else {
        return nil, sdkerrors.ErrInvalidRequest.Wrapf("invalid keeper type: %T", k.Keeper)
    }
}

Updated the implementation to replace the two send functions to remove the type requirement.

emidev98 commented 8 months ago

@javiersuweijie when does the bank module fail? I have not experienced any issue with it

javiersuweijie commented 8 months ago

@javiersuweijie when does the bank module fail? I have not experienced any issue with it

Its a new thing that was introduced in SDK 50