Skip to content

Commit

Permalink
clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
kayagokalp committed Jul 9, 2024
1 parent 626559e commit 4af06f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
10 changes: 3 additions & 7 deletions forc-plugins/forc-client/src/op/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,7 @@ async fn deploy_chunked(
provider: &Provider,
pkg_name: &str,
) -> anyhow::Result<(ContractId, Vec<ContractId>)> {
let max_contract_size = command
.maximum_contract_size
.unwrap_or_else(|| MAX_CONTRACT_SIZE);
let max_contract_size = command.maximum_contract_size.unwrap_or(MAX_CONTRACT_SIZE);
// TODO: remove this clone.
let contract_chunks = split_into_chunks(compiled.bytecode.bytes.clone(), max_contract_size);
let mut deployed_contracts = vec![];
Expand All @@ -208,7 +206,7 @@ async fn deploy_chunked(

let deployed_contracts: Vec<_> = deployed_contracts
.iter()
.map(|deployed_contract| deployed_contract.contract_id().clone())
.map(|deployed_contract| *deployed_contract.contract_id())
.collect();

let program_abi = match &compiled.program_abi {
Expand Down Expand Up @@ -335,9 +333,7 @@ pub async fn deploy(command: cmd::Deploy) -> Result<Vec<DeployedContract>> {
&pkg.descriptor.name
);
let bytecode_size = pkg.bytecode.bytes.len();
let max_contract_size = command
.maximum_contract_size
.unwrap_or_else(|| MAX_CONTRACT_SIZE);
let max_contract_size = command.maximum_contract_size.unwrap_or(MAX_CONTRACT_SIZE);
let (deployed_contract_id, chunk_ids) = if bytecode_size > max_contract_size {
// Deploy chunked
let node_url = get_node_url(&command.node, &pkg.descriptor.manifest_file.network)?;
Expand Down
6 changes: 2 additions & 4 deletions forc-plugins/forc-client/src/util/pkg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl ContractChunk {
wallet_mode,
command.default_signer || command.unsigned,
command.signing_key,
&provider,
provider,
)
.await?
.ok_or_else(|| anyhow::anyhow!("failed to select a signer for the transaction"))?;
Expand Down Expand Up @@ -100,14 +100,12 @@ pub fn split_into_chunks(bytecode: Vec<u8>, chunk_size: usize) -> Vec<ContractCh
// them to word boundry.

Check warning on line 100 in forc-plugins/forc-client/src/util/pkg.rs

View workflow job for this annotation

GitHub Actions / find-typos

"boundry" should be "boundary".
assert!(chunk_size % 8 == 0);
let mut chunks = Vec::new();
let mut id = 0;

for chunk in bytecode.chunks(chunk_size) {
for (id, chunk) in bytecode.chunks(chunk_size).enumerate() {
let chunk = chunk.to_vec();
let size = chunk.len();
let contract_chunk = ContractChunk::new(id, size, chunk);
chunks.push(contract_chunk);
id += 1;
}

chunks
Expand Down

0 comments on commit 4af06f8

Please sign in to comment.