Skip to content

Commit 19869cb

Browse files
authored
revert some debug code (aptos-labs#12504)
1 parent d6acef0 commit 19869cb

File tree

6 files changed

+9
-27
lines changed

6 files changed

+9
-27
lines changed

aptos-move/framework/aptos-framework/doc/block.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ This module defines a struct storing the metadata of the block and new block eve
4040

4141

4242
<pre><code><b>use</b> <a href="account.md#0x1_account">0x1::account</a>;
43-
<b>use</b> <a href="../../aptos-stdlib/doc/debug.md#0x1_debug">0x1::debug</a>;
4443
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
4544
<b>use</b> <a href="event.md#0x1_event">0x1::event</a>;
4645
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features">0x1::features</a>;
@@ -50,7 +49,6 @@ This module defines a struct storing the metadata of the block and new block eve
5049
<b>use</b> <a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg">0x1::reconfiguration_with_dkg</a>;
5150
<b>use</b> <a href="stake.md#0x1_stake">0x1::stake</a>;
5251
<b>use</b> <a href="state_storage.md#0x1_state_storage">0x1::state_storage</a>;
53-
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string">0x1::string</a>;
5452
<b>use</b> <a href="system_addresses.md#0x1_system_addresses">0x1::system_addresses</a>;
5553
<b>use</b> <a href="../../aptos-stdlib/doc/table_with_length.md#0x1_table_with_length">0x1::table_with_length</a>;
5654
<b>use</b> <a href="timestamp.md#0x1_timestamp">0x1::timestamp</a>;
@@ -582,7 +580,6 @@ The runtime always runs this before executing the transactions in a block.
582580
<a href="timestamp.md#0x1_timestamp">timestamp</a>: u64,
583581
randomness_seed: Option&lt;<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;&gt;,
584582
) <b>acquires</b> <a href="block.md#0x1_block_BlockResource">BlockResource</a>, <a href="block.md#0x1_block_CommitHistory">CommitHistory</a> {
585-
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - block_prologue_ext begin"));
586583
<b>let</b> epoch_interval = <a href="block.md#0x1_block_block_prologue_common">block_prologue_common</a>(
587584
&vm,
588585
<a href="../../aptos-stdlib/../move-stdlib/doc/hash.md#0x1_hash">hash</a>,
@@ -598,7 +595,6 @@ The runtime always runs this before executing the transactions in a block.
598595
<b>if</b> (<a href="timestamp.md#0x1_timestamp">timestamp</a> - <a href="reconfiguration.md#0x1_reconfiguration_last_reconfiguration_time">reconfiguration::last_reconfiguration_time</a>() &gt;= epoch_interval) {
599596
<a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_try_start">reconfiguration_with_dkg::try_start</a>();
600597
};
601-
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - block_prologue_ext end"))
602598
}
603599
</code></pre>
604600

aptos-move/framework/aptos-framework/doc/reconfiguration_with_dkg.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Reconfiguration with DKG helper functions.
1616

1717

1818
<pre><code><b>use</b> <a href="consensus_config.md#0x1_consensus_config">0x1::consensus_config</a>;
19-
<b>use</b> <a href="../../aptos-stdlib/doc/debug.md#0x1_debug">0x1::debug</a>;
2019
<b>use</b> <a href="dkg.md#0x1_dkg">0x1::dkg</a>;
2120
<b>use</b> <a href="execution_config.md#0x1_execution_config">0x1::execution_config</a>;
2221
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features">0x1::features</a>;
@@ -28,7 +27,6 @@ Reconfiguration with DKG helper functions.
2827
<b>use</b> <a href="reconfiguration.md#0x1_reconfiguration">0x1::reconfiguration</a>;
2928
<b>use</b> <a href="reconfiguration_state.md#0x1_reconfiguration_state">0x1::reconfiguration_state</a>;
3029
<b>use</b> <a href="stake.md#0x1_stake">0x1::stake</a>;
31-
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/string.md#0x1_string">0x1::string</a>;
3230
<b>use</b> <a href="validator_consensus_info.md#0x1_validator_consensus_info">0x1::validator_consensus_info</a>;
3331
<b>use</b> <a href="version.md#0x1_version">0x1::version</a>;
3432
</code></pre>
@@ -53,12 +51,10 @@ Do nothing if one is already in progress.
5351

5452

5553
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_try_start">try_start</a>() {
56-
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - try_start begin"));
5754
<b>let</b> incomplete_dkg_session = <a href="dkg.md#0x1_dkg_incomplete_session">dkg::incomplete_session</a>();
5855
<b>if</b> (<a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_is_some">option::is_some</a>(&incomplete_dkg_session)) {
5956
<b>let</b> session = <a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option_borrow">option::borrow</a>(&incomplete_dkg_session);
6057
<b>if</b> (<a href="dkg.md#0x1_dkg_session_dealer_epoch">dkg::session_dealer_epoch</a>(session) == <a href="reconfiguration.md#0x1_reconfiguration_current_epoch">reconfiguration::current_epoch</a>()) {
61-
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - try_start <b>abort</b>"));
6258
<b>return</b>
6359
}
6460
};
@@ -70,7 +66,6 @@ Do nothing if one is already in progress.
7066
<a href="stake.md#0x1_stake_cur_validator_consensus_infos">stake::cur_validator_consensus_infos</a>(),
7167
<a href="stake.md#0x1_stake_next_validator_consensus_infos">stake::next_validator_consensus_infos</a>(),
7268
);
73-
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - try_start end"))
7469
}
7570
</code></pre>
7671

