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

tests and move 2024 cleanup #17517

Merged
merged 1 commit into from
May 8, 2024
Merged

tests and move 2024 cleanup #17517

merged 1 commit into from
May 8, 2024

Conversation

dariorussi
Copy link
Contributor

@dariorussi dariorussi commented May 5, 2024

Description

Mostly moved tests in their own files. Particularly tests that have to be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk about

Test plan

Existing test, no feature added


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

Copy link

vercel bot commented May 5, 2024

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

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2024 1:06pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 1:06pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 1:06pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 1:06pm

Copy link
Contributor

@longbowlu longbowlu left a comment

Choose a reason for hiding this comment

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

overall looks good with a few nits

Comment on lines 87 to 95
public(package) fun create(ctx: &TxContext): BridgeCommittee {
assert!(tx_context::sender(ctx) == @0x0, ENotSystemAddress);
BridgeCommittee {
members: vec_map::empty(),
member_registrations: vec_map::empty(),
last_committee_update_epoch: 0,
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

do you want to do sth like

///////////////////////////////////////////
///          Public functions           ///
///////////////////////////////////////////

to make it more readable and for future contributors?

Copy link
Contributor Author

@dariorussi dariorussi May 7, 2024

Choose a reason for hiding this comment

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

I really do not like that but I could add a public function group marker

// Dupicate keys would cause `try_create_next_committee` to fail and,
// in consequence, an end of epoch transaction to fail (safe mode run).
// This check will ensure the creation of the committee is correct.
fun check_uniqueness_bridge_keys(self: &BridgeCommittee, bridge_pubkey_bytes: vector<u8>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have unit test for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not think so and we are not yet 100% test coverage. So soon...

scenario.end();
destroy(treasury);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: new line

let mut bcs = bcs::new(input);
assert!(peel_u64_be(&mut bcs) == expected, 0)
#[test_only]
public(package) fun validator_eth_addresses(block_list: &Blocklist): &vector<vector<u8>> {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call, I do not see usage so I will remove and see, thanks

let mut bcs = bcs::new(input);
assert!(peel_u64_be_for_testing(&mut bcs) == expected, 0)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Comment on lines +72 to +89
public fun token_id<T>(self: &BridgeTreasury): u8 {
let metadata = self.get_token_metadata<T>();
metadata.id
}

public fun decimal_multiplier<T>(self: &BridgeTreasury): u64 {
let metadata = self.get_token_metadata<T>();
metadata.decimal_multiplier
}

public fun notional_value<T>(self: &BridgeTreasury): u64 {
let metadata = self.get_token_metadata<T>();
metadata.notional_value
}
Copy link
Contributor

Choose a reason for hiding this comment

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

do these need to be public? It looks like people won't be able to get &BridgeTreasury anyway: https://github.com/MystenLabs/sui/blob/feature/native-bridge/crates/sui-framework/packages/bridge/sources/bridge.move#L674

Copy link
Contributor Author

@dariorussi dariorussi May 7, 2024

Choose a reason for hiding this comment

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

I think from the limiter? also they seemed accessors that are pretty harmless

@dariorussi
Copy link
Contributor Author

feedback

Copy link
Contributor

@patrickkuo patrickkuo left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup, LGTM

@dariorussi dariorussi merged commit e94113a into feature/native-bridge May 8, 2024
48 checks passed
@dariorussi dariorussi deleted the bridge_ut2 branch May 8, 2024 13:35
patrickkuo pushed a commit that referenced this pull request May 8, 2024
## Description

Mostly moved tests in their own files. Particularly tests that have to
be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk
about

## Test plan

Existing test, no feature added

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Mostly moved tests in their own files. Particularly tests that have to
be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk
about

## Test plan

Existing test, no feature added

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Mostly moved tests in their own files. Particularly tests that have to
be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk
about

## Test plan

Existing test, no feature added

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Mostly moved tests in their own files. Particularly tests that have to
be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk
about

## Test plan

Existing test, no feature added

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
patrickkuo pushed a commit that referenced this pull request May 9, 2024
## Description

Mostly moved tests in their own files. Particularly tests that have to
be expanded.
Move 2024 cleanup.
Formatting and convention alignment.

This is almost no change except for few visibility changes we will talk
about

## Test plan

Existing test, no feature added

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
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.

3 participants