Skip to content

Commit

Permalink
fix(bridge-history): address validation (#1063)
Browse files Browse the repository at this point in the history
Co-authored-by: colinlyguo <colinlyguo@users.noreply.github.com>
  • Loading branch information
colinlyguo and colinlyguo authored Jan 3, 2024
1 parent fdb71dd commit ac20a00
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions bridge-history-api/conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
"USDCGatewayAddr": "0x33B60d5Dd260d453cAC3782b0bDC01ce84672142",
"LIDOGatewayAddr": "0x8aE8f22226B9d789A36AC81474e633f8bE2856c9",
"DAIGatewayAddr": "0xaC78dff3A87b5b534e366A93E785a0ce8fA6Cc62",
"GatewayRouterAddr": "0x4C0926FF5252A435FD19e10ED15e5a249Ba19d79",
"MessageQueueAddr": "0x5300000000000000000000000000000000000000"
"GatewayRouterAddr": "0x4C0926FF5252A435FD19e10ED15e5a249Ba19d79"
},
"db": {
"dsn": "postgres://postgres:123456@localhost:5444/test?sslmode=disable",
Expand Down
6 changes: 4 additions & 2 deletions bridge-history-api/internal/logic/l1_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ func NewL1FetcherLogic(cfg *config.LayerConfig, db *gorm.DB, client *ethclient.C
}

// Optional erc20 gateways.
if cfg.USDCGatewayAddr != "" {
if common.HexToAddress(cfg.USDCGatewayAddr) != (common.Address{}) {
addressList = append(addressList, common.HexToAddress(cfg.USDCGatewayAddr))
}

if cfg.LIDOGatewayAddr != "" {
if common.HexToAddress(cfg.LIDOGatewayAddr) != (common.Address{}) {
addressList = append(addressList, common.HexToAddress(cfg.LIDOGatewayAddr))
}

log.Info("L1 Fetcher configured with the following address list", "addresses", addressList)

f := &L1FetcherLogic{
db: db,
crossMessageOrm: orm.NewCrossMessage(db),
Expand Down
6 changes: 4 additions & 2 deletions bridge-history-api/internal/logic/l2_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ func NewL2FetcherLogic(cfg *config.LayerConfig, db *gorm.DB, client *ethclient.C
}

// Optional erc20 gateways.
if cfg.USDCGatewayAddr != "" {
if common.HexToAddress(cfg.USDCGatewayAddr) != (common.Address{}) {
addressList = append(addressList, common.HexToAddress(cfg.USDCGatewayAddr))
}

if cfg.LIDOGatewayAddr != "" {
if common.HexToAddress(cfg.LIDOGatewayAddr) != (common.Address{}) {
addressList = append(addressList, common.HexToAddress(cfg.LIDOGatewayAddr))
}

log.Info("L2 Fetcher configured with the following address list", "addresses", addressList)

f := &L2FetcherLogic{
db: db,
crossMessageOrm: orm.NewCrossMessage(db),
Expand Down
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.3.46"
var tag = "v4.3.47"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down

0 comments on commit ac20a00

Please sign in to comment.