Skip to content

Instantly share code, notes, and snippets.

@mkaczanowski
Created July 22, 2021 11:49
Show Gist options
  • Save mkaczanowski/06c43592a66453e13871d419870e66eb to your computer and use it in GitHub Desktop.
Save mkaczanowski/06c43592a66453e13871d419870e66eb to your computer and use it in GitHub Desktop.
diff --git a/spec/client/ics-028-wasm-client/README.md b/spec/client/ics-028-wasm-client/README.md
index 598f067..8fb7700 100644
--- a/spec/client/ics-028-wasm-client/README.md
+++ b/spec/client/ics-028-wasm-client/README.md
@@ -130,8 +130,9 @@ function initialise(
): ClientState {
codeHandle = getWasmCode(wasmCodeId)
assert(codeHandle.isInitializationDataValid(initializationData, consensusState))
- set("clients/{identifier}/consensusStates/{height}", consensusState)
- return codeHandle.initialise(initializationData, consensusState)
+
+ store = getStore("clients/{identifier}")
+ return codeHandle.initialise(store, initializationData, consensusState)
}
```
@@ -153,11 +154,11 @@ function checkValidityAndUpdateState(
clientState: ClientState,
epoch: uint64,
header: Header) {
+ store = getStore("clients/{identifier}")
codeHandle = clientState.codeHandle()
- isValid, consensusState = codeHandle.validateHeaderAndCreateConsensusState(clientState, header, epoch)
- set("clients/{identifier}/consensusStates/{header.height}", consensusState)
- // save the client
- set("clients/{identifier}", clientState)
+
+ // verify that provided header is valid and state is saved
+ assert(codeHandle.validateHeaderAndCreateConsensusState(store, clientState, header, epoch))
}
```
@@ -169,11 +170,9 @@ Wasm client misbehaviour checking determines whether or not two conflicting head
function checkMisbehaviourAndUpdateState(
clientState: ClientState,
misbehaviour: Misbehaviour) {
+ store = getStore("clients/{identifier}")
codeHandle = clientState.codeHandle()
- consensusState = get("clients/{identifier}/consensusStates/{misbehaviour.fromHeight}")
- assert(codeHandle.handleMisbehaviour(clientState, consensusState, misbehaviour))
- // save the client
- set("clients/{identifier}", clientState)
+ assert(codeHandle.handleMisbehaviour(store, clientState, misbehaviour))
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment