Skip to content

Automatic interface implementation registration #1579

@krisbitney

Description

@krisbitney

Is your feature request related to a problem? Please describe.
Let's say I change the ethereum provider interface URI to acknowledge a new minor or patch release:

ens/wraps.eth:ethereum-provider@1.0.0 --> ens/wraps.eth:ethereum-provider@1.0.1

We also update the ethereum provider plugin implements the new interface.

To use the new interface, we have to register the plugin to BOTH interfaces in the config:

    interfaces:[
      {
        interface: "wrap://ens/wraps.eth:ethereum-provider@1.0.0",
        implementations: ["wrap://plugin/ethereum-provider"]
      },
      {
        interface: "wrap://ens/wraps.eth:ethereum-provider@1.0.1",
        implementations: ["wrap://plugin/ethereum-provider"]
      }
    ],

OR we need to update multiple wrappers to use the new interface and publish new version of them:

  • ethereum wrapper
  • ens wrapper
  • ens text record resolver wrapper

Updating wrappers can create a cascading effect of rebuilds and URI changes to avoid multiple registrations for the same interface.

Describe the solution you'd like
There are multiple ways to solve the problem.

One solution could be to allow multiple interfaces to be registered to one plugin:

    interfaces:[
      {
        interface: [
          "wrap://ens/wraps.eth:ethereum-provider@1.0.0",
          "wrap://ens/wraps.eth:ethereum-provider@1.0.1"
        ],
        implementations: ["wrap://plugin/ethereum-provider"]
      },
    ],

That solution requires the user to know and list interface URIs. What if the user wants to invoke arbitrary wrappers (like Polysnap) that use a variety of versions for multiple interfaces?

Another alternative could be to add an IUriResolver that is capable of redirecting versioned URIs based on semver assumptions. This solution requires trust that semver was followed correctly.

A better solution could be to make embedded packages more aware of which interfaces they implement, and make interface implementations more automatic (proposed by @dOrgJelli).

For example, maybe when a wrapper is invoked and it looks for interface implementations, the client would return implementations based on the schema (i.e. duck typing) instead of the URI. Or perhaps the client would wait until an interface implementation is invoked and then check which packages have the invoked method--so rather than compare the whole schema, just make sure the package implements the invoked method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions