Cosmos-sdk: Drop amino support in x/capability

Created on 17 Sep 2020  Â·  10Comments  Â·  Source: cosmos/cosmos-sdk

Summary

We can remove amino support in x/capability since the capability module was constructed for IBC and IBC doesn't support amino


For Admin Use

  • [ ] Not duplicate issue
  • [ ] Appropriate labels applied
  • [ ] Appropriate contributors tagged
  • [ ] Contributor assigned/self-assigned
encoding capability

Most helpful comment

x/capability has not been included in any releases right? That was my understanding for why removing amino registration would be fine.

All 10 comments

@colin-axner Can you point to where you see amino usage in x/capability? Pretty sure we already removed it, and the keeper just takes a BinaryMarshaler.

on the amino registration (codec.go). Removing that file suffices

on the amino registration (codec.go). Removing that file suffices

I don't follow? Every single module has a RegisterLegacyAminoCodec call.

I don't follow? Every single module has a RegisterLegacyAminoCodec call.

not the IBC modules

The IBC module does a no-op on RegisterLegacyAminoCodec. This prevents developers from even thinking of using amino. There is no reason to keep references to amino or register types for amino for code only used by IBC atm

But there's no clear statement or imperative that x/capability is solely used by x/ibc, right? Meaning, x/capability is unaware of x/ibc or any other upstream "consumer" for that matter. So wouldn't it be safe to leave it as-is? We shouldn't just assume x/ibc is the main consumer of the module and remove support for Amino. I could be wrong.

But there's no clear statement or imperative that x/capability is solely used by x/ibc, right? Meaning, x/capability is unaware of x/ibc or any other upstream "consumer" for that matter. So wouldn't it be safe to leave it as-is? We shouldn't just assume x/ibc is the main consumer of the module and remove support for Amino. I could be wrong.

This is all correct and sounds reasonable to me. Amino usage should be restricted to just genesis encoding since the keeper uses a BinaryMarshaler?

On the flip side, if we did remove the codec.go file, a "consumer" could still register the capability types of their codec and use the capability module.

At the very least I think we can remove this code since it is unused and unexported:

var (                                                                                                
    amino = codec.NewLegacyAmino()                                          
)                                                                       

func init() {                                                                                        
    RegisterLegacyAminoCodec(amino)                                                
    amino.Seal()                                                                                     
}     

We have codec.go in every module AFAIK. I'm just trying to figure out why remove it from x/capability and not from everything else?

x/capability has not been included in any releases right? That was my understanding for why removing amino registration would be fine.

I see. Valid point!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hendrikhofstadt picture hendrikhofstadt  Â·  3Comments

rigelrozanski picture rigelrozanski  Â·  3Comments

mossid picture mossid  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments

ValarDragon picture ValarDragon  Â·  3Comments