8000 Remaining fixes for 1.0.0-rc2 by cwgoes · Pull Request #230 · cosmos/ibc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remaining fixes for 1.0.0-rc2 #230

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

Merged
merged 10 commits into from
Aug 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions misc/aspell_dict
10000
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
personal_ws-1.1 en 412
personal_ws-1.1 en 430
unescrow
onChanCloseConfirm
clientKey
Expand All @@ -10,11 +10,11 @@ desiredCounterpartyIdentifier
queryClientConnections
stablecoins
packetAcknowledgementPath
ClientSubmitMisbehaviour
encodings
addConnectionToClient
exfiltration
relayer
Cehalopod
timeoutClose
timeoutPacket
Statefulness
Expand Down Expand Up @@ -52,6 +52,7 @@ handleConnOpenInit
connOpenTry
boolean
LaTeX
handlePacketTimeoutOnClose
CommitmentProof
getVerifiedRoot
OPENTRY
Expand All @@ -63,6 +64,7 @@ chanOpenInit
handleConnOpenTimeout
callbackPath
handleChanOpenAck
unescrows
ERC
validator
authenticationPath
Expand Down Expand Up @@ -102,6 +104,7 @@ middled
channelId
queryClientConsensusState
consensusStatePath
PacketSend
unescrowing
InitialPubkey
handlePacketRecv
Expand Down Expand Up @@ -162,6 +165,7 @@ connOpenAck
WASM
queryConnectionChannels
NFT
onChanCloseInit
newpubkey
dataflow
datagrams
Expand Down Expand Up @@ -195,6 +199,7 @@ auth
unreceived
handleConnOpenAck
handleChanOpenTimeout
portId
chanCloseInit
prover
CommitmentState
Expand All @@ -207,13 +212,15 @@ proofInit
nextSequenceSendPath
getConsensusState
png
ClientMisbehaviour
tokenized
connectionId
newCallbacks
destChannel
updateClient
connectionChannelsPath
onChanOpenAck
channelEscrowAddresses
Pre
privateStore
sdk
Expand Down Expand Up @@ -255,11 +262,13 @@ lifecycle
desiredCounterpartyConnectionIdentifier
chanCloseConfirm
ChangeOperator
handlePacketAcknowledgement
UDP
changelog
synchrony
chanOpenConfirm
removeChannelFromConnection
timeoutPacketClose
queryClientFrozen
recv
8000 repudiable
Expand All @@ -281,6 +290,7 @@ bijective
Juwoon
proofTimeout
clientTypePath
handleClientMisbehaviour
interoperation
tokenising
authenticationKey
Expand Down Expand Up @@ -311,6 +321,7 @@ connOpenInit
getValue
channelIdentifier
handleClientCreate
channelSet
ABCI
struct
consensusState
Expand All @@ -329,7 +340,9 @@ interoperability
Betazoid
callingModuleIdentifier
LogStore
PacketTimeoutOnClose
introspectable
unescrowed
destPort
ModuleCallbacks
Multichain
Expand All @@ -338,6 +351,7 @@ blockchain's
blockchains
serialisable
chanOpenTry
onAcknowledgePacket
incrementing
queryConnection
validValue
Expand All @@ -347,12 +361,14 @@ structs
keyspaces
counterpartyStateRoot
JSON
PacketAcknowledgement
consensusHeight
createMembershipProof
Yun
md
counterpartyConnectionIdentifier
OpCommitmentRoot
onTimeoutPacketClose
transactional
counterpartyPortIdentifier
packetCommitmentKey
Expand All @@ -373,6 +389,7 @@ collateralisation
datapipe
ConnCloseAck
VM
ModuleState
Strawman
tx
bytestring
Expand Down Expand Up @@ -408,6 +425,7 @@ QUIC
permissioning
renderer
chanId
onSendPacket
positionally
OpHeaderProof
CryptoKitty
Binary file modified spec.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion spec/ics-001-ics-standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ stage: draft
category: meta
author: Christopher Goes <cwgoes@tendermint.com>
created: 2019-02-12
modified: 2019-08-17
modified: 2019-08-25
---

