Skip to content

Commit 98dae83

Browse files
committed
runtime: Reference the mapping context safely in handle_ethereum_block
1 parent 5a6b974 commit 98dae83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

runtime/wasm/src/module/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ impl WasmInstance {
161161
mut self,
162162
handler_name: &str,
163163
) -> Result<BlockState, anyhow::Error> {
164-
let block: &Arc<EthereumBlockType> = &self.take_ctx().ctx.block;
164+
let context = self.take_ctx();
165165

166166
// Prepare an Ethereum Block for the WASM runtime
167-
let arg = match block.as_ref() {
167+
let arg = match context.ctx.block.as_ref() {
168168
EthereumBlockType::FullWithReceipts(block) => self
169169
.asc_new::<AscFullEthereumBlockWithReceipts, _>(
170-
&FullEthereumBlockDataWithReceipts::from(block),
170+
&FullEthereumBlockDataWithReceipts::try_from(block).unwrap(),
171171
)
172172
.erase(),
173173
EthereumBlockType::Full(block) => self
@@ -180,7 +180,7 @@ impl WasmInstance {
180180

181181
self.invoke_handler(handler_name, arg)?;
182182

183-
Ok(self.take_ctx().ctx.state)
183+
Ok(context.ctx.state)
184184
}
185185

186186
pub(crate) fn take_ctx(&mut self) -> WasmInstanceContext {

0 commit comments

Comments
 (0)