Encode DataColumn responses with Electra context bytes (#6313)

* Use Electra context bytes if PeerDAS is not activated in Deneb. Remove some outdated `das` TODOs.

* Fix lint.
This commit is contained in:
Jimmy Chen
2024-08-28 20:46:38 +10:00
committed by GitHub
parent 1e4d0e53c7
commit c7b9cbe120
3 changed files with 11 additions and 9 deletions

View File

@@ -423,14 +423,19 @@ fn context_bytes<E: EthSpec>(
}
};
}
RPCResponse::BlobsByRange(_)
| RPCResponse::BlobsByRoot(_)
| RPCResponse::DataColumnsByRoot(_)
| RPCResponse::DataColumnsByRange(_) => {
// TODO(das): If DataColumnSidecar is defined as an Electra type, update the
// context bytes to point to ForkName::Electra
RPCResponse::BlobsByRange(_) | RPCResponse::BlobsByRoot(_) => {
return fork_context.to_context_bytes(ForkName::Deneb);
}
RPCResponse::DataColumnsByRoot(_) | RPCResponse::DataColumnsByRange(_) => {
// TODO(das): Remove deneb fork after `peerdas-devnet-2`.
return if fork_context.spec.eip7594_fork_epoch
== fork_context.spec.deneb_fork_epoch
{
fork_context.to_context_bytes(ForkName::Deneb)
} else {
fork_context.to_context_bytes(ForkName::Electra)
};
}
RPCResponse::LightClientBootstrap(lc_bootstrap) => {
return lc_bootstrap
.map_with_fork_name(|fork_name| fork_context.to_context_bytes(fork_name));