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

feat(relayer): check event status one more time before sending call #17120

Merged
merged 13 commits into from
May 14, 2024
4 changes: 2 additions & 2 deletions .github/workflows/eventindexer.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ on:

jobs:
lint-eventindexer:
name: lint
name: lint-eventindexer
runs-on: [taiko-runner]
steps:
- uses: actions/setup-go@v5
@@ -30,7 +30,7 @@ jobs:

test-eventindexer:
runs-on: [taiko-runner]
needs: lint
needs: lint-eventindexer
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
10 changes: 5 additions & 5 deletions .github/workflows/guardians-health-check.yaml
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ on:
- "packages/guardian-prover-health-check/**"

jobs:
lint:
name: lint
lint-guardian-prover-health-check:
name: lint-guardian-prover-health-check
runs-on: [taiko-runner]
steps:
- uses: actions/setup-go@v5
@@ -28,9 +28,9 @@ jobs:
working-directory: ./packages/guardian-prover-health-check
args: --config=.golangci.yml --timeout=4m

test:
test-guardian-prover-health-check:
runs-on: [taiko-runner]
needs: lint
needs: lint-guardian-prover-health-check
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
@@ -52,7 +52,7 @@ jobs:
files: ./packages/guardian-prover-health-check/coverage.txt
flags: guardian-prover-health-check

push-docker-image:
push-guardian-prover-health-check-docker-image:
# only push docker image on PR merge to main
if: ${{ github.event }} == 'push'
name: Build and push docker image
4 changes: 2 additions & 2 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ on:

jobs:
lint-relayer:
name: lint
name: lint-relayer
runs-on: [taiko-runner]
steps:
- uses: actions/setup-go@v5
@@ -30,7 +30,7 @@ jobs:

test-relayer:
runs-on: [taiko-runner]
needs: lint
needs: lint-relayer
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ func (srv *Server) GetSignedBlocks(c echo.Context) error {

start, err = strconv.ParseUint(c.QueryParam("start"), 10, 64)
if err != nil {
log.Error("Failed to parse start", "error", err)
return echo.NewHTTPError(http.StatusBadRequest, err)
}
}
31 changes: 13 additions & 18 deletions packages/relayer/ERC1155Vault.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
[
{
"type": "function",
"name": "MAX_TOKEN_PER_TXN",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "acceptOwnership",
@@ -90,6 +77,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
@@ -1003,11 +1003,6 @@
"name": "VAULT_INVALID_TO_ADDR",
"inputs": []
},
{
"type": "error",
"name": "VAULT_MAX_TOKEN_PER_TXN_EXCEEDED",
"inputs": []
},
{
"type": "error",
"name": "VAULT_PERMISSION_DENIED",
13 changes: 13 additions & 0 deletions packages/relayer/ERC20Vault.json
Original file line number Diff line number Diff line change
@@ -165,6 +165,19 @@
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
31 changes: 13 additions & 18 deletions packages/relayer/ERC721Vault.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
[
{
"type": "function",
"name": "MAX_TOKEN_PER_TXN",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "acceptOwnership",
@@ -90,6 +77,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
@@ -959,11 +959,6 @@
"name": "VAULT_INVALID_TO_ADDR",
"inputs": []
},
{
"type": "error",
"name": "VAULT_MAX_TOKEN_PER_TXN_EXCEEDED",
"inputs": []
},
{
"type": "error",
"name": "VAULT_PERMISSION_DENIED",
13 changes: 13 additions & 0 deletions packages/relayer/QuotaManager.json
Original file line number Diff line number Diff line change
@@ -61,6 +61,19 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
13 changes: 13 additions & 0 deletions packages/relayer/SignalService.json
Original file line number Diff line number Diff line change
@@ -100,6 +100,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
36 changes: 36 additions & 0 deletions packages/relayer/TaikoL1.json
Original file line number Diff line number Diff line change
@@ -363,6 +363,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "impl",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "inNonReentrant",
@@ -639,6 +652,19 @@
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "resetGenesisHash",
"inputs": [
{
"name": "_genesisBlockHash",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "resolve",
@@ -1943,6 +1969,16 @@
"name": "L1_RECEIVE_DISABLED",
"inputs": []
},
{
"type": "error",
"name": "L1_TOO_LATE",
"inputs": []
},
{
"type": "error",
"name": "L1_TOO_LATE",
"inputs": []
},
{
"type": "error",
"name": "L1_TOO_MANY_BLOCKS",
39 changes: 35 additions & 4 deletions packages/relayer/bindings/bridge/Bridge.go

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions packages/relayer/bindings/erc1155vault/ERC1155Vault.go

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion packages/relayer/bindings/erc20vault/ERC20Vault.go

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions packages/relayer/bindings/erc721vault/ERC721Vault.go

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion packages/relayer/bindings/quotamanager/QuotaManager.go

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion packages/relayer/bindings/signalservice/SignalService.go

Large diffs are not rendered by default.

54 changes: 53 additions & 1 deletion packages/relayer/bindings/taikol1/TaikoL1.go

Large diffs are not rendered by default.

33 changes: 32 additions & 1 deletion packages/relayer/bindings/taikol2/TaikoL2.go

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
@@ -431,6 +431,27 @@ func (p *Processor) sendProcessMessageCall(
estimatedCost = gasUsed * (baseFee.Uint64() + gasTipCap.Uint64())
}

// we should check event status one more time, after we have waiting for
// confirmations, and after we have generated proof. its possible another relayer
// or the user themself has claimed this in the time it took
// for us to do this work, which would cause us to revert.
eventStatus, err := p.eventStatusFromMsgHash(ctx, event.MsgHash)
if err != nil {
return nil, errors.Wrap(err, "p.eventStatusFromMsgHash")
}

if !canProcessMessage(
ctx,
eventStatus,
event.Message.SrcOwner,
p.relayerAddr,
uint64(event.Message.GasLimit),
) {
slog.Error("can not process message after waiting for confirmations", "err", errUnprocessable)

return nil, errUnprocessable
}

candidate := txmgr.TxCandidate{
TxData: data,
Blobs: nil,
2 changes: 1 addition & 1 deletion packages/relayer/processor/processor.go
Original file line number Diff line number Diff line change
@@ -465,7 +465,7 @@ func (p *Processor) eventLoop(ctx context.Context) {

headers := make(map[string]interface{}, 0)

headers["retries"] = timesRetried + 1
headers["retries"] = int64(timesRetried + 1)

if err := p.queue.Publish(
ctx,