From 0600bdabd4172974e00754a15d29e646df167fa8 Mon Sep 17 00:00:00 2001 From: George Knee Date: Mon, 28 Oct 2024 19:50:32 +0000 Subject: [PATCH] Improve definition of channel encoding (#444) * make channel encoding algorithm clearer * tweak * tweak * break line --- specs/protocol/derivation.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/specs/protocol/derivation.md b/specs/protocol/derivation.md index 02d97daa4..89b82e4ed 100644 --- a/specs/protocol/derivation.md +++ b/specs/protocol/derivation.md @@ -368,15 +368,18 @@ where: A channel is encoded by applying a streaming compression algorithm to a list of batches: ```text -rlp_batches = [] +encoded_batches = [] for batch in batches: - rlp_batches.append(batch) + encoded_batches ++ batch.encode() +rlp_batches = rlp_encode(encoded_batches) ``` where: -- `batches` is the input, a sequence of batches byte-encoded as per the next section ("Batch Encoding") -- `rlp_batches` is the concatenation of the RLP-encoded batches +- `batches` is the input, a sequence of batches each with a byte-encoder +function `.encode()` as per the next section ("Batch Encoding") +- `encoded_batches` is a byte array: the concatenation of the encoded batches +- `rlp_batches` is the rlp encoding of the concatenated encoded batches ```text channel_encoding = zlib_compress(rlp_batches)