You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On client creation the ClientKeeper's store_client_type method is never called (see here), but the ClientType is read during client update (see here) and the update will fail if it can't be found.
The ClientKeeper has three 'store' methods that have to be implemented, two of them (store_client_stateand store_consensus_state) are called on client creation and as an implementer of the trait I expect the same behaviour with store_client_type, however currently the implicit contract is that calling store_client_state is the responsibility of the implementer of ClientKeeper. Failing to set the client type lead to runtime failure during subsequent client-update.
I see two possible solution to prevent this error in future implementations of ClientKeeper:
Remove the store_client_type method and make it explicit that it is the responsibility of the trait implementer to store the type.
Call the store_client_type on client creation to ensure a consistent behaviour of all 'store' methods.
A pseudo code implementation of ClientKeeper that will fail on create-client followed update-client:
implClientKeeperforDummy{fnstore_client_type(t){self.client_type = t;// Never executed}fnstore_client_state(s){self.client_state = s;}fnstore_consensus_state(cs){self.consensus_state = cs;}}
The "fixed" version according to current behaviour:
implClientKeeperforDummy{fnstore_client_type(t){}fnstore_client_state(s){self.client_type = s.t;// The client type is set hereself.client_state = s;}fnstore_consensus_state(cs){self.consensus_state = cs;}}
For Admin Use
Not duplicate issue
Appropriate labels applied
Appropriate milestone (priority) applied
Appropriate contributors tagged
Contributor assigned/self-assigned
The text was updated successfully, but these errors were encountered:
Crate
modules
Summary of Bug
On client creation the
ClientKeeper
'sstore_client_type
method is never called (see here), but the ClientType is read during client update (see here) and the update will fail if it can't be found.The
ClientKeeper
has three 'store' methods that have to be implemented, two of them (store_client_state
andstore_consensus_state
) are called on client creation and as an implementer of the trait I expect the same behaviour withstore_client_type
, however currently the implicit contract is that callingstore_client_state
is the responsibility of the implementer ofClientKeeper
. Failing to set the client type lead to runtime failure during subsequent client-update.I see two possible solution to prevent this error in future implementations of
ClientKeeper
:store_client_type
method and make it explicit that it is the responsibility of the trait implementer to store the type.store_client_type
on client creation to ensure a consistent behaviour of all 'store' methods.Version
db2be6f
Steps to Reproduce
A pseudo code implementation of
ClientKeeper
that will fail on create-client followed update-client:The "fixed" version according to current behaviour:
For Admin Use
The text was updated successfully, but these errors were encountered: