You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I feel we mark functions as unsafe in an inconsistent way at the moment. I think we should discuss this and establish some guidelines (are there some best practices from Rust).
A function such this one does nothing that is actually unsafe so I don't think it should be marked unsafe:
pub unsafe extern "C" fn trigger_parentchain_block_import() -> sgx_status_t {
match GLOBAL_TRIGGERED_PARENTCHAIN_IMPORT_DISPATCHER_COMPONENT.get() {
Ok(dispatcher) => match dispatcher.import_all() {
Ok(_) => sgx_status_t::SGX_SUCCESS,
Err(e) => {
error!("Failed to trigger import of parentchain blocks: {:?}", e);
sgx_status_t::SGX_ERROR_UNEXPECTED
},
},
Err(e) => Error::ComponentContainer(e).into(),
}
}
On the other hand I think this should be marked unsafe as the function cannot guarantee all these pointers are valid and the memory is of the correct size.
I doubt that we can change this. The rust compiler complains if the upper one is not marked unsafe. We should be able to add an unsafe to the lower one though.
I feel we mark functions as
unsafe
in an inconsistent way at the moment. I think we should discuss this and establish some guidelines (are there some best practices from Rust).A function such this one does nothing that is actually unsafe so I don't think it should be marked unsafe:
On the other hand I think this should be marked unsafe as the function cannot guarantee all these pointers are valid and the memory is of the correct size.
The text was updated successfully, but these errors were encountered: