Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP restriction and support custom token's logo #106

Merged
merged 116 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
ac0c17d
Return message bridges in APIs
trunghai95 Mar 21, 2024
10652b2
Use time.now for ready_time
trunghai95 Mar 21, 2024
e6827e5
Add prometheus client foundation
trunghai95 Feb 29, 2024
1bbe2d7
Record qps and latency metrics
trunghai95 Feb 29, 2024
a83d3da
Fix bug and add unit test
trunghai95 Feb 29, 2024
ba56a0f
Add log and update naming
trunghai95 Mar 1, 2024
00178ca
Add order metrics
trunghai95 Mar 1, 2024
784d7f4
Fix bug due to old go version
trunghai95 Mar 1, 2024
c89be01
Use time.now for ready_time
trunghai95 Mar 21, 2024
cab7f3f
Add order wait time metrics
trunghai95 Mar 22, 2024
7b003db
Add message bridge allowlist
trunghai95 Mar 26, 2024
21ea0b5
Merge branch 'release/v0.3.0' into hai/usdc-lxly
trunghai95 Mar 27, 2024
04605c0
Merge branch 'release/v0.3.0' into hai/integrate-prometheus
trunghai95 Mar 27, 2024
a972620
Add metrics
trunghai95 Mar 27, 2024
d11f33e
Fix bug
trunghai95 Mar 27, 2024
6441c54
Merge remote-tracking branch 'origin/release/v0.3.1' into hai/usdc-lxly
Apr 1, 2024
fbdd046
fix conflict
Apr 1, 2024
4777d1a
Merge branch 'release/v0.3.1' into hai/integrate-prometheus
trunghai95 Apr 2, 2024
d8029ed
Add leaf type to push messages
trunghai95 Apr 2, 2024
570b92b
Add leaf type to order metrics
trunghai95 Apr 2, 2024
7cc60a3
Fix query:
trunghai95 Apr 2, 2024
f999e8f
Add dest net to metrics
trunghai95 Apr 2, 2024
f60d688
Export metrics port
trunghai95 Apr 2, 2024
8a6ba26
add convert contract addr to token addr
Apr 3, 2024
0c6f961
Update dest_addr logic
trunghai95 Apr 3, 2024
7001828
Update sql
trunghai95 Apr 3, 2024
4647a68
Fix SQL
trunghai95 Apr 3, 2024
e1e966d
Regenerate mocks
trunghai95 Apr 3, 2024
cc5bef4
fix bug
Apr 3, 2024
1e6b2a4
Fix bug
trunghai95 Apr 3, 2024
7357e43
fix bug
Apr 3, 2024
b91da1d
fix auto claim usdc
Apr 7, 2024
25946fa
fix auto claim usdc
Apr 7, 2024
307284f
merge fix sync codes
Apr 7, 2024
a1b0850
get bridge api add globalIndex filed
Apr 7, 2024
f4c003e
Merge branch 'release/v0.3.1' into hai/usdc-lxly
trunghai95 Apr 8, 2024
7cb0ec8
Refactor USDC LxLy logic
trunghai95 Apr 8, 2024
8067247
Refactor
trunghai95 Apr 8, 2024
d77dec8
Fix lint
trunghai95 Apr 8, 2024
b8b2415
Add unit test
trunghai95 Apr 8, 2024
a6f6f97
Fix lint
trunghai95 Apr 8, 2024
0007e80
Return destContractAddr for message deposit
trunghai95 Apr 8, 2024
6ea03de
Push message for USDC LxLy
trunghai95 Apr 8, 2024
6e775f3
Add limit for monitor txs
trunghai95 Apr 8, 2024
e6560cc
Fix lint
trunghai95 Apr 8, 2024
88652b0
fix usdc deposit create push msg
Apr 9, 2024
16d666e
Decrease nonce cache when add tx fail
trunghai95 Apr 9, 2024
75aec50
Add metrics env label
trunghai95 Apr 11, 2024
8636735
Add metrics endpoint config
trunghai95 Apr 11, 2024
b634cc9
Merge branch 'hai/integrate-prometheus' into hai/usdc-lxly-prometheus
trunghai95 Apr 11, 2024
3cf00d8
Update USDC metrics
trunghai95 Apr 11, 2024
b566380
fix not push usdc bug
Apr 11, 2024
df02c2f
Update ReplaceUSDCDepositInfo
trunghai95 Apr 12, 2024
11fe6a4
add metrics prefix
trunghai95 Apr 12, 2024
9b1b20f
Fix metric label
trunghai95 Apr 16, 2024
9d03f1a
Fix metric label
trunghai95 Apr 16, 2024
865b554
Add histogram custom buckets
trunghai95 Apr 17, 2024
324c45c
Update buckets
trunghai95 Apr 17, 2024
a8f937e
Merge pull request #102 from okx/hai/metrics-custom-buckets
trunghai95 Apr 17, 2024
4bbd7f1
API metrics to return code and msg
trunghai95 Apr 18, 2024
67ee591
Fix bug and add unit test
trunghai95 Apr 18, 2024
a1e9982
Overwrite orig network id
trunghai95 Apr 18, 2024
96df519
Refine buckets
trunghai95 Apr 19, 2024
b686f3c
Add block number metrics
trunghai95 Apr 23, 2024
aea8b58
Trigger record latest block num
trunghai95 Apr 23, 2024
4d7d59d
Add debug log
trunghai95 Apr 23, 2024
6caa960
Fix bug
trunghai95 Apr 23, 2024
6f44131
Refactor nacos
trunghai95 Apr 19, 2024
e056834
Init ip restriction client
trunghai95 Apr 22, 2024
ad8a056
Add IP check interceptor
trunghai95 Apr 22, 2024
6e129ae
Change config time
trunghai95 Apr 22, 2024
4f4f387
Add HTTPS scheme to nacos url
trunghai95 Apr 22, 2024
130d361
Fix bug
trunghai95 Apr 23, 2024
7c309a8
Change latest block num record frequency
trunghai95 Apr 23, 2024
ca59ee2
Fix lint
trunghai95 Apr 23, 2024
5a2c7b2
Add debug log
trunghai95 Apr 23, 2024
33aa548
Add debug log
trunghai95 Apr 23, 2024
4a64377
Change synced block metrics
trunghai95 Apr 23, 2024
e387cac
Merge pull request #104 from okx/hai/sync-block-metrics
trunghai95 Apr 24, 2024
f279361
Revamp IP restriction error code
trunghai95 Apr 24, 2024
9d874b1
Fix logs
trunghai95 Apr 24, 2024
ed06a04
Update error codes
trunghai95 Apr 24, 2024
5a7e3cd
Update interceptors order
trunghai95 Apr 24, 2024
7edaf87
Fix interceptor
trunghai95 Apr 24, 2024
aacbacd
Merge branch 'hai/usdc-lxly-prometheus-3' into hai/ip-restriction
trunghai95 Apr 24, 2024
f90328e
Rollback nacos-sdk-go version
trunghai95 Apr 25, 2024
a675e85
Revamp nacos error logs
trunghai95 Apr 25, 2024
70e8fed
Add safety check for IP restriction
trunghai95 Apr 25, 2024
50b8a77
Update
trunghai95 Apr 25, 2024
b860908
Fix logs
trunghai95 Apr 25, 2024
46cdd35
Close the http response body
trunghai95 Apr 25, 2024
d6b3caf
Fix lint
trunghai95 Apr 25, 2024
3df4ee2
Change error structure
trunghai95 Apr 25, 2024
ec127fc
add logo infos for pending and all transaction api
Apr 26, 2024
ea2302f
init token logo client
Apr 26, 2024
03ae21f
Change logs
trunghai95 Apr 26, 2024
f43e013
fix review optimizations
Apr 26, 2024
89b2ed1
optimize log
Apr 26, 2024
03722b7
fix go lint problem
Apr 26, 2024
d9a8b2f
add logo info for push
Apr 29, 2024
0eca2c0
add new common models for types
Apr 29, 2024
53865b2
Merge remote-tracking branch 'origin/hai/ip-restriction' into bard/ad…
Apr 29, 2024
83745b3
fix token service endpoint
Apr 29, 2024
3367b53
fix url bug
Apr 29, 2024
06c80a4
fix get token logo param error
Apr 29, 2024
a6a7970
fix address map key to lower case
Apr 29, 2024
b371c15
fix bug
Apr 29, 2024
20b64cc
add comments
Apr 29, 2024
bd63489
fix json error
Apr 29, 2024
8df36f1
Use proto error codes
trunghai95 May 3, 2024
d29bd30
Fix unit test
trunghai95 May 3, 2024
c731f49
fix native token match failed
May 6, 2024
03f7814
fix go lint
May 7, 2024
53b76d3
Merge remote-tracking branch 'origin/hai/ip-restriction' into bard/ad…
May 7, 2024
f5e5088
Remove kafka from local tests
trunghai95 May 7, 2024
3c8f107
Merge branch 'hai/ip-restriction' into bard/add_token_info_into_tx_20…
trunghai95 May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ DOCKER_COMPOSE_BRIDGE := xlayer-bridge-service
DOCKER_COMPOSE_BRIDGE_V1TOV2 := xlayer-bridge-service-v1tov2

