-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Replace message_id with nonce in MessageProof
query
#1363
Changes from 6 commits
4a29026
7a6807a
75713e6
c7311a6
5e89f45
c711a46
2e394cc
c220b59
8acff6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ use fuel_core_types::{ | |
}, | ||
fuel_merkle::binary::in_memory::MerkleTree, | ||
fuel_tx::{ | ||
input::message::compute_message_id, | ||
Receipt, | ||
TxId, | ||
}, | ||
|
@@ -139,7 +140,7 @@ impl<D: DatabasePort + ?Sized> MessageProofData for D { | |
pub fn message_proof<T: MessageProofData + ?Sized>( | ||
database: &T, | ||
transaction_id: Bytes32, | ||
message_id: MessageId, | ||
desired_nonce: Nonce, | ||
commit_block_id: BlockId, | ||
) -> StorageResult<Option<MessageProof>> { | ||
// Check if the receipts for this transaction actually contain this message id or exit. | ||
|
@@ -154,7 +155,7 @@ pub fn message_proof<T: MessageProofData + ?Sized>( | |
amount, | ||
data, | ||
.. | ||
} if r.message_id() == Some(message_id) => { | ||
} if r.nonce() == Some(&desired_nonce) => { | ||
Some((sender, recipient, nonce, amount, data)) | ||
} | ||
_ => None, | ||
|
@@ -185,6 +186,8 @@ pub fn message_proof<T: MessageProofData + ?Sized>( | |
None => return Ok(None), | ||
}; | ||
|
||
let message_id = compute_message_id(&sender, &recipient, &nonce, amount, &data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand correctly, this is kinda the meat of the change: Rather than using the message id directly, we pass in the nonce. Together, these pieces of information allow us to reconstruct the message id. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep. Maybe I could have reworded the contents of the issue. We were just asking for more information than needed. |
||
|
||
let message_proof = | ||
match message_receipts_proof(database, message_id, &message_block_txs)? { | ||
Some(proof) => proof, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could just be my interpretation, but I believe we are putting changelog updates at the start of the section - something like a reverse chronological order, so that the newest things are first.