Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed Aug 20, 2024
1 parent c23c883 commit 21abd64
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/starknet/tx_v2_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ impl TxV2Info {
Value::Felt(self.transaction_hash),
Value::Felt(self.chain_id),
Value::Felt(self.nonce),
Value::Array {
Value::Struct(vec![Value::Array {
ty: resource_bounds_ty,
data: self
.resource_bounds
.into_iter()
.map(ResourceBounds::into_value)
.collect(),
},
}]),
Value::U128(self.tip),
Value::Array {
Value::Struct(vec![Value::Array {
ty: felt252_ty.clone(),
data: self.paymaster_data.into_iter().map(Value::Felt).collect(),
},
}]),
Value::U32(self.nonce_data_availability_mode),
Value::U32(self.fee_data_availability_mode),
Value::Array {
Expand Down
2 changes: 2 additions & 0 deletions src/vm/enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub fn eval_init(
};
assert_eq!(info.n_variants, variants.len());
assert!(info.index < info.n_variants);
dbg!(&value);
dbg!(&variants[info.index]);
assert!(value.is(registry, &variants[info.index]));

EvalAction::NormalBranch(
Expand Down
46 changes: 34 additions & 12 deletions src/vm/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,27 +496,49 @@ fn eval_get_execution_info_v2(

let result = syscall_handler.get_execution_info_v2(&mut gas);

let out_ty = registry
let mut out_ty = registry
.get_type(&info.branch_signatures()[0].vars[2].ty)
.unwrap();
let mut out_ty_id = &info.branch_signatures()[0].vars[2].ty;

let out_ty = if let CoreTypeConcrete::Struct(inner) = out_ty {
let out_ty = registry.get_type(&inner.members[1]).unwrap();
if let CoreTypeConcrete::Box(inner) = out_ty {
out_ty_id = &inner.ty;
out_ty = registry.get_type(&inner.ty).unwrap();
};

if let CoreTypeConcrete::Struct(inner) = out_ty {
// should be resourcebound ty
inner.members[7].clone()
} else {
panic!()
}
} else {
panic!()
if let CoreTypeConcrete::Struct(inner) = out_ty {
out_ty_id = &inner.members[1];
out_ty = registry.get_type(&inner.members[1]).unwrap();
};

if let CoreTypeConcrete::Box(inner) = out_ty {
out_ty_id = &inner.ty;
out_ty = registry.get_type(&inner.ty).unwrap();
};

if let CoreTypeConcrete::Struct(inner) = out_ty {
out_ty_id = &inner.members[7];
out_ty = registry.get_type(&inner.members[7]).unwrap();
};

if let CoreTypeConcrete::Struct(inner) = out_ty {
out_ty_id = &inner.members[0];
out_ty = registry.get_type(&inner.members[0]).unwrap();
};
if let CoreTypeConcrete::Snapshot(inner) = out_ty {
out_ty_id = &inner.ty;
out_ty = registry.get_type(&inner.ty).unwrap();
};
if let CoreTypeConcrete::Array(inner) = out_ty {
out_ty_id = &inner.ty;
out_ty = registry.get_type(&inner.ty).unwrap();
};
dbg!(&out_ty_id);

match result {
Ok(res) => EvalAction::NormalBranch(
0,
smallvec![Value::U128(gas), system, res.into_value(felt_ty, out_ty)],
smallvec![Value::U128(gas), system, res.into_value(felt_ty, out_ty_id.clone())],
),
Err(e) => EvalAction::NormalBranch(
1,
Expand Down

0 comments on commit 21abd64

Please sign in to comment.