Skip to content
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

chore: remove redundant and implicit From impl #418

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions core/src/preflight/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ pub async fn preflight<BDP: BlockDataProvider>(
let parent_block_number = parent_header.number;

// Create the guest input
let input = GuestInput::from((
block.clone(),
let input = GuestInput {
block,
parent_header,
taiko_chain_spec.clone(),
taiko_guest_input,
));
chain_spec: taiko_chain_spec.clone(),
taiko: taiko_guest_input,
..Default::default()
};

// Create the block builder, run the transactions and extract the DB
let provider_db = ProviderDb::new(provider, taiko_chain_spec, parent_block_number).await?;
Expand Down
18 changes: 0 additions & 18 deletions host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,6 @@ pub enum Message {
Aggregate(AggregationOnlyRequest),
}

impl From<&ProofRequest> for Message {
fn from(value: &ProofRequest) -> Self {
Self::Task(value.clone())
}
}

impl From<&ProofTaskDescriptor> for Message {
fn from(value: &ProofTaskDescriptor) -> Self {
Self::Cancel(value.clone())
}
}

impl From<AggregationOnlyRequest> for Message {
fn from(value: AggregationOnlyRequest) -> Self {
Self::Aggregate(value)
}
}

impl ProverState {
pub fn init() -> HostResult<Self> {
// Read the command line arguments;
Expand Down
4 changes: 3 additions & 1 deletion host/src/server/api/v2/proof/cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ async fn cancel_handler(
proof_request.prover.clone().to_string(),
));

prover_state.task_channel.try_send(Message::from(&key))?;
prover_state
.task_channel
.try_send(Message::Cancel(key.clone()))?;

let mut manager = prover_state.task_manager();

Expand Down
4 changes: 2 additions & 2 deletions host/src/server/api/v2/proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async fn proof_handler(

prover_state
.task_channel
.try_send(Message::from(&proof_request))?;
.try_send(Message::Task(proof_request))?;

Ok(TaskStatus::Registered.into())
}
Expand All @@ -100,7 +100,7 @@ async fn proof_handler(

prover_state
.task_channel
.try_send(Message::from(&proof_request))?;
.try_send(Message::Task(proof_request))?;

Ok(TaskStatus::Registered.into())
}
Expand Down
4 changes: 2 additions & 2 deletions host/src/server/api/v3/proof/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async fn aggregation_handler(

prover_state
.task_channel
.try_send(Message::from(aggregation_request.clone()))?;
.try_send(Message::Aggregate(aggregation_request))?;
return Ok(Status::from(TaskStatus::Registered));
};

Expand All @@ -84,7 +84,7 @@ async fn aggregation_handler(

prover_state
.task_channel
.try_send(Message::from(aggregation_request))?;
.try_send(Message::Aggregate(aggregation_request))?;

Ok(Status::from(TaskStatus::Registered))
}
Expand Down
4 changes: 3 additions & 1 deletion host/src/server/api/v3/proof/cancel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ async fn cancel_handler(
proof_request.prover.clone().to_string(),
));

prover_state.task_channel.try_send(Message::from(&key))?;
prover_state
.task_channel
.try_send(Message::Cancel(key.clone()))?;

let mut manager = prover_state.task_manager();

Expand Down
10 changes: 6 additions & 4 deletions host/src/server/api/v3/proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async fn proof_handler(
manager
.update_task_progress(key.clone(), TaskStatus::Registered, None)
.await?;
prover_state.task_channel.try_send(Message::from(req))?;
prover_state.task_channel.try_send(Message::Task(req.to_owned()))?;

is_registered = true;
is_success = false;
Expand All @@ -116,7 +116,9 @@ async fn proof_handler(
// If there are no tasks with provided config, create a new one.
manager.enqueue_task(key).await?;

prover_state.task_channel.try_send(Message::from(req))?;
prover_state
.task_channel
.try_send(Message::Task(req.to_owned()))?;
is_registered = true;
continue;
};
Expand Down Expand Up @@ -170,7 +172,7 @@ async fn proof_handler(
.await?;
prover_state
.task_channel
.try_send(Message::from(aggregation_request))?;
.try_send(Message::Aggregate(aggregation_request))?;
Ok(Status::from(TaskStatus::Registered))
}
// If the task has succeeded, return the proof.
Expand All @@ -191,7 +193,7 @@ async fn proof_handler(

prover_state
.task_channel
.try_send(Message::from(aggregation_request.clone()))?;
.try_send(Message::Aggregate(aggregation_request))?;
Ok(Status::from(TaskStatus::Registered))
}
} else {
Expand Down
14 changes: 0 additions & 14 deletions lib/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,6 @@ pub struct ZkAggregationGuestInput {
pub block_inputs: Vec<B256>,
}

impl From<(Block, Header, ChainSpec, TaikoGuestInput)> for GuestInput {
fn from(
(block, parent_header, chain_spec, taiko): (Block, Header, ChainSpec, TaikoGuestInput),
) -> Self {
Self {
block,
chain_spec,
taiko,
parent_header,
..Self::default()
}
}
}

#[derive(Clone, Debug, Default, Serialize, Deserialize)]

pub enum BlockProposedFork {
Expand Down
Loading