diff --git a/.github/workflows/coverage-check.yml b/.github/workflows/coverage-check.yml new file mode 100644 index 0000000000..29d37bc11f --- /dev/null +++ b/.github/workflows/coverage-check.yml @@ -0,0 +1,380 @@ +name: Coverage Check + +on: + pull_request_target: + branches: [ 'develop', 'release_**' ] + types: [ opened, synchronize, reopened ] + +permissions: + contents: read + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +env: + # Fail the check if total coverage drops more than this percentage + COVERAGE_DROP_THRESHOLD: 5.0 + # Warn if coverage drops more than this percentage + COVERAGE_WARN_THRESHOLD: 3.0 + +jobs: + # Run tests on PR branch and base branch in parallel + coverage-pr: + name: Coverage (PR Branch) + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-coverage-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-coverage-gradle- + + - name: Run tests and generate coverage reports + run: ./gradlew test jacocoTestReport + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 + with: + name: coverage-pr + path: '**/build/reports/jacoco/test/jacocoTestReport.xml' + retention-days: 1 + + coverage-base: + name: Coverage (Base Branch) + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.sha }} + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-coverage-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-coverage-gradle- + + - name: Run tests and generate coverage reports + run: ./gradlew test jacocoTestReport + + - name: Upload coverage reports + uses: actions/upload-artifact@v4 + with: + name: coverage-base + path: '**/build/reports/jacoco/test/jacocoTestReport.xml' + retention-days: 1 + + coverage-compare: + name: Compare Coverage + needs: [ coverage-pr, coverage-base ] + runs-on: ubuntu-latest + if: always() && needs.coverage-pr.result == 'success' + + steps: + - name: Download PR coverage + uses: actions/download-artifact@v4 + with: + name: coverage-pr + path: coverage-pr + + - name: Download base coverage + uses: actions/download-artifact@v4 + with: + name: coverage-base + path: coverage-base + continue-on-error: true + + - name: Compare coverage + id: compare + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const path = require('path'); + + // --- JaCoCo XML Parser --- + // Use the last match of each counter type, which is the report-level summary. + // JaCoCo XML nests counters at method → class → package → report level. + function parseCounter(xml, type) { + const regex = new RegExp(``, 'g'); + let match; + let last = null; + while ((match = regex.exec(xml)) !== null) { + last = match; + } + if (!last) return null; + const missed = parseInt(last[1], 10); + const covered = parseInt(last[2], 10); + const total = missed + covered; + return { missed, covered, total, pct: total > 0 ? (covered / total * 100) : 0 }; + } + + function parseJacocoXml(xmlContent) { + return { + instruction: parseCounter(xmlContent, 'INSTRUCTION'), + branch: parseCounter(xmlContent, 'BRANCH'), + line: parseCounter(xmlContent, 'LINE'), + method: parseCounter(xmlContent, 'METHOD'), + class: parseCounter(xmlContent, 'CLASS'), + }; + } + + // --- Find all JaCoCo XML reports --- + function findReports(dir) { + const reports = {}; + if (!fs.existsSync(dir)) return reports; + + function walk(d) { + for (const entry of fs.readdirSync(d, { withFileTypes: true })) { + const full = path.join(d, entry.name); + if (entry.isDirectory()) { + walk(full); + } else if (entry.name === 'jacocoTestReport.xml') { + // Extract module name from path + const rel = path.relative(dir, full); + const module = rel.split(path.sep)[0]; + reports[module] = fs.readFileSync(full, 'utf8'); + } + } + } + walk(dir); + return reports; + } + + // --- Aggregate coverage across modules --- + function aggregateCoverage(reportsMap) { + const types = ['instruction', 'branch', 'line', 'method', 'class']; + const agg = {}; + for (const t of types) { + agg[t] = { missed: 0, covered: 0, total: 0, pct: 0 }; + } + + for (const [mod, xml] of Object.entries(reportsMap)) { + const parsed = parseJacocoXml(xml); + for (const t of types) { + if (parsed[t]) { + agg[t].missed += parsed[t].missed; + agg[t].covered += parsed[t].covered; + agg[t].total += parsed[t].total; + } + } + } + for (const t of types) { + agg[t].pct = agg[t].total > 0 ? (agg[t].covered / agg[t].total * 100) : 0; + } + return agg; + } + + // --- Per-module coverage --- + function perModuleCoverage(reportsMap) { + const result = {}; + for (const [mod, xml] of Object.entries(reportsMap)) { + result[mod] = parseJacocoXml(xml); + } + return result; + } + + // --- Format helpers --- + function fmtPct(val) { + return val != null ? val.toFixed(2) + '%' : 'N/A'; + } + + function diffIcon(diff) { + if (diff > 0.1) return '🟢'; + if (diff < -0.1) return '🔴'; + return '⚪'; + } + + function fmtDiff(diff) { + if (diff == null) return 'N/A'; + const sign = diff >= 0 ? '+' : ''; + return `${sign}${diff.toFixed(2)}%`; + } + + // --- Main --- + const prReports = findReports('coverage-pr'); + const baseReports = findReports('coverage-base'); + const hasBase = Object.keys(baseReports).length > 0; + + const prAgg = aggregateCoverage(prReports); + const baseAgg = hasBase ? aggregateCoverage(baseReports) : null; + + const prModules = perModuleCoverage(prReports); + const baseModules = hasBase ? perModuleCoverage(baseReports) : null; + + // --- Build Summary Table --- + let body = '### 📊 Code Coverage Report\n\n'; + + // Overall summary + body += '#### Overall Coverage\n\n'; + body += '| Metric | '; + if (hasBase) body += 'Base | '; + body += 'PR | '; + if (hasBase) body += 'Diff | '; + body += '\n'; + body += '| --- | '; + if (hasBase) body += '--- | '; + body += '--- | '; + if (hasBase) body += '--- | '; + body += '\n'; + + const metrics = [ + ['Line', 'line'], + ['Branch', 'branch'], + ['Instruction', 'instruction'], + ['Method', 'method'], + ]; + + let coverageDrop = 0; + + for (const [label, key] of metrics) { + const prVal = prAgg[key].pct; + body += `| ${label} | `; + if (hasBase) { + const baseVal = baseAgg[key].pct; + const diff = prVal - baseVal; + if (key === 'line') coverageDrop = diff; + body += `${fmtPct(baseVal)} | `; + body += `${fmtPct(prVal)} | `; + body += `${diffIcon(diff)} ${fmtDiff(diff)} | `; + } else { + body += `${fmtPct(prVal)} | `; + } + body += '\n'; + } + + // Per-module breakdown + const allModules = [...new Set([...Object.keys(prModules), ...(baseModules ? Object.keys(baseModules) : [])])].sort(); + + if (allModules.length > 1) { + body += '\n
\n📦 Per-Module Coverage (Line)\n\n'; + body += '| Module | '; + if (hasBase) body += 'Base | '; + body += 'PR | '; + if (hasBase) body += 'Diff | '; + body += '\n'; + body += '| --- | '; + if (hasBase) body += '--- | '; + body += '--- | '; + if (hasBase) body += '--- | '; + body += '\n'; + + for (const mod of allModules) { + const prLine = prModules[mod]?.line; + const baseLine = baseModules?.[mod]?.line; + const prPct = prLine ? prLine.pct : null; + const basePct = baseLine ? baseLine.pct : null; + + body += `| \`${mod}\` | `; + if (hasBase) { + body += `${basePct != null ? fmtPct(basePct) : 'N/A'} | `; + body += `${prPct != null ? fmtPct(prPct) : 'N/A'} | `; + if (prPct != null && basePct != null) { + const diff = prPct - basePct; + body += `${diffIcon(diff)} ${fmtDiff(diff)} | `; + } else { + body += 'N/A | '; + } + } else { + body += `${prPct != null ? fmtPct(prPct) : 'N/A'} | `; + } + body += '\n'; + } + body += '\n
\n'; + } + + // --- Threshold check --- + const threshold = parseFloat('${{ env.COVERAGE_DROP_THRESHOLD }}'); + const warnThreshold = parseFloat('${{ env.COVERAGE_WARN_THRESHOLD }}'); + let passed = true; + + if (hasBase && coverageDrop < -threshold) { + passed = false; + body += `\n> [!CAUTION]\n> Line coverage dropped by **${fmtDiff(coverageDrop)}**, exceeding the allowed threshold of **-${threshold}%**.\n`; + body += `> Please add tests to cover the new or modified code.\n`; + } else if (hasBase && coverageDrop < -warnThreshold) { + body += `\n> [!WARNING]\n> Line coverage decreased by **${fmtDiff(coverageDrop)}**, exceeding the warning threshold of **-${warnThreshold}%**.\n`; + body += `> Consider adding tests to cover the new or modified code.\n`; + } else if (hasBase && coverageDrop < 0) { + body += `\n> [!NOTE]\n> Line coverage decreased by **${fmtDiff(coverageDrop)}**, within the allowed threshold.\n`; + } else if (!hasBase) { + body += `\n> [!NOTE]\n> Base branch coverage is unavailable. Only PR branch coverage is shown.\n`; + } else { + body += `\n> [!TIP]\n> Coverage is stable or improved. Great job! 🎉\n`; + } + + fs.writeFileSync('coverage-report.md', body); + core.setOutput('passed', passed.toString()); + core.setOutput('coverage_drop', coverageDrop.toFixed(2)); + + - name: Find existing comment + id: find-comment + uses: actions/github-script@v7 + with: + script: | + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }); + const marker = '### 📊 Code Coverage Report'; + const existing = comments.data.find(c => c.body.includes(marker)); + core.setOutput('comment_id', existing ? existing.id.toString() : ''); + + - name: Post or update PR comment + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const body = fs.readFileSync('coverage-report.md', 'utf8'); + const commentId = '${{ steps.find-comment.outputs.comment_id }}'; + + if (commentId) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: parseInt(commentId), + body: body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: body, + }); + } + + - name: Check coverage threshold + if: steps.compare.outputs.passed == 'false' + run: | + echo "::error::Line coverage dropped by ${{ steps.compare.outputs.coverage_drop }}%, exceeding the threshold of -${{ env.COVERAGE_DROP_THRESHOLD }}%" + exit 1 diff --git a/framework/src/main/resources/config-backup.conf b/framework/src/main/resources/config-backup.conf deleted file mode 100644 index bf4bab4403..0000000000 --- a/framework/src/main/resources/config-backup.conf +++ /dev/null @@ -1,179 +0,0 @@ -net { - # type is deprecated and has no effect. - # type = mainnet -} - -storage { - # Directory for storing persistent data - - db.directory = "database", - index.directory = "index", - - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain defualt and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ - // { - // name = "account", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - // { - // name = "account-index", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - ] - -} - -node.discovery = { - enable = true - persist = true - external.ip = null -} - -# custom stop condition -#node.shutdown = { -# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. -# BlockHeight = 33350800 # if block header height in persistent db matched. -# BlockCount = 12 # block sync count after node start. -#} - -node.backup { - port = 10001 - priority = 8 - members = [ - #"192.168.1.182" - ] -} - -node { - # trust node for solidity node - # trustNode = "ip:port" - - # expose extension api to public or not - walletExtensionApi = true - - listen.port = 18888 - - connection.timeout = 2 - - tcpNettyWorkThreadNum = 0 - - udpNettyWorkThreadNum = 1 - - # Number of validate sign thread, default availableProcessors / 2 - # validateSignThreadNum = 16 - - minParticipationRate = 33 - - p2p { - version = 100001 # 10000: mainnet; 71: testnet - } - - rpc { - port = 50051 - - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - } - -} - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ - "192.168.1.182:18888" - ] -} - -genesis.block = { - # Reserve balance - assets = [ - { - accountName = "Zion" - accountType = "AssetIssue" - address = "TNNqZuYhMfQvooC4kJwTsMJEQVU3vWGa5u" - balance = "95000000000000000" - }, - { - accountName = "Sun" - accountType = "AssetIssue" - address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb" - balance = "5000000000000000" - }, - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip" - balance = "-9223372036854775808" - } - ] - - witnesses = [ - { - address: TVdyt1s88BdiCjKt6K2YuoSmpWScZYK1QF, - url = "http://Alioth.com", - voteCount = 100027 - } - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000" -} - -localwitness = [ - e901ef62b241b6f1577fd6ea34ef8b1c4b3ddee1e3c051b9e63f5ff729ad47a1 -] - -block = { - needSyncCheck = false # first node : false, other : true - maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms) -} \ No newline at end of file diff --git a/framework/src/main/resources/config-beta.conf b/framework/src/main/resources/config-beta.conf deleted file mode 100644 index d925c264d3..0000000000 --- a/framework/src/main/resources/config-beta.conf +++ /dev/null @@ -1,235 +0,0 @@ -net { - # type is deprecated and has no effect. - # type = mainnet -} - -storage { - # Directory for storing persistent data - - db.directory = "database", - index.directory = "index", - - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain defualt and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ - // { - // name = "account", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - // { - // name = "account-index", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - ] - -} - -node.discovery = { - enable = true - persist = true - external.ip = null -} - -# custom stop condition -#node.shutdown = { -# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. -# BlockHeight = 33350800 # if block header height in persistent db matched. -# BlockCount = 12 # block sync count after node start. -#} - -node { - # trust node for solidity node - trustNode = "47.93.9.236:50051" - - listen.port = 18888 - - connection.timeout = 2 - - active = [ - "47.93.9.236:18888", - "47.93.33.201:18888", - "123.56.10.6:18888", - "39.107.80.135:18888", - "47.93.184.2:18888" - ] - - p2p { - version = 102 # 47: testnet; 101: debug - } - - rpc { - port = 50051 - - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - } - -} - -sync { - node.count = 30 -} - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ - "47.93.9.236:18888", - "47.93.33.201:18888", - "123.56.10.6:18888", - "39.107.80.135:18888", - "47.93.184.2:18888" - ] -} - -genesis.block = { - # Reserve balance - assets = [ - # the account of foundation. - { - accountName = "Zion" - accountType = "AssetIssue" - address = "27WuXYGzxHXU7ynKDzoudJd9mS9Bw4vmbER" - balance = "25000000000000000" - }, - - # the account of payment - { - accountName = "Sun" - accountType = "AssetIssue" - address = "27Vm12vh5Mm9HzPSWBDvbZu1U25xvyFvexF" - balance = "10000000000000000" - }, - - # the account of coin burn - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "27WnTihwXsqCqpiNedWvtKCZHsLg5LjQ4XD" - balance = "-9223372036854775808" - }, - - #testng001 - { - accountName = "Testng001" - accountType = "AssetIssue" - address = "27YcHNYcxHGRf5aujYzWQaJSpQ4WN4fJkiU" - balance = "10000000000000000" - }, - - #testng002 - { - accountName = "Testng002" - accountType = "AssetIssue" - address = "27WvzgdLiUvNAStq2BCvA1LZisdD3fBX8jv" - balance = "20000000000000000" - }, - - #testng003 - { - accountName = "Testng003" - accountType = "AssetIssue" - address = "27iDPGt91DX3ybXtExHaYvrgDt5q5d6EtFM" - balance = "30000000000000000" - } - ] - - witnesses = [ - { - address: 27QAUYjg5FXfxcvyHcWF3Aokd5eu9iYgs1c - url = "http://Mercury.org", - voteCount = 105 - }, - { - address: 27g8BKC65R7qsnEr2vf7R2Nm7MQfvuJ7im4 - url = "http://Venus.org", - voteCount = 104 - }, - { - address: 27Uoo1DVmYT1fFYPdnTtueyqHkjR3DaDjwo - url = "http://Earth.org", - voteCount = 103 - }, - { - address: 27mEGtrpetip67KuXHFShryhGWd8nbSfLRW - url = "http://Mars.org", - voteCount = 102 - }, - { - address: 27jvZ4iJ7LQ8UP3VKPGQLp3oj7c7jFf6Q32 - url = "http://Jupiter.org", - voteCount = 101 - } - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000" -} - -localwitness = [ - -] - -block = { - needSyncCheck = true - maintenanceTimeInterval = 21600000 - proposalExpireTime = 259200000 // 3 day: 259200000(ms) -} - -vm = { - supportConstant = true - minTimeRatio = 0.6 - maxTimeRatio = 5.0 -} - -committee = { - allowCreationOfContracts = 1 //mainnet:0 (reset by committee),test:1 -} \ No newline at end of file diff --git a/framework/src/main/resources/config-localtest.conf b/framework/src/main/resources/config-localtest.conf deleted file mode 100644 index 38a9708bec..0000000000 --- a/framework/src/main/resources/config-localtest.conf +++ /dev/null @@ -1,291 +0,0 @@ -net { - # type is deprecated and has no effect. - # type = mainnet -} - -storage { - # Directory for storing persistent data - db.directory = "database", - index.directory = "index", - - # This configuration item is only for SolidityNode. - # Turn off the index is "off", else "on". - # Turning off the index will significantly improve the performance of the SolidityNode sync block. - # You can turn off the index if you don't use the two interfaces getTransactionsToThis and getTransactionsFromThis. - index.switch = "on" - - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain defualt and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ - // { - // name = "account", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - // { - // name = "account-index", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - ] - checkpoint.version = 2 - checkpoint.sync = true -} - -node.discovery = { - enable = true - persist = true - external.ip = null -} - -# custom stop condition -#node.shutdown = { -# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. -# BlockHeight = 33350800 # if block header height in persistent db matched. -# BlockCount = 12 # block sync count after node start. -#} - -node.backup { - port = 10001 - priority = 8 - members = [ - ] -} - -node { - # trust node for solidity node - # trustNode = "ip:port" - trustNode = "127.0.0.1:50051" - - # expose extension api to public or not - walletExtensionApi = true - - listen.port = 6666 - - connection.timeout = 2 - - tcpNettyWorkThreadNum = 0 - - udpNettyWorkThreadNum = 1 - - # Number of validate sign thread, default availableProcessors / 2 - # validateSignThreadNum = 16 - - maxConnectionsWithSameIp = 10 - - minParticipationRate = 0 - - # check the peer data transfer ,disconnect factor - isOpenFullTcpDisconnect = true - inactiveThreshold = 600 //seconds - - p2p { - version = 333 # 11111: mainnet; 20180622: testnet - } - - active = [ - # Active establish connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - ] - - passive = [ - # Passive accept connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - ] - - http { - fullNodePort = 8090 - solidityPort = 8091 - } - - rpc { - port = 50051 - # default value is 50061 - # solidityPort = 50061 - - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - minEffectiveConnection = 0 - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - - # The switch of the reflection service, effective for all gRPC services - reflectionService = false - } - - jsonrpc { - # httpFullNodeEnable = true - # httpFullNodePort = 8545 - # httpSolidityEnable = true - # httpSolidityPort = 8555 - # httpPBFTEnable = true - # httpPBFTPort = 8565 - # maxBlockRange = 5000 - # maxSubTopics = 1000 - # maxBlockFilterNum = 30000 - } - -} - - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ - "127.0.0.1:6666", - // "127.0.0.1:7777", - // "127.0.0.1:8888", - // "127.0.0.1:9999", - ] -} - -genesis.block = { - # Reserve balance - assets = [ - # the account of foundation. - { - accountName = "Zion" - accountType = "AssetIssue" - address = "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW" - balance = "25000000000000000" - }, - - # the account of payment - { - accountName = "Sun" - accountType = "AssetIssue" - address = "TGehVcNhud84JDCGrNHKVz9jEAVKUpbuiv" - balance = "10000000000000000" - }, - - # the account of coin burn - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "THKrowiEfCe8evdbaBzDDvQjM5DGeB3s3F" - balance = "-9223372036854775808" - } - ] - - witnesses = [ - { - address: TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz - url = "http://Test.org", - voteCount = 106 - }, - // { - // address: TPrLL5ckUdMaPNgJYmGv23qtYjBE34aBf8 - // url = "http://Mercury.org", - // voteCount = 105 - // }, - // { - // address: TEZBh76rouEQpB2zqYVopbRXGx7RfyWorT - // #address: 27TfVERREG3FeWMHEAQ95tWHG4sb3ANn3Qe - // url = "http://Venus.org", - // voteCount = 104 - // }, - // { - // address: TN27wbfCLEN1gP2PZAxHgU3QZrntsLyxdj - // #address: 27b8RUuyZnNPFNZGct2bZkNu9MnGWNAdH3Z - // url = "http://Earth.org", - // voteCount = 103 - // }, - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0x0000000000000000000000000000000000000000000000000000000000000000" -} - -// Optional.The default is empty. -// It is used when the witness account has set the witnessPermission. -// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, -// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. -// When it is empty,the localwitness is configured with the private key of the witness account. - -//localWitnessAccountAddress = TN3zfjYUmMFK3ZsHSsrdJoNRtGkQmZLBLz - -localwitness = [ - -] - - -#localwitnesskeystore = [ -# "localwitnesskeystore.json" -#] - -block = { - needSyncCheck = false - maintenanceTimeInterval = 21600000 - proposalExpireTime = 259200000 // 3 day: 259200000(ms) -} - - -vm = { - supportConstant = true - minTimeRatio = 0.0 - maxTimeRatio = 5.0 -} - -committee = { - allowCreationOfContracts = 1 //mainnet:0 (reset by committee),test:1 - allowMultiSign = 1 //mainnet:0 (reset by committee),test:1 - allowSameTokenName = 1 - allowTvmTransferTrc10 = 1 - allowTvmConstantinople = 1 - allowTvmSolidity059 = 1 - allowMarketTransaction = 1 - allowTransactionFeePool = 1 -} - -log.level = { - root = "INFO" // TRACE;DEBUG;INFO;WARN;ERROR - allowCreationOfContracts = 1 //mainnet:0 (reset by committee),test:1 - allowMultiSign = 1 //mainnet:0 (reset by committee),test:1 -} diff --git a/framework/src/main/resources/config-test-net.conf b/framework/src/main/resources/config-test-net.conf deleted file mode 100644 index 58b0905d49..0000000000 --- a/framework/src/main/resources/config-test-net.conf +++ /dev/null @@ -1,387 +0,0 @@ -net { - # type is deprecated and has no effect. - # type = mainnet -} - -storage { - # Directory for storing persistent data - - db.directory = "database", - index.directory = "index", - - # You can custom these 14 databases' configs: - - # account, account-index, asset-issue, block, block-index, - # block_KDB, peers, properties, recent-block, trans, - # utxo, votes, witness, witness_schedule. - - # Otherwise, db configs will remain defualt and data will be stored in - # the path of "output-directory" or which is set by "-d" ("--output-directory"). - - # Attention: name is a required field that must be set !!! - properties = [ - // { - // name = "account", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - // { - // name = "account-index", - // path = "storage_directory_test", - // createIfMissing = true, - // paranoidChecks = true, - // verifyChecksums = true, - // compressionType = 1, // compressed with snappy - // blockSize = 4096, // 4 KB = 4 * 1024 B - // writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // cacheSize = 10485760, // 10 MB = 10 * 1024 * 1024 B - // maxOpenFiles = 100 - // }, - ] - - needToUpdateAsset = true - -} - -node.discovery = { - enable = true - persist = true - external.ip = null -} - -# custom stop condition -#node.shutdown = { -# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. -# BlockHeight = 33350800 # if block header height in persistent db matched. -# BlockCount = 12 # block sync count after node start. -#} - -node.backup { - port = 10001 - priority = 8 - members = [ - ] -} - -node { - # trust node for solidity node - # trustNode = "ip:port" - trustNode = "127.0.0.1:50051" - - # expose extension api to public or not - walletExtensionApi = true - - listen.port = 18888 - - connection.timeout = 2 - - fetchBlock.timeout = 200 - - tcpNettyWorkThreadNum = 0 - - udpNettyWorkThreadNum = 1 - - # Number of validate sign thread, default availableProcessors / 2 - # validateSignThreadNum = 16 - - maxConnectionsWithSameIp = 2 - - minParticipationRate = 30 - - # check the peer data transfer ,disconnect factor - isOpenFullTcpDisconnect = true - - p2p { - version = 20180911 - } - - active = [ - # Active establish connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - "47.90.240.201:18888", - "47.89.188.246:18888", - "47.90.208.195:18888", - "47.89.188.162:18888" - ] - - passive = [ - # Passive accept connection in any case - # Sample entries: - # "ip:port", - # "ip:port" - ] - - http { - fullNodePort = 8090 - solidityPort = 8091 - } - - rpc { - port = 50051 - - # Number of gRPC thread, default availableProcessors / 2 - # thread = 16 - - # The maximum number of concurrent calls permitted for each incoming connection - # maxConcurrentCallsPerConnection = - - # The HTTP/2 flow control window, default 1MB - # flowControlWindow = - - # Connection being idle for longer than which will be gracefully terminated - maxConnectionIdleInMillis = 60000 - - # Connection lasting longer than which will be gracefully terminated - # maxConnectionAgeInMillis = - - # The maximum message size allowed to be received on the server, default 4MB - # maxMessageSize = - - # The maximum size of header list allowed to be received, default 8192 - # maxHeaderListSize = - } - -} - - -seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes - # example: - # ip.list = [ - # "ip:port", - # "ip:port" - # ] - ip.list = [ - "47.90.240.201:18888", - "47.89.188.246:18888", - "47.90.208.195:18888", - "47.89.188.162:18888", - "47.89.185.110:18888", - "47.89.183.137:18888", - "47.90.240.239:18888", - "47.88.55.186:18888", - "47.254.75.152:18888", - "47.254.36.2:18888", - "47.254.73.154:18888", - "47.254.20.22:18888", - "47.254.33.129:18888", - "47.254.45.208:18888", - "47.74.159.205:18888", - "47.74.149.105:18888", - "47.74.144.205:18888", - "47.74.159.52:18888", - "47.88.237.77:18888", - "47.74.149.180:18888", - "47.88.229.149:18888", - "47.74.182.133:18888", - "47.88.229.123:18888", - "47.74.152.210:18888", - "47.75.205.223:18888", - "47.75.113.95:18888", - "47.75.57.234:18888" - ] -} - -genesis.block = { - # Reserve balance - assets = [ - { - accountName = "Zion" - accountType = "AssetIssue" - address = "TNNqZuYhMfQvooC4kJwTsMJEQVU3vWGa5u" - balance = "95000000000000000" - }, - { - accountName = "Sun" - accountType = "AssetIssue" - address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb" - balance = "5000000000000000" - }, - { - accountName = "Blackhole" - accountType = "AssetIssue" - address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip" - balance = "-9223372036854775808" - } - ] - - witnesses = [ - { - address: TVdyt1s88BdiCjKt6K2YuoSmpWScZYK1QF, - url = "http://Alioth.com", - voteCount = 100027 - }, - { - address: TCNVmGtkfknHpKSZXepZDXRowHF7kosxcv, - url = "http://Aries.com", - voteCount = 100026 - }, - { - address: TAbzgkG8p3yF5aywKVgq9AaAu6hvF2JrVC, - url = "http://Cancer.com", - voteCount = 100025 - }, - { - address: TMmmvwvkBPBv3Gkw9cGKbZ8PLznYkTu3ep, - url = "http://Capricorn.com", - voteCount = 100024 - }, - { - address: TBJHZu4Sm86aWHtt6VF6KQSzot8vKTuTKx, - url = "http://Cassiopeia.com", - voteCount = 100023 - }, - { - address: TLvCstA93piBhpdvMggJ9r5b793b6rqdGd, - url = "http://Crux.com", - voteCount = 100022 - }, - { - address: TEf2ADumcubtg9NeNi7bNP14KfvYxKzTDu, - url = "http://Delphinus.com", - voteCount = 100021 - }, - { - address: TTqqbNxnqniyeCFi4aYwQQFHtuMwiBLARo, - url = "http://Dorado.com", - voteCount = 100020 - }, - { - address: TWwJwoqAYvUVjmp5odhwZYgKekBqL3Mbcf, - url = "http://Dubhe.com", - voteCount = 100019 - }, - { - address: TCPKsDZCJDzC83KWcAnHo9b46DN9o4s48y, - url = "http://Eridanus.com", - voteCount = 100018 - }, - { - address: TJnd8wF5ScEvuYq4WnJUyGbg6iS7ibnWrY, - url = "http://Gemini.com", - voteCount = 100017 - }, - { - address: TTZDB64rNpdw8rpEKko5FhB7BMUf5y4JMT, - url = "http://Hercules.com", - voteCount = 100016 - }, - { - address: TVWapNccbdFDqdHjFGnJ8ePancR6HjSned, - url = "http://Leo.com", - voteCount = 100015 - }, - { - address: TUVdiR6bYsuDNB5HWPLyK3ueY6225n5AdJ, - url = "http://Libra.com", - voteCount = 100014 - }, - { - address: TRBQFNJrJJzzgqfnbP9WvAjWd2oCNyqanC, - url = "http://Lupus.com", - voteCount = 100013 - }, - { - address: TBSq7zAhyEyVf96tbQmh6SwBGRiQXJf9sx, - url = "http://Lyra.com", - voteCount = 100012 - }, - { - address: TFZhwKPxqadgLGSwkiD1JeFJgfSMn2BD75, - url = "http://Monoceros.com", - voteCount = 100011 - }, - { - address: TZ6PqKSodEW7yQNYSDS8WoDo8t3SfACV3V, - url = "http://Norma.com", - voteCount = 100010 - }, - { - address: TSiyqwmcqsDBXQmWPZhC4Y5zncECMN61Li, - url = "http://Orion.com", - voteCount = 100009 - }, - { - address: TVnWr8bm3b2gDrJDBTfWXuPXiT1cvZUGan, - url = "http://Pavo.com", - voteCount = 100008 - }, - { - address: TNR2BDkX53rFCvkSg89nK7nfeC6hLN7B5o, - url = "http://Perseus.com", - voteCount = 100007 - }, - { - address: TVw2k1pD3n4ErWnr4uWmjVwsdai8vT5wyn, - url = "http://Phecda.com", - voteCount = 100006 - }, - { - address: THtcGdFXoGWNd9PDrhCradfvcdsQAoNVAC, - url = "http://Phoenix.com", - voteCount = 100005 - }, - { - address: TEZ31xxrECtLmsGvQFnh2quQVxKFoHxqqu, - url = "http://Pyxis.com", - voteCount = 100004 - }, - { - address: TA6ztifHZSkQ5F6KMe73rYRgQ5fBKLPomV, - url = "http://Scutum.com", - voteCount = 100003 - }, - { - address: TXuLKjf8J8aCKgDgA5uczwn1yQNYVPLocY, - url = "http://Taurus.com", - voteCount = 100002 - }, - { - address: TAihbgDWBK1QTS5gsk7evWDy2nhpkmkGZJ, - url = "http://Volans.com", - voteCount = 100001 - } - ] - - timestamp = "0" #2017-8-26 12:00:00 - - parentHash = "0x30000000001d13ab3ece497c7eb3ef3a0e17941f1c69c2e66088f461266ecac3" -} - -#localwitness = [ -#] - -localwitnesskeystore = [ - "src/main/resources/localwitnesskeystore.json" -] - -block = { - needSyncCheck = true - maintenanceTimeInterval = 600000 - proposalExpireTime = 600000 // 3 day: 259200000(ms) -} - - -vm = { - supportConstant = true - minTimeRatio = 0.0 - maxTimeRatio = 5.0 -} - -committee = { - allowCreationOfContracts = 0 //mainnet:0 (reset by committee),test:1 -} - -log.level = { - root = "INFO" // TRACE;DEBUG;INFO;WARN;ERROR -}