Skip to content

Commit

Permalink
Cherry pick 18359 to 1.28.0 (MystenLabs#18386)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## 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:
  • Loading branch information
longbowlu authored Jun 24, 2024
1 parent e53cbee commit 1d48056
Show file tree
Hide file tree
Showing 15 changed files with 946 additions and 20 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions crates/sui-framework/docs/bridge/committee.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ title: Module `0xb::committee`
- [Struct `BlocklistValidatorEvent`](#0xb_committee_BlocklistValidatorEvent)
- [Struct `BridgeCommittee`](#0xb_committee_BridgeCommittee)
- [Struct `CommitteeUpdateEvent`](#0xb_committee_CommitteeUpdateEvent)
- [Struct `CommitteeMemberUrlUpdateEvent`](#0xb_committee_CommitteeMemberUrlUpdateEvent)
- [Struct `CommitteeMember`](#0xb_committee_CommitteeMember)
- [Struct `CommitteeMemberRegistration`](#0xb_committee_CommitteeMemberRegistration)
- [Constants](#@Constants_0)
Expand Down Expand Up @@ -137,6 +138,39 @@ title: Module `0xb::committee`
</dl>


</details>

<a name="0xb_committee_CommitteeMemberUrlUpdateEvent"></a>

## Struct `CommitteeMemberUrlUpdateEvent`



<pre><code><b>struct</b> <a href="committee.md#0xb_committee_CommitteeMemberUrlUpdateEvent">CommitteeMemberUrlUpdateEvent</a> <b>has</b> <b>copy</b>, drop
</code></pre>



<details>
<summary>Fields</summary>


<dl>
<dt>
<code>member: <a href="../move-stdlib/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
<dt>
<code>new_url: <a href="../move-stdlib/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
</dt>
<dd>

</dd>
</dl>


</details>

<a name="0xb_committee_CommitteeMember"></a>
Expand Down Expand Up @@ -663,6 +697,10 @@ title: Module `0xb::committee`
<b>let</b> (_, member) = self.members.get_entry_by_idx_mut(idx);
<b>if</b> (member.sui_address == ctx.sender()) {
member.http_rest_url = new_url;
emit (<a href="committee.md#0xb_committee_CommitteeMemberUrlUpdateEvent">CommitteeMemberUrlUpdateEvent</a> {
member: member.bridge_pubkey_bytes,
new_url
});
<b>return</b>
};
idx = idx + 1;
Expand Down
3 changes: 2 additions & 1 deletion crates/sui-framework/docs/bridge/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ Emergency op payload is just a single byte


<pre><code><b>public</b> <b>fun</b> <a href="message.md#0xb_message_extract_blocklist_payload">extract_blocklist_payload</a>(<a href="message.md#0xb_message">message</a>: &<a href="message.md#0xb_message_BridgeMessage">BridgeMessage</a>): <a href="message.md#0xb_message_Blocklist">Blocklist</a> {
// blocklist payload should consist of one byte blocklist type, and list of 33 bytes ecdsa pub keys
// blocklist payload should consist of one byte blocklist type, and list of 20 bytes evm addresses
// derived from ECDSA <b>public</b> keys
<b>let</b> <b>mut</b> <a href="../move-stdlib/bcs.md#0x1_bcs">bcs</a> = bcs::new(<a href="message.md#0xb_message">message</a>.payload);
<b>let</b> blocklist_type = <a href="../move-stdlib/bcs.md#0x1_bcs">bcs</a>.peel_u8();
<b>let</b> <b>mut</b> address_count = <a href="../move-stdlib/bcs.md#0x1_bcs">bcs</a>.peel_u8();
Expand Down
9 changes: 9 additions & 0 deletions crates/sui-framework/packages/bridge/sources/committee.move
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ module bridge::committee {
stake_participation_percentage: u64
}

public struct CommitteeMemberUrlUpdateEvent has copy, drop {
member: vector<u8>,
new_url: vector<u8>,
}

public struct CommitteeMember has copy, drop, store {
/// The Sui Address of the validator
sui_address: address,
Expand Down Expand Up @@ -274,6 +279,10 @@ module bridge::committee {
let (_, member) = self.members.get_entry_by_idx_mut(idx);
if (member.sui_address == ctx.sender()) {
member.http_rest_url = new_url;
emit (CommitteeMemberUrlUpdateEvent {
member: member.bridge_pubkey_bytes,
new_url
});
return
};
idx = idx + 1;
Expand Down
3 changes: 2 additions & 1 deletion crates/sui-framework/packages/bridge/sources/message.move
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ module bridge::message {
}

public fun extract_blocklist_payload(message: &BridgeMessage): Blocklist {
// blocklist payload should consist of one byte blocklist type, and list of 33 bytes ecdsa pub keys
// blocklist payload should consist of one byte blocklist type, and list of 20 bytes evm addresses
// derived from ECDSA public keys
let mut bcs = bcs::new(message.payload);
let blocklist_type = bcs.peel_u8();
let mut address_count = bcs.peel_u8();
Expand Down
3 changes: 3 additions & 0 deletions crates/sui-framework/published_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3883,6 +3883,9 @@ BridgeCommittee
CommitteeUpdateEvent
public struct
0xb::committee
CommitteeMemberUrlUpdateEvent
public struct
0xb::committee
CommitteeMember
public struct
0xb::committee
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@
"name": "Result",
"value": {
"minSupportedProtocolVersion": "1",
"maxSupportedProtocolVersion": "51",
"maxSupportedProtocolVersion": "52",
"protocolVersion": "6",
"featureFlags": {
"accept_zklogin_in_multisig": false,
Expand Down
4 changes: 3 additions & 1 deletion crates/sui-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::{info, warn};

/// The minimum and maximum protocol versions supported by this build.
const MIN_PROTOCOL_VERSION: u64 = 1;
const MAX_PROTOCOL_VERSION: u64 = 51;
const MAX_PROTOCOL_VERSION: u64 = 52;

// Record history of protocol version allocations here:
//
Expand Down Expand Up @@ -147,6 +147,7 @@ const MAX_PROTOCOL_VERSION: u64 = 51;
// Prepose consensus commit prologue in checkpoints.
// Set number of leaders per round for Mysticeti commits.
// Version 51: Switch to DKG V1.
// Version 52: Emit `CommitteeMemberUrlUpdateEvent` when updating bridge node url.

#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct ProtocolVersion(u64);
Expand Down Expand Up @@ -2419,6 +2420,7 @@ impl ProtocolConfig {
51 => {
cfg.random_beacon_dkg_version = Some(1);
}
52 => {}
// Use this template when making changes:
//
// // modify an existing constant.
Expand Down
Loading

0 comments on commit 1d48056

Please sign in to comment.