Skip to content

devnet-sdk: Introduce simple DI system for customizing setup #14853

@teddyknox

Description

@teddyknox

It would be nice if, when defining a devnet-sdk test, we could simultaneously describe:

  1. Constraints on the test's intended subject (i.e. this test expects to run against an Isthmus devnet with available wallets, if it is run against a Holocene devnet then it should skip)
  2. Clients for interacting with the intended subject

At the moment, #1 is handled by devnet-sdk validators, and #2 is handled by standardized taxonomy of devnet-sdk system objects.

This works but comes with a few drawbacks:

  1. When registering a validator (constraint) on a test subject, the constraint must be specified with respect to an arbitrary chain index, which must then be referenced later to unpack the values from the devnet-sdk system object.
  2. Validators and required clients must be handled independently, leading to redundancy in definitions.
  3. It's difficult to see what aspects of the system object the test interacts with at a glance. Instead you must read the entire test scenario.

As an alternative, we might consider a simple DI system that allows us to declaratively define test specs which kill two birds with one stone.

testSpec := TestSpect{
  SequencerA: MustOpNode(t, WithChain(chainA), WithActiveSequencer(true)),
  SequencerB: MustOpNode(t, WithChain(chainB), WithActiveSequencer(true)),
  VerifierB: MustOpNode(t, WithChain(chainB), WithActiveSequencer(false)),
}

This is not a burning need at the moment, but I am documenting discussions thus far in case this becomes a pain point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions