-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add Blobstream Client to rpc crate #543
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks! left some ideas
@@ -45,7 +45,7 @@ pub async fn new_test_client(auth_level: AuthLevel) -> Result<Client> { | |||
let client = Client::new(&url, token.as_deref()).await?; | |||
|
|||
// minimum 2 blocks | |||
client.header_wait_for_height(2).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this block, the account we use for blob submission should be founded with tia, why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when testing against mocha, if I had my node sync from a recent height and trusted hash, waiting for height 2 would trigger a warning on the node header not found
(celestia-node), so removing it allowed me to test this, but we could have an env for this height and that way the test does not assume you have a node synced from genesis etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can instead do a loop here, where we request network head and break if it is >2 and sleep otherwise
|
||
// DataRootTupleRoot is the root of the merkle tree created | ||
// from a set of data root tuples. | ||
pub type DataRootTupleRoot = Bytes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it is a hash, could we alias it to celestia_types::Hash
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes can def do that
.await | ||
.unwrap(); | ||
|
||
println!("data root tuple root: {:x?}", result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would combine those tests into a single one where we request a proof and the root and just call proof.verify(root).unwrap()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I pushed and opened the PR before making the test more robust if you will, let me get this under a single test 🫡
let client = new_test_client(AuthLevel::Write).await.unwrap(); | ||
|
||
let result = client | ||
.get_data_root_tuple_root(4211296, 4211298) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those tests seem to fail on CI.
called `Result::unwrap()` on an `Err` value: Call(ErrorObject { code: ServerError(1), message: "end block 4211300 is higher than local chain height 28. Wait for the node until it syncs up to 4211300", data: None })
could you instead make header_get_network_head()
request and adjust height accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted!
async fn get_data_root_tuple_root( | ||
&self, | ||
start: u64, | ||
end: u64, | ||
) -> Result<DataRootTupleRoot, Error>; | ||
|
||
/// GetDataRootTupleInclusionProof returns a data root tuple inclusion proof for a given height | ||
/// between a range from start to end | ||
#[method(name = "blobstream.GetDataRootTupleInclusionProof")] | ||
async fn get_data_root_tuple_inclusion_proof( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more thing, since those will be implicitly exposed on any jsonrpsee client, we have a convention of prefixing methods with the modeule name. Could you rename those to start with blobstream_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so blobstream_get_data_root_tuple_root
?
Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com> Signed-off-by: Diego <31937514+Ferret-san@users.noreply.github.com>
Co-authored-by: Maciej Zwoliński <mac.zwolinski@gmail.com> Signed-off-by: Diego <31937514+Ferret-san@users.noreply.github.com>
Adds the
Blobstream
trait for theClient
to be able to make blobstream related requests. The blobstream service for celestia-node can be found here