-
Notifications
You must be signed in to change notification settings - Fork 370
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
feat(sdk): add support program registration #1842
Conversation
SP1 Performance Test Results Branch: mattstam/sdk-network-v2-mergable
|
unrelated CI failing |
|
||
/// Sets the fulfillment strategy for the client. By default, the strategy is set to `Hosted`. | ||
pub fn with_strategy(&mut self, strategy: FulfillmentStrategy) { | ||
self.strategy = strategy; | ||
} |
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.
note: I will do other SDK improvements in a subsequent PR
@@ -95,6 +97,76 @@ impl NetworkClient { | |||
Ok(res.into_inner().nonce) | |||
} | |||
|
|||
/// Get the verifying key hash from a verifying key. The verifying key hash is used to identify | |||
/// a program. | |||
pub fn get_vk_hash(vk: &SP1VerifyingKey) -> Result<Vec<u8>> { |
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.
Wondering if we should use SP1VerifyingKeyHash([u32; 8]) or something
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.
will keep this in mind
Problem: uploading the elf and doing prover.setup(elf) to get the vk on every request is unnecessary.
Solution: the elf and vk are no longer sent every request, instead they are only sent if the program hasn't been registered in the network yet.
Previous SDK prove:
New SDK prove:
a. if error:
i. upload the elf
ii. call CreateProgram(vk_hash, vk, program_uri)
Example output with registration, since the program doesn't exist yet:
and then re-running it, it skips the registration: