diff --git a/api/src/context.rs b/api/src/context.rs index 0293524d48d5f..25d29f614514c 100644 --- a/api/src/context.rs +++ b/api/src/context.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_api_types::{Error, LedgerInfo, TransactionOnChainData}; -use aptos_config::config::{ApiConfig, RoleType}; +use aptos_config::config::ApiConfig; use aptos_crypto::HashValue; use aptos_mempool::{MempoolClientRequest, MempoolClientSender, SubmissionStatus}; use aptos_types::{ @@ -34,7 +34,6 @@ pub struct Context { chain_id: ChainId, db: Arc, mp_sender: MempoolClientSender, - role: RoleType, api_config: ApiConfig, } @@ -43,14 +42,12 @@ impl Context { chain_id: ChainId, db: Arc, mp_sender: MempoolClientSender, - role: RoleType, api_config: ApiConfig, ) -> Self { Self { chain_id, db, mp_sender, - role, api_config, } } diff --git a/api/src/runtime.rs b/api/src/runtime.rs index 95377167c656f..332c899bf57e5 100644 --- a/api/src/runtime.rs +++ b/api/src/runtime.rs @@ -29,12 +29,11 @@ pub fn bootstrap( .build() .expect("[api] failed to create runtime"); - let role = config.base.role; let api_config = config.api.clone(); let api = WebServer::from(api_config.clone()); runtime.spawn(async move { - let context = Context::new(chain_id, db, mp_sender, role, api_config); + let context = Context::new(chain_id, db, mp_sender, api_config); let routes = index::routes(context); api.serve(routes).await; }); diff --git a/api/src/tests/events_test.rs b/api/src/tests/events_test.rs index a7ece471f4796..dc7f188615ca4 100644 --- a/api/src/tests/events_test.rs +++ b/api/src/tests/events_test.rs @@ -122,7 +122,7 @@ async fn test_get_events_by_struct_type_has_generic_type_parameter() { // Instead of creating the example, we just look up an event handle that does not exist. let path = format!( "/accounts/0x1/events/{}/coin", - utf8_percent_encode("0x1::TestCoin::Balance<0x1::ABC::ABC>", NON_ALPHANUMERIC).to_string() + utf8_percent_encode("0x1::TestCoin::Balance<0x1::ABC::ABC>", NON_ALPHANUMERIC) ); let resp = context.expect_status_code(404).get(path.as_str()).await; context.check_golden_output(resp); diff --git a/api/src/tests/golden_output.rs b/api/src/tests/golden_output.rs index eca3bc635d68d..ada67efca5401 100644 --- a/api/src/tests/golden_output.rs +++ b/api/src/tests/golden_output.rs @@ -21,7 +21,7 @@ pub(crate) struct GoldenOutputs { fn golden_path() -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - path.push(GOLDEN_DIR_PATH.to_string()); + path.push(GOLDEN_DIR_PATH); path } diff --git a/api/src/tests/test_context.rs b/api/src/tests/test_context.rs index 5ee38c51415fa..7ef4cf577d414 100644 --- a/api/src/tests/test_context.rs +++ b/api/src/tests/test_context.rs @@ -6,7 +6,7 @@ use aptos_api_types::{ mime_types, HexEncodedBytes, TransactionOnChainData, X_APTOS_CHAIN_ID, X_APTOS_LEDGER_TIMESTAMP, X_APTOS_LEDGER_VERSION, }; -use aptos_config::config::{ApiConfig, RoleType}; +use aptos_config::config::ApiConfig; use aptos_crypto::{hash::HashValue, SigningKey}; use aptos_genesis_tool::validator_builder::{RootKeys, ValidatorBuilder}; use aptos_global_constants::OWNER_ACCOUNT; @@ -72,7 +72,6 @@ pub fn new_test_context(test_name: &'static str) -> TestContext { ChainId::test(), db.clone(), mempool.ac_client.clone(), - RoleType::Validator, ApiConfig::default(), ), rng, @@ -128,7 +127,7 @@ impl TestContext { pub fn check_golden_output(&mut self, msg: Value) { if self.golden_output.is_none() { - self.golden_output = Some(GoldenOutputs::new(self.test_name.replace(":", "_"))); + self.golden_output = Some(GoldenOutputs::new(self.test_name.replace(':', "_"))); } self.golden_output.as_ref().unwrap().log(&pretty(&msg)); } diff --git a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs index 8df3f0b765f49..7d89d5fbd552d 100644 --- a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs +++ b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs @@ -1,6 +1,9 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +// We're currently evaluating the future of this crate +#![allow(dead_code)] + use anyhow::{bail, format_err, Result}; use aptos_crypto::{ ed25519::{Ed25519PrivateKey, Ed25519PublicKey}, diff --git a/aptos-move/aptos-vm/src/adapter_common.rs b/aptos-move/aptos-vm/src/adapter_common.rs index 3f303f28b29ce..72b9bcc73e1bf 100644 --- a/aptos-move/aptos-vm/src/adapter_common.rs +++ b/aptos-move/aptos-vm/src/adapter_common.rs @@ -131,14 +131,14 @@ pub fn validate_signed_transaction( pub(crate) fn validate_signature_checked_transaction( adapter: &A, - mut session: &mut SessionExt, + session: &mut SessionExt, transaction: &SignatureCheckedTransaction, allow_too_new: bool, log_context: &AdapterLogSchema, ) -> Result<(), VMStatus> { adapter.check_transaction_format(transaction)?; - let prologue_status = adapter.run_prologue(&mut session, transaction, log_context); + let prologue_status = adapter.run_prologue(session, transaction, log_context); match prologue_status { Err(err) if !allow_too_new || err.status_code() != StatusCode::SEQUENCE_NUMBER_TOO_NEW => { Err(err) diff --git a/aptos-move/aptos-vm/src/aptos_vm_impl.rs b/aptos-move/aptos-vm/src/aptos_vm_impl.rs index 7db6b634121c5..2cc770b91c24c 100644 --- a/aptos-move/aptos-vm/src/aptos_vm_impl.rs +++ b/aptos-move/aptos-vm/src/aptos_vm_impl.rs @@ -265,9 +265,7 @@ impl AptosVMImpl { let secondary_public_key_hashes: Vec = txn_data .secondary_authentication_key_preimages .iter() - .map(|preimage| { - MoveValue::vector_u8(HashValue::sha3_256_of(&preimage.to_vec()).to_vec()) - }) + .map(|preimage| MoveValue::vector_u8(HashValue::sha3_256_of(preimage).to_vec())) .collect(); let args = if self.get_version()? >= APTOS_VERSION_3 && txn_data.is_multi_agent() { vec![ diff --git a/aptos-move/e2e-tests/src/executor.rs b/aptos-move/e2e-tests/src/executor.rs index 0474d87858952..c46254bef6e5e 100644 --- a/aptos-move/e2e-tests/src/executor.rs +++ b/aptos-move/e2e-tests/src/executor.rs @@ -273,13 +273,7 @@ impl FakeExecutor { let ap = AccessPath::resource_access_path(ResourceKey::new(*addr, T::struct_tag())); let data_blob = StateView::get_state_value(&self.data_store, &StateKey::AccessPath(ap)) .expect("account must exist in data store") - .unwrap_or_else(|| { - panic!( - "Can't fetch {} resource for {}", - T::STRUCT_NAME.to_string(), - addr - ) - }); + .unwrap_or_else(|| panic!("Can't fetch {} resource for {}", T::STRUCT_NAME, addr)); bcs::from_bytes(data_blob.as_slice()).ok() } diff --git a/aptos-move/e2e-tests/src/golden_outputs.rs b/aptos-move/e2e-tests/src/golden_outputs.rs index f14e32a4fd6e9..396985fa1d639 100644 --- a/aptos-move/e2e-tests/src/golden_outputs.rs +++ b/aptos-move/e2e-tests/src/golden_outputs.rs @@ -15,7 +15,7 @@ pub(crate) struct GoldenOutputs { fn golden_path() -> PathBuf { let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - path.push(GOLDEN_DIR_PATH.to_string()); + path.push(GOLDEN_DIR_PATH); path } diff --git a/aptos-move/transaction-builder-generator/src/typescript.rs b/aptos-move/transaction-builder-generator/src/typescript.rs index 55818559c6a6b..6a87a01a59991 100644 --- a/aptos-move/transaction-builder-generator/src/typescript.rs +++ b/aptos-move/transaction-builder-generator/src/typescript.rs @@ -465,7 +465,7 @@ return new AptosTypes.Script(code, tyArgs, args);"#, }}, "#, abi.name().to_camel_case(), - abi.doc().replace("\"", "\\\"").replace("\n", "\" + \n \""), + abi.doc().replace('\"', "\\\"").replace('\n', "\" + \n \""), abi.ty_args() .iter() .map(|ty_arg| format!("\"{}\"", ty_arg.name())) @@ -504,7 +504,7 @@ return new AptosTypes.Script(code, tyArgs, args);"#, writeln!( self.out, " description: \"{}\",", - abi.doc().replace("\"", "\\\"").replace("\n", "\" + \n \"") + abi.doc().replace('\"', "\\\"").replace('\n', "\" + \n \"") )?; writeln!( self.out, diff --git a/aptos-move/transaction-replay/src/main.rs b/aptos-move/transaction-replay/src/main.rs index 3aff81e21eb79..4b7b0e841470b 100644 --- a/aptos-move/transaction-replay/src/main.rs +++ b/aptos-move/transaction-replay/src/main.rs @@ -18,9 +18,6 @@ struct Opt { /// Path to the local AptosDB file #[structopt(long, parse(from_os_str))] db: Option, - /// Full URL address to connect to - should include port number, if applicable - #[structopt(short = "u", long)] - url: Option, /// If true, persist the effects of replaying transactions via `cmd` to disk in a format understood by the Move CLI #[structopt(short = "s", global = true)] save_write_sets: bool, diff --git a/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs b/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs index e29378fd1c876..e6de68faea056 100644 --- a/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs +++ b/aptos-move/writeset-transaction-generator/src/admin_script_builder.rs @@ -45,7 +45,7 @@ fn compile_admin_script(input: &str) -> Result