diff --git a/arbitrator/prover/src/binary.rs b/arbitrator/prover/src/binary.rs index 1180a705a6..c4e64f9991 100644 --- a/arbitrator/prover/src/binary.rs +++ b/arbitrator/prover/src/binary.rs @@ -234,9 +234,6 @@ pub struct Local { pub struct NameCustomSection { pub module: String, pub functions: HashMap, - // TODO: remove this when re-initializing the rollup - // this is kept around to deserialize old binaries - pub _locals_removed: HashMap>, } #[derive(Clone, Default)] diff --git a/arbitrator/prover/src/machine.rs b/arbitrator/prover/src/machine.rs index 38790dcc6b..ba6e0b1fb0 100644 --- a/arbitrator/prover/src/machine.rs +++ b/arbitrator/prover/src/machine.rs @@ -8,7 +8,7 @@ use crate::{ memory::Memory, merkle::{Merkle, MerkleType}, reinterpret::{ReinterpretAsSigned, ReinterpretAsUnsigned}, - utils::{file_bytes, Bytes32, CBytes, DeprecatedTableType}, + utils::{file_bytes, Bytes32, CBytes, RemoteTableType}, value::{ArbValueType, FunctionType, IntegerValType, ProgramCounter, Value}, wavm::{ pack_cross_module_call, unpack_cross_module_call, wasm_to_wavm, FloatingPointImpls, @@ -21,7 +21,7 @@ use fnv::FnvHashMap as HashMap; use num::{traits::PrimInt, Zero}; use rayon::prelude::*; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, FromInto}; +use serde_with::serde_as; use sha3::Keccak256; use std::{ borrow::Cow, @@ -211,7 +211,7 @@ impl TableElement { #[serde_as] #[derive(Clone, Debug, Serialize, Deserialize)] struct Table { - #[serde_as(as = "FromInto")] + #[serde(with = "RemoteTableType")] ty: TableType, elems: Vec, #[serde(skip)] @@ -1102,7 +1102,6 @@ impl Machine { let mut entrypoint_names = NameCustomSection { module: "entry".into(), functions: HashMap::default(), - _locals_removed: HashMap::default(), }; entrypoint_names .functions diff --git a/arbitrator/prover/src/utils.rs b/arbitrator/prover/src/utils.rs index 4c3a258e8b..4579536eda 100644 --- a/arbitrator/prover/src/utils.rs +++ b/arbitrator/prover/src/utils.rs @@ -102,19 +102,6 @@ impl fmt::Debug for Bytes32 { } } -impl From for TableType { - fn from(table: DeprecatedTableType) -> Self { - Self { - element_type: match table.ty { - DeprecatedRefType::FuncRef => Type::FuncRef, - DeprecatedRefType::ExternRef => Type::ExternRef, - }, - initial: table.limits.minimum_size, - maximum: table.limits.maximum_size, - } - } -} - /// A Vec allocated with libc::malloc pub struct CBytes { ptr: *mut u8, @@ -150,46 +137,6 @@ impl fmt::Debug for CBytes { } } -// TODO: remove this when re-initializing the rollup -// this is kept around to deserialize old binaries -#[derive(Serialize, Deserialize)] -pub enum DeprecatedRefType { - FuncRef, - ExternRef, -} - -// TODO: remove this when re-initializing the rollup -// this is kept around to deserialize old binaries -#[derive(Serialize, Deserialize)] -pub struct DeprecatedLimits { - pub minimum_size: u32, - pub maximum_size: Option, -} - -// TODO: remove this when re-initializing the rollup -// this is kept around to deserialize old binaries -#[derive(Serialize, Deserialize)] -pub struct DeprecatedTableType { - pub ty: DeprecatedRefType, - pub limits: DeprecatedLimits, -} - -impl From for DeprecatedTableType { - fn from(table: TableType) -> Self { - Self { - ty: match table.element_type { - Type::FuncRef => DeprecatedRefType::FuncRef, - Type::ExternRef => DeprecatedRefType::ExternRef, - x => panic!("impossible table type {:?}", x), - }, - limits: DeprecatedLimits { - minimum_size: table.initial, - maximum_size: table.maximum, - }, - } - } -} - impl From<&[u8]> for CBytes { fn from(slice: &[u8]) -> Self { if slice.is_empty() { @@ -209,6 +156,27 @@ impl From<&[u8]> for CBytes { } } +#[derive(Serialize, Deserialize)] +#[serde(remote = "Type")] +enum RemoteType { + I32, + I64, + F32, + F64, + V128, + FuncRef, + ExternRef, +} + +#[derive(Serialize, Deserialize)] +#[serde(remote = "TableType")] +pub struct RemoteTableType { + #[serde(with = "RemoteType")] + pub element_type: Type, + pub initial: u32, + pub maximum: Option, +} + impl Drop for CBytes { fn drop(&mut self) { unsafe { libc::free(self.ptr as _) }