Skip to content

Commit fa66f3d

Browse files
devin-ai-integration[bot]Jayant Krishnamurthy
andcommitted
fix(fortuna): Fix formatting issues
Co-Authored-By: Jayant Krishnamurthy <[email protected]>
1 parent f27dea7 commit fa66f3d

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

apps/fortuna/src/chain/ethereum.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ impl<T: JsonRpcClient + 'static + Clone> SignablePythContractInner<T> {
8282
.await?
8383
{
8484
// Extract Log from TransactionReceipt.
85-
let l: RawLog = r.logs.first()
85+
let l: RawLog = r
86+
.logs
87+
.first()
8688
.ok_or_else(|| anyhow!("No logs in receipt"))?
8789
.clone()
8890
.into();
@@ -115,7 +117,9 @@ impl<T: JsonRpcClient + 'static + Clone> SignablePythContractInner<T> {
115117
.await?
116118
{
117119
// Extract Log from TransactionReceipt.
118-
let l: RawLog = r.logs.first()
120+
let l: RawLog = r
121+
.logs
122+
.first()
119123
.ok_or_else(|| anyhow!("No logs in receipt"))?
120124
.clone()
121125
.into();
@@ -153,12 +157,13 @@ impl<T: JsonRpcClient + 'static + Clone> SignablePythContractInner<T> {
153157
.await?
154158
.await?
155159
{
156-
if let PythRandomEvents::Revealed1Filter(r) =
157-
PythRandomEvents::decode_log(&r.logs.first()
160+
if let PythRandomEvents::Revealed1Filter(r) = PythRandomEvents::decode_log(
161+
&r.logs
162+
.first()
158163
.ok_or_else(|| anyhow!("No logs in receipt"))?
159164
.clone()
160-
.into())?
161-
{
165+
.into(),
166+
)? {
162167
Ok(r.random_number)
163168
} else {
164169
Err(anyhow!("No log with randomnumber"))

apps/fortuna/src/state.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,13 @@ impl PebbleHashChain {
106106
// actually at the *front* of the list. Thus, it's easier to compute indexes from the end of the list.
107107
let index_from_end_of_subsampled_list = ((self.len() - 1) - i) / self.sample_interval;
108108
let mut i_index = self.len() - 1 - index_from_end_of_subsampled_list * self.sample_interval;
109-
let mut val = *self.hash.get(self.hash.len().saturating_sub(1 + index_from_end_of_subsampled_list))
109+
let mut val = *self
110+
.hash
111+
.get(
112+
self.hash
113+
.len()
114+
.saturating_sub(1 + index_from_end_of_subsampled_list),
115+
)
110116
.ok_or_else(|| anyhow::anyhow!("Index out of bounds in hash chain"))?;
111117

112118
while i_index > i {
@@ -149,9 +155,13 @@ impl HashChainState {
149155
.ok_or(anyhow::anyhow!(
150156
"Hash chain for the requested sequence number is not available."
151157
))?;
152-
let chain = self.hash_chains.get(chain_index)
158+
let chain = self
159+
.hash_chains
160+
.get(chain_index)
153161
.ok_or_else(|| anyhow::anyhow!("Chain index out of bounds"))?;
154-
let offset = self.offsets.get(chain_index)
162+
let offset = self
163+
.offsets
164+
.get(chain_index)
155165
.ok_or_else(|| anyhow::anyhow!("Offset index out of bounds"))?;
156166
chain.reveal_ith(sequence_number - offset)
157167
}

0 commit comments

Comments
 (0)