## What is an ICS?
Expand Down
66 changes: 42 additions & 24 deletions spec/ics-002-client-semantics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires: 23, 24
required-by: 3
author: Juwoon Yun <joon@tendermint.com>, Christopher Goes <cwgoes@tendermint.com>
created: 2019-02-25
modified: 2019-08-15
modified: 2019-08-25
---

## Synopsis
Expand Down Expand Up @@ -70,11 +70,8 @@ could be provided as executable WASM functions when the client instance is creat
can check that a particular machine has stored a particular `ConsensusState`.

* `ClientState` is an opaque type representing the state of a client.
A `ClientState` must expose query functions to retrieve trusted state roots at previously
verified heights and retrieve the current `ConsensusState`.

* `createClient`, `queryClient`, `updateClient`, `freezeClient`, and `deleteClient` function signatures are as defined in [ICS 25](../ics-025-handler-interface).
The function implementations are defined in this specification.
A `ClientState` must expose query functions to verify membership or non-membership of
key-value pairs in state at particular heights and to retrieve the current `ConsensusState`.

### Desired Properties

Expand Down Expand Up @@ -276,6 +273,8 @@ function createClient(
provableStore.set(clientTypePath(id), clientType)
privateStore.set(clientStatePath(id), clientState)
}
assert(!client.frozen)
return client.verifiedRoots[height].verifyNonMembership(path, proof)
```

#### Query
Expand Down Expand Up @@ -311,7 +310,7 @@ function updateClient(
assert(clientType !== null)
clientState = privateStore.get(clientStatePath(id))
assert(clientState !== null)
assert(clientType.validityPredicate(clientState, header))
clientType.validityPredicate(clientState, header)
}
```

Expand All @@ -328,7 +327,7 @@ function submitMisbehaviourToClient(
assert(clientType !== null)
clientState = privateStore.get(clientStatePath(id))
assert(clientState !== null)
assert(clientType.misbehaviourPredicate(clientState, evidence))
clientType.misbehaviourPredicate(clientState, evidence)
}
```

Expand All @@ -352,12 +351,12 @@ interface ClientState {
}

interface ConsensusState {
height: uint64
sequence: uint64
publicKey: PublicKey
}

interface Header {
height: uint64
sequence: uint64
commitmentRoot: CommitmentRoot
signature: Signature
newPublicKey: Maybe<PublicKey>
Expand All @@ -368,46 +367,66 @@ interface Evidence {
h2: Header
}

// algorithm run by operator to commit a new block
function commit(
root: CommitmentRoot,
height: uint64,
sequence: uint64,
newPublicKey: Maybe<PublicKey>): Header {
signature = privateKey.sign(root, height, newPublicKey)
header = Header{height, root, signature}
signature = privateKey.sign(root, sequence, newPublicKey)
header = Header{sequence, root, signature}
return header
}

// initialisation function defined by the client type
function initialize(consensusState: ConsensusState): ClientState {
return ClientState{false, Set.singleton(consensusState.publicKey), Map.empty()}
}

// validity predicate function defined by the client type
function validityPredicate(
clientState: ClientState,
header: Header) {
assert(consensusState.height + 1 === header.height)
assert(consensusState.sequence + 1 === header.sequence)
assert(consensusState.publicKey.verify(header.signature))
if (header.newPublicKey !== null)
if (header.newPublicKey !== null) {
consensusState.publicKey = header.newPublicKey
clientState.pastPublicKeys.add(header.newPublicKey)
consensusState.height = header.height
clientState.verifiedRoots[height] = header.commitmentRoot
}
consensusState.sequence = header.sequence
clientState.verifiedRoots[sequence] = header.commitmentRoot
}

// state membership verification function defined by the client type
function verifyMembership(
clientState: ClientState,
sequence: uint64,
proof: CommitmentProof
path: Path,
value: Value) {
assert(!client.frozen)
return client.verifiedRoots[sequence].verifyMembership(path, value, proof)
}

function getVerifiedRoot(
// state non-membership function defined by the client type
function verifyNonMembership(
clientState: ClientState,
height: uint64) {
sequence: uint64,
proof: CommitmentProof,
path: Path) {
assert(!client.frozen)
return client.verifiedRoots[height]
return client.verifiedRoots[sequence].verifyNonMembership(path, proof)
}

// misbehaviour verification function defined by the client type
// any duplicate signature by a past or current key freezes the client
function misbehaviourPredicate(
clientState: ClientState,
evidence: Evidence) {
h1 = evidence.h1
h2 = evidence.h2
assert(h1.publicKey === h2.publicKey)
assert(clientState.pastPublicKeys.contains(h1.publicKey))
assert(h1.height === h2.height)
assert(h1.sequence === h2.sequence)
assert(h1.commitmentRoot !== h2.commitmentRoot)
assert(h1.publicKey.verify(h1.signature))
assert(h2.publicKey.verify(h2.signature))
Expand All @@ -417,16 +436,15 @@ function misbehaviourPredicate(

### Properties & Invariants

- Client identifiers are immutable & first-come-first-serve: once a client identifier has been allocated, all future headers & trusted states stored under that identifier will have satisfied the client's validity predicate.
- Client identifiers are immutable & first-come-first-serve. Clients cannot be deleted (allowing deletion would potentially allow future replay of past packets if identifiers were re-used).

## Backwards Compatibility

Not applicable.

## Forwards Compatibility

In a future version, this ICS will define a new function `unfreezeClient` that can be called
when the application logic resolves an misbehaviour event.
New client types can be added by IBC implementations at-will as long as they confirm to this interface.

## Example Implementation

Expand Down
12 changes: 6 additions & 6 deletions spec/ics-003-connection-semantics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires: 2, 24
required-by: 4, 25
author: Christopher Goes <cwgoes@tendermint.com>, Juwoon Yun <joon@tendermint.com>
created: 2019-03-07
modified: 2019-05-17
modified: 2019-08-25
---

## Synopsis
Expand Down Expand Up @@ -196,11 +196,11 @@ function connOpenTry(
counterpartyConnectionIdentifier: Identifier,
counterpartyClientIdentifier: Identifier,
clientIdentifier: Identifier,
version: string,
counterpartyVersion: string
proofInit: CommitmentProof,
proofHeight: uint64,
consensusHeight: uint64,
version: string,
counterpartyVersion: string) {
consensusHeight: uint64) {
assert(consensusHeight <= getCurrentHeight())
client = queryClient(connection.clientIdentifier)
expectedConsensusState = getConsensusState(consensusHeight)
Expand Down Expand Up @@ 7C48 -259,7 +259,7 @@ function connOpenConfirm(
expected = ConnectionEnd{OPEN, identifier, connection.counterpartyClientIdentifier,
connection.clientIdentifier, connection.version}
client = queryClient(connection.clientIdentifier)
assert(client.verifyMembership(counterpartyStateRoot, proofAck,
assert(client.verifyMembership(proofHeight, proofAck,
connectionPath(connection.counterpartyConnectionIdentifier), expected))
connection.state = OPEN
provableStore.set(connectionPath(identifier), connection)
Expand All @@ -284,7 +284,7 @@ A correct protocol execution flows as follows (note that all calls are made thro
| Actor | `ConnCloseInit` | A | (ANY, ANY) | (CLOSED, ANY) |
| Relayer | `ConnCloseConfirm` | B | (CLOSED, ANY) | (CLOSED, CLOSED) |

*ConnCloseInit* initialises a close attempt on chain A. It will succeed only if the associated connection does not have any channels.
*ConnCloseInit* initialises a close attempt on chain A. It will succeed only if the associated connection does not have any associated open channels.

Once closed, connections cannot be reopened.

Expand Down
Loading
0