Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WasmTendermintConfig struct implementing ClientConfig interface #4048

Closed
crodriguezvega opened this issue Jul 9, 2023 · 1 comment
Closed
Labels
08-wasm testing Testing package and unit/integration tests type: refactor Architecture, code or CI improvements that may or may not tackle technical debt.

Comments

@crodriguezvega
Copy link
Contributor

Thank you @damiannolan for this suggestion.

In order to be able to write tests with the Tendermint wasm light client, a change in the testing package was made to specify where the light client is a regular Tendermint light client or a Tendermint wasm light client. A bool parameter was added to NewTendermintConfig to indicate this.

As proposed by @damiannolan, instead of using a bool to add behaviour to an existing type, add a new type (as that is what the ClientConfig interface is intended for):

type WasmTendermintConfig struct {
	TendermintConfig
	CodeID []byte // or string??
}

func NewWasmTendermintConfig(codeID []byte) *WasmTendermintConfig {
	return &WasmTendermintConfig{
		CodeID:                 codeID,
		TendermintConfig: TendermintConfig{
			TrustLevel:      DefaultTrustLevel,
			TrustingPeriod:  TrustingPeriod,
			UnbondingPeriod: UnbondingPeriod,
			MaxClockDrift:   MaxClockDrift,
		},
	}
}

func (wasmcfg *WasmTendermintConfig) GetClientType() string {
	// return exported.Wasm
	return "08-wasm"
}
  • Add a WithClientConfig method to the testing Endpoint:
// WithClientConfig sets the client config on the associated Endpoint and returns it.
func (endpoint *Endpoint) WithClientConfig(clientCfg ClientConfig) *Endpoint {
	endpoint.ClientConfig = clientCfg
	return endpoint
}
@crodriguezvega crodriguezvega added testing Testing package and unit/integration tests type: refactor Architecture, code or CI improvements that may or may not tackle technical debt. 08-wasm labels Jul 9, 2023
@crodriguezvega crodriguezvega added this to the 08-wasm/v1.0.0 milestone Jul 9, 2023
@crodriguezvega crodriguezvega self-assigned this Jul 28, 2023
@colin-axner
Copy link
Contributor

Closing as this is not necessary. I think we will likely take an approach more in line with #4807 and #4808 as the testing pkg will need to avoid importing light client types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
08-wasm testing Testing package and unit/integration tests type: refactor Architecture, code or CI improvements that may or may not tackle technical debt.
Projects
Archived in project
Development

No branches or pull requests

3 participants