Skip to content

Commit

Permalink
Documentation and method names. handling sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos committed Oct 16, 2024
1 parent 7aaa0b2 commit 17ccbb2
Show file tree
Hide file tree
Showing 7 changed files with 603 additions and 593 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
gas_feature_versions::{RELEASE_V1_18, RELEASE_V1_22},
gas_schedule::NativeGasParameters,
};
use aptos_gas_algebra::{InternalGas, InternalGasPerArg, InternalGasPerByte};
use aptos_gas_algebra::{InternalGas, InternalGasPerAbstractValueUnit, InternalGasPerArg, InternalGasPerByte};

crate::gas_schedule::macros::define_gas_parameters!(
MoveStdlibGasParameters,
Expand Down
572 changes: 276 additions & 296 deletions aptos-move/framework/aptos-stdlib/doc/big_ordered_map.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions aptos-move/framework/aptos-stdlib/doc/fixed_point64.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,22 @@ The multiplied value would be too large to be held in a <code>u128</code>



<a id="0x1_fixed_point64_ENEGATIVE_RESULT"></a>
<a id="0x1_fixed_point64_ERATIO_OUT_OF_RANGE"></a>

Abort code on calculation result is negative.
The computed ratio when converting to a <code><a href="fixed_point64.md#0x1_fixed_point64_FixedPoint64">FixedPoint64</a></code> would be unrepresentable


<pre><code><b>const</b> <a href="fixed_point64.md#0x1_fixed_point64_ENEGATIVE_RESULT">ENEGATIVE_RESULT</a>: u64 = 65542;
<pre><code><b>const</b> <a href="fixed_point64.md#0x1_fixed_point64_ERATIO_OUT_OF_RANGE">ERATIO_OUT_OF_RANGE</a>: u64 = 131077;
</code></pre>



<a id="0x1_fixed_point64_ERATIO_OUT_OF_RANGE"></a>
<a id="0x1_fixed_point64_ENEGATIVE_RESULT"></a>

The computed ratio when converting to a <code><a href="fixed_point64.md#0x1_fixed_point64_FixedPoint64">FixedPoint64</a></code> would be unrepresentable
Abort code on calculation result is negative.


<pre><code><b>const</b> <a href="fixed_point64.md#0x1_fixed_point64_ERATIO_OUT_OF_RANGE">ERATIO_OUT_OF_RANGE</a>: u64 = 131077;
<pre><code><b>const</b> <a href="fixed_point64.md#0x1_fixed_point64_ENEGATIVE_RESULT">ENEGATIVE_RESULT</a>: u64 = 65542;
</code></pre>


Expand Down
2 changes: 2 additions & 0 deletions aptos-move/framework/aptos-stdlib/doc/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This is the reference documentation of the Aptos standard library.

- [`0x1::any`](any.md#0x1_any)
- [`0x1::aptos_hash`](hash.md#0x1_aptos_hash)
- [`0x1::big_ordered_map`](big_ordered_map.md#0x1_big_ordered_map)
- [`0x1::big_vector`](big_vector.md#0x1_big_vector)
- [`0x1::bls12381`](bls12381.md#0x1_bls12381)
- [`0x1::bls12381_algebra`](bls12381_algebra.md#0x1_bls12381_algebra)
Expand Down Expand Up @@ -42,6 +43,7 @@ This is the reference documentation of the Aptos standard library.
- [`0x1::simple_map`](simple_map.md#0x1_simple_map)
- [`0x1::smart_table`](smart_table.md#0x1_smart_table)
- [`0x1::smart_vector`](smart_vector.md#0x1_smart_vector)
- [`0x1::storage_slots_allocator`](storage_slots_allocator.md#0x1_storage_slots_allocator)
- [`0x1::string_utils`](string_utils.md#0x1_string_utils)
- [`0x1::table`](table.md#0x1_table)
- [`0x1::table_with_length`](table_with_length.md#0x1_table_with_length)
Expand Down
16 changes: 8 additions & 8 deletions aptos-move/framework/aptos-stdlib/doc/storage_slots_allocator.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for example:
- [Function `fill_reserved_slot`](#0x1_storage_slots_allocator_fill_reserved_slot)
- [Function `remove_and_reserve`](#0x1_storage_slots_allocator_remove_and_reserve)
- [Function `free_reserved_slot`](#0x1_storage_slots_allocator_free_reserved_slot)
- [Function `push_to_reuse_queue`](#0x1_storage_slots_allocator_push_to_reuse_queue)
- [Function `push_to_reuse_queue_if_enabled`](#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled)
- [Function `next_slot_index`](#0x1_storage_slots_allocator_next_slot_index)


Expand Down Expand Up @@ -288,7 +288,7 @@ for example:

for (i in 0..num_to_preallocate) {
<b>let</b> slot_index = self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_next_slot_index">next_slot_index</a>();
self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue">push_to_reuse_queue</a>(slot_index);
self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled">push_to_reuse_queue_if_enabled</a>(slot_index);
};

self
Expand Down Expand Up @@ -353,7 +353,7 @@ for example:
<pre><code><b>public</b> <b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_remove">remove</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">StorageSlotsAllocator</a>&lt;T&gt;, slot_index: u64): T {
<b>let</b> Link::Occupied { value } = self.slots.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_remove">remove</a>(slot_index);

self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue">push_to_reuse_queue</a>(slot_index);
self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled">push_to_reuse_queue_if_enabled</a>(slot_index);

value
}
Expand Down Expand Up @@ -581,21 +581,21 @@ Remove storage slot, but reserve it for later.

<pre><code><b>public</b> <b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_free_reserved_slot">free_reserved_slot</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">StorageSlotsAllocator</a>&lt;T&gt;, slot: <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_ReservedSlot">ReservedSlot</a>) {
<b>let</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_ReservedSlot">ReservedSlot</a> { slot_index } = slot;
self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue">push_to_reuse_queue</a>(slot_index);
self.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled">push_to_reuse_queue_if_enabled</a>(slot_index);
}
</code></pre>



</details>

<a id="0x1_storage_slots_allocator_push_to_reuse_queue"></a>
<a id="0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled"></a>

## Function `push_to_reuse_queue`
## Function `push_to_reuse_queue_if_enabled`



<pre><code><b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue">push_to_reuse_queue</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">storage_slots_allocator::StorageSlotsAllocator</a>&lt;T&gt;, slot_index: u64)
<pre><code><b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled">push_to_reuse_queue_if_enabled</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">storage_slots_allocator::StorageSlotsAllocator</a>&lt;T&gt;, slot_index: u64)
</code></pre>


Expand All @@ -604,7 +604,7 @@ Remove storage slot, but reserve it for later.
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue">push_to_reuse_queue</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">StorageSlotsAllocator</a>&lt;T&gt;, slot_index: u64) {
<pre><code><b>fun</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_push_to_reuse_queue_if_enabled">push_to_reuse_queue_if_enabled</a>&lt;T: store&gt;(self: &<b>mut</b> <a href="storage_slots_allocator.md#0x1_storage_slots_allocator_StorageSlotsAllocator">StorageSlotsAllocator</a>&lt;T&gt;, slot_index: u64) {
<b>if</b> (self is StorageSlotsAllocator::Reuse&lt;T&gt;) {
self.slots.<a href="storage_slots_allocator.md#0x1_storage_slots_allocator_add">add</a>(slot_index, Link::Vacant { next: self.reuse_head_index });
self.reuse_head_index = slot_index;
Expand Down
Loading

0 comments on commit 17ccbb2

Please sign in to comment.