-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
add extended_checks to aptos-transactional-test-harness #13337
Conversation
b7483a7
to
c7e4315
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13337 +/- ##
=========================================
- Coverage 33.0% 33.0% -0.1%
=========================================
Files 1760 1760
Lines 338918 338939 +21
=========================================
- Hits 112023 111961 -62
- Misses 226895 226978 +83 ☔ View full report in Codecov by Sentry. |
@@ -113,7 +113,7 @@ impl<'a> ExtendedChecker<'a> { | |||
|
|||
fn run(&mut self) { | |||
for ref module in self.env.get_modules() { | |||
if module.is_target() { | |||
if module.is_primary_target() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @brmataptos. After changing to is_primary_target
, we need to be careful and make sure for the V1 path, all target modules are checked.
@@ -874,7 +951,8 @@ fn compile_ir_module<'a>( | |||
) -> Result<CompiledModule> { | |||
use move_ir_compiler::Compiler as IRCompiler; | |||
let code = std::fs::read_to_string(file_name).unwrap(); | |||
IRCompiler::new(deps.collect()).into_compiled_module(&code) | |||
let module = IRCompiler::new(deps.collect()).into_compiled_module(&code)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A noob question, what is the difference between before and after this code change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing. At some point I had added an Option<GlobalEnv>
result to a tuple here, but then realized it wasn't useful. I guess i didn't clean up completely.
} | ||
struct OuterStruct has key { | ||
any_field: vector<InnerStruct> | ||
bug: BYTECODE VERIFICATION FAILED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just reveals that the issue #13191 still exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
@@ -130,9 +135,10 @@ fn annotated_module_from_unit(unit: &AnnotatedCompiledUnit) -> Option<&Annotated | |||
} | |||
} | |||
|
|||
impl PreCompiledModules for FullyCompiledProgram { | |||
impl PreCompiledModules for (FullyCompiledProgram, Vec<PackagePaths>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not even know we can do something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only tried it on a whim, and was surprised to find it compiles.
82368c7
to
954367f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a8637fb
to
0d9e0f8
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Run
extended_checks
as part of theaptos-transactional-test-harness
.Fixes #13297.
To run
extended_checks
we need a model (GlobalEnv
) to be generatedby compilation. For Compiler V2 this is pretty straightforward, as we
just have to enable the
"attach-compiled-module"
experiment. ForCompiler V1, the compilation entry point currently used by the test
framework doesn't generate a model as part of compilation, and reusing
the process used in
BuiltPackage::build()
(defined inaptos-move/framework/src/build_package.rs
) is overly complex.So instead, we follow the process that was used in
CompiledPackage::build_all()
(defined inthird_party/move/tools/move-package/src/compilation/compiled_package.rs
)to build a model under compiler V1, needed for ABIs or Docgen with
compiler V1.
The main implication is that we need input
PackagePaths
fordependencies, notably the Stdlibs, so we make a copy of that in the
framework to be re-used in
compile_source_unit()
(defined inthird_party/move/testing-infra/transactional-test-runner/src/framework.rs
)if
need_model
istrue
.We just learned that Rust Traits can't call a default implementation
from a specialized implementation, so we must rename the default
implementations of
MoveTestAdapter
trait functionscompile_module
and
compile_script
as*_default()
, leaving the original functionsas forwarders that can be overwritten by new implementations for
AptosTestAdapter
(defined inaptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs
)to call the default compile methods and then run extended checks as
appropriate.
How Has This Been Tested?
Added a new test that should fails extended checks.
Was reminded that an existing test (
diamond_clicker.move
) should have been failingextended checks, as it now fails in bytcode verification.
Key Areas to Review
It's a little messy, but much of the mess relates to compiler-v1 and
the third_party/aptos-move boundary which both should be going away
soonish, so let's not get hung up on it. :-) We really need to
refactor to simplify the compiler/module-building interfaces, but skip
that for now.
Type of Change
Which Components or Systems Does This Change Impact?
Checklist