Skip to content

Commit

Permalink
fixing rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Oct 8, 2023
1 parent 973c69e commit f923ebf
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 64 deletions.
4 changes: 3 additions & 1 deletion sway-core/src/asm_generation/fuel/data_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ impl Entry {
ConstantValue::U256(u) => {
Entry::new_byte_array(u.to_be_bytes().to_vec(), name, padding)
}
ConstantValue::B256(bs) => Entry::new_byte_array(bs.to_vec(), name, padding),
ConstantValue::B256(bs) => {
Entry::new_byte_array(bs.to_be_bytes().to_vec(), name, padding)
}
ConstantValue::String(bs) => Entry::new_byte_array(bs.clone(), name, padding),

ConstantValue::Array(els) => Entry::new_collection(
Expand Down
17 changes: 3 additions & 14 deletions sway-core/src/ir_generation/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1893,12 +1893,7 @@ impl<'eng> FnCompiler<'eng> {
// We must compile the RHS before checking for shadowing, as it will still be in the
// previous scope.
let body_deterministically_aborts = body.deterministically_aborts(self.engines.de(), false);
dbg!(body.with_context(context));
let init_val = self.compile_expression_to_value(context, md_mgr, body)?;
dbg!(
&init_val,
init_val.get_type(context).unwrap().as_string(context)
);
if init_val.is_diverging(context) || body_deterministically_aborts {
return Ok(Some(init_val));
}
Expand All @@ -1913,7 +1908,6 @@ impl<'eng> FnCompiler<'eng> {
// otherwise use a store.
let var_ty = local_var.get_type(context);
if ir_type_size_in_bytes(context, &var_ty) > 0 {
dbg!(&local_name, var_ty.as_string(context));
let local_ptr = self
.current_block
.ins(context)
Expand Down Expand Up @@ -2146,7 +2140,6 @@ impl<'eng> FnCompiler<'eng> {
context,
elem_type,
)?;
dbg!(elem_type.as_string(context));

let array_type = Type::new_array(context, elem_type, contents.len() as u64);

Expand All @@ -2155,13 +2148,12 @@ impl<'eng> FnCompiler<'eng> {
.function
.new_local_var(context, temp_name, array_type, None, false)
.map_err(|ir_error| CompileError::InternalOwned(ir_error.to_string(), Span::dummy()))?;
dbg!(array_var.get_type(context).as_string(context));

let array_value = self
.current_block
.ins(context)
.get_local(array_var)
.add_metadatum(context, span_md_idx);
dbg!(array_value.get_type(context).unwrap().as_string(context));

// Compile each element and insert it immediately.
for (idx, elem_expr) in contents.iter().enumerate() {
Expand All @@ -2174,13 +2166,10 @@ impl<'eng> FnCompiler<'eng> {
elem_type,
idx as u64,
);
dbg!(gep_val.get_type(context).unwrap().as_string(context));
dbg!(elem_value.get_type(context).unwrap().as_string(context));
dbg!(self
.current_block
self.current_block
.ins(context)
.store(gep_val, elem_value)
.add_metadatum(context, span_md_idx));
.add_metadatum(context, span_md_idx);
}
Ok(array_value)
}
Expand Down
8 changes: 2 additions & 6 deletions sway-ir/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,12 +1383,8 @@ mod ir_builder {
.state_store_word(*val_map.get(&src).unwrap(), *val_map.get(&key).unwrap())
.add_metadatum(context, opt_metadata),
IrAstOperation::Store(stored_val_name, dst_val_name) => {
let dst_val_ptr = *val_map.get(dbg!(&dst_val_name)).unwrap();
let stored_val = *val_map.get(dbg!(&stored_val_name)).unwrap();

dbg!(dst_val_ptr.get_type(context).unwrap().as_string(context));
dbg!(stored_val.get_type(context).unwrap().as_string(context));
dbg!(stored_val.with_context(context));
let dst_val_ptr = *val_map.get(&dst_val_name).unwrap();
let stored_val = *val_map.get(&stored_val_name).unwrap();

block
.ins(context)
Expand Down
2 changes: 0 additions & 2 deletions sway-ir/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ struct InstructionVerifier<'a, 'eng> {

impl<'a, 'eng> InstructionVerifier<'a, 'eng> {
fn verify_instructions(&self) -> Result<(), IrError> {
dbg!(&self.cur_function.name);
for ins in &self.cur_block.instructions {
dbg!(ins);
let value_content = &self.context.values[ins.0];
if let ValueDatum::Instruction(instruction) = &value_content.value {
match instruction {
Expand Down
11 changes: 6 additions & 5 deletions test/src/sdk-harness/test_projects/call_frames/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ async fn can_get_contract_id() {
#[tokio::test]
async fn can_get_id_contract_id_this() {
let (instance, id) = get_call_frames_instance().await;
let result = instance.methods().get_id_contract_id_this().call().await.unwrap();
let result = instance
.methods()
.get_id_contract_id_this()
.call()
.await
.unwrap();
assert_eq!(result.value, id);
}

Expand Down Expand Up @@ -78,11 +83,7 @@ async fn can_get_second_param_u64() {
async fn can_get_second_param_bool() {
let (instance, _id) = get_call_frames_instance().await;
let result = instance.methods().get_second_param_bool(true);
dbg!(&result.contract_call.output_param);
let result = result.call().await.unwrap();
for r in result.receipts {
dbg!(r);
}
assert_eq!(result.value, true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ async fn script_configurables() -> Result<()> {
.main()
.call()
.await?;
dbg!(&response);

let expected_value = (
8u8,
Expand Down
2 changes: 0 additions & 2 deletions test/src/sdk-harness/test_projects/hashing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,12 @@ mod sha256 {
let expected_1 = Bits256(hash_str("John", Hash::Sha256));
let expected_2 = Bits256(hash_str("Nick", Hash::Sha256));

dbg!(1);
let call_1 = instance
.methods()
.sha256_str_array(SizedAsciiString::try_from("John").unwrap())
.call()
.await
.unwrap();
dbg!(&call_1);
let call_2 = instance
.methods()
.sha256_str_array(SizedAsciiString::try_from("John").unwrap())
Expand Down
23 changes: 10 additions & 13 deletions test/src/sdk-harness/test_projects/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ async fn can_send_bool_message() {
.call()
.await
.unwrap();
dbg!(&call_response);

let message_receipt = call_response
.receipts
Expand Down Expand Up @@ -337,18 +336,16 @@ async fn can_send_string_message() {
let message = "fuel";
let amount = 33u64;

let call_response = dbg!(
messages_instance
.methods()
.send_typed_message_string(
Bits256(*recipient_address),
message.try_into().unwrap(),
amount,
)
.call()
.await
)
.unwrap();
let call_response = messages_instance
.methods()
.send_typed_message_string(
Bits256(*recipient_address),
message.try_into().unwrap(),
amount,
)
.call()
.await
.unwrap();

let message_receipt = call_response
.receipts
Expand Down
2 changes: 1 addition & 1 deletion test/src/sdk-harness/test_projects/storage_init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn test_storage_init_instance() -> TestStorageInitContract<WalletUnlocked>
#[tokio::test]
async fn test_initializers() {
let methods = test_storage_init_instance().await.methods();
let l = dbg!(methods.test_initializers().call().await);
let l = methods.test_initializers().call().await;
let receipts = match l {
Ok(l) => l.receipts,
Err(Error::RevertTransactionError { receipts, .. }) => receipts,
Expand Down
32 changes: 13 additions & 19 deletions test/src/sdk-harness/test_projects/storage_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,16 +918,12 @@ mod to_u64_map {
None
);

dbg!(7);
dbg!(
instance
.methods()
.insert_into_bool_to_u64_map(key1, val1)
.call()
.await
)
.unwrap();
dbg!(7);
instance
.methods()
.insert_into_bool_to_u64_map(key1, val1)
.call()
.await
.unwrap();

instance
.methods()
Expand All @@ -937,15 +933,13 @@ mod to_u64_map {
.unwrap();

assert_eq!(
dbg!(
instance
.methods()
.get_from_bool_to_u64_map(key1)
.call()
.await
)
.unwrap()
.value,
instance
.methods()
.get_from_bool_to_u64_map(key1)
.call()
.await
.unwrap()
.value,
Some(val1)
);
assert_eq!(
Expand Down

0 comments on commit f923ebf

Please sign in to comment.