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

Check bridge routes on send token #16960

Merged
merged 2 commits into from
Mar 30, 2024
Merged

Conversation

dariorussi
Copy link
Contributor

@dariorussi dariorussi commented Mar 29, 2024

Description

Audit found that send_token was not checking for valid routes.
Added the missing check

Test Plan

Added unit tests.
Positive tests (no abort) for send_token are a bit trickier and will be added when unit test review is done. They were not there so this is not a regression in tests.


If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

Copy link

vercel bot commented Mar 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am
multisig-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am
mysten-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am
sui-kiosk ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2024 4:18am

@@ -93,6 +93,7 @@ module bridge::bridge {
const EBridgeAlreadyPaused: u64 = 13;
const EBridgeNotPaused: u64 = 14;
const ETokenAlreadyClaimed: u64 = 15;
const EInvalidBridgeRoute: u64 = 16;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a headsup this will conflict with your other PRs

@@ -175,6 +176,7 @@ module bridge::bridge {
) {
let inner = load_inner_mut(self);
assert!(!inner.paused, EBridgeUnavailable);
assert!(chain_ids::is_valid_route(inner.chain_id, target_chain), EInvalidBridgeRoute);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow this was a big miss

fun test_execute_send_token_invalid_route() {
let mut scenario = test_scenario::begin(@0x0);
let ctx = test_scenario::ctx(&mut scenario);
let chain_id = chain_ids::sui_devnet();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use testnet(), since we are deprecating devnet id

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@dariorussi dariorussi merged commit 3635644 into feature/native-bridge Mar 30, 2024
45 checks passed
@dariorussi dariorussi deleted the bridge_audit3 branch March 30, 2024 13:04
patrickkuo pushed a commit that referenced this pull request May 2, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
patrickkuo pushed a commit that referenced this pull request May 8, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Audit found that `send_token` was not checking for valid routes.
Added the missing check

## Test Plan

Added unit tests.
Positive tests (no abort) for `send_token` are a bit trickier and will
be added when unit test review is done. They were not there so this is
not a regression in tests.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants