From 7faf5356ce86e49e10a75fcffa0aba654f16cd9d Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 16 Feb 2024 04:04:56 +0800 Subject: [PATCH] [Plugins] Add neo submodule (#873) * fix codeql * fix * add neo as submodule * update to the latest * revert the codeql * Revert "revert the codeql" This reverts commit e1e9ec6bbe5bcd3629f31fb160a9356ee7254245. * revert codeql * update workflow to init submodule * fix the plugins tests. * remove codeql instead of fixing it here, fixing it can be done in another pr or just not at all. --- .github/workflows/codeql.yml | 76 ------------------- .github/workflows/main.yml | 15 +++- .gitmodules | 3 + Directory.Build.props | 10 ++- neo | 1 + neo-modules.sln | 44 +++++++++++ src/Directory.Build.props | 2 +- .../Neo.Plugins.OracleService.Tests.csproj | 9 ++- .../TestBlockchain.cs | 2 +- .../config.json | 74 ++++++++++++++++++ 10 files changed, 150 insertions(+), 86 deletions(-) delete mode 100644 .github/workflows/codeql.yml create mode 100644 .gitmodules create mode 160000 neo create mode 100644 tests/Neo.Plugins.OracleService.Tests/config.json diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index ee0ca6f73..000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,76 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "master" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "master" ] - schedule: - - cron: '34 22 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'csharp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47fefc808..aeac01453 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,9 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} - name: Check format @@ -56,7 +59,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive - name: Get version id: get_version run: | @@ -69,9 +75,12 @@ jobs: if: steps.check_tag.outputs.statusCode == '404' id: create_release uses: actions/create-release@v1 + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + fetch-depth: 0 + submodules: recursive tag_name: ${{ steps.get_version.outputs.version }} release_name: ${{ steps.get_version.outputs.version }} prerelease: ${{ contains(steps.get_version.outputs.version, '-') }} diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..ebbaed60b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "neo"] + path = neo + url = https://github.com/neo-project/neo.git diff --git a/Directory.Build.props b/Directory.Build.props index 4c77ef351..83e0b030d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,9 @@ git https://github.com/neo-project/neo-modules.git - - - - \ No newline at end of file + + + + + + diff --git a/neo b/neo new file mode 160000 index 000000000..fd3d68d52 --- /dev/null +++ b/neo @@ -0,0 +1 @@ +Subproject commit fd3d68d527322d150cd9d850440418ac7644c8b3 diff --git a/neo-modules.sln b/neo-modules.sln index 8a1931586..1a56d33ab 100644 --- a/neo-modules.sln +++ b/neo-modules.sln @@ -43,6 +43,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SQLiteWallet", "src\SQLiteW EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StorageDumper", "src\StorageDumper\StorageDumper.csproj", "{938D86EA-0F48-436B-9255-4AD9A8E6B9AC}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo", "neo\src\Neo\Neo.csproj", "{A00FC746-1351-4275-B2D9-489477B409C0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.IO", "neo\src\Neo.IO\Neo.IO.csproj", "{FEC96A32-38AB-426B-A93E-D37583BEE901}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Json", "neo\src\Neo.Json\Neo.Json.csproj", "{188D043E-393D-4E5B-A216-4274BF9AFB23}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.VM", "neo\src\Neo.VM\Neo.VM.csproj", "{EDDE78BC-2064-4517-B9B2-25BA012A93C1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Extensions", "neo\src\Neo.Extensions\Neo.Extensions.csproj", "{9FF233D7-84C2-4947-96F6-88EE3594C66A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neo.Cryptography.BLS12_381", "neo\src\Neo.Cryptography.BLS12_381\Neo.Cryptography.BLS12_381.csproj", "{7437514A-290D-4F84-B315-32ED95F710C1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependency", "Dependency", "{997874E0-C2A7-4EB2-85AA-180AF592DC6D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -121,6 +135,30 @@ Global {938D86EA-0F48-436B-9255-4AD9A8E6B9AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {938D86EA-0F48-436B-9255-4AD9A8E6B9AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {938D86EA-0F48-436B-9255-4AD9A8E6B9AC}.Release|Any CPU.Build.0 = Release|Any CPU + {A00FC746-1351-4275-B2D9-489477B409C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A00FC746-1351-4275-B2D9-489477B409C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A00FC746-1351-4275-B2D9-489477B409C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A00FC746-1351-4275-B2D9-489477B409C0}.Release|Any CPU.Build.0 = Release|Any CPU + {FEC96A32-38AB-426B-A93E-D37583BEE901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FEC96A32-38AB-426B-A93E-D37583BEE901}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FEC96A32-38AB-426B-A93E-D37583BEE901}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FEC96A32-38AB-426B-A93E-D37583BEE901}.Release|Any CPU.Build.0 = Release|Any CPU + {188D043E-393D-4E5B-A216-4274BF9AFB23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {188D043E-393D-4E5B-A216-4274BF9AFB23}.Debug|Any CPU.Build.0 = Debug|Any CPU + {188D043E-393D-4E5B-A216-4274BF9AFB23}.Release|Any CPU.ActiveCfg = Release|Any CPU + {188D043E-393D-4E5B-A216-4274BF9AFB23}.Release|Any CPU.Build.0 = Release|Any CPU + {EDDE78BC-2064-4517-B9B2-25BA012A93C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDDE78BC-2064-4517-B9B2-25BA012A93C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDDE78BC-2064-4517-B9B2-25BA012A93C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDDE78BC-2064-4517-B9B2-25BA012A93C1}.Release|Any CPU.Build.0 = Release|Any CPU + {9FF233D7-84C2-4947-96F6-88EE3594C66A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FF233D7-84C2-4947-96F6-88EE3594C66A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FF233D7-84C2-4947-96F6-88EE3594C66A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FF233D7-84C2-4947-96F6-88EE3594C66A}.Release|Any CPU.Build.0 = Release|Any CPU + {7437514A-290D-4F84-B315-32ED95F710C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7437514A-290D-4F84-B315-32ED95F710C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7437514A-290D-4F84-B315-32ED95F710C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7437514A-290D-4F84-B315-32ED95F710C1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -144,6 +182,12 @@ Global {8D2EE375-2E2D-45FE-A4E9-0254D12C7554} = {59D802AB-C552-422A-B9C3-64D329FBCDCC} {D121D57A-512E-4F74-ADA1-24482BF5C42B} = {97E81C78-1637-481F-9485-DA1225E94C23} {938D86EA-0F48-436B-9255-4AD9A8E6B9AC} = {97E81C78-1637-481F-9485-DA1225E94C23} + {A00FC746-1351-4275-B2D9-489477B409C0} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} + {7437514A-290D-4F84-B315-32ED95F710C1} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} + {9FF233D7-84C2-4947-96F6-88EE3594C66A} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} + {FEC96A32-38AB-426B-A93E-D37583BEE901} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} + {188D043E-393D-4E5B-A216-4274BF9AFB23} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} + {EDDE78BC-2064-4517-B9B2-25BA012A93C1} = {997874E0-C2A7-4EB2-85AA-180AF592DC6D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {61D3ADE6-BBFC-402D-AB42-1C71C9F9EDE3} diff --git a/src/Directory.Build.props b/src/Directory.Build.props index b173f4db2..bccb0e3ee 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -7,4 +7,4 @@ PreserveNewest - \ No newline at end of file + diff --git a/tests/Neo.Plugins.OracleService.Tests/Neo.Plugins.OracleService.Tests.csproj b/tests/Neo.Plugins.OracleService.Tests/Neo.Plugins.OracleService.Tests.csproj index cb4dd1c6c..82e65d521 100644 --- a/tests/Neo.Plugins.OracleService.Tests/Neo.Plugins.OracleService.Tests.csproj +++ b/tests/Neo.Plugins.OracleService.Tests/Neo.Plugins.OracleService.Tests.csproj @@ -14,4 +14,11 @@ runtime - \ No newline at end of file + + + + PreserveNewest + PreserveNewest + + + diff --git a/tests/Neo.Plugins.OracleService.Tests/TestBlockchain.cs b/tests/Neo.Plugins.OracleService.Tests/TestBlockchain.cs index fca5ca9d4..adef80ccb 100644 --- a/tests/Neo.Plugins.OracleService.Tests/TestBlockchain.cs +++ b/tests/Neo.Plugins.OracleService.Tests/TestBlockchain.cs @@ -21,7 +21,7 @@ public static class TestBlockchain static TestBlockchain() { Console.WriteLine("initialize NeoSystem"); - TheNeoSystem = new NeoSystem(ProtocolSettings.Default, null, null); + TheNeoSystem = new NeoSystem(ProtocolSettings.Load("config.json"), null, null); } public static void InitializeMockNeoSystem() diff --git a/tests/Neo.Plugins.OracleService.Tests/config.json b/tests/Neo.Plugins.OracleService.Tests/config.json new file mode 100644 index 000000000..b4800b80e --- /dev/null +++ b/tests/Neo.Plugins.OracleService.Tests/config.json @@ -0,0 +1,74 @@ +{ + "ApplicationConfiguration": { + "Logger": { + "Path": "Logs", + "ConsoleOutput": false, + "Active": false + }, + "Storage": { + "Engine": "LevelDBStore", // Candidates [MemoryStore, LevelDBStore, RocksDBStore] + "Path": "Data_LevelDB_{0}" // {0} is a placeholder for the network id + }, + "P2P": { + "Port": 10333, + "MinDesiredConnections": 10, + "MaxConnections": 40, + "MaxConnectionsPerAddress": 3 + }, + "UnlockWallet": { + "Path": "", + "Password": "", + "IsActive": false + }, + "Contracts": { + "NeoNameService": "0x50ac1c37690cc2cfc594472833cf57505d5f46de" + }, + "Plugins": { + "DownloadUrl": "https://api.github.com/repos/neo-project/neo-modules/releases" + } + }, + "ProtocolConfiguration": { + "Network": 860833102, + "AddressVersion": 53, + "MillisecondsPerBlock": 15000, + "MaxTransactionsPerBlock": 512, + "MemoryPoolMaxTransactions": 50000, + "MaxTraceableBlocks": 2102400, + "Hardforks": { + "HF_Aspidochelone": 1730000, + "HF_Basilisk": 4120000 + }, + "InitialGasDistribution": 5200000000000000, + "ValidatorsCount": 7, + "StandbyCommittee": [ + "03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c", + "02df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093", + "03b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a", + "02ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba554", + "024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d", + "02aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e", + "02486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a70", + "023a36c72844610b4d34d1968662424011bf783ca9d984efa19a20babf5582f3fe", + "03708b860c1de5d87f5b151a12c2a99feebd2e8b315ee8e7cf8aa19692a9e18379", + "03c6aa6e12638b36e88adc1ccdceac4db9929575c3e03576c617c49cce7114a050", + "03204223f8c86b8cd5c89ef12e4f0dbb314172e9241e30c9ef2293790793537cf0", + "02a62c915cf19c7f19a50ec217e79fac2439bbaad658493de0c7d8ffa92ab0aa62", + "03409f31f0d66bdc2f70a9730b66fe186658f84a8018204db01c106edc36553cd0", + "0288342b141c30dc8ffcde0204929bb46aed5756b41ef4a56778d15ada8f0c6654", + "020f2887f41474cfeb11fd262e982051c1541418137c02a0f4961af911045de639", + "0222038884bbd1d8ff109ed3bdef3542e768eef76c1247aea8bc8171f532928c30", + "03d281b42002647f0113f36c7b8efb30db66078dfaaa9ab3ff76d043a98d512fde", + "02504acbc1f4b3bdad1d86d6e1a08603771db135a73e61c9d565ae06a1938cd2ad", + "0226933336f1b75baa42d42b71d9091508b638046d19abd67f4e119bf64a7cfb4d", + "03cdcea66032b82f5c30450e381e5295cae85c5e6943af716cc6b646352a6067dc", + "02cd5a5547119e24feaa7c2a0f37b8c9366216bab7054de0065c9be42084003c8a" + ], + "SeedList": [ + "seed1.neo.org:10333", + "seed2.neo.org:10333", + "seed3.neo.org:10333", + "seed4.neo.org:10333", + "seed5.neo.org:10333" + ] + } +}