Skip to content

Commit

Permalink
Add table, string, frombcs, acl, secp2561k, gasschedule module (#231)
Browse files Browse the repository at this point in the history
* add some function in Compare (#180)

* [Feature] Simple map (#182)

* Add SimpleMap

* Add SimpleMap

* update Language version

* add secp256k1 file

* Replace from `script` tag to `entry`

* std name for new move

* move 6 binary byte code changed

* Fix integration test

* Fix type info

* Event util and typeinfo

* Add from_bcs module and native function

* Add from_bcs module and native function

* New module for FromBCS

* add table module from branch 'table_module'

* add table module from branch 'table_module'

* add some function of Table module

* Add ACL to StarcoinFramework

* Add ACL to StarcoinFramework

* Revert big vector

* Add spawn_from for vector slice

* Add test spawn_from for vector slice

* Add test spawn_from for vector slice

* [Feature] Simple map (#182)

* Add SimpleMap

* Add SimpleMap

* update Language version

* add secp256k1 file

* Replace from `script` tag to `entry`

* std name for new move

* move 6 binary byte code changed

* Fix integration test

* Fix type info

* Event util and typeinfo

* Add from_bcs module and native function

* Add from_bcs module and native function

* New module for FromBCS

* add table module from branch 'table_module'

* add table module from branch 'table_module'

* add some function of Table module

* Add ACL to StarcoinFramework

* Add ACL to StarcoinFramework

* Revert big vector

* Add spawn_from for vector slice

* Add test spawn_from for vector slice

* Add test spawn_from for vector slice

* Merge from remote

* Merge from remote

* Retest some integration test

* Retest some integration test

* Retest some integration test

* Retest some integration test

* Retest some integration test

* Retest some integration test

* Fix checkpoints test error

* Change test mpm to tag: v1.13.5-alpha.0

* merge from gas schedule

* add gas for new native functions

* fix the name of the gas fee

* Merge some bytecodes from GasSchedule

* dev setup for alpha

* integration test

* Fix simple map unittest failure

* add gas schedule in integration test

* add gas schedule documents

---------

Co-authored-by: WGB5445 <919603023@qq.com>
Co-authored-by: nk_ysg <nk_ysg@163.com>
Co-authored-by: jackzhhuang <jackzhhuang@gmail.com>
  • Loading branch information
4 people authored Apr 17, 2023
1 parent 2b726cc commit 7ce805c
Show file tree
Hide file tree
Showing 55 changed files with 4,138 additions and 75 deletions.
2 changes: 1 addition & 1 deletion build/StarcoinFramework/BuildInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiled_package_info:
StarcoinAssociation: "0x0000000000000000000000000a550c18"
StarcoinFramework: "0x00000000000000000000000000000001"
VMReserved: "0x00000000000000000000000000000000"
source_digest: C5F3C72BEE36CF6413885088E508AC9B9C66597449BB1707A92172BAA7412AB3
source_digest: B69D86B6C8EF7035E9FC0A1859E98A39CDAD4BA84059D6CF3AE1E21E81DAA9B9
build_flags:
dev_mode: false
test_mode: false
Expand Down
Binary file added build/StarcoinFramework/bytecode_modules/ACL.mv
Binary file not shown.
Binary file added build/StarcoinFramework/bytecode_modules/FromBCS.mv
Binary file not shown.
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Genesis.mv
Binary file not shown.
Binary file not shown.
Binary file added build/StarcoinFramework/bytecode_modules/String.mv
Binary file not shown.
Binary file added build/StarcoinFramework/bytecode_modules/Table.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/TypeInfo.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/VMConfig.mv
Binary file not shown.
Binary file modified build/StarcoinFramework/bytecode_modules/Vector.mv
Binary file not shown.
205 changes: 205 additions & 0 deletions build/StarcoinFramework/docs/ACL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@

<a name="0x1_ACL"></a>

# Module `0x1::ACL`

Access control list (acl) module. An acl is a list of account addresses who
have the access permission to a certain object.
This module uses a <code>vector</code> to represent the list, but can be refactored to
use a "set" instead when it's available in the language in the future.


- [Struct `ACL`](#0x1_ACL_ACL)
- [Constants](#@Constants_0)
- [Function `empty`](#0x1_ACL_empty)
- [Function `add`](#0x1_ACL_add)
- [Function `remove`](#0x1_ACL_remove)
- [Function `contains`](#0x1_ACL_contains)
- [Function `assert_contains`](#0x1_ACL_assert_contains)


<pre><code><b>use</b> <a href="Errors.md#0x1_Errors">0x1::Errors</a>;
<b>use</b> <a href="Vector.md#0x1_Vector">0x1::Vector</a>;
</code></pre>



<a name="0x1_ACL_ACL"></a>

## Struct `ACL`



<pre><code><b>struct</b> <a href="ACL.md#0x1_ACL">ACL</a> <b>has</b> <b>copy</b>, drop, store
</code></pre>



<details>
<summary>Fields</summary>


<dl>
<dt>
<code>list: vector&lt;<b>address</b>&gt;</code>
</dt>
<dd>

</dd>
</dl>


</details>

<a name="@Constants_0"></a>

## Constants


<a name="0x1_ACL_ECONTAIN"></a>

The ACL already contains the address.


<pre><code><b>const</b> <a href="ACL.md#0x1_ACL_ECONTAIN">ECONTAIN</a>: u64 = 0;
</code></pre>



<a name="0x1_ACL_ENOT_CONTAIN"></a>

The ACL does not contain the address.


<pre><code><b>const</b> <a href="ACL.md#0x1_ACL_ENOT_CONTAIN">ENOT_CONTAIN</a>: u64 = 1;
</code></pre>



<a name="0x1_ACL_empty"></a>

## Function `empty`

Return an empty ACL.


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_empty">empty</a>(): <a href="ACL.md#0x1_ACL_ACL">ACL::ACL</a>
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_empty">empty</a>(): <a href="ACL.md#0x1_ACL">ACL</a> {
<a href="ACL.md#0x1_ACL">ACL</a>{ list: <a href="Vector.md#0x1_Vector_empty">Vector::empty</a>&lt;<b>address</b>&gt;() }
}
</code></pre>



</details>

<a name="0x1_ACL_add"></a>

## Function `add`

Add the address to the ACL.


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_add">add</a>(acl: &<b>mut</b> <a href="ACL.md#0x1_ACL_ACL">ACL::ACL</a>, addr: <b>address</b>)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_add">add</a>(acl: &<b>mut</b> <a href="ACL.md#0x1_ACL">ACL</a>, addr: <b>address</b>) {
<b>assert</b>!(!<a href="Vector.md#0x1_Vector_contains">Vector::contains</a>(&<b>mut</b> acl.list, &addr), <a href="Errors.md#0x1_Errors_invalid_argument">Errors::invalid_argument</a>(<a href="ACL.md#0x1_ACL_ECONTAIN">ECONTAIN</a>));
<a href="Vector.md#0x1_Vector_push_back">Vector::push_back</a>(&<b>mut</b> acl.list, addr);
}
</code></pre>



</details>

<a name="0x1_ACL_remove"></a>

## Function `remove`

Remove the address from the ACL.


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_remove">remove</a>(acl: &<b>mut</b> <a href="ACL.md#0x1_ACL_ACL">ACL::ACL</a>, addr: <b>address</b>)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_remove">remove</a>(acl: &<b>mut</b> <a href="ACL.md#0x1_ACL">ACL</a>, addr: <b>address</b>) {
<b>let</b> (found, index) = <a href="Vector.md#0x1_Vector_index_of">Vector::index_of</a>(&<b>mut</b> acl.list, &addr);
<b>assert</b>!(found, <a href="Errors.md#0x1_Errors_invalid_argument">Errors::invalid_argument</a>(<a href="ACL.md#0x1_ACL_ENOT_CONTAIN">ENOT_CONTAIN</a>));
<a href="Vector.md#0x1_Vector_remove">Vector::remove</a>(&<b>mut</b> acl.list, index);
}
</code></pre>



</details>

<a name="0x1_ACL_contains"></a>

## Function `contains`

Return true iff the ACL contains the address.


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_contains">contains</a>(acl: &<a href="ACL.md#0x1_ACL_ACL">ACL::ACL</a>, addr: <b>address</b>): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_contains">contains</a>(acl: &<a href="ACL.md#0x1_ACL">ACL</a>, addr: <b>address</b>): bool {
<a href="Vector.md#0x1_Vector_contains">Vector::contains</a>(&acl.list, &addr)
}
</code></pre>



</details>

<a name="0x1_ACL_assert_contains"></a>

## Function `assert_contains`

assert! that the ACL has the address.


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_assert_contains">assert_contains</a>(acl: &<a href="ACL.md#0x1_ACL_ACL">ACL::ACL</a>, addr: <b>address</b>)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="ACL.md#0x1_ACL_assert_contains">assert_contains</a>(acl: &<a href="ACL.md#0x1_ACL">ACL</a>, addr: <b>address</b>) {
<b>assert</b>!(<a href="ACL.md#0x1_ACL_contains">contains</a>(acl, addr), <a href="Errors.md#0x1_Errors_invalid_argument">Errors::invalid_argument</a>(<a href="ACL.md#0x1_ACL_ENOT_CONTAIN">ENOT_CONTAIN</a>));
}
</code></pre>



</details>
2 changes: 1 addition & 1 deletion build/StarcoinFramework/docs/Block.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ Call at block prologue
<b>move_to</b>&lt;<a href="Block.md#0x1_Block_Checkpoints">Checkpoints</a>&gt;(
account,
<a href="Block.md#0x1_Block_Checkpoints">Checkpoints</a> {
checkpoints : checkpoints,
checkpoints,
index : 0,
last_number : 0,
});
Expand Down
Loading

0 comments on commit 7ce805c

Please sign in to comment.