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

chore: refactor signature id and failed signatures #194

Merged
merged 30 commits into from
Feb 13, 2025

Conversation

ChaoticTempest
Copy link
Contributor

@ChaoticTempest ChaoticTempest commented Feb 11, 2025

SignId is now used everywhere instead of request_id. A couple things were made more efficient like no longer passing the part of sign requests around, instead we wholly pass around SignRequest which contains all the info the node needs to do signature generation.

  • SignId is an id agnostic of any chain, just has raw request_id, payload and epsilon.
  • SignArgs is all the info that is not present in the SignId such as entropy, key_version, and path.
  • IndexedSignRequest is all the info from the indexer which includes SignId and SignArgs.
  • SignRequest has more info that is not present on the chain but only inside the node such as participants and proposer.
  • removed ContractSignRequest since SignArgs basically replaces it.
  • SignatureMessage now uses SignId and does not send ContractSignRequest anymore since it was never used. This info is already indexed by each of the nodes so not necessary to confirm this, but the proposer and presignature id is still something that each node needs to come up with, so that is still being passed around. This is not a breaking serialization change since the messages are forward/backwards compatible as long as the field's names are unique/new which they are with this change.
  • Failed requests are now a part of the SignQueue for better management of requests overall. All failed requests are put at the front of the queue as to be process immediately on the next try. Note that retrying uses the same participants, which is not ideal. In a separate PR, I'll have it so that the participants are reselected but the proposer will stay the same. This selection is deterministic where the seed for randomization is entropy + retry_count.
  • SignQueue::expire will now expire old requests that have been sitting in the queue for too long

@volovyks volovyks mentioned this pull request Feb 11, 2025
Copy link
Contributor

@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.

Lots of good stuff that I'm ready to merge, but I either do not understand or disagree with the core thing in this PR - SignId.

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
@ChaoticTempest
Copy link
Contributor Author

note, that since the near contract also uses SignId for respond and internal tracking of requests, the SignId had to be precomputed in the contract and indexer separately similar to eth way of computing it

recovery_id: 0,
};

let request_json = format!(
"'{}'",
serde_json::to_string(&json!({"request": request, "response": response})).unwrap()
serde_json::to_string(&json!({"sign_id": sign_id, "signature": signature})).unwrap()
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: We have breaking changes in this PR too.

@ChaoticTempest ChaoticTempest merged commit b4d77ae into develop Feb 13, 2025
2 of 3 checks passed
@ChaoticTempest ChaoticTempest deleted the phuong/chore/refactor-signature branch February 13, 2025 17:22
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.

2 participants