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

cache signatures only in acp118 handler #3474

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ceyonur
Copy link
Contributor

@ceyonur ceyonur commented Oct 15, 2024

Why this should be merged

Cache might be needed to shared with other components. Currently we cache whole proto signature response, a plain signature caching can be more straightforward to be returned from shared cache for other components.

For instance Subnet-EVM can use this signature cache in API calls and in legacy p2p handler.

How this works

Caches and returns direct signature bytes rather than proto SignatureResponse

How this was tested

Added UT

@ceyonur ceyonur marked this pull request as ready for review October 15, 2024 20:58
Comment on lines 129 to 134
if tt.cacher.Len() > 0 {
// Ensure the cache is populated with correct signature
sig, ok := tt.cacher.Get(unsignedMessage.ID())
require.True(ok)
require.Equal(sig, response.Signature)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than checking the length (which seems fairly fragile) we should just assert that the signature is as expected if the cacher returns the signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return responseBytesFromSignature(signature)
}

func responseBytesFromSignature(signature []byte) ([]byte, *common.AppError) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func responseBytesFromSignature(signature []byte) ([]byte, *common.AppError) {
func signatureToResponse(signature []byte) ([]byte, *common.AppError) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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