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
|
// Check if emitter is a registered chain
|
||||||
registration, found := k.GetChainRegistration(ctx, uint32(v.EmitterChain))
|
registration, found := k.GetChainRegistration(ctx, uint32(v.EmitterChain))
|
||||||
if !found {
|
if !found {
|
||||||
return nil, types.ErrUnregisteredEmitter
|
return nil, types.ErrUnregisteredChain
|
||||||
}
|
}
|
||||||
if !bytes.Equal(v.EmitterAddress[:], registration.EmitterAddress) {
|
if !bytes.Equal(v.EmitterAddress[:], registration.EmitterAddress) {
|
||||||
return nil, types.ErrUnregisteredEmitter
|
return nil, types.ErrUnregisteredEmitter
|
||||||
|
@ -200,6 +200,10 @@ func (k msgServer) ExecuteVAA(goCtx context.Context, msg *types.MsgExecuteVAA) (
|
||||||
return nil, types.ErrNativeAssetRegistration
|
return nil, types.ErrNativeAssetRegistration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, found := k.GetChainRegistration(ctx, uint32(tokenChain)); !found {
|
||||||
|
return nil, types.ErrUnregisteredEmitter
|
||||||
|
}
|
||||||
|
|
||||||
identifier := types.GetWrappedCoinIdentifier(tokenChain, tokenAddress)
|
identifier := types.GetWrappedCoinIdentifier(tokenChain, tokenAddress)
|
||||||
rollBackProtection, found := k.GetCoinMetaRollbackProtection(ctx, identifier)
|
rollBackProtection, found := k.GetCoinMetaRollbackProtection(ctx, identifier)
|
||||||
if found && rollBackProtection.LastUpdateSequence >= v.Sequence {
|
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")
|
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")
|
ErrNegativeFee = sdkerrors.Register(ModuleName, 1135, "fee cannot be negative")
|
||||||
ErrRegisterWormholeChain = sdkerrors.Register(ModuleName, 1136, "cannot register an emitter for wormhole-chain on wormhole-chain")
|
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