Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoroughly fix Issue 8875: Warn in compilation when encounter an unknown attribute #9229

Merged
merged 9 commits into from
Aug 16, 2023
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use move_transactional_test_runner::{
use move_vm_runtime::session::SerializedReturnValues;
use once_cell::sync::Lazy;
use std::{
collections::{BTreeMap, HashMap},
collections::{BTreeMap, BTreeSet, HashMap},
convert::TryFrom,
fmt,
path::Path,
Expand Down Expand Up @@ -294,6 +294,7 @@ static PRECOMPILED_APTOS_FRAMEWORK: Lazy<FullyCompiledProgram> = Lazy::new(|| {
deps,
None,
move_compiler::Flags::empty().set_sources_shadow_deps(false),
aptos_framework::extended_checks::get_all_attribute_names(),
)
.unwrap();
match program_res {
Expand Down Expand Up @@ -551,6 +552,10 @@ impl<'a> MoveTestAdapter<'a> for AptosTestAdapter<'a> {
self.default_syntax
}

fn known_attributes(&self) -> &BTreeSet<String> {
aptos_framework::extended_checks::get_all_attribute_names()
}

fn init(
default_syntax: SyntaxChoice,
_comparison_mode: bool,
Expand Down
3 changes: 1 addition & 2 deletions aptos-move/aptos-vm-benchmarks/samples/add-numbers/Move.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
name = 'add-numbers'
version = '1.0.0'
[dependencies.AptosFramework]
git = 'https://github.com/aptos-labs/aptos-core.git'
rev = 'main'
local = '../../../..'
subdir = 'aptos-move/framework/aptos-framework'
34 changes: 0 additions & 34 deletions aptos-move/framework/aptos-stdlib/doc/math128.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Standard math utilities missing in the Move Language.
- [Function `log2_64`](#0x1_math128_log2_64)
- [Function `sqrt`](#0x1_math128_sqrt)
- [Function `ceil_div`](#0x1_math128_ceil_div)
- [Function `assert_approx_the_same`](#0x1_math128_assert_approx_the_same)
- [Specification](#@Specification_1)
- [Function `max`](#@Specification_1_max)
- [Function `min`](#@Specification_1_min)
Expand Down Expand Up @@ -414,39 +413,6 @@ Returns square root of x, precisely floor(sqrt(x))



</details>

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

## Function `assert_approx_the_same`

For functions that approximate a value it's useful to test a value is close
to the most correct value up to last digit


<pre><code>#[testonly]
<b>fun</b> <a href="math128.md#0x1_math128_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u128)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="math128.md#0x1_math128_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u128) {
<b>if</b> (x &lt; y) {
<b>let</b> tmp = x;
x = y;
y = tmp;
};
<b>let</b> mult = <a href="math128.md#0x1_math128_pow">pow</a>(10, precission);
<b>assert</b>!((x - y) * mult &lt; x, 0);
}
</code></pre>



</details>

<a name="@Specification_1"></a>
Expand Down
34 changes: 0 additions & 34 deletions aptos-move/framework/aptos-stdlib/doc/math64.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Standard math utilities missing in the Move Language.
- [Function `log2`](#0x1_math64_log2)
- [Function `sqrt`](#0x1_math64_sqrt)
- [Function `ceil_div`](#0x1_math64_ceil_div)
- [Function `assert_approx_the_same`](#0x1_math64_assert_approx_the_same)
- [Specification](#@Specification_1)
- [Function `max`](#@Specification_1_max)
- [Function `min`](#@Specification_1_min)
Expand Down Expand Up @@ -369,39 +368,6 @@ Returns square root of x, precisely floor(sqrt(x))



</details>

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

## Function `assert_approx_the_same`

For functions that approximate a value it's useful to test a value is close
to the most correct value up to last digit


<pre><code>#[testonly]
<b>fun</b> <a href="math64.md#0x1_math64_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u64)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="math64.md#0x1_math64_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u64) {
<b>if</b> (x &lt; y) {
<b>let</b> tmp = x;
x = y;
y = tmp;
};
<b>let</b> mult = (<a href="math64.md#0x1_math64_pow">pow</a>(10, precission) <b>as</b> u128);
<b>assert</b>!((x - y) * mult &lt; x, 0);
}
</code></pre>



</details>

<a name="@Specification_1"></a>
Expand Down
34 changes: 0 additions & 34 deletions aptos-move/framework/aptos-stdlib/doc/math_fixed.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Standard math utilities missing in the Move Language.
- [Function `mul_div`](#0x1_math_fixed_mul_div)
- [Function `exp_raw`](#0x1_math_fixed_exp_raw)
- [Function `pow_raw`](#0x1_math_fixed_pow_raw)
- [Function `assert_approx_the_same`](#0x1_math_fixed_assert_approx_the_same)


<pre><code><b>use</b> <a href="../../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
Expand Down Expand Up @@ -294,39 +293,6 @@ Specialized function for x * y / z that omits intermediate shifting



</details>

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

## Function `assert_approx_the_same`

For functions that approximate a value it's useful to test a value is close
to the most correct value up to last digit


<pre><code>#[testonly]
<b>fun</b> <a href="math_fixed.md#0x1_math_fixed_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u128)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="math_fixed.md#0x1_math_fixed_assert_approx_the_same">assert_approx_the_same</a>(x: u128, y: u128, precission: u128) {
<b>if</b> (x &lt; y) {
<b>let</b> tmp = x;
x = y;
y = tmp;
};
<b>let</b> mult = <a href="math128.md#0x1_math128_pow">math128::pow</a>(10, precission);
<b>assert</b>!((x - y) * mult &lt; x, 0);
}
</code></pre>



</details>


Expand Down
34 changes: 0 additions & 34 deletions aptos-move/framework/aptos-stdlib/doc/math_fixed64.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Standard math utilities missing in the Move Language.
- [Function `mul_div`](#0x1_math_fixed64_mul_div)
- [Function `exp_raw`](#0x1_math_fixed64_exp_raw)
- [Function `pow_raw`](#0x1_math_fixed64_pow_raw)
- [Function `assert_approx_the_same`](#0x1_math_fixed64_assert_approx_the_same)


<pre><code><b>use</b> <a href="../../move-stdlib/doc/error.md#0x1_error">0x1::error</a>;
Expand Down Expand Up @@ -289,39 +288,6 @@ Specialized function for x * y / z that omits intermediate shifting



</details>

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

## Function `assert_approx_the_same`

For functions that approximate a value it's useful to test a value is close
to the most correct value up to last digit


<pre><code>#[testonly]
<b>fun</b> <a href="math_fixed64.md#0x1_math_fixed64_assert_approx_the_same">assert_approx_the_same</a>(x: u256, y: u256, precission: u128)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="math_fixed64.md#0x1_math_fixed64_assert_approx_the_same">assert_approx_the_same</a>(x: u256, y: u256, precission: u128) {
<b>if</b> (x &lt; y) {
<b>let</b> tmp = x;
x = y;
y = tmp;
};
<b>let</b> mult = (<a href="math128.md#0x1_math128_pow">math128::pow</a>(10, precission) <b>as</b> u256);
<b>assert</b>!((x - y) * mult &lt; x, 0);
}
</code></pre>



</details>


Expand Down
Loading