From c19b52026f52f667b13913b65979a8c4eca9805c Mon Sep 17 00:00:00 2001 From: zzzckck <152148891+zzzckck@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:00:29 +0800 Subject: [PATCH] Update BEP-466.md --- BEPs/BEP-466.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/BEPs/BEP-466.md b/BEPs/BEP-466.md index 81b6bdcd..72fc48f5 100644 --- a/BEPs/BEP-466.md +++ b/BEPs/BEP-466.md @@ -27,17 +27,24 @@ The goal is to make the block format compatible with EIP-7685. This allows for s ## Specification -### Block Body - -Define `requests` as an empty array: +### Requests +A `requests` object consists of a `request_type` prepended to an opaque byte array `request_data`. ```golang -requests = make(types.Requests, 0) +requests = request_type ++ request_data ``` +Each request type will defines its own `requests` object using with its own `request_data` format. ### Block Header -In accordance with EIP-7685, add `requests_hash` to the end of the block header: +In accordance with EIP-7685, add a new 32 byte value `requests_hash` to the end of the block header: ```golang +def compute_requests_hash(requests): + m = sha256() + for r in requests: + m.update(sha256(r)) + return m.digest() + +requests = make(types.Requests, 0) // empty request for BSC block.header.requests_hash = compute_requests_hash(requests) ``` When calculating the header signature, ensure that requests_hash is included in the computation.