-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Introduce genericism around the entry-point of the execute queue in pvf validation. #3226
Conversation
ed89425
to
50d5a5e
Compare
389bcdd
to
2178a44
Compare
) => { | ||
let (code_tx, code_rx) = oneshot::channel(); | ||
// TODO ensure that we needn't call this every time | ||
let validation_code = match runtime_api_request( |
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.
What is the best option to ensure the validation_code is only fetched if it has not yet been prepared?
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.
That's actually a feature in itself.
See https://github.com/paritytech/polkadot/issues/2866
node/core/pvf/src/execute/worker.rs
Outdated
} | ||
|
||
async fn recv_request(stream: &mut UnixStream) -> io::Result<(PathBuf, Vec<u8>)> { | ||
async fn recv_request(stream: &mut UnixStream) -> io::Result<(PathBuf, Vec<u8>, String)> { |
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.
I guess at this point we should introduce a nominal type
node/core/pvf/src/host.rs
Outdated
/// This function enables the implementation of the Candidate Validation subsystem to delineate | ||
/// the entry-point of the PVF and the oneshot channel passed to the execution of any function | ||
/// exported in the pvf. | ||
/// |
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.
There is quite some trailing whitespaces.
Could you please clean them up in this PR. Also it would be great if you can configure your editor to remove trailing whitespaces automatically on save
node/core/pvf/src/host.rs
Outdated
/// situations this function should return immediately. | ||
/// | ||
/// Returns an error if the request cannot be sent to the validation host, i.e. if it shut down. | ||
pub async fn execute_pprevf( |
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.
oh no
This is why I proposed to think of another name for this feature xD
) => { | ||
let (code_tx, code_rx) = oneshot::channel(); | ||
// TODO ensure that we needn't call this every time | ||
let validation_code = match runtime_api_request( |
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.
That's actually a feature in itself.
See https://github.com/paritytech/polkadot/issues/2866
This PR introduces genericism around the entry-point of the execute queue in pvf validation. That is, currently it is assumed that every PVF exports a function
validate_block
, and every worker in the PVF execute queue hard-codes this entry-point. In order to support additional function entry-points in the PVF, we modify the queue to accept the entry-point function as an argument.This PR is currently blocked by: paritytech/substrate#9093.
Once unblocked, the following modifications will be made:
executor_intf::prevalidate
should test that thevalidate_block
is exported in the RuntimeBlobCollatorProtocol
should request a validation under the PVFvalidate_collator
by submitting aCandidateValidationMessage
validate_collator
not be exported in the PVF,CandidateValidation
should notify theCollatorProtocol
that they needn't encforce itvalidate_collator
function, then the CollatorProtocol will enforce thatCollatorProtocolMessage::Declare
should include all input data to thevalidate_collator
function and submit theseDeclare
message, the validator will disconnect peers for whichCandidateValidation
has notified of a failed Collator Validation