Skip to content

Commit

Permalink
txn emitter - add more info on failed txn (#15756)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor <[email protected]>
  • Loading branch information
igor-aptos and igor-aptos authored Jan 16, 2025
1 parent 6716334 commit fbf0256
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 56 deletions.
4 changes: 2 additions & 2 deletions aptos-move/e2e-benchmark/data/calibration_values.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ InitializeVectorPicture { length: 128 } 34 0.942 1.061 169.4
VectorPicture { length: 128 } 34 0.917 1.058 47.6
VectorPictureRead { length: 128 } 34 0.909 1.075 46.3
InitializeVectorPicture { length: 30720 } 34 0.942 1.057 28928.4
VectorPicture { length: 30720 } 34 0.924 1.081 6409.9
VectorPictureRead { length: 30720 } 34 0.938 1.089 6409.9
VectorPicture { length: 30720 } 34 0.924 1.081 6900.0
VectorPictureRead { length: 30720 } 34 0.938 1.089 6900.0
SmartTablePicture { length: 30720, num_points_per_txn: 200 } 34 0.972 1.074 42970.1
SmartTablePicture { length: 1048576, num_points_per_txn: 300 } 34 0.960 1.066 73865.4
ResourceGroupsSenderWriteTag { string_length: 1024 } 34 0.898 1.062 16.2
Expand Down
27 changes: 23 additions & 4 deletions crates/transaction-emitter-lib/src/emitter/submission_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,27 @@ pub async fn submit_transactions(
.counts();
if let Some(failure) = failures.first() {
sample!(SampleRate::Duration(Duration::from_secs(60)), {
let sender = txns[failure.transaction_index].sender();
let first_failed_txn = &txns[failure.transaction_index];
let sender = first_failed_txn.sender();
use aptos_types::transaction::TransactionPayload::*;
let payload = match first_failed_txn.payload() {
Script(_) => "script".to_string(),
ModuleBundle(_) => "module_bundle".to_string(),
EntryFunction(entry_function) => format!(
"entry {}::{}",
entry_function.module(),
entry_function.function()
),
Multisig(_) => "multisig".to_string(),
};

let first_failed_txn_info = format!(
"due to {:?}, for account {}, max gas {}, payload {}",
failure,
first_failed_txn.sender(),
first_failed_txn.max_gas_amount(),
payload,
);

let last_transactions =
if let Ok(account) = client.get_account_bcs(sender).await {
Expand All @@ -513,11 +533,10 @@ pub async fn submit_transactions(
.map_or(-1, |v| v.into_inner() as i64);

warn!(
"[{:?}] Failed to submit {} txns in a batch, first failure due to {:?}, for account {}, chain id: {:?}, first asked: {}, failed seq nums: {:?}, failed error codes: {:?}, balance of {} and last transaction for account: {:?}",
"[{:?}] Failed to submit {} txns in a batch, first failure: {}, chain id: {:?}, first asked: {}, failed seq nums: {:?}, failed error codes: {:?}, balance of {} and last transaction for account: {:?}",
client.path_prefix_string(),
failures.len(),
failure,
sender,
first_failed_txn_info,
txns[0].chain_id(),
txns[0].sequence_number(),
failures.iter().map(|f| txns[f.transaction_index].sequence_number()).collect::<Vec<_>>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ async fn warn_detailed_error(
err: Result<&aptos_types::transaction::TransactionInfo, &RestError>,
) {
let sender = txn.sender();
use aptos_types::transaction::TransactionPayload::*;
let payload = match txn.payload() {
Script(_) => "script".to_string(),
ModuleBundle(_) => "module_bundle".to_string(),
EntryFunction(entry_function) => format!(
"entry {}::{}",
entry_function.module(),
entry_function.function()
),
Multisig(_) => "multisig".to_string(),
};
let (last_transactions, seq_num) =
if let Ok(account) = rest_client.get_account_bcs(sender).await {
let inner = account.into_inner();
Expand Down Expand Up @@ -194,11 +205,12 @@ async fn warn_detailed_error(
.map_or(-1, |v| v.into_inner() as i128);

warn!(
"[{:?}] Failed {} transaction: {:?}, seq num: {}, gas: unit {} and max {}, for account {}, last seq_num {:?}, balance of {} and last transaction for account: {:?}",
"[{:?}] Failed {} transaction: {:?}, seq num: {}, payload: {}, gas: unit {} and max {}, for account {}, last seq_num {:?}, balance of {} and last transaction for account: {:?}",
rest_client.path_prefix_string(),
call_name,
err,
txn.sequence_number(),
payload,
txn.gas_unit_price(),
txn.max_gas_amount(),
sender,
Expand Down
96 changes: 57 additions & 39 deletions crates/transaction-workloads-lib/src/raw_module_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,11 @@ pub static MODULES_SIMPLE: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { vec![
pub static PACKAGE_FRAMEWORK_USECASES_METADATA: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
17, 70, 114, 97, 109, 101, 119, 111, 114, 107, 85, 115, 101, 99, 97, 115, 101, 115,
1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 51, 68, 54, 69, 51, 48, 54, 53,
54, 52, 67, 68, 68, 69, 68, 69, 57, 50, 53, 68, 69, 52, 55, 52, 52, 57,
69, 67, 51, 66, 66, 53, 48, 67, 67, 67, 49, 56, 69, 70, 70, 66, 55, 56,
53, 66, 49, 69, 57, 70, 52, 68, 49, 55, 56, 66, 50, 68, 68, 66, 65, 57,
56, 51, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
1, 0, 0, 0, 0, 0, 0, 0, 0, 64, 70, 49, 55, 49, 54, 53, 49, 70,
66, 54, 55, 70, 70, 66, 51, 48, 70, 49, 65, 57, 53, 56, 67, 55, 52, 51,
52, 51, 55, 55, 51, 55, 49, 48, 51, 68, 52, 68, 54, 50, 56, 55, 70, 67,
55, 66, 56, 67, 52, 53, 65, 69, 51, 67, 56, 65, 56, 67, 51, 66, 65, 49,
69, 66, 215, 1, 31, 139, 8, 0, 0, 0, 0, 0, 2, 255, 165, 144, 187, 142,
194, 64, 12, 69, 251, 249, 10, 107, 182, 38, 236, 15, 108, 193, 238, 138, 150, 6,
170, 8, 33, 51, 49, 33, 100, 176, 163, 241, 240, 144, 16, 255, 78, 44, 30, 130,
22, 100, 23, 215, 246, 189, 167, 112, 217, 97, 104, 177, 166, 185, 99, 220, 18, 252,
Expand All @@ -292,28 +292,29 @@ pub static PACKAGE_FRAMEWORK_USECASES_METADATA: Lazy<Vec<u8>> = Lazy::new(|| {
134, 107, 160, 99, 88, 35, 215, 38, 101, 5, 65, 88, 51, 114, 6, 172, 170, 68,
170, 96, 20, 5, 236, 5, 197, 88, 184, 242, 182, 183, 231, 117, 187, 101, 108, 116,
77, 105, 113, 55, 219, 163, 143, 163, 223, 191, 127, 239, 46, 112, 10, 188, 112, 161,
1, 0, 0, 8, 18, 97, 103, 103, 114, 101, 103, 97, 116, 111, 114, 95, 101, 120,
1, 0, 0, 9, 18, 97, 103, 103, 114, 101, 103, 97, 116, 111, 114, 95, 101, 120,
97, 109, 112, 108, 101, 0, 0, 0, 12, 99, 111, 105, 110, 95, 101, 120, 97, 109,
112, 108, 101, 0, 0, 0, 22, 102, 117, 110, 103, 105, 98, 108, 101, 95, 97, 115,
115, 101, 116, 95, 101, 120, 97, 109, 112, 108, 101, 0, 0, 0, 12, 109, 97, 112,
115, 95, 101, 120, 97, 109, 112, 108, 101, 0, 0, 0, 7, 111, 98, 106, 101, 99,
116, 115, 0, 0, 0, 23, 114, 101, 115, 111, 117, 114, 99, 101, 95, 103, 114, 111,
117, 112, 115, 95, 101, 120, 97, 109, 112, 108, 101, 0, 0, 0, 8, 116, 111, 107,
101, 110, 95, 118, 49, 0, 0, 0, 14, 118, 101, 99, 116, 111, 114, 95, 101, 120,
97, 109, 112, 108, 101, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116, 115, 0, 0, 0, 21, 112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 101, 100,
95, 116, 114, 97, 110, 115, 102, 101, 114, 0, 0, 0, 23, 114, 101, 115, 111, 117,
114, 99, 101, 95, 103, 114, 111, 117, 112, 115, 95, 101, 120, 97, 109, 112, 108, 101,
0, 0, 0, 8, 116, 111, 107, 101, 110, 95, 118, 49, 0, 0, 0, 14, 118, 101,
99, 116, 111, 114, 95, 101, 120, 97, 109, 112, 108, 101, 0, 0, 0, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 65, 112, 116, 111, 115,
70, 114, 97, 109, 101, 119, 111, 114, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 14, 65, 112, 116, 111, 115, 70, 114, 97, 109, 101, 119, 111,
114, 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 65,
112, 116, 111, 115, 83, 116, 100, 108, 105, 98, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 11, 65, 112, 116, 111, 115, 83, 116, 100, 108, 105, 98, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 10, 77, 111, 118, 101, 83, 116, 100, 108, 105, 98, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 10, 77, 111, 118, 101,
83, 116, 100, 108, 105, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 10, 65, 112, 116, 111,
115, 84, 111, 107, 101, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 10, 65, 112, 116, 111, 115, 84, 111, 107, 101, 110, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 4, 17, 65, 112, 116, 111, 115, 84, 111, 107, 101, 110, 79, 98, 106, 101, 99,
116, 115, 0,
0, 0, 0, 0, 0, 0, 0, 0, 4, 17, 65, 112, 116, 111, 115, 84, 111, 107,
101, 110, 79, 98, 106, 101, 99, 116, 115, 0,
]
});

Expand Down Expand Up @@ -667,6 +668,24 @@ pub static MODULE_FRAMEWORK_USECASES_OBJECTS: Lazy<Vec<u8>> = Lazy::new(|| {
]
});

#[rustfmt::skip]
pub static MODULE_FRAMEWORK_USECASES_PERMISSIONED_TRANSFER: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
161, 28, 235, 11, 7, 0, 0, 10, 7, 1, 0, 4, 3, 4, 12, 5, 16, 6,
7, 22, 45, 8, 67, 64, 16, 131, 1, 31, 12, 162, 1, 15, 0, 0, 1, 2,
0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 3, 6, 12, 5, 3, 0,
21, 112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 101, 100, 95, 116, 114, 97, 110,
115, 102, 101, 114, 8, 116, 114, 97, 110, 115, 102, 101, 114, 13, 97, 112, 116, 111,
115, 95, 97, 99, 99, 111, 117, 110, 116, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 171, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 20, 99, 111, 109, 112, 105, 108, 97, 116, 105, 111, 110, 95, 109, 101, 116, 97,
100, 97, 116, 97, 9, 0, 3, 50, 46, 48, 3, 50, 46, 49, 0, 1, 4, 0,
1, 5, 11, 0, 11, 1, 11, 2, 17, 1, 2, 0,
]
});

#[rustfmt::skip]
pub static MODULE_FRAMEWORK_USECASES_RESOURCE_GROUPS_EXAMPLE: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
Expand Down Expand Up @@ -1036,6 +1055,7 @@ pub static MODULES_FRAMEWORK_USECASES: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { vec![
MODULE_FRAMEWORK_USECASES_FUNGIBLE_ASSET_EXAMPLE.to_vec(),
MODULE_FRAMEWORK_USECASES_MAPS_EXAMPLE.to_vec(),
MODULE_FRAMEWORK_USECASES_OBJECTS.to_vec(),
MODULE_FRAMEWORK_USECASES_PERMISSIONED_TRANSFER.to_vec(),
MODULE_FRAMEWORK_USECASES_RESOURCE_GROUPS_EXAMPLE.to_vec(),
MODULE_FRAMEWORK_USECASES_TOKEN_V1.to_vec(),
MODULE_FRAMEWORK_USECASES_VECTOR_EXAMPLE.to_vec(),
Expand Down Expand Up @@ -1744,26 +1764,24 @@ pub static MODULES_COMPLEX: Lazy<Vec<Vec<u8>>> = Lazy::new(|| { vec![
pub static PACKAGE_AMBASSADOR_TOKEN_METADATA: Lazy<Vec<u8>> = Lazy::new(|| {
vec![
10, 97, 109, 98, 97, 115, 115, 97, 100, 111, 114, 1, 0, 0, 0, 0, 0, 0,
0, 0, 64, 70, 52, 52, 65, 66, 48, 70, 68, 68, 52, 52, 65, 48, 49, 48,
68, 68, 57, 67, 48, 54, 53, 52, 49, 66, 68, 53, 69, 70, 51, 49, 56, 70,
70, 68, 70, 70, 69, 69, 56, 70, 53, 57, 52, 68, 68, 52, 51, 53, 48, 68,
57, 69, 56, 67, 57, 67, 57, 48, 66, 56, 70, 66, 70, 161, 2, 31, 139, 8,
0, 0, 0, 0, 0, 2, 255, 173, 144, 63, 79, 195, 48, 16, 197, 119, 127, 138,
83, 58, 116, 33, 127, 88, 145, 24, 42, 68, 87, 22, 182, 168, 66, 142, 125, 77,
76, 98, 95, 228, 115, 2, 18, 226, 187, 99, 211, 54, 136, 210, 5, 169, 146, 7,
219, 239, 221, 251, 61, 187, 30, 165, 234, 101, 139, 59, 225, 164, 69, 184, 135, 181,
180, 141, 100, 150, 154, 252, 90, 204, 232, 217, 144, 75, 215, 183, 69, 85, 84, 107,
33, 86, 160, 9, 28, 5, 80, 157, 116, 45, 66, 32, 200, 94, 178, 27, 80, 228,
148, 199, 128, 32, 181, 246, 200, 12, 14, 81, 163, 134, 61, 121, 176, 164, 167, 1,
243, 113, 106, 6, 195, 29, 4, 228, 96, 92, 11, 123, 31, 145, 111, 228, 123, 81,
31, 135, 144, 119, 226, 135, 31, 177, 89, 245, 254, 176, 217, 62, 102, 66, 212, 26,
71, 116, 26, 157, 50, 201, 181, 130, 205, 24, 136, 183, 167, 136, 232, 253, 128, 214,
132, 52, 211, 133, 48, 242, 93, 89, 198, 99, 55, 53, 133, 34, 91, 202, 100, 206,
7, 217, 240, 113, 187, 176, 139, 232, 138, 245, 121, 106, 180, 249, 38, 158, 233, 81,
243, 56, 39, 193, 74, 227, 28, 134, 12, 62, 79, 244, 103, 234, 209, 61, 53, 175,
168, 2, 95, 187, 64, 72, 217, 57, 29, 194, 47, 150, 184, 240, 1, 3, 41, 57,
36, 91, 81, 148, 203, 58, 228, 89, 154, 177, 92, 160, 231, 37, 150, 188, 63, 79,
250, 111, 228, 239, 222, 49, 246, 11, 123, 181, 222, 205, 98, 2, 0, 0, 1, 10,
0, 0, 64, 68, 70, 50, 57, 50, 70, 53, 53, 56, 50, 66, 48, 57, 50, 65,
51, 54, 55, 65, 53, 69, 55, 69, 57, 65, 48, 48, 69, 66, 51, 68, 57, 52,
48, 55, 56, 67, 49, 54, 69, 65, 66, 65, 48, 50, 52, 69, 65, 65, 50, 52,
57, 52, 49, 55, 70, 54, 50, 51, 52, 53, 67, 50, 48, 253, 1, 31, 139, 8,
0, 0, 0, 0, 0, 2, 255, 173, 142, 63, 79, 195, 64, 12, 197, 247, 251, 20,
86, 24, 186, 144, 63, 172, 72, 12, 21, 162, 43, 11, 91, 84, 161, 203, 157, 155,
28, 73, 236, 232, 236, 20, 36, 196, 119, 231, 142, 22, 144, 16, 99, 55, 219, 239,
249, 253, 94, 187, 88, 55, 218, 30, 247, 134, 236, 140, 112, 7, 27, 59, 119, 86,
196, 122, 142, 27, 115, 196, 40, 129, 41, 159, 111, 170, 166, 106, 54, 198, 92, 129,
103, 32, 86, 112, 131, 165, 30, 65, 25, 138, 231, 226, 26, 28, 147, 139, 168, 8,
214, 251, 136, 34, 64, 136, 30, 61, 28, 56, 194, 204, 126, 157, 176, 92, 214, 110,
10, 50, 128, 162, 104, 160, 30, 14, 49, 33, 95, 57, 142, 166, 61, 63, 161, 236,
205, 47, 63, 97, 139, 230, 237, 126, 187, 123, 40, 140, 105, 61, 46, 72, 30, 201,
133, 236, 218, 46, 202, 178, 251, 14, 72, 206, 119, 232, 131, 230, 143, 65, 117, 145,
219, 186, 78, 235, 176, 118, 149, 227, 185, 182, 217, 92, 78, 182, 147, 243, 248, 67,
174, 146, 43, 149, 151, 181, 243, 225, 139, 247, 71, 79, 90, 196, 99, 22, 102, 27,
136, 80, 11, 248, 56, 177, 159, 120, 68, 122, 236, 94, 208, 169, 92, 26, 175, 57,
187, 228, 83, 248, 191, 21, 62, 1, 7, 30, 19, 174, 183, 1, 0, 0, 1, 10,
97, 109, 98, 97, 115, 115, 97, 100, 111, 114, 0, 0, 0, 4, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 14, 65, 112, 116, 111, 115, 70, 114,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

module 0xABCD::permissioned_transfer {
use aptos_framework::aptos_account;
use aptos_framework::permissioned_signer;
// use aptos_framework::permissioned_signer;
use aptos_framework::primary_fungible_store;

public entry fun transfer_permissioned(
source: &signer, to: address, amount: u64
) {
let handle = permissioned_signer::create_permissioned_handle(source);
let permissioned_signer = permissioned_signer::signer_from_permissioned_handle(&handle);
// public entry fun transfer_permissioned(
// source: &signer, to: address, amount: u64
// ) {
// let handle = permissioned_signer::create_permissioned_handle(source);
// let permissioned_signer = permissioned_signer::signer_from_permissioned_handle(&handle);

primary_fungible_store::grant_apt_permission(source, &permissioned_signer, amount);
aptos_account::transfer(&permissioned_signer, to, amount);
// primary_fungible_store::grant_apt_permission(source, &permissioned_signer, amount);
// aptos_account::transfer(&permissioned_signer, to, amount);

permissioned_signer::destroy_permissioned_handle(handle);
}
// permissioned_signer::destroy_permissioned_handle(handle);
// }

public entry fun transfer(
source: &signer, to: address, amount: u64
Expand Down

0 comments on commit fbf0256

Please sign in to comment.