Skip to content

Commit 42d905a

Browse files
authored
introduce randomness_config and jwk_consensus_config and deprecate the corresponding feature flags (aptos-labs#12449)
* introduce randomness_config and jwk_consensus_config * update * update * update smoke tests * update smoke tests * update jwk consensus config to use MoveAny * update jwk consensus config to use MoveAny 2 * update jwk smoke tests * lint * update spec * fix spec * randomness config entries (aptos-labs#12459) * debug * debug * debug * debug * debug * debug * debug * debug * debug * update * Squashed commit of the following: commit 4cf95e61d33c06e729cfbddffe3eab09350264d4 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 14:37:13 2024 -0700 debug commit 70b2c1b Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 14:23:51 2024 -0700 debug commit f08b4e2 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 13:36:16 2024 -0700 debug commit 380539b Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 13:30:33 2024 -0700 debug commit 493fd06 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 13:20:19 2024 -0700 debug commit 39fd286 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 12:46:02 2024 -0700 debug commit 95fc591 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 10:02:12 2024 -0700 debug commit 731440f Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 09:34:42 2024 -0700 debug commit 5909631 Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 09:25:29 2024 -0700 debug commit eaa993a Author: zhoujun.ma <[email protected]> Date: Tue Mar 12 09:22:34 2024 -0700 debug * lint
1 parent ee0d090 commit 42d905a

File tree

71 files changed

+1990
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1990
-494
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ on a proposal multiple times as long as the total voting power of these votes do
100100
<b>use</b> <a href="governance_proposal.md#0x1_governance_proposal">0x1::governance_proposal</a>;
101101
<b>use</b> <a href="../../aptos-stdlib/doc/math64.md#0x1_math64">0x1::math64</a>;
102102
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option">0x1::option</a>;
103+
<b>use</b> <a href="randomness_config.md#0x1_randomness_config">0x1::randomness_config</a>;
103104
<b>use</b> <a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg">0x1::reconfiguration_with_dkg</a>;
104105
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">0x1::signer</a>;
105106
<b>use</b> <a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map">0x1::simple_map</a>;
@@ -1485,7 +1486,7 @@ since such updates are applied whenever we enter an new epoch.
14851486

14861487
<pre><code><b>public</b> <b>fun</b> <a href="aptos_governance.md#0x1_aptos_governance_reconfigure">reconfigure</a>(aptos_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) {
14871488
<a href="system_addresses.md#0x1_system_addresses_assert_aptos_framework">system_addresses::assert_aptos_framework</a>(aptos_framework);
1488-
<b>if</b> (<a href="consensus_config.md#0x1_consensus_config_validator_txn_enabled">consensus_config::validator_txn_enabled</a>() && <a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features_reconfigure_with_dkg_enabled">features::reconfigure_with_dkg_enabled</a>()) {
1489+
<b>if</b> (<a href="consensus_config.md#0x1_consensus_config_validator_txn_enabled">consensus_config::validator_txn_enabled</a>() && <a href="randomness_config.md#0x1_randomness_config_enabled">randomness_config::enabled</a>()) {
14891490
<a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_try_start">reconfiguration_with_dkg::try_start</a>();
14901491
} <b>else</b> {
14911492
<a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_finish">reconfiguration_with_dkg::finish</a>(aptos_framework);

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ 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>;
4344
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
4445
<b>use</b> <a href="event.md#0x1_event">0x1::event</a>;
4546
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/features.md#0x1_features">0x1::features</a>;
@@ -49,6 +50,7 @@ This module defines a struct storing the metadata of the block and new block eve
4950
<b>use</b> <a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg">0x1::reconfiguration_with_dkg</a>;
5051
<b>use</b> <a href="stake.md#0x1_stake">0x1::stake</a>;
5152
<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>;
5254
<b>use</b> <a href="system_addresses.md#0x1_system_addresses">0x1::system_addresses</a>;
5355
<b>use</b> <a href="../../aptos-stdlib/doc/table_with_length.md#0x1_table_with_length">0x1::table_with_length</a>;
5456
<b>use</b> <a href="timestamp.md#0x1_timestamp">0x1::timestamp</a>;
@@ -580,6 +582,7 @@ The runtime always runs this before executing the transactions in a block.
580582
<a href="timestamp.md#0x1_timestamp">timestamp</a>: u64,
581583
randomness_seed: Option&lt;<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;&gt;,
582584
) <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"));
583586
<b>let</b> epoch_interval = <a href="block.md#0x1_block_block_prologue_common">block_prologue_common</a>(
584587
&vm,
585588
<a href="../../aptos-stdlib/../move-stdlib/doc/hash.md#0x1_hash">hash</a>,
@@ -594,7 +597,8 @@ The runtime always runs this before executing the transactions in a block.
594597

595598
<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) {
596599
<a href="reconfiguration_with_dkg.md#0x1_reconfiguration_with_dkg_try_start">reconfiguration_with_dkg::try_start</a>();
597-
}
600+
};
601+
<a href="../../aptos-stdlib/doc/debug.md#0x1_debug_print">debug::print</a>(&utf8(b"0312 - block_prologue_ext end"))
598602
}
599603
</code></pre>
600604

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

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ NOTE: on-chain config <code>0x1::state::ValidatorSet</code> implemented its own
2323
- [Function `upsert`](#0x1_config_buffer_upsert)
2424
- [Function `extract`](#0x1_config_buffer_extract)
2525
- [Specification](#@Specification_1)
26-
- [Function `initialize`](#@Specification_1_initialize)
2726
- [Function `does_exist`](#@Specification_1_does_exist)
2827
- [Function `upsert`](#@Specification_1_upsert)
2928
- [Function `extract`](#@Specification_1_extract)
@@ -96,9 +95,11 @@ Config buffer operations failed with permission denied.
9695

9796

9897
<pre><code><b>public</b> <b>fun</b> <a href="config_buffer.md#0x1_config_buffer_initialize">initialize</a>(aptos_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) {
99-
<b>move_to</b>(aptos_framework, <a href="config_buffer.md#0x1_config_buffer_PendingConfigs">PendingConfigs</a> {
100-
configs: <a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_new">simple_map::new</a>(),
101-
})
98+
<b>if</b> (!<b>exists</b>&lt;<a href="config_buffer.md#0x1_config_buffer_PendingConfigs">PendingConfigs</a>&gt;(@aptos_framework)) {
99+
<b>move_to</b>(aptos_framework, <a href="config_buffer.md#0x1_config_buffer_PendingConfigs">PendingConfigs</a> {
100+
configs: <a href="../../aptos-stdlib/doc/simple_map.md#0x1_simple_map_new">simple_map::new</a>(),
101+
})
102+
}
102103
}
103104
</code></pre>
104105

@@ -208,22 +209,6 @@ Typically used in <code>X::on_new_epoch()</code> where X is an on-chaon config.
208209

209210

210211

211-
<a id="@Specification_1_initialize"></a>
212-
213-
### Function `initialize`
214-
215-
216-
<pre><code><b>public</b> <b>fun</b> <a href="config_buffer.md#0x1_config_buffer_initialize">initialize</a>(aptos_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
217-
</code></pre>
218-
219-
220-
221-
222-
<pre><code><b>aborts_if</b> <b>exists</b>&lt;<a href="config_buffer.md#0x1_config_buffer_PendingConfigs">PendingConfigs</a>&gt;(<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer_address_of">signer::address_of</a>(aptos_framework));
223-
</code></pre>
224-
225-
226-
227212
<a id="@Specification_1_does_exist"></a>
228213

229214
### Function `does_exist`

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ DKG on-chain states and helper functions.
2828
<pre><code><b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
2929
<b>use</b> <a href="event.md#0x1_event">0x1::event</a>;
3030
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/option.md#0x1_option">0x1::option</a>;
31+
<b>use</b> <a href="randomness_config.md#0x1_randomness_config">0x1::randomness_config</a>;
3132
<b>use</b> <a href="system_addresses.md#0x1_system_addresses">0x1::system_addresses</a>;
3233
<b>use</b> <a href="timestamp.md#0x1_timestamp">0x1::timestamp</a>;
3334
<b>use</b> <a href="validator_consensus_info.md#0x1_validator_consensus_info">0x1::validator_consensus_info</a>;
@@ -57,6 +58,12 @@ This can be considered as the public input of DKG.
5758
</dt>
5859
<dd>
5960

61+
</dd>
62+
<dt>
63+
<code><a href="randomness_config.md#0x1_randomness_config">randomness_config</a>: <a href="randomness_config.md#0x1_randomness_config_RandomnessConfig">randomness_config::RandomnessConfig</a></code>
64+
</dt>
65+
<dd>
66+
6067
</dd>
6168
<dt>
6269
<code>dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;</code>
@@ -247,7 +254,7 @@ Mark on-chain DKG state as in-progress. Notify validators to start DKG.
247254
Abort if a DKG is already in progress.
248255

249256

250-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="dkg.md#0x1_dkg_start">start</a>(dealer_epoch: u64, dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;, target_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;)
257+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="dkg.md#0x1_dkg_start">start</a>(dealer_epoch: u64, <a href="randomness_config.md#0x1_randomness_config">randomness_config</a>: <a href="randomness_config.md#0x1_randomness_config_RandomnessConfig">randomness_config::RandomnessConfig</a>, dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;, target_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;)
251258
</code></pre>
252259

253260

@@ -258,12 +265,14 @@ Abort if a DKG is already in progress.
258265

259266
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="dkg.md#0x1_dkg_start">start</a>(
260267
dealer_epoch: u64,
268+
<a href="randomness_config.md#0x1_randomness_config">randomness_config</a>: RandomnessConfig,
261269
dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;ValidatorConsensusInfo&gt;,
262270
target_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;ValidatorConsensusInfo&gt;,
263271
) <b>acquires</b> <a href="dkg.md#0x1_dkg_DKGState">DKGState</a> {
264272
<b>let</b> dkg_state = <b>borrow_global_mut</b>&lt;<a href="dkg.md#0x1_dkg_DKGState">DKGState</a>&gt;(@aptos_framework);
265273
<b>let</b> new_session_metadata = <a href="dkg.md#0x1_dkg_DKGSessionMetadata">DKGSessionMetadata</a> {
266274
dealer_epoch,
275+
<a href="randomness_config.md#0x1_randomness_config">randomness_config</a>,
267276
dealer_validator_set,
268277
target_validator_set,
269278
};
@@ -434,7 +443,7 @@ Return the dealer epoch of a <code><a href="dkg.md#0x1_dkg_DKGSessionState">DKGS
434443
### Function `start`
435444

436445

437-
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="dkg.md#0x1_dkg_start">start</a>(dealer_epoch: u64, dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;, target_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;)
446+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="dkg.md#0x1_dkg_start">start</a>(dealer_epoch: u64, <a href="randomness_config.md#0x1_randomness_config">randomness_config</a>: <a href="randomness_config.md#0x1_randomness_config_RandomnessConfig">randomness_config::RandomnessConfig</a>, dealer_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;, target_validator_set: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;<a href="validator_consensus_info.md#0x1_validator_consensus_info_ValidatorConsensusInfo">validator_consensus_info::ValidatorConsensusInfo</a>&gt;)
438447
</code></pre>
439448

440449

0 commit comments

Comments
 (0)