Open
Conversation
b27508d to
8a7ce23
Compare
kwsantiago
suggested changes
Nov 25, 2025
| oracle_public_key: crate::ser_impls::read_schnorr_pubkey(reader)?, | ||
| signatures: { | ||
| let len: u16 = Readable::read(reader)?; | ||
| let mut signatures = Vec::with_capacity(len as usize); |
Contributor
There was a problem hiding this comment.
No validation on len before allocating capacity?
| impl Readable for OracleAnnouncement { | ||
| fn read<R: bitcoin::io::Read>(reader: &mut R) -> Result<Self, DecodeError> { | ||
| let _type_id: u64 = BigSize::read(reader)?.0; | ||
| let _length: u64 = BigSize::read(reader)?.0; |
Contributor
There was a problem hiding this comment.
On lines 252, 257, 502 the _length field is read but never validated?
Comment on lines
+256
to
+257
| let _type_id: u64 = BigSize::read(reader)?.0; | ||
| let _length: u64 = BigSize::read(reader)?.0; |
Contributor
There was a problem hiding this comment.
Why is TLV header read twice?
Comment on lines
+284
to
+287
| let event_size = self.oracle_event.serialized_length(); | ||
| BigSize(self.oracle_event.type_id() as u64).serialized_length() + | ||
| BigSize(event_size as u64).serialized_length() + | ||
| event_size |
Contributor
There was a problem hiding this comment.
Calculating the size manually could lead to buffer overflows.
| let mut cursor = Cursor::new(bytes); | ||
| let announcement = OracleAnnouncement::read(&mut cursor); | ||
| println!("{:?}", announcement); | ||
| assert!(announcement.is_ok()) |
Contributor
There was a problem hiding this comment.
Should we add validation on whether the parsed content matches the expected values?
Comment on lines
+227
to
+238
| // fn read_oracle_message<T: Readable>(msg: MagnoliaResponse) -> Result<T, Error> { | ||
| // let bytes = hex::decode(msg.hex).map_err(|e| Error::OracleError(e.to_string()))?; | ||
| // let mut cursor = Cursor::new(bytes); | ||
| // let _type_id: u64 = lightning::util::ser::BigSize::read(&mut cursor).unwrap().0; | ||
| // let _length: u64 = lightning::util::ser::BigSize::read(&mut cursor).unwrap().0; | ||
| // T::read(&mut cursor).map_err(|e| Error::OracleError(e.to_string())) | ||
| // } | ||
| // impl_dlc_writeable!(OracleAnnouncement, { | ||
| // (announcement_signature, {cb_writeable, write_schnorrsig, read_schnorrsig}), | ||
| // (oracle_public_key, {cb_writeable, write_schnorr_pubkey, read_schnorr_pubkey}), | ||
| // (oracle_event, {cb_writeable, write_as_tlv, read_as_tlv}) | ||
| // }); |
Contributor
There was a problem hiding this comment.
Is this worth keeping commented out versus deleting entirely?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.