Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit ed756a4
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Mar 28 15:21:03 2024 +0800

    chore(deps): bump gorm.io/gorm from 1.25.7 to 1.25.8 (#16517)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com>

commit 0a0a219
Author: Korbinian <KorbinianK@users.noreply.github.com>
Date:   Thu Mar 28 08:07:47 2024 +0100

    fix(repo): bridge ui preview deployments (#16540)

commit ebb9da3
Author: jeff <113397187+cyberhorsey@users.noreply.github.com>
Date:   Wed Mar 27 20:48:19 2024 -0700

    feat(relayer): pause the bridge when a message has been detected as not sent (#16542)

commit 7890829
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Mar 28 01:14:43 2024 +0000

    chore(deps): bump github.com/docker/docker from 25.0.3+incompatible to 25.0.5+incompatible (#16490)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit 41967e8
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Thu Mar 28 01:14:43 2024 +0000

    chore(deps-dev): bump solc from 0.7.3 to 0.8.25 (#16462)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com>

commit e8c25bd
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Mar 27 21:15:19 2024 -0400

    chore(deps-dev): bump @vitest/coverage-v8 from 1.3.1 to 1.4.0 (#16514)

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: d1onys1us <13951458+d1onys1us@users.noreply.github.com>

commit 3e3f529
Author: xiaodino <ruby@taiko.xyz>
Date:   Wed Mar 27 14:53:13 2024 -0700

    feat(relayer): add one more prometheus target for rabbitmq queue (#16539)

    Co-authored-by: Korbinian <KorbinianK@users.noreply.github.com>

commit 3beba21
Author: Korbinian <KorbinianK@users.noreply.github.com>
Date:   Wed Mar 27 09:59:44 2024 +0100

    feat(bridge-ui): retry dialog (#16536)

commit 0c5aba2
Author: Roger <50648015+RogerLamTd@users.noreply.github.com>
Date:   Wed Mar 27 01:59:17 2024 -0700

    ci(blobstorage): deploy blobs swagger api (#16531)

commit bb91cd1
Author: Korbinian <KorbinianK@users.noreply.github.com>
Date:   Wed Mar 27 07:51:21 2024 +0100

    chore(repo): preview builds for internal project (#16502)

commit 5c84e16
Author: jeff <113397187+cyberhorsey@users.noreply.github.com>
Date:   Tue Mar 26 22:18:45 2024 -0700

    fix(relayer): handling message received events should compare message dest chain with indexer source chain (#16537)

    Co-authored-by: Roger <50648015+RogerLamTd@users.noreply.github.com>
  • Loading branch information
KorbinianK committed Mar 28, 2024
1 parent 991b166 commit 50363d7
Show file tree
Hide file tree
Showing 13 changed files with 202 additions and 100 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/blobstorage-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BLOBSTORAGE }}

on:
push:
branches-ignore:
- main
- release-please-*
paths:
- "packages/blobstorage/**"

jobs:
Deploy-Preview:
runs-on: [taiko-runner]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

- name: Install Vercel CLI
run: pnpm add --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/blobstorage-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BLOBSTORAGE }}

on:
push:
tags:
- "blobstorage-*"

jobs:
Deploy-Production:
runs-on: [taiko-runner]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

- name: Install Vercel CLI
run: pnpm add --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
37 changes: 21 additions & 16 deletions .github/workflows/bridge-ui-preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Vercel Preview Deployment

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_BRIDGE_UI }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

on:
push:
Expand All @@ -13,21 +14,25 @@ on:
jobs:
Deploy-Preview:
runs-on: [taiko-runner]
strategy:
matrix:
org: ["Public", "Internal"]
include:
- org: "Public"
org_id_secret: "VERCEL_ORG_ID"
project_id_secret: "VERCEL_PROJECT_ID_BRIDGE_UI"
- org: "Internal"
org_id_secret: "VERCEL_ORG_ID"
project_id_secret: "VERCEL_PROJECT_ID_BRIDGE_UI_INTERNAL"
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

- uses: actions/checkout@v2
- name: Install Vercel CLI
run: pnpm add --global vercel@latest

- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build Project Artifacts
run: npm install --global vercel@latest
- name: Setup Vercel Environment for ${{ matrix.org }}
run: |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets[matrix.org_id_secret] }} --project-id=${{ secrets[matrix.project_id_secret] }}
vercel link --token=${{ secrets.VERCEL_TOKEN }} --confirm --name=${{ matrix.org }} --scope=${{ secrets[matrix.org_id_secret] }}
- name: Build Project Artifacts for ${{ matrix.org }}
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy Project Artifacts to Vercel
- name: Deploy Project Artifacts to Vercel for ${{ matrix.org }}
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ __pycache__/
# VSCode
.vscode/launch.json
packages/protocol/config.js
.vercel
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
gopkg.in/yaml.v3 v3.0.1
gorm.io/datatypes v1.2.0
gorm.io/driver/mysql v1.5.6
gorm.io/gorm v1.25.7
gorm.io/gorm v1.25.8
gotest.tools v2.2.0+incompatible
)

Expand Down Expand Up @@ -78,7 +78,7 @@ require (
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/docker v25.0.3+incompatible // indirect
github.com/docker/docker v25.0.5+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg=
github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/docker v25.0.3+incompatible h1:D5fy/lYmY7bvZa0XTZ5/UJPljor41F+vdyJG5luQLfQ=
github.com/docker/docker v25.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE=
github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down Expand Up @@ -853,8 +853,9 @@ gorm.io/driver/sqlserver v1.4.1 h1:t4r4r6Jam5E6ejqP7N82qAJIJAht27EGT41HyPfXRw0=
gorm.io/driver/sqlserver v1.4.1/go.mod h1:DJ4P+MeZbc5rvY58PnmN1Lnyvb5gw5NPzGshHDnJLig=
gorm.io/gorm v1.20.7/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.21.3/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo=
gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.5.0 h1:Ljk6PdHdOhAb5aDMWXjDLMMhph+BpztA4v1QdqEW2eY=
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@types/object-hash": "^3.0.6",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.0.2",
"@vitest/coverage-v8": "^1.3.1",
"@vitest/coverage-v8": "^1.4.0",
"@wagmi/cli": "^2.1.4",
"abitype": "^1.0.0",
"ajv": "^8.12.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-promise": "^6.1.1",
"ethers": "^5.7.2",
"solc": "0.7.3",
"solc": "0.8.25",
"solhint": "^4.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.3"
Expand Down
5 changes: 5 additions & 0 deletions packages/relayer/docker-compose/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ scrape_configs:
- job_name: "rabbitmq"
static_configs:
- targets: ["host.docker.internal:15692"]

- job_name: "rabbitmq_queue"
metrics_path: /metrics/per-object
static_configs:
- targets: ["host.docker.internal:15692"]
8 changes: 4 additions & 4 deletions packages/relayer/indexer/handle_message_received_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ func (i *Indexer) handleMessageReceivedEvent(
"txHash", event.Raw.TxHash.Hex(),
)

// if the destinatio chain doesnt match, we dont process it in this indexer.
if new(big.Int).SetUint64(event.Message.DestChainId).Cmp(i.destChainId) != 0 {
// if the destination doesnt match our source chain, we dont want to handle this event.
if new(big.Int).SetUint64(event.Message.DestChainId).Cmp(i.srcChainId) != 0 {
slog.Info("skipping event, wrong chainID",
"messageDestChainID",
event.Message.DestChainId,
"indexerDestChainID",
i.destChainId.Uint64(),
"indexerSrcChainID",
i.srcChainId.Uint64(),
)

return nil
Expand Down
14 changes: 3 additions & 11 deletions packages/relayer/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,9 @@ var (
Name: "transactions_suspended_ops_total",
Help: "The total number of suspended transactions",
})
BlocksScanned = promauto.NewCounter(prometheus.CounterOpts{
Name: "blocks_scanned_ops_total",
Help: "The total number of scanned blocks. Acts as heartbeat metric.",
})
BlocksScannedError = promauto.NewCounter(prometheus.CounterOpts{
Name: "blocks_scanned_error_ops_total",
Help: "The total number of scanned block errors.",
BridgePaused = promauto.NewCounter(prometheus.CounterOpts{
Name: "bridge_paused_opts_total",
Help: "The total number of times the bridge has been paused",
})
RetriableEvents = promauto.NewCounter(prometheus.CounterOpts{
Name: "events_processed_retriable_status_ops_total",
Expand All @@ -114,8 +110,4 @@ var (
Name: "messages_not_received_on_dest_chain_opts_total",
Help: "The total number of messages that were not received on the destination chain",
})
ErrorsEncounteredDuringSubscription = promauto.NewCounter(prometheus.CounterOpts{
Name: "errors_encountered_during_subscription_opts_total",
Help: "The total number of errors that occurred during active subscription",
})
)
68 changes: 54 additions & 14 deletions packages/relayer/watchdog/watchdog.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,41 +285,38 @@ func (w *Watchdog) checkMessage(ctx context.Context, msg queue.Message) error {
}

// check if the source chain sent this message
sent, err := w.srcBridge.IsMessageSent(nil, msgBody.Event.Message)
sent, err := w.destBridge.IsMessageSent(nil, msgBody.Event.Message)
if err != nil {
return errors.Wrap(err, "w.srcBridge.IsMessageSent")
return errors.Wrap(err, "w.destBridge.IsMessageSent")
}

// if so, do nothing, acknowledge message
if sent {
slog.Info("source bridge did send this message. returning early",
slog.Info("dest bridge did send this message. returning early",
"msgHash", common.BytesToHash(msgBody.Event.MsgHash[:]).Hex(),
"sent", sent,
)

return nil
}

data, err := encoding.BridgeABI.Pack("processMessage", [][32]byte{msgBody.Event.MsgHash}, true)
receipt, err := w.suspendMessage(ctx, msgBody.Event.MsgHash)
if err != nil {
return errors.Wrap(err, "encoding.BridgeABI.Pack")
return err
}

candidate := txmgr.TxCandidate{
TxData: data,
Blobs: nil,
To: &w.cfg.DestBridgeAddress,
}
slog.Info("Mined suspend tx", "txHash", hex.EncodeToString(receipt.TxHash.Bytes()))

receipt, err := w.txmgr.Send(ctx, candidate)
relayer.TransactionsSuspended.Inc()

pauseReceipt, err := w.pauseBridge(ctx)
if err != nil {
slog.Warn("Failed to send SuspendMessage transaction", "error", err.Error())
return err
}

slog.Info("Mined tx", "txHash", hex.EncodeToString(receipt.TxHash.Bytes()))
slog.Info("Mined pause tx", "txHash", hex.EncodeToString(pauseReceipt.TxHash.Bytes()))

relayer.TransactionsSuspended.Inc()
relayer.BridgePaused.Inc()

if _, err := w.suspendedTxRepo.Save(ctx,
relayer.SuspendTransactionOpts{
Expand All @@ -335,3 +332,46 @@ func (w *Watchdog) checkMessage(ctx context.Context, msg queue.Message) error {

return nil
}

func (w *Watchdog) suspendMessage(ctx context.Context, msgHash [32]byte) (*types.Receipt, error) {
data, err := encoding.BridgeABI.Pack("suspendMessages", [][32]byte{msgHash}, true)
if err != nil {
return nil, errors.Wrap(err, "encoding.BridgeABI.Pack")
}

candidate := txmgr.TxCandidate{
TxData: data,
Blobs: nil,
To: &w.cfg.SrcBridgeAddress,
}

receipt, err := w.txmgr.Send(ctx, candidate)
if err != nil {
slog.Warn("Failed to send SuspendMessage transaction", "error", err.Error())
return nil, err
}

return receipt, nil
}

func (w *Watchdog) pauseBridge(ctx context.Context) (*types.Receipt, error) {
data, err := encoding.BridgeABI.Pack("pause")
if err != nil {
return nil, errors.Wrap(err, "encoding.BridgeABI.Pack")
}

// pause the src bridge, which is the DESTINATION of the original message.
candidate := txmgr.TxCandidate{
TxData: data,
Blobs: nil,
To: &w.cfg.SrcBridgeAddress,
}

receipt, err := w.txmgr.Send(ctx, candidate)
if err != nil {
slog.Warn("Failed to send pause transaction", "error", err.Error())
return nil, err
}

return receipt, nil
}
Loading

0 comments on commit 50363d7

Please sign in to comment.