(
request: proto::sequencer::AuthenticatedTransactionBatch,
)
| 14 | type Output = proto::blockchain::BlockNumber; |
| 15 | |
| 16 | fn decode( |
| 17 | request: proto::sequencer::AuthenticatedTransactionBatch, |
| 18 | ) -> tonic::Result<Self::Input> { |
| 19 | let batch = ProposedBatch::read_from_bytes(&request.proposed_batch).map_err(|err| { |
| 20 | Status::invalid_argument(err.as_report_context("invalid proposed_batch")) |
| 21 | })?; |
| 22 | |
| 23 | if batch.transactions().len() != request.auth_inputs.len() { |
| 24 | return Err(Status::invalid_argument(format!( |
| 25 | "Number of inputs {} does not match number of transactions {} in batch", |
| 26 | request.auth_inputs.len(), |
| 27 | batch.transactions().len() |
| 28 | ))); |
| 29 | } |
| 30 | |
| 31 | let inputs = request |
| 32 | .auth_inputs |
| 33 | .into_iter() |
| 34 | .map(TransactionInputs::try_from) |
| 35 | .collect::<Result<Vec<_>, _>>() |
| 36 | .map_err(|err| { |
| 37 | Status::invalid_argument(err.as_report_context("invalid auth_inputs")) |
| 38 | })?; |
| 39 | |
| 40 | Ok((batch, inputs)) |
| 41 | } |
| 42 | |
| 43 | fn encode(output: Self::Output) -> tonic::Result<proto::blockchain::BlockNumber> { |
| 44 | Ok(output) |
nothing calls this directly
no test coverage detected