Skip to content

Relocate authenticated events client to sui-rust-sdk#223

Draft
alex-mysten wants to merge 6 commits intoMystenLabs:masterfrom
alex-mysten:steka-move-light-client-to-sdk
Draft

Relocate authenticated events client to sui-rust-sdk#223
alex-mysten wants to merge 6 commits intoMystenLabs:masterfrom
alex-mysten:steka-move-light-client-to-sdk

Conversation

@alex-mysten
Copy link

Summary

  • Add sui-authenticated-events-client crate with proof verification, OCS merkle proofs, and authenticated event streaming
  • Add transaction_digest(), events_digest(), changed_objects() methods to TransactionEffects in sui-sdk-types
  • Add EventId type to sui-sdk-types
  • Add merkle tree module to sui-crypto (relocated from fastcrypto)

Related PRs

  • sui: MystenLabs/sui#TBD
  • fastcrypto: MystenLabs/fastcrypto#TBD

@alex-mysten alex-mysten force-pushed the steka-move-light-client-to-sdk branch 2 times, most recently from 23bb7df to 7a45f61 Compare March 5, 2026 20:52
@alex-mysten alex-mysten changed the title Add sui-authenticated-events-client crate Relocate authenticated events client to sui-rust-sdk Mar 6, 2026
@alex-mysten alex-mysten force-pushed the steka-move-light-client-to-sdk branch 4 times, most recently from 0018378 to 0e37472 Compare March 6, 2026 20:13
Copy link
Collaborator

@bmwill bmwill left a comment

Choose a reason for hiding this comment

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

This is a large PR. Its going to take a while to get through it so i'll probably leave comments in waves. I think there is opportunity to probably break things down into slightly smaller bits and get those merged in pieces.

/// })]
/// })
/// ```
fn build_accumulator_key_type_tag_bcs() -> Vec<u8> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we doing all of this instead of just building the TypeTag and serializing it?

Digest::new(root_digest)
}

pub fn derive_event_stream_head_object_id(stream_id: Address) -> Result<Address, anyhow::Error> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have existing utilities for deriving dynamic child objects as well as derived ids in the main sdk types crate, we should use those and not reimplement the logic elsewhere

let key_type_tag_bcs = build_accumulator_key_type_tag_bcs();

// hash(intent_scope || parent || len(key_bcs) || key_bcs || key_type_tag_bcs)
let mut hasher = blake2::Blake2b::<U32>::new();
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a Hasher in the main sdk types crate that handles the interface to the blake2b256 hashing infra, if we do need to access a hasher, lets reuse that.

/// An ObjectRef that is BCS-compatible with `(ObjectID, SequenceNumber, ObjectDigest)` from sui-types.
/// Implements Ord so it can be used in Merkle non-inclusion proofs.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct OrderedObjectRef(pub Address, pub u64, pub Digest);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have ObjectReference, why can't we use that?

use sui_sdk_types::Digest;
use sui_sdk_types::ObjectReference;

pub type U256 = BUintD8<32>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have a U256 type in the main sdk types crate, i don't believe is to fully exposed yet, but we could do that and would be preferable to defining a new one here

Copy link
Author

@alex-mysten alex-mysten Mar 13, 2026

Choose a reason for hiding this comment

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

I presume we would want to wrap this type as this comment describes before making it pub?
There is also a pub crate U256 in zklogin

@@ -0,0 +1,26 @@
[package]
name = "sui-authenticated-events-client"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need a full new crate? i think we could probably break this down into:

  • core proof logic (which afaik is just working with blake2b digests) which could likely find a home in the sui-sdk-types crate (maybe under a feature gate)
  • networking/RPC component which can probably live in the sui-rpc crate.

}
}

#[derive(Debug, Serialize, Deserialize)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should actively remove Serialize/Deserialize impls where there are not needed, and if it is needed we should document if its a requirement that they define a BCS schema or not.

Comment on lines +25 to +35
pub trait ProofBuilder {
fn construct(self, checkpoint: &CheckpointData) -> ProofResult<Proof>;
}

pub trait ProofVerifier {
fn verify(self, committee: &ValidatorCommittee) -> ProofResult<()>;
}

pub trait ProofContentsVerifier {
fn verify(self, targets: &ProofTarget, summary: &CheckpointSummary) -> ProofResult<()>;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these traits necessary? or would the logic be better suited to just be explicit methods on the various types?

@alex-mysten alex-mysten force-pushed the steka-move-light-client-to-sdk branch 3 times, most recently from aca5eb2 to 1b052e2 Compare March 17, 2026 15:17
…ve bnum dependency leak

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alex-mysten alex-mysten force-pushed the steka-move-light-client-to-sdk branch from 1b052e2 to 25a1759 Compare March 17, 2026 15:50
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