DOCKER_COMPOSE_REDIS := xlayer-bridge-redis
DOCKER_COMPOSE_COIN_KAFKA_NODE := xlayer-bridge-coin-kafka
DOCKER_COMPOSE_ZOOKEEPER := kafka-zookeeper

RUN_STATE_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_STATE_DB)
RUN_POOL_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_POOL_DB)
RUN_BRIDGE_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE_DB)
RUN_REDIS := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_REDIS)
RUN_COIN_KAFKA := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_COIN_KAFKA_NODE)
RUN_ZOOKEEPER := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZOOKEEPER)
RUN_DBS := ${RUN_BRIDGE_DB} && ${RUN_STATE_DB} && ${RUN_POOL_DB} && ${RUN_REDIS} && ${RUN_COIN_KAFKA} && ${RUN_ZOOKEEPER}
RUN_DBS := ${RUN_BRIDGE_DB} && ${RUN_STATE_DB} && ${RUN_POOL_DB} && ${RUN_REDIS}
RUN_NODE := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_NODE)
RUN_NODE_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_NODE_V1TOV2)
RUN_AGGREGATOR_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_AGGREGATOR_V1TOV2)
Expand Down
9 changes: 8 additions & 1 deletion bridgectrl/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/binary"

"github.com/0xPolygonHermez/zkevm-bridge-service/etherman"
"github.com/0xPolygonHermez/zkevm-bridge-service/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/iden3/go-iden3-crypto/keccak256"
"golang.org/x/crypto/sha3"
)
Expand Down Expand Up @@ -42,6 +44,11 @@ func hashDeposit(deposit *etherman.Deposit) [KeyLen]byte {
binary.BigEndian.PutUint32(destNet, uint32(deposit.DestinationNetwork))
var buf [KeyLen]byte
metaHash := keccak256.Hash(deposit.Metadata)
copy(res[:], keccak256.Hash([]byte{deposit.LeafType}, origNet, deposit.OriginalAddress[:], destNet, deposit.DestinationAddress[:], deposit.Amount.FillBytes(buf[:]), metaHash))
destAddr := deposit.DestinationAddress
emptyAddr := common.Address{}
if deposit.LeafType == uint8(utils.LeafTypeMessage) && deposit.DestContractAddress != emptyAddr {
destAddr = deposit.DestContractAddress
}
copy(res[:], keccak256.Hash([]byte{deposit.LeafType}, origNet, deposit.OriginalAddress[:], destNet, destAddr[:], deposit.Amount.FillBytes(buf[:]), metaHash))
return res
}
Loading
Loading