Skip to content

Commit 0d158aa

Browse files
ebuchmancwgoes
authored andcommitted
Merge PR cosmos#235: More minor fixes from review
* ibc/3: external relayer process * ics24: privateStore/provableStore intro * ics2: some code fixes * Update spec/ics-024-host-requirements/README.md
1 parent 3c552fe commit 0d158aa

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

ibc/3_IBC_TERMINOLOGY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ A *handshake* is a particular class of sub-protocol involving multiple datagrams
8686

8787
Sub-protocols are defined as a set of datagram kinds and functions which must be implemented by the IBC handler module of the implementing blockchain.
8888

89-
Datagrams must be relayed between chains by an external process. This process is assumed to behave in an arbitrary manner — no safety properties are dependent on its behaviour, although progress is generally dependent on the existence of at least one correct relayer process.
89+
Datagrams must be relayed between chains by an external relayer process. This relayer process is assumed to behave in an arbitrary manner — no safety properties are dependent on its behaviour, although progress is generally dependent on the existence of at least one correct relayer process.
9090

9191
IBC sub-protocols are reasoned about as interactions between two chains `A` and `B` — there is no prior distinction between these two chains and they are assumed to be executing the same, correct IBC protocol. `A` is simply by convention the chain which goes first in the sub-protocol and `B` the chain which goes second. Protocol definitions should generally avoid including `A` and `B` in variable names to avoid confusion (as the chains themselves do not know whether they are `A` or `B` in the protocol).
9292

spec/ics-002-client-semantics/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ but they must expose this common set of query functions to the IBC handler.
185185
type ClientState = bytes
186186
```
187187
188-
Client types must also define a function to initialize a client state with a provided consensus state:
188+
Client types must also define a method to initialize a client state with a provided consensus state:
189189
190190
```typescript
191191
type initialize = (ConsensusState) => ClientState
@@ -274,7 +274,7 @@ function createClient(
274274
privateStore.set(clientStatePath(id), clientState)
275275
}
276276
assert(!client.frozen)
277-
return client.verifiedRoots[height].verifyNonMembership(path, proof)
277+
return clientState.verifiedRoots[height].verifyNonMembership(path, proof)
278278
```
279279

280280
#### Query
@@ -374,7 +374,7 @@ function commit(
374374
sequence: uint64,
375375
newPublicKey: Maybe<PublicKey>): Header {
376376
signature = privateKey.sign(root, sequence, newPublicKey)
377-
header = Header{sequence, root, signature}
377+
header = Header{sequence, root, signature, newPublicKey}
378378
return header
379379
}
380380

@@ -405,7 +405,7 @@ function verifyMembership(
405405
path: Path,
406406
value: Value) {
407407
assert(!client.frozen)
408-
return client.verifiedRoots[sequence].verifyMembership(path, value, proof)
408+
return clientState.verifiedRoots[sequence].verifyMembership(path, value, proof)
409409
}
410410

411411
// state non-membership function defined by the client type
@@ -415,7 +415,7 @@ function verifyNonMembership(
415415
proof: CommitmentProof,
416416
path: Path) {
417417
assert(!client.frozen)
418-
return client.verifiedRoots[sequence].verifyNonMembership(path, proof)
418+
return clientState.verifiedRoots[sequence].verifyNonMembership(path, proof)
419419
}
420420

421421
// misbehaviour verification function defined by the client type

spec/ics-024-host-requirements/README.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Variable interpolation, denoted by curly braces, MAY be used as shorthand to def
4545

4646
### Key/value Store
4747

48-
The host state machine MUST provide two separate key-value store interfaces, each with three functions which behave in the standard way:
48+
The host state machine MUST provide a key-value store interface
49+
with three functions that behave in the standard way:
4950

5051
```typescript
5152
type Path = string
@@ -69,11 +70,20 @@ type delete = (path: Path) => void
6970
7071
These functions MUST be permissioned to the IBC handler module (the implementation of which is described in separate standards) only, so only the IBC handler module can `set` or `delete` the paths which can be read by `get`. This can possibly be implemented as a sub-store (prefixed key-space) of a larger key-value store used by the entire state machine.
7172
72-
The first interface provided by the host state machine MUST write to a key-value store whose data can be externally proved with a vector commitment as defined in [ICS 23](../ics-023-vector-commitments). The second interface MAY support external proofs, but is not required to - the IBC handler will never write data to it which needs to be proved.
73+
Host state machines must provide two instances of this interface -
74+
a `provableStore` for storage read by (i.e. proven to) other chains,
75+
and a `privateStore` for storage local to the host.
7376
74-
These interfaces are referred to throughout specifications which utilise them as the `provableStore` and the `privateStore` respectively, where `get`, `set`, and `delete` are called as methods, e.g. `provableStore.set('path', 'value')`.
77+
The `provableStore`:
7578
76-
The `provableStore` and `privateStore` differ also in their encoding restrictions. The `provableStore` MUST use canonical data structure encodings provided in these specifications as proto3 files, since values stored in the `provableStore` must be comprehensible to other machines implementing IBC.
79+
- MUST write to a key-value store whose data can be externally proved with a vector commitment as defined in [ICS 23](../ics-023-vector-commitments).
80+
- MUST use canonical data structure encodings provided in these specifications as proto3 files
81+
82+
The `privateStore`:
83+
84+
- MAY support external proofs, but is not required to - the IBC handler will never write data to it which needs to be proved.
85+
- MAY use canonical proto3 data structures, but is not required to - it can use
86+
whatever format is preferred by the application environment.
7787
7888
> Note: any key-value store interface which provides these methods & properties is sufficient for IBC. Host state machines may implement "proxy stores" with underlying storage models which do not directly match the path & value pairs set and retrieved through the store interface — paths could be grouped into buckets & values stored in pages which could be proved in a single commitment, path-spaces could be remapped non-contiguously in some bijective manner, etc — as long as `get`, `set`, and `delete` behave as expected and other machines can verify commitment proofs of path & value pairs (or their absence) in the provable store.
7989

0 commit comments

Comments
 (0)