Skip to content

Commit b448b29

Browse files
authored
Evm/integration phase2 [wip] (#201)
* add cors for localnet * add docs and default * docs * docs * integration with smr * fix move docs (#181) * fix move docs * fix docs * addressing comments * addressing comments * generate .md * fix bls test * add todo docs * update generated .md files * update .md docs * derive evm chain id from move chainid * get chainid method * fix docs only
1 parent 13b2ccb commit b448b29

Some content is hidden

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

55 files changed

+488
-127
lines changed

aptos-move/framework/aptos-stdlib/doc/bls12381.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,21 +313,21 @@ The public key size, in bytes
313313
<a id="0x1_bls12381_RANDOM_PK"></a>
314314

315315
Random signature generated by running <code>cargo test -- bls12381_sample_signature --nocapture --<b>include</b>-ignored</code> in <code>crates/aptos-crypto</code>.
316-
The associated SK is 07416693b6b32c84abe45578728e2379f525729e5b94762435a31e65ecc728da.
316+
The associated SK is 2692ef93b9f00fde863c8cf01755ddfc7a56c993f2310a1dea0773c14382c455.
317317

318318

319-
<pre><code><b>const</b> <a href="bls12381.md#0x1_bls12381_RANDOM_PK">RANDOM_PK</a>: <a href="../../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt; = [138, 83, 231, 174, 82, 112, 227, 231, 101, 205, 138, 64, 50, 194, 231, 124, 111, 126, 135, 164, 78, 187, 133, 191, 40, 164, 215, 134, 85, 101, 105, 143, 151, 83, 70, 113, 66, 98, 249, 228, 124, 111, 62, 13, 93, 149, 22, 96];
319+
<pre><code><b>const</b> <a href="bls12381.md#0x1_bls12381_RANDOM_PK">RANDOM_PK</a>: <a href="../../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt; = [136, 86, 166, 60, 29, 150, 121, 240, 207, 238, 148, 132, 73, 35, 115, 109, 121, 215, 173, 55, 48, 66, 144, 117, 206, 226, 239, 233, 71, 111, 233, 66, 72, 167, 47, 173, 16, 223, 169, 78, 126, 40, 116, 86, 184, 3, 218, 15];
320320
</code></pre>
321321

322322

323323

324324
<a id="0x1_bls12381_RANDOM_SIGNATURE"></a>
325325

326326
Random signature generated by running <code>cargo test -- bls12381_sample_signature --nocapture --<b>include</b>-ignored</code> in <code>crates/aptos-crypto</code>.
327-
The message signed is "Hello Supra!" and the associated SK is 07416693b6b32c84abe45578728e2379f525729e5b94762435a31e65ecc728da.
327+
The message signed is "Hello Supra!" and the associated SK is 2692ef93b9f00fde863c8cf01755ddfc7a56c993f2310a1dea0773c14382c455.
328328

329329

330-
<pre><code><b>const</b> <a href="bls12381.md#0x1_bls12381_RANDOM_SIGNATURE">RANDOM_SIGNATURE</a>: <a href="../../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt; = [160, 26, 101, 133, 79, 152, 125, 52, 52, 20, 155, 127, 8, 247, 7, 48, 227, 11, 36, 25, 132, 232, 113, 43, 194, 172, 168, 133, 214, 50, 170, 252, 237, 76, 63, 102, 18, 9, 222, 187, 107, 28, 134, 1, 50, 102, 35, 204, 22, 202, 47, 108, 158, 220, 83, 183, 184, 139, 116, 53, 251, 107, 5, 221, 236, 228, 24, 210, 195, 77, 198, 172, 162, 245, 161, 26, 121, 230, 119, 116, 88, 44, 20, 8, 74, 1, 220, 183, 130, 14, 76, 180, 186, 208, 234, 141];
330+
<pre><code><b>const</b> <a href="bls12381.md#0x1_bls12381_RANDOM_SIGNATURE">RANDOM_SIGNATURE</a>: <a href="../../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt; = [130, 99, 204, 129, 151, 224, 244, 181, 240, 188, 141, 35, 68, 234, 102, 41, 179, 210, 45, 48, 136, 201, 121, 203, 103, 55, 87, 52, 180, 245, 51, 96, 155, 12, 126, 126, 228, 12, 211, 226, 179, 66, 112, 35, 213, 89, 106, 209, 5, 86, 224, 16, 252, 36, 23, 157, 201, 34, 24, 94, 128, 176, 55, 226, 135, 228, 92, 119, 164, 255, 113, 204, 225, 82, 212, 103, 174, 208, 112, 74, 64, 221, 223, 136, 252, 102, 142, 166, 5, 218, 112, 46, 140, 177, 12, 4];
331331
</code></pre>
332332

333333

aptos-move/framework/aptos-stdlib/sources/cryptography/bls12381.move

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,12 @@ module aptos_std::bls12381 {
495495
//
496496

497497
/// Random signature generated by running `cargo test -- bls12381_sample_signature --nocapture --include-ignored` in `crates/aptos-crypto`.
498-
/// The message signed is "Hello Supra!" and the associated SK is 07416693b6b32c84abe45578728e2379f525729e5b94762435a31e65ecc728da.
499-
const RANDOM_SIGNATURE: vector<u8> = x"a01a65854f987d3434149b7f08f70730e30b241984e8712bc2aca885d632aafced4c3f661209debb6b1c8601326623cc16ca2f6c9edc53b7b88b7435fb6b05ddece418d2c34dc6aca2f5a11a79e67774582c14084a01dcb7820e4cb4bad0ea8d";
498+
/// The message signed is "Hello Supra!" and the associated SK is 2692ef93b9f00fde863c8cf01755ddfc7a56c993f2310a1dea0773c14382c455.
499+
const RANDOM_SIGNATURE: vector<u8> = x"8263cc8197e0f4b5f0bc8d2344ea6629b3d22d3088c979cb67375734b4f533609b0c7e7ee40cd3e2b3427023d5596ad10556e010fc24179dc922185e80b037e287e45c77a4ff71cce152d467aed0704a40dddf88fc668ea605da702e8cb10c04";
500500

501501
/// Random signature generated by running `cargo test -- bls12381_sample_signature --nocapture --include-ignored` in `crates/aptos-crypto`.
502-
/// The associated SK is 07416693b6b32c84abe45578728e2379f525729e5b94762435a31e65ecc728da.
503-
const RANDOM_PK: vector<u8> = x"8a53e7ae5270e3e765cd8a4032c2e77c6f7e87a44ebb85bf28a4d7865565698f975346714262f9e47c6f3e0d5d951660";
502+
/// The associated SK is 2692ef93b9f00fde863c8cf01755ddfc7a56c993f2310a1dea0773c14382c455.
503+
const RANDOM_PK: vector<u8> = x"8856a63c1d9679f0cfee94844923736d79d7ad3730429075cee2efe9476fe94248a72fad10dfa94e7e287456b803da0f";
504504

505505
//
506506
// Tests
@@ -755,7 +755,7 @@ module aptos_std::bls12381 {
755755
// Second, try some test-cases generated by running the following command in `crates/aptos-crypto`:
756756
// $ cargo test -- bls12381_sample_aggregate_pk_and_aggsig --nocapture --ignored
757757

758-
// The signed messages are "Hello, Aptos <i>!", where <i> \in {1, ..., 5}
758+
// The signed messages are "Hello, Supra <i>!", where <i> \in {1, ..., 5}
759759
let msgs = vector[
760760
x"48656c6c6f2c204170746f73203121",
761761
x"48656c6c6f2c204170746f73203221",
@@ -860,23 +860,23 @@ module aptos_std::bls12381 {
860860
// Test case generated by running `cargo test -- bls12381_sample_signature --nocapture --include-ignored` in
861861
// `crates/aptos-crypto`
862862
// =============================================================================================================
863-
// SK: 077c8a56f26259215a4a245373ab6ddf328ac6e00e5ea38d8700efa361bdc58d
863+
// SK: 2692ef93b9f00fde863c8cf01755ddfc7a56c993f2310a1dea0773c14382c455
864864

865-
let message = b"Hello Aptos!";
865+
let message = b"Hello Supra!";
866866

867867
// First, test signatures that verify
868868
let ok = verify_normal_signature(
869-
&signature_from_bytes(x"b01ce4632e94d8c611736e96aa2ad8e0528a02f927a81a92db8047b002a8c71dc2d6bfb94729d0973790c10b6ece446817e4b7543afd7ca9a17c75de301ae835d66231c26a003f11ae26802b98d90869a9e73788c38739f7ac9d52659e1f7cf7"),
870-
&option::extract(&mut public_key_from_bytes(x"94209a296b739577cb076d3bfb1ca8ee936f29b69b7dae436118c4dd1cc26fd43dcd16249476a006b8b949bf022a7858")),
869+
&signature_from_bytes(RANDOM_SIGNATURE),
870+
&option::extract(&mut public_key_from_bytes(RANDOM_PK)),
871871
message,
872872
);
873873
assert!(ok == true, 1);
874874

875-
let pk = option::extract(&mut public_key_from_bytes(x"94209a296b739577cb076d3bfb1ca8ee936f29b69b7dae436118c4dd1cc26fd43dcd16249476a006b8b949bf022a7858"));
875+
let pk = option::extract(&mut public_key_from_bytes(RANDOM_PK));
876876
let pk_with_pop = PublicKeyWithPoP { bytes: pk.bytes };
877877

878878
let ok = verify_signature_share(
879-
&signature_from_bytes(x"b01ce4632e94d8c611736e96aa2ad8e0528a02f927a81a92db8047b002a8c71dc2d6bfb94729d0973790c10b6ece446817e4b7543afd7ca9a17c75de301ae835d66231c26a003f11ae26802b98d90869a9e73788c38739f7ac9d52659e1f7cf7"),
879+
&signature_from_bytes(RANDOM_SIGNATURE),
880880
&pk_with_pop,
881881
message,
882882
);
@@ -894,9 +894,9 @@ module aptos_std::bls12381 {
894894
x"82ed7bb5528303a2e306775040a7309e0bd597b70d9949d8c6198a01a7be0b00079320ebfeaf7bbd5bfe86809940d252",
895895
];
896896
let messages = vector[
897-
b"Hello Aptos!",
898-
b"Hello Aptos!",
899-
b"Bello Aptos!",
897+
b"Hello Supra!",
898+
b"Hello Supra!",
899+
b"Bello Supra!",
900900
];
901901

902902
let i = 0;

aptos-move/framework/aptos-stdlib/sources/cryptography/multi_ed25519.move

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ module aptos_std::multi_ed25519 {
440440
assert!(option::extract(&mut unvalidated_public_key_threshold(&upk)) == threshold, 4);
441441
assert!(unvalidated_public_key_num_sub_pks(&upk) == group_size, 5);
442442

443-
let msg1 = b"Hello Aptos!";
443+
let msg1 = b"Hello Supra!";
444444
let sig1 = sign_arbitrary_bytes(&sk, msg1);
445445
assert!(signature_verify_strict(&sig1, &upk, msg1), 6);
446446

@@ -466,7 +466,7 @@ module aptos_std::multi_ed25519 {
466466
assert!(option::extract(&mut unvalidated_public_key_threshold(&upk)) == 4, 4);
467467
assert!(unvalidated_public_key_num_sub_pks(&upk) == 5, 5);
468468

469-
let msg1 = b"Hello Aptos!";
469+
let msg1 = b"Hello Supra!";
470470
let sig1 = sign_arbitrary_bytes(&sk, msg1);
471471
maul_first_signature(&mut sig1);
472472
assert!(!signature_verify_strict(&sig1, &upk, msg1), 6);

aptos-move/framework/supra-framework/doc/aggregator_factory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Returns a new aggregator.
217217
<td>2</td>
218218
<td>To create a new aggregator instance, the aggregator factory must already be initialized and exist under the Supra account.</td>
219219
<td>High</td>
220-
<td>The create_aggregator_internal function asserts that AggregatorFactory exists for the Aptos account.</td>
220+
<td>The create_aggregator_internal function asserts that AggregatorFactory exists for the Supra account.</td>
221221
<td>Formally verified via <a href="#high-level-req-2">CreateAggregatorInternalAbortsIf</a>.</td>
222222
</tr>
223223

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ Initialize the commit history resource if it's not in genesis.
487487
## Function `update_epoch_interval_microsecs`
488488

489489
Update the epoch interval.
490-
Can only be called as part of the Supra governance proposal process established by the AptosGovernance module.
490+
Can only be called as part of the Supra governance proposal process established by the SupraGovernance module.
491491

492492

493493
<pre><code><b>public</b> <b>fun</b> <a href="block.md#0x1_block_update_epoch_interval_microsecs">update_epoch_interval_microsecs</a>(supra_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, new_epoch_interval: u64)
@@ -940,7 +940,7 @@ new block event for WriteSetPayload.
940940

941941
<tr>
942942
<td>1</td>
943-
<td>During the module's initialization, it guarantees that the BlockResource resource moves under the Aptos framework account with initial values.</td>
943+
<td>During the module's initialization, it guarantees that the BlockResource resource moves under the Supra framework account with initial values.</td>
944944
<td>High</td>
945945
<td>The initialize function is responsible for setting up the initial state of the module, ensuring that the following conditions are met (1) the BlockResource resource is created, indicating its existence within the module's context, and moved under the Supra framework account, (2) the block height is set to zero during initialization, and (3) the epoch interval is greater than zero.</td>
946946
<td>Formally Verified via <a href="#high-level-req-1">Initialize</a>.</td>

aptos-move/framework/supra-framework/doc/chain_id.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Return the chain ID of this instance.
129129

130130
<tr>
131131
<td>2</td>
132-
<td>The chain id can only be fetched if the chain id resource exists under the Aptos framework account.</td>
132+
<td>The chain id can only be fetched if the chain id resource exists under the Supra framework account.</td>
133133
<td>Low</td>
134134
<td>The chain_id::get function fetches the chain id by borrowing the ChainId resource from the supra_framework account.</td>
135135
<td>Formally verified via <a href="#high-level-req-2">get</a>.</td>

aptos-move/framework/supra-framework/doc/coin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4150,7 +4150,7 @@ Can only be updated by <code>@supra_framework</code>.
41504150

41514151

41524152

4153-
<pre><code><b>include</b> <a href="system_addresses.md#0x1_system_addresses_AbortsIfNotAptosFramework">system_addresses::AbortsIfNotAptosFramework</a> { <a href="account.md#0x1_account">account</a>: supra_framework };
4153+
<pre><code><b>include</b> <a href="system_addresses.md#0x1_system_addresses_AbortsIfNotSupraFramework">system_addresses::AbortsIfNotSupraFramework</a> { <a href="account.md#0x1_account">account</a>: supra_framework };
41544154
<b>include</b> <a href="aggregator_factory.md#0x1_aggregator_factory_CreateAggregatorInternalAbortsIf">aggregator_factory::CreateAggregatorInternalAbortsIf</a>;
41554155
</code></pre>
41564156

aptos-move/framework/supra-framework/doc/consensus_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Only used in reconfigurations to apply the pending <code><a href="consensus_conf
279279

280280
<tr>
281281
<td>2</td>
282-
<td>Only aptos framework account is allowed to update the consensus configuration.</td>
282+
<td>Only supra framework account is allowed to update the consensus configuration.</td>
283283
<td>Medium</td>
284284
<td>The consensus_config::set function ensures that the signer is supra_framework.</td>
285285
<td>Formally verified via <a href="#high-level-req-2">set</a>.</td>
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
2+
<a id="0x1_evm_config"></a>
3+
4+
# Module `0x1::evm_config`
5+
6+
7+
8+
- [Resource `EvmConfig`](#0x1_evm_config_EvmConfig)
9+
- [Constants](#@Constants_0)
10+
- [Function `initialize`](#0x1_evm_config_initialize)
11+
- [Function `set_for_next_epoch`](#0x1_evm_config_set_for_next_epoch)
12+
- [Function `on_new_epoch`](#0x1_evm_config_on_new_epoch)
13+
- [Specification](#@Specification_1)
14+
- [Function `set_for_next_epoch`](#@Specification_1_set_for_next_epoch)
15+
- [Function `on_new_epoch`](#@Specification_1_on_new_epoch)
16+
17+
18+
<pre><code><b>use</b> <a href="config_buffer.md#0x1_config_buffer">0x1::config_buffer</a>;
19+
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
20+
<b>use</b> <a href="system_addresses.md#0x1_system_addresses">0x1::system_addresses</a>;
21+
<b>use</b> <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">0x1::vector</a>;
22+
</code></pre>
23+
24+
25+
26+
<a id="0x1_evm_config_EvmConfig"></a>
27+
28+
## Resource `EvmConfig`
29+
30+
The struct stores the on-chain EVM configuration.
31+
32+
33+
<pre><code><b>struct</b> <a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a> <b>has</b> drop, store, key
34+
</code></pre>
35+
36+
37+
38+
<details>
39+
<summary>Fields</summary>
40+
41+
42+
<dl>
43+
<dt>
44+
<code>config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;</code>
45+
</dt>
46+
<dd>
47+
48+
</dd>
49+
</dl>
50+
51+
52+
</details>
53+
54+
<a id="@Constants_0"></a>
55+
56+
## Constants
57+
58+
59+
<a id="0x1_evm_config_EINVALID_CONFIG"></a>
60+
61+
The provided on chain config bytes are empty or invalid
62+
63+
64+
<pre><code><b>const</b> <a href="evm_config.md#0x1_evm_config_EINVALID_CONFIG">EINVALID_CONFIG</a>: u64 = 1;
65+
</code></pre>
66+
67+
68+
69+
<a id="0x1_evm_config_initialize"></a>
70+
71+
## Function `initialize`
72+
73+
Publishes the EvmConfig config.
74+
75+
76+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="evm_config.md#0x1_evm_config_initialize">initialize</a>(supra_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
77+
</code></pre>
78+
79+
80+
81+
<details>
82+
<summary>Implementation</summary>
83+
84+
85+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="evm_config.md#0x1_evm_config_initialize">initialize</a>(supra_framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;) {
86+
<a href="system_addresses.md#0x1_system_addresses_assert_supra_framework">system_addresses::assert_supra_framework</a>(supra_framework);
87+
<b>assert</b>!(!<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_is_empty">vector::is_empty</a>(&config), <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="evm_config.md#0x1_evm_config_EINVALID_CONFIG">EINVALID_CONFIG</a>));
88+
<b>move_to</b>(supra_framework, <a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a> { config });
89+
}
90+
</code></pre>
91+
92+
93+
94+
</details>
95+
96+
<a id="0x1_evm_config_set_for_next_epoch"></a>
97+
98+
## Function `set_for_next_epoch`
99+
100+
This can be called by on-chain governance to update on-chain evm configs for the next epoch.
101+
Example usage:
102+
```
103+
supra_framework::evm_config::set_for_next_epoch(&framework_signer, some_config_bytes);
104+
supra_framework::supra_governance::reconfigure(&framework_signer);
105+
```
106+
107+
108+
<pre><code><b>public</b> <b>fun</b> <a href="evm_config.md#0x1_evm_config_set_for_next_epoch">set_for_next_epoch</a>(<a href="account.md#0x1_account">account</a>: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
109+
</code></pre>
110+
111+
112+
113+
<details>
114+
<summary>Implementation</summary>
115+
116+
117+
<pre><code><b>public</b> <b>fun</b> <a href="evm_config.md#0x1_evm_config_set_for_next_epoch">set_for_next_epoch</a>(<a href="account.md#0x1_account">account</a>: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;) {
118+
<a href="system_addresses.md#0x1_system_addresses_assert_supra_framework">system_addresses::assert_supra_framework</a>(<a href="account.md#0x1_account">account</a>);
119+
<b>assert</b>!(!<a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector_is_empty">vector::is_empty</a>(&config), <a href="../../aptos-stdlib/../move-stdlib/doc/error.md#0x1_error_invalid_argument">error::invalid_argument</a>(<a href="evm_config.md#0x1_evm_config_EINVALID_CONFIG">EINVALID_CONFIG</a>));
120+
std::config_buffer::upsert&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;(<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a> {config});
121+
}
122+
</code></pre>
123+
124+
125+
126+
</details>
127+
128+
<a id="0x1_evm_config_on_new_epoch"></a>
129+
130+
## Function `on_new_epoch`
131+
132+
Only used in reconfigurations to apply the pending <code><a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a></code> in buffer, if there is any.
133+
If supra_framework has a EvmConfig, then update the new config to supra_framework.
134+
Otherwise, move the new config to supra_framework.
135+
136+
137+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="evm_config.md#0x1_evm_config_on_new_epoch">on_new_epoch</a>(framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
138+
</code></pre>
139+
140+
141+
142+
<details>
143+
<summary>Implementation</summary>
144+
145+
146+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="evm_config.md#0x1_evm_config_on_new_epoch">on_new_epoch</a>(framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>) <b>acquires</b> <a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a> {
147+
<a href="system_addresses.md#0x1_system_addresses_assert_supra_framework">system_addresses::assert_supra_framework</a>(framework);
148+
<b>if</b> (<a href="config_buffer.md#0x1_config_buffer_does_exist">config_buffer::does_exist</a>&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;()) {
149+
<b>let</b> new_config = <a href="config_buffer.md#0x1_config_buffer_extract">config_buffer::extract</a>&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;();
150+
<b>if</b> (<b>exists</b>&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;(@supra_framework)) {
151+
*<b>borrow_global_mut</b>&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;(@supra_framework) = new_config;
152+
} <b>else</b> {
153+
<b>move_to</b>(framework, new_config);
154+
};
155+
}
156+
}
157+
</code></pre>
158+
159+
160+
161+
</details>
162+
163+
<a id="@Specification_1"></a>
164+
165+
## Specification
166+
167+
168+
169+
<pre><code><b>pragma</b> verify = <b>true</b>;
170+
<b>pragma</b> aborts_if_is_strict;
171+
</code></pre>
172+
173+
174+
175+
<a id="@Specification_1_set_for_next_epoch"></a>
176+
177+
### Function `set_for_next_epoch`
178+
179+
180+
<pre><code><b>public</b> <b>fun</b> <a href="evm_config.md#0x1_evm_config_set_for_next_epoch">set_for_next_epoch</a>(<a href="account.md#0x1_account">account</a>: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>, config: <a href="../../aptos-stdlib/../move-stdlib/doc/vector.md#0x1_vector">vector</a>&lt;u8&gt;)
181+
</code></pre>
182+
183+
184+
185+
186+
<pre><code><b>include</b> <a href="config_buffer.md#0x1_config_buffer_SetForNextEpochAbortsIf">config_buffer::SetForNextEpochAbortsIf</a>;
187+
</code></pre>
188+
189+
190+
191+
<a id="@Specification_1_on_new_epoch"></a>
192+
193+
### Function `on_new_epoch`
194+
195+
196+
<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="evm_config.md#0x1_evm_config_on_new_epoch">on_new_epoch</a>(framework: &<a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>)
197+
</code></pre>
198+
199+
200+
201+
202+
<pre><code><b>requires</b> @supra_framework == std::signer::address_of(framework);
203+
<b>include</b> <a href="config_buffer.md#0x1_config_buffer_OnNewEpochRequirement">config_buffer::OnNewEpochRequirement</a>&lt;<a href="evm_config.md#0x1_evm_config_EvmConfig">EvmConfig</a>&gt;;
204+
<b>aborts_if</b> <b>false</b>;
205+
</code></pre>
206+
207+
208+
[move-book]: https://aptos.dev/move/book/SUMMARY

0 commit comments

Comments
 (0)