Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-schott committed Apr 9, 2024
1 parent 38603b5 commit 56f5db7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
34 changes: 15 additions & 19 deletions ledger/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ use ledger_committee::{Committee, MIN_VALIDATOR_STAKE};
use ledger_store::{helpers::memory::ConsensusMemory, ConsensusStore};
use synthesizer::{program::Program, vm::VM, Stack};

<<<<<<< HEAD
=======
use console::types::U16;
>>>>>>> 69b5b17a9 (clippy)
use indexmap::IndexMap;

#[test]
Expand Down Expand Up @@ -1770,7 +1774,7 @@ finalize is_id:
assert.eq r0 network.id;
",
))
.unwrap();
.unwrap();

// Deploy.
let transaction = ledger.vm.deploy(&private_key, &program, None, 0, None, rng).unwrap();
Expand All @@ -1788,15 +1792,10 @@ finalize is_id:

// Execute functions `is_block` and `is_id` to assert that the on-chain state is as expected.
let inputs_block: [Value<CurrentNetwork>; 1] = [Value::from_str("2u32").unwrap()];
let tx_block = ledger
.vm
.execute(&private_key, (&program_id, "is_block"), inputs_block.iter(), None, 0, None, rng)
.unwrap();
let tx_block =
ledger.vm.execute(&private_key, (&program_id, "is_block"), inputs_block.iter(), None, 0, None, rng).unwrap();
let inputs_id: [Value<CurrentNetwork>; 1] = [Value::from(Literal::U16(U16::new(CurrentNetwork::ID)))];
let tx_id = ledger
.vm
.execute(&private_key, (&program_id, "is_id"), inputs_id.iter(), None, 0, None, rng)
.unwrap();
let tx_id = ledger.vm.execute(&private_key, (&program_id, "is_id"), inputs_id.iter(), None, 0, None, rng).unwrap();

// Construct the next block.
let block_2 =
Expand All @@ -1806,18 +1805,15 @@ finalize is_id:

// Execute the program.
let inputs_block_2: [Value<CurrentNetwork>; 1] = [Value::from_str("3u32").unwrap()];
let tx_block_2= ledger
.vm
.execute(&private_key, (&program_id, "is_block"), inputs_block_2.iter(), None, 0, None, rng)
.unwrap();
let tx_id_2 = ledger
.vm
.execute(&private_key, (&program_id, "is_id"), inputs_id.iter(), None, 0, None, rng)
.unwrap();
let tx_block_2 =
ledger.vm.execute(&private_key, (&program_id, "is_block"), inputs_block_2.iter(), None, 0, None, rng).unwrap();
let tx_id_2 =
ledger.vm.execute(&private_key, (&program_id, "is_id"), inputs_id.iter(), None, 0, None, rng).unwrap();

// Construct the next block.
let block_3 =
ledger.prepare_advance_to_next_beacon_block(&private_key, vec![], vec![], vec![tx_block_2, tx_id_2], rng).unwrap();
let block_3 = ledger
.prepare_advance_to_next_beacon_block(&private_key, vec![], vec![], vec![tx_block_2, tx_id_2], rng)
.unwrap();
// Advance to the next block.
ledger.advance_to_next_block(&block_3).unwrap();
}
Expand Down
1 change: 0 additions & 1 deletion synthesizer/process/src/stack/finalize_types/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ impl<N: Network> FinalizeTypes<N> {
&network_id_type == member_type,
"Struct member '{struct_name}.{member_name}' expects {member_type}, but found '{network_id_type}' in the operand '{operand}'.",
)

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion synthesizer/process/src/stack/finalize_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl<N: Network> FinalizeTypes<N> {
Operand::Signer => bail!("'self.signer' is not a valid operand in a finalize context."),
Operand::Caller => bail!("'self.caller' is not a valid operand in a finalize context."),
Operand::BlockHeight => FinalizeType::Plaintext(PlaintextType::Literal(LiteralType::U32)),
Operand::NetworkID => FinalizeType::Plaintext(PlaintextType::Literal(LiteralType::U16))
Operand::NetworkID => FinalizeType::Plaintext(PlaintextType::Literal(LiteralType::U16)),
})
}

Expand Down

0 comments on commit 56f5db7

Please sign in to comment.