Skip to content

Commit

Permalink
try IBC prefixed asset when matching deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanoroshiba committed Nov 1, 2024
1 parent 681831d commit 862a4ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions grpc/execution/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package execution

import (
"crypto/sha256"
"encoding/hex"
"fmt"
"math/big"

Expand Down Expand Up @@ -39,8 +40,9 @@ func validateAndUnmarshalSequencerTx(
return nil, fmt.Errorf("disallowed asset %s in deposit tx", deposit.Asset)
}

if deposit.Asset != bac.AssetDenom {
return nil, fmt.Errorf("asset %s does not match bridge address %s asset", deposit.Asset, bridgeAddress)
assetHash := sha256.Sum256([]byte(deposit.Asset))
if deposit.Asset != bac.AssetDenom && ("ibc/" + hex.EncodeToString(assetHash[:])) != bac.AssetDenom {
return nil, fmt.Errorf("neither trace nor IBC prefixed asset %s match bridge address %s asset", deposit.Asset, bridgeAddress)
}

recipient := common.HexToAddress(deposit.DestinationChainAddress)
Expand Down

0 comments on commit 862a4ea

Please sign in to comment.