From aada8d6316d7c3b520706622736b959b39c75c5a Mon Sep 17 00:00:00 2001 From: hduoc2003 Date: Fri, 23 Aug 2024 10:09:31 +0000 Subject: [PATCH 1/2] refactor: split into multiple packages --- libs/Move.toml | 12 ++++++++++++ {sources/libs => libs/sources}/bytes.move | 2 +- {sources/libs => libs/sources}/convert_memory.move | 2 +- {sources => libs/sources}/prime_field_element_0.move | 0 Move.toml => verifier/Move.toml | 5 ++++- .../sources}/components/fact_registry.move | 0 {sources => verifier/sources}/fri.move | 0 {sources => verifier/sources}/fri_layer.move | 0 .../sources}/fri_statement_contract.move | 0 {sources => verifier/sources}/fri_transform.move | 0 .../sources}/merkle_statement_contract.move | 0 {sources => verifier/sources}/merkle_verifier.move | 0 {sources => verifier/sources}/test/fri_test.move | 0 {sources => verifier/sources}/test/merkle_test.move | 0 .../sources}/test/test_verify_fri_statement.move | 0 .../sources}/test/test_verify_merkle_statement.move | 0 16 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 libs/Move.toml rename {sources/libs => libs/sources}/bytes.move (99%) rename {sources/libs => libs/sources}/convert_memory.move (90%) rename {sources => libs/sources}/prime_field_element_0.move (100%) rename Move.toml => verifier/Move.toml (75%) rename {sources => verifier/sources}/components/fact_registry.move (100%) rename {sources => verifier/sources}/fri.move (100%) rename {sources => verifier/sources}/fri_layer.move (100%) rename {sources => verifier/sources}/fri_statement_contract.move (100%) rename {sources => verifier/sources}/fri_transform.move (100%) rename {sources => verifier/sources}/merkle_statement_contract.move (100%) rename {sources => verifier/sources}/merkle_verifier.move (100%) rename {sources => verifier/sources}/test/fri_test.move (100%) rename {sources => verifier/sources}/test/merkle_test.move (100%) rename {sources => verifier/sources}/test/test_verify_fri_statement.move (100%) rename {sources => verifier/sources}/test/test_verify_merkle_statement.move (100%) diff --git a/libs/Move.toml b/libs/Move.toml new file mode 100644 index 0000000..76449c3 --- /dev/null +++ b/libs/Move.toml @@ -0,0 +1,12 @@ +[package] +name = "libs" +version = "1.0.0" +authors = [] + +[addresses] +lib_addr = "_" + +[dependencies.AptosFramework] +git = "https://github.com/aptos-labs/aptos-core.git" +rev = "mainnet" +subdir = "aptos-move/framework/aptos-framework" diff --git a/sources/libs/bytes.move b/libs/sources/bytes.move similarity index 99% rename from sources/libs/bytes.move rename to libs/sources/bytes.move index f4ca1cd..4a50395 100644 --- a/sources/libs/bytes.move +++ b/libs/sources/bytes.move @@ -1,4 +1,4 @@ -module verifier_addr::bytes { +module lib_addr::bytes { use std::bcs::to_bytes; use std::vector; use std::vector::{append, for_each_ref}; diff --git a/sources/libs/convert_memory.move b/libs/sources/convert_memory.move similarity index 90% rename from sources/libs/convert_memory.move rename to libs/sources/convert_memory.move index a602712..808a9a5 100644 --- a/sources/libs/convert_memory.move +++ b/libs/sources/convert_memory.move @@ -1,4 +1,4 @@ -module verifier_addr::convert_memory { +module lib_addr::convert_memory { use std::vector; public fun copy_vec_to_memory(vec: vector, table: &mut vector, start_prt: u64) { diff --git a/sources/prime_field_element_0.move b/libs/sources/prime_field_element_0.move similarity index 100% rename from sources/prime_field_element_0.move rename to libs/sources/prime_field_element_0.move diff --git a/Move.toml b/verifier/Move.toml similarity index 75% rename from Move.toml rename to verifier/Move.toml index bcbe8aa..1720bf5 100644 --- a/Move.toml +++ b/verifier/Move.toml @@ -4,7 +4,7 @@ version = "1.0.0" authors = [] [addresses] -verifier_addr = "0d86ef4ed97b15752707c861650d084d2ad181357b7f966a2e08a931c63187c7" +verifier_addr = "_" [dev-addresses] @@ -13,4 +13,7 @@ git = "https://github.com/aptos-labs/aptos-core.git" rev = "release-v.1.14" subdir = "aptos-move/framework/aptos-framework" +[dependencies] +libs = {local = "../libs"} + [dev-dependencies] diff --git a/sources/components/fact_registry.move b/verifier/sources/components/fact_registry.move similarity index 100% rename from sources/components/fact_registry.move rename to verifier/sources/components/fact_registry.move diff --git a/sources/fri.move b/verifier/sources/fri.move similarity index 100% rename from sources/fri.move rename to verifier/sources/fri.move diff --git a/sources/fri_layer.move b/verifier/sources/fri_layer.move similarity index 100% rename from sources/fri_layer.move rename to verifier/sources/fri_layer.move diff --git a/sources/fri_statement_contract.move b/verifier/sources/fri_statement_contract.move similarity index 100% rename from sources/fri_statement_contract.move rename to verifier/sources/fri_statement_contract.move diff --git a/sources/fri_transform.move b/verifier/sources/fri_transform.move similarity index 100% rename from sources/fri_transform.move rename to verifier/sources/fri_transform.move diff --git a/sources/merkle_statement_contract.move b/verifier/sources/merkle_statement_contract.move similarity index 100% rename from sources/merkle_statement_contract.move rename to verifier/sources/merkle_statement_contract.move diff --git a/sources/merkle_verifier.move b/verifier/sources/merkle_verifier.move similarity index 100% rename from sources/merkle_verifier.move rename to verifier/sources/merkle_verifier.move diff --git a/sources/test/fri_test.move b/verifier/sources/test/fri_test.move similarity index 100% rename from sources/test/fri_test.move rename to verifier/sources/test/fri_test.move diff --git a/sources/test/merkle_test.move b/verifier/sources/test/merkle_test.move similarity index 100% rename from sources/test/merkle_test.move rename to verifier/sources/test/merkle_test.move diff --git a/sources/test/test_verify_fri_statement.move b/verifier/sources/test/test_verify_fri_statement.move similarity index 100% rename from sources/test/test_verify_fri_statement.move rename to verifier/sources/test/test_verify_fri_statement.move diff --git a/sources/test/test_verify_merkle_statement.move b/verifier/sources/test/test_verify_merkle_statement.move similarity index 100% rename from sources/test/test_verify_merkle_statement.move rename to verifier/sources/test/test_verify_merkle_statement.move From cfac34ec46ef70b6cf9c0e67bce0e75b5d44259f Mon Sep 17 00:00:00 2001 From: draply Date: Fri, 23 Aug 2024 17:15:49 +0700 Subject: [PATCH 2/2] fix: navori ci --- .github/actions/setup_aptos_cli/action.yaml | 5 +++++ .github/workflows/aptos_test.yaml | 4 ++-- libs/Move.toml | 5 ++++- libs/sources/bytes.move | 4 ++-- libs/sources/prime_field_element_0.move | 2 +- verifier/Move.toml | 5 ++++- verifier/sources/fri_layer.move | 4 ++-- verifier/sources/fri_statement_contract.move | 4 ++-- verifier/sources/fri_transform.move | 2 +- verifier/sources/merkle_statement_contract.move | 4 ++-- verifier/sources/merkle_verifier.move | 2 +- 11 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/actions/setup_aptos_cli/action.yaml b/.github/actions/setup_aptos_cli/action.yaml index bd59974..7caeb98 100644 --- a/.github/actions/setup_aptos_cli/action.yaml +++ b/.github/actions/setup_aptos_cli/action.yaml @@ -1,5 +1,10 @@ name: Setup Aptos CLI description: A composite action that sets up the Aptos CLI +inputs: + version: + description: 'The version of the Aptos CLI to install' + required: true + default: '4.0.0' runs: using: "composite" steps: diff --git a/.github/workflows/aptos_test.yaml b/.github/workflows/aptos_test.yaml index 9adfb25..140835a 100644 --- a/.github/workflows/aptos_test.yaml +++ b/.github/workflows/aptos_test.yaml @@ -18,5 +18,5 @@ jobs: - uses: ./.github/actions/setup_aptos_cli with: version: 4.0.0 - - name: Test - run: aptos move test + - name: test_contract + run: (cd libs && aptos move test --skip-fetch-latest-git-deps --skip-attribute-checks) & (cd verifier && aptos move test --skip-fetch-latest-git-deps --skip-attribute-checks) \ No newline at end of file diff --git a/libs/Move.toml b/libs/Move.toml index 76449c3..53dc031 100644 --- a/libs/Move.toml +++ b/libs/Move.toml @@ -6,7 +6,10 @@ authors = [] [addresses] lib_addr = "_" +[dev-addresses] +lib_addr = "0x70c7fb94e185ce44f460f4fd8f9c38751bf9689ce8faefb7a216d8f224ec38fc" + [dependencies.AptosFramework] git = "https://github.com/aptos-labs/aptos-core.git" -rev = "mainnet" +rev = "aptos-release-v1.17" subdir = "aptos-move/framework/aptos-framework" diff --git a/libs/sources/bytes.move b/libs/sources/bytes.move index 4a50395..db82a83 100644 --- a/libs/sources/bytes.move +++ b/libs/sources/bytes.move @@ -72,11 +72,11 @@ module lib_addr::bytes { } #[test_only] -module verifier_addr::bytes_test { +module lib_addr::bytes_test { use std::bcs::to_bytes; use std::vector; - use verifier_addr::bytes::{pad, vec_to_bytes_be}; + use lib_addr::bytes::{pad, vec_to_bytes_be}; #[test] fun test_padding() { diff --git a/libs/sources/prime_field_element_0.move b/libs/sources/prime_field_element_0.move index 750be76..85c8e93 100644 --- a/libs/sources/prime_field_element_0.move +++ b/libs/sources/prime_field_element_0.move @@ -1,4 +1,4 @@ -module verifier_addr::prime_field_element_0 { +module lib_addr::prime_field_element_0 { // This line is used for generating constants DO NOT REMOVE! // 3618502788666131213697322783095070105623107215331596699973092056135872020481 const K_MODULUS: u256 = 0x800000000000011000000000000000000000000000000000000000000000001; diff --git a/verifier/Move.toml b/verifier/Move.toml index 1720bf5..f9ce052 100644 --- a/verifier/Move.toml +++ b/verifier/Move.toml @@ -5,12 +5,15 @@ authors = [] [addresses] verifier_addr = "_" +lib_addr = "_" [dev-addresses] +verifier_addr = "0x70c7fb94e185ce44f460f4fd8f9c38751bf9689ce8faefb7a216d8f224ec38fc" +lib_addr = "0x70c7fb94e185ce44f460f4fd8f9c38751bf9689ce8faefb7a216d8f224ec38f3" [dependencies.AptosFramework] git = "https://github.com/aptos-labs/aptos-core.git" -rev = "release-v.1.14" +rev = "aptos-release-v1.17" subdir = "aptos-move/framework/aptos-framework" [dependencies] diff --git a/verifier/sources/fri_layer.move b/verifier/sources/fri_layer.move index f3554af..28cd0b9 100644 --- a/verifier/sources/fri_layer.move +++ b/verifier/sources/fri_layer.move @@ -3,10 +3,10 @@ module verifier_addr::fri_layer { use std::vector; use aptos_std::aptos_hash::keccak256; - use verifier_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; + use lib_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; use verifier_addr::fri::{get_fri, update_fri}; use verifier_addr::fri_transform::transform_coset; - use verifier_addr::prime_field_element_0::{fmul, fpow}; + use lib_addr::prime_field_element_0::{fmul, fpow}; // This line is used for generating constants DO NOT REMOVE! // 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000 diff --git a/verifier/sources/fri_statement_contract.move b/verifier/sources/fri_statement_contract.move index 20dbda8..ef62a21 100644 --- a/verifier/sources/fri_statement_contract.move +++ b/verifier/sources/fri_statement_contract.move @@ -4,8 +4,8 @@ module verifier_addr::fri_statement_contract { use aptos_std::aptos_hash::keccak256; use aptos_framework::event::emit; - use verifier_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; - use verifier_addr::convert_memory::copy_vec_to_memory; + use lib_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; + use lib_addr::convert_memory::copy_vec_to_memory; use verifier_addr::fact_registry::register_fact; use verifier_addr::fri::{get_fri, new_fri, update_fri}; diff --git a/verifier/sources/fri_transform.move b/verifier/sources/fri_transform.move index 9451998..5aa8d46 100644 --- a/verifier/sources/fri_transform.move +++ b/verifier/sources/fri_transform.move @@ -1,7 +1,7 @@ module verifier_addr::fri_transform { use std::vector; - use verifier_addr::prime_field_element_0::fmul; + use lib_addr::prime_field_element_0::fmul; // This line is used for generating constants DO NOT REMOVE! // 3618502788666131213697322783095070105623107215331596699973092056135872020481 diff --git a/verifier/sources/merkle_statement_contract.move b/verifier/sources/merkle_statement_contract.move index b3ad0c9..c8467b4 100644 --- a/verifier/sources/merkle_statement_contract.move +++ b/verifier/sources/merkle_statement_contract.move @@ -6,8 +6,8 @@ module verifier_addr::merkle_statement_contract { use aptos_std::math64::pow; use aptos_framework::event; - use verifier_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; - use verifier_addr::convert_memory::copy_vec_to_memory; + use lib_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; + use lib_addr::convert_memory::copy_vec_to_memory; use verifier_addr::fact_registry::register_fact; use verifier_addr::fri::{get_fri, new_fri, update_fri}; diff --git a/verifier/sources/merkle_verifier.move b/verifier/sources/merkle_verifier.move index dd06586..29810f2 100644 --- a/verifier/sources/merkle_verifier.move +++ b/verifier/sources/merkle_verifier.move @@ -5,7 +5,7 @@ module verifier_addr::merkle_verifier { use aptos_std::aptos_hash::keccak256; use aptos_framework::event; - use verifier_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; + use lib_addr::bytes::{bytes32_to_u256, u256_to_bytes32}; use verifier_addr::fri::{get_fri, update_fri}; // This line is used for generating constants DO NOT REMOVE!