Relocate authenticated events client to sui-rust-sdk#223
Relocate authenticated events client to sui-rust-sdk#223alex-mysten wants to merge 6 commits intoMystenLabs:masterfrom
Conversation
23bb7df to
7a45f61
Compare
0018378 to
0e37472
Compare
bmwill
left a comment
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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> { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" | |||
There was a problem hiding this comment.
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-rpccrate.
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize)] |
There was a problem hiding this comment.
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.
| 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<()>; | ||
| } |
There was a problem hiding this comment.
are these traits necessary? or would the logic be better suited to just be explicit methods on the various types?
…erics Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
aca5eb2 to
1b052e2
Compare
…ve bnum dependency leak Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1b052e2 to
25a1759
Compare
Summary
sui-authenticated-events-clientcrate with proof verification, OCS merkle proofs, and authenticated event streamingtransaction_digest(),events_digest(),changed_objects()methods toTransactionEffectsin sui-sdk-typesEventIdtype to sui-sdk-typesRelated PRs