concordium-rust-smart-contracts
concordium-rust-smart-contracts copied to clipboard
Delete testing infrastructure, supporting traits and types, and simplify names of types
Task description
We are in the process of deprecating the old testing infrastructure, as described in https://github.com/Concordium/concordium-rust-smart-contracts/issues/335, and related issues.
The testing infrastructure will remain in place for now, but it will eventually be removed. There is no current timeline for this.
This issue describes the preliminary ideas about what will happen at that point.
- [ ] Delete the traits that only exist to allow your contracts to use the testing infrastructure
- For example
HasHost
, which has two concrete implementationsExternHost
andTestHost
.
- For example
- [ ] Delete the testing infrastructure code, including the types, fx.
TestHost
- [ ] Remove the
Extern*
prefixes, fx forExternHost
andExternReturnValue
etc.- The prefix no longer has any value as corresponding
Test*
types are removed. - The names will then conflict with the type aliases we created, which should be removed. For example
type Host = ExternHost
.
- The prefix no longer has any value as corresponding
- [ ] Remove the mentioning of the test infrastructure in the code documentation.
- [ ] Remove the
state_parameter
attribute, see the comment below.
We still have two example contracts that use the old testing library because they use quickcheck (as described in https://github.com/Concordium/concordium-rust-smart-contracts/pull/347). Ideally, we should integrate quickcheck in the integration testing library, rewrite the tests for those two contracts, and then completely remove the old testing infrastructure. Alternatively, we can also drop the support for quickcheck for now and remove the tests that use it. Which allows us to remove the old testing infrastructure now.
From my point of view, the primary pain points with current types is the added complexity once you dive into the types because we have the abstraction from traits, and because the abstraction shines through when using state*
types in your state, e.g.:
#[derive(Serial, DeserialWithState)]
#[concordium(state_parameter = "S")]
struct State<S = StateApi> {
addresses: StateSet<AccountAddress, S>,
}