Skip to content

Commit

Permalink
kakarot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Jun 26, 2024
1 parent 12466f1 commit ba50be8
Show file tree
Hide file tree
Showing 11 changed files with 11,277 additions and 62 deletions.
100 changes: 50 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ark-secp256r1 = "0.4.0"
assert_matches = "1.5.0"
cached = "0.44.0"
cairo-felt = "0.9.1"
cairo-lang-casm = "2.6.0"
cairo-lang-runner = "2.6.0"
cairo-lang-starknet-classes = "2.6.0"
cairo-lang-utils = "2.6.0"
cairo-lang-casm = "2.6.3"
cairo-lang-runner = "2.6.3"
cairo-lang-starknet-classes = "2.6.3"
cairo-lang-utils = "2.6.3"
cairo-vm = "0.9.2"
criterion = "0.3"
derive_more = "0.99.17"
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/ERC20/ERC20_Cairo1/erc20.casm.json
Original file line number Diff line number Diff line change
Expand Up @@ -35583,5 +35583,5 @@
]
]
],
"compiler_version": "2.6.0"
"compiler_version": "2.6.3"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prime": "0x800000000000011000000000000000000000000000000000000000000000001",
"compiler_version": "2.6.0",
"compiler_version": "2.6.3",
"bytecode": [
"0xa0680017fff8000",
"0x7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prime": "0x800000000000011000000000000000000000000000000000000000000000001",
"compiler_version": "2.6.0",
"compiler_version": "2.6.3",
"bytecode": [
"0xa0680017fff8000",
"0x7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prime": "0x800000000000011000000000000000000000000000000000000000000000001",
"compiler_version": "2.6.0",
"compiler_version": "2.6.3",
"bytecode": [
"0xa0680017fff8000",
"0x7",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"prime": "0x800000000000011000000000000000000000000000000000000000000000001",
"compiler_version": "2.6.0",
"compiler_version": "2.6.3",
"bytecode": [],
"bytecode_segment_lengths": 0,
"hints": [],
Expand Down
22 changes: 20 additions & 2 deletions crates/blockifier/src/execution/contract_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub mod test;

pub type ContractClassResult<T> = Result<T, ContractClassError>;

#[derive(Clone, Debug, Eq, PartialEq, derive_more::From)]
#[derive(Clone, Debug, Eq, PartialEq, derive_more::From, Deserialize)]
pub enum ContractClass {
V0(ContractClassV0),
V1(ContractClassV1),
Expand Down Expand Up @@ -166,6 +166,24 @@ impl Deref for ContractClassV1 {
}
}

impl<'de> Deserialize<'de> for ContractClassV1 {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
// Deserialize into a JSON value
let json_value: serde_json::Value = Deserialize::deserialize(deserializer)?;

// Convert into a JSON string
let json_string = serde_json::to_string(&json_value)
.map_err(|err| DeserializationError::custom(err.to_string()))?;

// Use try_from_json_string to deserialize into ContractClassV1
ContractClassV1::try_from_json_string(&json_string)
.map_err(|err| DeserializationError::custom(err.to_string()))
}
}

impl ContractClassV1 {
fn constructor_selector(&self) -> Option<EntryPointSelector> {
Some(self.0.entry_points_by_type[&EntryPointType::Constructor].first()?.selector)
Expand Down Expand Up @@ -340,7 +358,7 @@ pub struct ContractClassV1Inner {
bytecode_segment_lengths: NestedIntList,
}

#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)]
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq, Deserialize)]
pub struct EntryPointV1 {
pub selector: EntryPointSelector,
pub offset: EntryPointOffset,
Expand Down
Loading

0 comments on commit ba50be8

Please sign in to comment.