aptos-move/framework/aptos-framework/sources/block.move

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ module aptos_framework::block {
66
use std::option;
77
use aptos_std::table_with_length::{Self, TableWithLength};
88
use std::option::Option;
9-
use std::string::utf8;
10-
use aptos_std::debug;
119
use aptos_framework::randomness;
1210

1311
use aptos_framework::account;
@@ -215,7 +213,6 @@ module aptos_framework::block {
215213
timestamp: u64,
216214
randomness_seed: Option<vector<u8>>,
217215
) acquires BlockResource, CommitHistory {
218-
debug::print(&utf8(b"0312 - block_prologue_ext begin"));
219216
let epoch_interval = block_prologue_common(
220217
&vm,
221218
hash,
@@ -231,7 +228,6 @@ module aptos_framework::block {
231228
if (timestamp - reconfiguration::last_reconfiguration_time() >= epoch_interval) {
232229
reconfiguration_with_dkg::try_start();
233230
};
234-
debug::print(&utf8(b"0312 - block_prologue_ext end"))
235231
}
236232

237233
#[view]

aptos-move/framework/aptos-framework/sources/reconfiguration_with_dkg.move

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
module aptos_framework::reconfiguration_with_dkg {
33
use std::features;
44
use std::option;
5-
use std::string::utf8;
6-
use aptos_std::debug;
75
use aptos_framework::consensus_config;
86
use aptos_framework::dkg;
97
use aptos_framework::execution_config;
@@ -20,12 +18,10 @@ module aptos_framework::reconfiguration_with_dkg {
2018
/// Trigger a reconfiguration with DKG.
2119
/// Do nothing if one is already in progress.
2220
public(friend) fun try_start() {
23-
debug::print(&utf8(b"0312 - try_start begin"));
2421
let incomplete_dkg_session = dkg::incomplete_session();
2522
if (option::is_some(&incomplete_dkg_session)) {
2623
let session = option::borrow(&incomplete_dkg_session);
2724
if (dkg::session_dealer_epoch(session) == reconfiguration::current_epoch()) {
28-
debug::print(&utf8(b"0312 - try_start abort"));
2925
return
3026
}
3127
};
@@ -37,7 +33,6 @@ module aptos_framework::reconfiguration_with_dkg {
3733
stake::cur_validator_consensus_infos(),
3834
stake::next_validator_consensus_infos(),
3935
);
40-
debug::print(&utf8(b"0312 - try_start end"))
4136
}
4237

4338
/// Clear incomplete DKG session, if it exists.

aptos-move/framework/src/natives/debug.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ fn native_print(
3232
debug_assert!(ty_args.is_empty());
3333
debug_assert!(args.len() == 1);
3434

35-
let val = safely_pop_arg!(args, Struct);
36-
let bytes = val.unpack()?.next().unwrap();
35+
if cfg!(feature = "testing") {
36+
let val = safely_pop_arg!(args, Struct);
37+
let bytes = val.unpack()?.next().unwrap();
3738

38-
println!(
39-
"[debug] {}",
40-
std::str::from_utf8(&bytes.value_as::<Vec<u8>>()?).unwrap()
41-
);
39+
println!(
40+
"[debug] {}",
41+
std::str::from_utf8(&bytes.value_as::<Vec<u8>>()?).unwrap()
42+
);
43+
}
4244

4345
Ok(smallvec![])
4446
}

types/src/contract_event.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,7 @@ impl TryFrom<&ContractEvent> for DKGStartEvent {
311311
if event.type_tag != TypeTag::Struct(Box::new(Self::struct_tag())) {
312312
bail!("conversion to dkg start event failed with wrong type tag")
313313
}
314-
let x = bcs::from_bytes(&event.event_data).map_err(Into::into);
315-
println!("0312 - ContractEvent to DKGStartEvent: {}", x.is_ok());
316-
x
314+
bcs::from_bytes(&event.event_data).map_err(Into::into)
317315
},
318316
}
319317
}

0 commit comments

Comments
 (0)