filecoin-project / go-f3

Golang implementation of Fast Finality for Filecoin (F3)
Apache License 2.0
10 stars 7 forks source link

Refactor validation logic for a more pluggable functionality #561

Closed masih closed 1 month ago

masih commented 2 months ago

The current validation logic is encapsulated at a package-level function that takes a number of arguments to validate a given message. This is useful for users whom are just interested in validating a given gpbft message but does require Host to be passed in. Host is a heavy struct; but in validation it is only used to marshal payload.

Separately, it is desirable to cache the computationally expensive parts of validation specially if the rate of duplicates in the live network is high. The two computationally expensive parts are: message signature validation and justification aggregated signature validation. The work in #557 and #560 introduces caching for validation purposes. But the API can be refined further to make future extensions easier while making modifications less error-prone since message validation is highly critical.

Consider:

masih commented 2 months ago

Also see: https://github.com/filecoin-project/go-f3/pull/560#discussion_r1714173707