Skip to content
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

Cleaned up the response verification #649

Merged
merged 14 commits into from
Jul 19, 2024
Merged

Conversation

DavidM-D
Copy link
Contributor

This now does native ecdsa key derivation and the epsilon is unreversed

@DavidM-D DavidM-D requested a review from volovyks June 17, 2024 22:02
@@ -117,6 +117,8 @@ impl MpcContract {
fn add_sign_result(&mut self, payload: &SignatureRequest, signature: SignatureResponse) {
if self.pending_requests.contains_key(payload) {
self.pending_requests.insert(payload, &Some(signature));
} else {
env::panic_str(&format!("Key not found: {:?}", payload))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the node behavior in case of a failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a test, I'll add it in

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature is discarded after retying, is that alright?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's discarded, we need to alert the requestor of the signature that it failed to publish somehow. I guess with yield/resume we can do this by returning an error and pancing so we can do this in future, but maybe for now we just store the signature to be sent again on the next iteration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now we can add a record_failure method to contract, and cross contract call to it when it fails. The record_failure can be actually not record anything on chain, but because it is cross contract called, we can modify the indexer part to catch it.

Of course yield/resume would be better if it can be implemented soon, and signature discarded as a short term solution is acceptable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up pushing it to the back of the queue and retrying unless it fails in the contract. It's easy to DoS the contract if you allow incorrect responses to cancel the request.

chain-signatures/node/src/protocol/signature.rs Outdated Show resolved Hide resolved
chain-signatures/node/src/protocol/signature.rs Outdated Show resolved Hide resolved
chain-signatures/node/src/protocol/signature.rs Outdated Show resolved Hide resolved
chain-signatures/node/src/protocol/signature.rs Outdated Show resolved Hide resolved
@@ -117,6 +117,8 @@ impl MpcContract {
fn add_sign_result(&mut self, payload: &SignatureRequest, signature: SignatureResponse) {
if self.pending_requests.contains_key(payload) {
self.pending_requests.insert(payload, &Some(signature));
} else {
env::panic_str(&format!("Key not found: {:?}", payload))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's discarded, we need to alert the requestor of the signature that it failed to publish somehow. I guess with yield/resume we can do this by returning an error and pancing so we can do this in future, but maybe for now we just store the signature to be sent again on the next iteration

ailisp
ailisp previously approved these changes Jul 4, 2024
Copy link
Member

@ailisp ailisp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@volovyks volovyks mentioned this pull request Jul 17, 2024
@DavidM-D DavidM-D force-pushed the dmd/cleanup-signature-check branch 2 times, most recently from 46dec87 to 371bc62 Compare July 18, 2024 13:07
@DavidM-D DavidM-D force-pushed the dmd/cleanup-signature-check branch from 371bc62 to 6867939 Compare July 18, 2024 13:11
@DavidM-D
Copy link
Contributor Author

I think this is ready to merge

Copy link
Collaborator

@volovyks volovyks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DavidM-D DavidM-D merged commit cbd2def into develop Jul 19, 2024
3 checks passed
@DavidM-D DavidM-D deleted the dmd/cleanup-signature-check branch July 19, 2024 12:00
Copy link

Terraform Feature Environment Destroy (dev-649)

Terraform Initialization ⚙️success

Terraform Destroy success

Show Destroy Plan


No changes. No objects need to be destroyed.

Either you have not created any objects yet or the existing objects were
already deleted outside of Terraform.

Destroy complete! Resources: 0 destroyed.

Pusher: @DavidM-D, Action: pull_request, Working Directory: ``, Workflow: Terraform Feature Env (Destroy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants