feat(link): custom light client - POC - #1391
Conversation
| "github.com/cosmos/ibc/link/lightclient/remotepoc" | ||
| ) | ||
|
|
||
| func main() { |
There was a problem hiding this comment.
This is an example of how a consumer would construct the binary to compile their custom proving logic into the CLI.
| ) | ||
|
|
||
| // TestRemoteAttestationLightClientRelaysPacket relays through a remote prover. | ||
| func TestRemoteAttestationLightClientRelaysPacket(t *testing.T) { |
| @@ -0,0 +1,222 @@ | |||
| // SPDX-License-Identifier: Apache-2.0 | |||
There was a problem hiding this comment.
Exposes root command in public api
| @@ -64,6 +66,9 @@ type ClientEnd struct { | |||
| ClientID string `yaml:"clientId"` | |||
| Type ClientType `yaml:"type"` | |||
|
|
|||
| // ClientParams is interpreted by the factory registered for Type. | |||
There was a problem hiding this comment.
This accepts arbitrary yaml configuration and lets the custom prover implementations decide how to validate and interpret it.
| @@ -0,0 +1,89 @@ | |||
| // SPDX-License-Identifier: Apache-2.0 | |||
There was a problem hiding this comment.
Implementation of a server that implements the interface the POC remote prover expects. Executes attestation proof logic.
| @@ -0,0 +1,124 @@ | |||
| // SPDX-License-Identifier: Apache-2.0 | |||
There was a problem hiding this comment.
POC of how consumers might implement a prover that calls out to a remote service to generate proofs.
| ) | ||
|
|
||
| // Prover generates proofs for one light client. | ||
| type Prover interface { |
There was a problem hiding this comment.
The prover interface that consumers would create custom implementations of.
| } | ||
|
|
||
| // ProverFactory builds provers for one custom light-client type. | ||
| type ProverFactory interface { |
There was a problem hiding this comment.
Consumers create a factory that the relayer invokes to create provers during startup.
We could extend this to also offer a ValidateParams method that hooks into config validation and lets consumers validate clientParams. This doesn't really feel necessary as I doubt consumers will intend to distribute their binary very broadly and probably don't care as much about the UX as much as we do. They can currently just do some validation in the constructor if they want.
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
87d350b to
80ac2ea
Compare
Signed-off-by: Dennis Fang <dhsfang@gmail.com>
Summary
Adds support for custom light-client provers in downstream-compiled ibc binaries.
I chose to expose the CLI root command and have it accept the custom light client provers as this felt like the option that was the smallest extension of the public surface and the most straightforward for consumers to understand. This also enables consumers of custom light client prover functionality to continue operating Link through the CLI. Alternatives like exposing the relayer service drag more of the internals out into the public interface requiring the consumer to understand a larger set of components and the relayer service lifecycle. Exposing it also feels premature as the relayer service architecture is still not stable and we have not thoroughly thought through or tried to understand the possible use cases that may influence the design of these libraries.
Once the approach is validated, I'll remove the POC specific code and do some additional cleanup before putting up the PR for review. I haven't fully refactored the internal proof generation library to keep the diff small as I mainly wanted feedback on the public API which is as follows:
Public API
Downstream binaries register custom prover factories when constructing the CLI:
A factory identifies its client type and constructs one prover for each configured client:
Custom provers implement the proof-generation contract used by the relayer. The relayer creates one prover per light client instance that is responsible for creating proofs for the light client and indicating what height of the counterparty chain it considers provable
Operators select the custom implementation and provide implementation-specific parameters through the normal Link configuration via a new arbitrarily shaped
clientParams:I've left some comments in the diff to highlight the most important parts.