Skip to content

Commit b71bfcc

Browse files
gabriele-0201rphmeier
authored andcommitted
shim: remane functions, wait_* to await_*
1 parent 87d69f4 commit b71bfcc

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

sugondat/shim/src/cmd/query/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub async fn get_block_at(
2626
BlockRef::Best => None,
2727
BlockRef::Hash(h) => Some(h),
2828
BlockRef::Number(n) => Some(match block.wait {
29-
true => client.wait_block_hash(n).await,
29+
true => client.await_block_hash(n).await,
3030
false => client
3131
.block_hash(n)
3232
.await?
@@ -35,7 +35,7 @@ pub async fn get_block_at(
3535
};
3636

3737
match block.wait {
38-
true => client.wait_block_at(maybe_hash).await,
38+
true => client.await_block_at(maybe_hash).await,
3939
false => client.get_block_at(maybe_hash).await,
4040
}
4141
}

sugondat/shim/src/dock/rollkit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ impl RollkitRPCServer for RollkitDock {
3333
namespace, height
3434
);
3535
let namespace = parse_namespace(&namespace).map_err(|_| err::bad_namespace())?;
36-
let block_hash = self.client.wait_finalized_height(height).await;
37-
let block = self.client.wait_block_at(Some(block_hash)).await.unwrap();
36+
let block_hash = self.client.await_finalized_height(height).await;
37+
let block = self.client.await_block_at(Some(block_hash)).await.unwrap();
3838
let mut blobs = vec![];
3939
for blob in block.blobs {
4040
if blob.namespace == namespace {

sugondat/shim/src/dock/sovereign.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ impl SovereignRPCServer for SovereignDock {
3333
namespace: sugondat_nmt::Namespace,
3434
) -> Result<Block, ErrorObjectOwned> {
3535
info!("get_block({})", height);
36-
let block_hash = self.client.wait_finalized_height(height).await;
37-
let block = self.client.wait_block_at(Some(block_hash)).await.unwrap();
36+
let block_hash = self.client.await_finalized_height(height).await;
37+
let block = self.client.await_block_at(Some(block_hash)).await.unwrap();
3838
let proof = make_namespace_proof(&block, namespace);
3939
let blobs = block
4040
.blobs

sugondat/shim/src/sugondat_rpc/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ impl Client {
6262
/// Blocks until the sugondat node has finalized a block at the given height. Returns
6363
/// the block hash of the block at the given height.
6464
#[tracing::instrument(level = Level::DEBUG, skip(self))]
65-
pub async fn wait_finalized_height(&self, height: u64) -> [u8; 32] {
65+
pub async fn await_finalized_height(&self, height: u64) -> [u8; 32] {
6666
tracing::info!("Waiting for block at height: {}", height);
6767
loop {
6868
let conn = self.connector.ensure_connected().await;
69-
match conn.finalized.wait_until_finalized(self, height).await {
69+
match conn.finalized.await_finalized(self, height).await {
7070
Some(block_hash) => return block_hash,
7171
None => {
7272
// The watcher task has terminated. Reset the connection and retry.
@@ -111,7 +111,7 @@ impl Client {
111111
/// Returns the block hash of the block at the given height,
112112
/// automatically retrying until it succeeds.
113113
/// `None` indicates the best block.
114-
pub async fn wait_block_hash(&self, height: u64) -> [u8; 32] {
114+
pub async fn await_block_hash(&self, height: u64) -> [u8; 32] {
115115
loop {
116116
match self.block_hash(height).await {
117117
Ok(Some(res)) => break res,
@@ -155,7 +155,7 @@ impl Client {
155155
/// Returns the header and the body of the block with the given hash,
156156
/// automatically retrying until it succeeds.
157157
/// `None` indicates the best block.
158-
async fn wait_header_and_extrinsics(
158+
async fn await_header_and_extrinsics(
159159
&self,
160160
block_hash: Option<[u8; 32]>,
161161
) -> (Header, Vec<sugondat_subxt::ExtrinsicDetails>) {
@@ -189,8 +189,8 @@ impl Client {
189189
///
190190
/// `None` indicates that the best block should be used.
191191
#[tracing::instrument(level = Level::DEBUG, skip(self))]
192-
pub async fn wait_block_at(&self, block_hash: Option<[u8; 32]>) -> anyhow::Result<Block> {
193-
Block::from_header_and_extrinsics(self.wait_header_and_extrinsics(block_hash).await)
192+
pub async fn await_block_at(&self, block_hash: Option<[u8; 32]>) -> anyhow::Result<Block> {
193+
Block::from_header_and_extrinsics(self.await_header_and_extrinsics(block_hash).await)
194194
}
195195

196196
/// Submit a blob with the given namespace and signed with the given key. The block is submitted
@@ -325,7 +325,7 @@ impl FinalizedHeadWatcher {
325325

326326
/// Wait until the sugondat node has finalized a block at the given height. Returns the block
327327
/// hash of that finalized block, or `None` in case the watcher task has terminated.
328-
async fn wait_until_finalized(&self, client: &Client, height: u64) -> Option<[u8; 32]> {
328+
async fn await_finalized(&self, client: &Client, height: u64) -> Option<[u8; 32]> {
329329
let mut rx = self.rx.clone();
330330
let (finalized_height, block_hash) = loop {
331331
if let Err(_) = rx.changed().await {

0 commit comments

Comments
 (0)