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

fix: bank msg server interface error #315

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

javiersuweijie
Copy link
Member

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
Copy link
Contributor

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

@javiersuweijie
Copy link
Member Author

@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

@javiersuweijie javiersuweijie merged commit d7fd5df into release/v0.4.x Feb 27, 2024
3 checks passed
@emidev98 emidev98 deleted the fix/bank-msg-server branch February 27, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants