wormchain: tokenbridge: Don't register asset meta for unknown chains
This commit is contained in:
parent
832a72057d
commit
8f70fd1719
|
@ -52,7 +52,7 @@ func (k msgServer) ExecuteVAA(goCtx context.Context, msg *types.MsgExecuteVAA) (
|
|||
// Check if emitter is a registered chain
|
||||
registration, found := k.GetChainRegistration(ctx, uint32(v.EmitterChain))
|
||||
if !found {
|
||||
return nil, types.ErrUnregisteredEmitter
|
||||
return nil, types.ErrUnregisteredChain
|
||||
}
|
||||
if !bytes.Equal(v.EmitterAddress[:], registration.EmitterAddress) {
|
||||
return nil, types.ErrUnregisteredEmitter
|
||||
|
@ -200,6 +200,10 @@ func (k msgServer) ExecuteVAA(goCtx context.Context, msg *types.MsgExecuteVAA) (
|
|||
return nil, types.ErrNativeAssetRegistration
|
||||
}
|
||||
|
||||
if _, found := k.GetChainRegistration(ctx, uint32(tokenChain)); !found {
|
||||
return nil, types.ErrUnregisteredEmitter
|
||||
}
|
||||
|
||||
identifier := types.GetWrappedCoinIdentifier(tokenChain, tokenAddress)
|
||||
rollBackProtection, found := k.GetCoinMetaRollbackProtection(ctx, identifier)
|
||||
if found && rollBackProtection.LastUpdateSequence >= v.Sequence {
|
||||
|
|
|
@ -39,4 +39,5 @@ var (
|
|||
ErrAssetMetaRollback = sdkerrors.Register(ModuleName, 1134, "asset meta must have a higher sequence than the last update")
|
||||
ErrNegativeFee = sdkerrors.Register(ModuleName, 1135, "fee cannot be negative")
|
||||
ErrRegisterWormholeChain = sdkerrors.Register(ModuleName, 1136, "cannot register an emitter for wormhole-chain on wormhole-chain")
|
||||
ErrUnregisteredChain = sdkerrors.Register(ModuleName, 1138, "chain is not registered")
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue