massa icon indicating copy to clipboard operation
massa copied to clipboard

Generate unique event IDs and AsyncMessage IDs

Open damip opened this issue 1 year ago • 2 comments

Followup of https://github.com/massalabs/massa/pull/4197

  • [ ] define Event IDs and generate them using the execution hash trail: Hash::compute_from_tuple("EVENT_ID".to_bytes(), context.execution_trial_hash.to_bytes(), context.event_index.to_be_bytes())
  • [ ] return the event ID when calling the emit_event ABI
  • [ ] define AsyncMessage IDs and generate them using the trail: Hash::compute_from_tuple("ASYNC_MSG_ID".to_bytes(), context.execution_trial_hash.to_bytes(), context.async_message_index.to_be_bytes())
  • [ ] return the AsyncMessageID when emitting a message from the ABI

damip avatar Jul 11 '23 09:07 damip

Actual AsyncMessageId impl:

https://github.com/massalabs/massa/blob/215bce594e600561903cd0aca1a06948c8f81904/massa-async-pool/src/message.rs#L29-L32

aoudiamoncef avatar Jul 11 '23 10:07 aoudiamoncef

Actual AsyncMessageId impl:

Yes, I will check if we can do better in this issue, but first I need to make this work: https://github.com/massalabs/massa/pull/4197

damip avatar Jul 11 '23 10:07 damip