-
Notifications
You must be signed in to change notification settings - Fork 816
Description
When handling BLS Public Keys, we often re-verify an already verified BLS public key. However, the BLS Public Keys are verified before being added to the P-Chain, so the keys that are already part of the validator set do not need to be re-verified every time.
We should add support for handling both trusted/untrusted BLS Public Keys (may be applicable to other objects from the blst library as well) to reduce the overhead of re-verification.
Specifically, the CPU profile from the new GetValidatorSet over gRPC (#1326) shows that the majority of time is spent in CGO. This may add unnecessary overhead in both compressing the key and re-validating the key:
- https://github.com/ava-labs/avalanchego/blob/master/utils/crypto/bls/public.go#L28
- https://github.com/ava-labs/avalanchego/blob/master/utils/crypto/bls/public.go#L38
When serving these public keys over gRPC, they have already been verified, so we can treat them as trusted input and reduce the overhead here.