-
Notifications
You must be signed in to change notification settings - Fork 32
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
[SLT-315] refactor(opbot): use gql api #3260
Changes from 1 commit
dadc913
dccd638
c1d21e4
cd2187a
8885dd5
9dc780d
2ef3bbf
6cf146a
451a2d7
6c02517
a932e29
543fa15
50c4ecc
a4cd9aa
3e90715
a40d79d
7c12249
8724af9
9bd0038
a7d5072
4f1f04c
1dbcd96
6b4c78e
51d46c5
d0867c5
7679fde
fce526b
146d28d
111d862
54b1391
0dd607d
7835278
6c7c8f2
56bcab9
5e3f0e2
2e85f89
2829c0f
88f9165
643c0dc
1193c9c
a4997e6
634144a
bc29e4d
72fa23b
69e03b2
f6c9020
1fbfbfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,7 +279,7 @@ | |
ctx.Context(), | ||
big.NewInt(int64(rawRequest.Bridge.OriginChainID)), | ||
func(transactor *bind.TransactOpts) (tx *types.Transaction, err error) { | ||
tx, err = fastBridgeContract.Refund(transactor, common.Hex2Bytes(rawRequest.BridgeRequest.Request)) | ||
tx, err = fastBridgeContract.Refund(transactor, common.Hex2Bytes(rawRequest.Bridge.Request)) | ||
if err != nil { | ||
return nil, fmt.Errorf("error submitting refund: %w", err) | ||
} | ||
|
@@ -313,7 +313,7 @@ | |
return | ||
} | ||
|
||
_, err = ctx.Response().Reply(fmt.Sprintf("refund submitted: %s", toTXSlackLink(status.TxHash().String(), uint32(rawRequest.Bridge.OriginChainID)))) | ||
if err != nil { | ||
log.Println(err) | ||
} | ||
|
@@ -332,12 +332,12 @@ | |
return nil, fmt.Errorf("error fetching rfq contracts: %w", err) | ||
} | ||
|
||
chainClient, err := b.rpcClient.GetChainClient(ctx, int(req.Bridge.OriginChainID)) | ||
if err != nil { | ||
return nil, fmt.Errorf("error getting chain client: %w", err) | ||
} | ||
|
||
contractAddress, ok := contracts.Contracts[uint32(req.Bridge.OriginChainID)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential integer overflow when accessing contract address The conversion of Consider using a safe conversion function similar to the one suggested earlier: - contractAddress, ok := contracts.Contracts[uint32(req.Bridge.OriginChainID)]
+ contractAddress, ok := contracts.Contracts[safeUint32(req.Bridge.OriginChainID)] Where func safeUint32(v int) uint32 {
if v < 0 || v > math.MaxUint32 {
// Handle error or return a default value
return 0
}
return uint32(v)
} 🧰 Tools🪛 GitHub Check: codecov/patch
🪛 GitHub Check: Lint (contrib/opbot)
|
||
if !ok { | ||
return nil, errors.New("contract address not found") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use safe chain ID conversion in toTXSlackLink call.
Similar to previous occurrences, direct conversion of chain ID to uint32 could cause integer overflow.
Apply this diff:
🧰 Tools
🪛 GitHub Check: Lint (contrib/opbot)