From bb9b23a884e06162680dd71f072f5884d1652f17 Mon Sep 17 00:00:00 2001 From: fmacleal Date: Wed, 3 Jul 2024 23:21:42 +0200 Subject: [PATCH] Applying changes from review --- .github/action.yml | 2 +- .github/images/Dockerfile | 8 +- .github/images/entrypoint.sh | 13 +- .../{logbacks => logback}/logback-fed-1.xml | 2 +- .../{logbacks => logback}/logback-fed-2.xml | 2 +- .../{logbacks => logback}/logback-fed-3.xml | 2 +- .../{logbacks => logback}/logback-fed-4.xml | 2 +- .../{logbacks => logback}/logback-fed-5.xml | 2 +- .../rit-local-configs/regtest-all-keys.js | 138 +++++------------- .github/workflows/ci.yml | 5 +- .gitignore | 4 +- 11 files changed, 58 insertions(+), 122 deletions(-) rename .github/images/rit-local-configs/{logbacks => logback}/logback-fed-1.xml (99%) rename .github/images/rit-local-configs/{logbacks => logback}/logback-fed-2.xml (99%) rename .github/images/rit-local-configs/{logbacks => logback}/logback-fed-3.xml (99%) rename .github/images/rit-local-configs/{logbacks => logback}/logback-fed-4.xml (99%) rename .github/images/rit-local-configs/{logbacks => logback}/logback-fed-5.xml (99%) diff --git a/.github/action.yml b/.github/action.yml index 8c093f38..36d02fa3 100644 --- a/.github/action.yml +++ b/.github/action.yml @@ -33,4 +33,4 @@ runs: RSKJ_BRANCH: ${{ inputs.rskj-branch }} FEDERATOR_BRANCH: ${{ inputs.federator-branch }} RIT_BRANCH: ${{ inputs.rit-branch }} - RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} \ No newline at end of file + RIT_LOG_LEVEL: ${{ inputs.rit-log-level }} diff --git a/.github/images/Dockerfile b/.github/images/Dockerfile index 7a03bb98..7317f4e8 100644 --- a/.github/images/Dockerfile +++ b/.github/images/Dockerfile @@ -4,7 +4,7 @@ LABEL Description="Custom RSK node image to execute Rootstock Integration Tests" RUN apt-get update \ && apt-get install -y --no-install-recommends \ - wget gnupg2 curl git ca-certificates mocha \ + wget gnupg2 curl git ca-certificates mocha \ && apt clean # -- nodeJs --------------------------------------------------------- @@ -44,13 +44,13 @@ RUN cd /tmp \ # -- configure entrypoint to run RIT-------------------------------------------- -RUN mkdir -p /usr/src/logbacks +RUN mkdir -p /usr/src/logback WORKDIR /usr/src COPY entrypoint.sh /usr/src/entrypoint.sh COPY rit-local-configs/regtest-all-keys.js /usr/src/regtest.js -COPY rit-local-configs/logbacks/* /usr/src/logbacks/ +COPY rit-local-configs/logback/* /usr/src/logback/ COPY scripts/* /usr/src/ RUN chmod +x /usr/src/entrypoint.sh \ @@ -62,4 +62,4 @@ RUN chmod +x /usr/src/entrypoint.sh \ ENTRYPOINT ["/usr/src/entrypoint.sh"] -EXPOSE 18332 \ No newline at end of file +EXPOSE 18332 diff --git a/.github/images/entrypoint.sh b/.github/images/entrypoint.sh index 9e36b56d..a66a0df1 100644 --- a/.github/images/entrypoint.sh +++ b/.github/images/entrypoint.sh @@ -6,16 +6,15 @@ set -e echo -e "\n\n--------- Starting the configuration of rskj ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/rskj.git rskj -cd rskj && git checkout $RSKJ_BRANCH +cd rskj && git checkout ${INPUT_RSKJ_BRANCH} chmod +x ./configure.sh && chmod +x gradlew ./configure.sh -./gradlew --no-daemon clean build -x test echo -e "\n\n--------- Starting the configuration of powpeg ---------\n\n" cd /usr/src/ git clone https://github.com/rsksmart/powpeg-node.git powpeg cp configure_gradle_federator.sh powpeg -cd powpeg && git checkout $FEDERATOR_BRANCH +cd powpeg && git checkout ${INPUT_FEDERATOR_BRANCH} chmod +x ./configure.sh && chmod +x gradlew ./configure_gradle_federator.sh ./configure.sh @@ -26,9 +25,9 @@ cd /usr/src/ git clone https://github.com/rsksmart/rootstock-integration-tests.git rit mv configure_rit_locally.sh rit mv regtest.js rit/config/regtest.js -mv /usr/src/logbacks/* /usr/src/rit/logbacks/ +mv /usr/src/logback/* /usr/src/rit/logback/ cd rit -git checkout $RIT_BRANCH +git checkout ${INPUT_RIT_BRANCH} chmod +x ./configure.sh ./configure.sh ./configure_rit_locally.sh "$FED_VERSION" @@ -47,5 +46,5 @@ else fi echo -e "$MESSAGE" -echo "status=$STATUS" >> $env:GITHUB_OUTPUT -echo "message=$MESSAGE" >> $env:GITHUB_OUTPUT +echo "status=${STATUS}" >>${GITHUB_OUTPUT} +echo "message=${MESSAGE}" >> ${GITHUB_OUTPUT} diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml b/.github/images/rit-local-configs/logback/logback-fed-1.xml similarity index 99% rename from .github/images/rit-local-configs/logbacks/logback-fed-1.xml rename to .github/images/rit-local-configs/logback/logback-fed-1.xml index 0f562cb9..db5dbbcf 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-1.xml +++ b/.github/images/rit-local-configs/logback/logback-fed-1.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-1.log + /usr/src/logs/rsk-fed-1.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml b/.github/images/rit-local-configs/logback/logback-fed-2.xml similarity index 99% rename from .github/images/rit-local-configs/logbacks/logback-fed-2.xml rename to .github/images/rit-local-configs/logback/logback-fed-2.xml index 509b62ad..f29c83bf 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-2.xml +++ b/.github/images/rit-local-configs/logback/logback-fed-2.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-2.log + /usr/src/logs/rsk-fed-2.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml b/.github/images/rit-local-configs/logback/logback-fed-3.xml similarity index 99% rename from .github/images/rit-local-configs/logbacks/logback-fed-3.xml rename to .github/images/rit-local-configs/logback/logback-fed-3.xml index 9fd82fc0..992b2421 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-3.xml +++ b/.github/images/rit-local-configs/logback/logback-fed-3.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-3.log + /usr/src/logs/rsk-fed-3.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml b/.github/images/rit-local-configs/logback/logback-fed-4.xml similarity index 99% rename from .github/images/rit-local-configs/logbacks/logback-fed-4.xml rename to .github/images/rit-local-configs/logback/logback-fed-4.xml index c6ca2443..2b45b734 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-4.xml +++ b/.github/images/rit-local-configs/logback/logback-fed-4.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-4.log + /usr/src/logs/rsk-fed-4.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n diff --git a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml b/.github/images/rit-local-configs/logback/logback-fed-5.xml similarity index 99% rename from .github/images/rit-local-configs/logbacks/logback-fed-5.xml rename to .github/images/rit-local-configs/logback/logback-fed-5.xml index 6936f610..76c227f5 100644 --- a/.github/images/rit-local-configs/logbacks/logback-fed-5.xml +++ b/.github/images/rit-local-configs/logback/logback-fed-5.xml @@ -22,7 +22,7 @@ - /Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-5.log + /usr/src/logs/rsk-fed-5.log %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n diff --git a/.github/images/rit-local-configs/regtest-all-keys.js b/.github/images/rit-local-configs/regtest-all-keys.js index a9d45f99..11d1a837 100644 --- a/.github/images/rit-local-configs/regtest-all-keys.js +++ b/.github/images/rit-local-configs/regtest-all-keys.js @@ -4,6 +4,43 @@ const keysPathResolve = 'node-keys'; const classpath = process.env.POWPEG_NODE_JAR_PATH; const federatesLogbackPath = path.resolve(__dirname, 'logback'); +function createPublicKeyEntry(key) { + return { btc: key, rsk: key, mst: key }; +} + +const publicKeys = [ + createPublicKeyEntry('0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124'), + createPublicKeyEntry('03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db'), + createPublicKeyEntry('02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1'), + createPublicKeyEntry('031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5'), + createPublicKeyEntry('036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a'), +] + +const nodeIds = [ + '62634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a1243bd206c2c7a218d6ff4c9a185e71f066bd354e5267875b7683fbc70a1d455e87', + 'c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04dbb0bde4f3854613b16032fb214f9cc00f75363976ee078cc4409cdc543036ccfd', + 'cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be19e9da12b897b83765fbaebe717fab74fcb1b57c82f7978b8be3296239909e626', + '1da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc52191fc2bd3b06ece06b68390cbb3ba306284aed9ca7cb61dd6289e66e693126f', + '6bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a9a8cbaf526d344b5df39b80433609e006586050fd2188d30ab000b0fb6a6baaf', +] + +const generateFedConfig = (i) => { + nodeIndex = i + 1 + logbackFile: `${federatesLogbackPath}/logback-fed.xml`, + classpath: classpath, + configFile: `${nodesConfigPath}/rsk-reg-${nodeIndex}.conf`, + publicKeys: publicKeys[i], + customConfig: { + 'federator.signers.BTC.type': 'keyFile', + 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg${nodeIndex}.key`), + 'federator.signers.RSK.type': 'keyFile', + 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/regg${nodeIndex}.key`), + 'federator.signers.MST.type': 'keyFile', + 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/regg${nodeIndex}.key`) + }, + nodeId: nodeIds[i] +}, + module.exports = { init: { mineInitialBitcoin: true, @@ -14,103 +51,6 @@ module.exports = { rpcPassword: 'test', dir: process.env.BITCOIN_DATA_DIR, }, - federate: [ - { - logbackFile: `${federatesLogbackPath}/logback-fed-1.xml`, - classpath: classpath, - configFile: `${nodesConfigPath}/rsk-reg-1.conf`, - publicKeys: { - btc: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', - rsk: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', - mst: '0362634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a124', - }, - customConfig: { - 'federator.signers.BTC.type': 'keyFile', - 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`), - 'federator.signers.RSK.type': 'keyFile', - 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`), - 'federator.signers.MST.type': 'keyFile', - 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg1.key`) - }, - nodeId: '62634ab57dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a1243bd206c2c7a218d6ff4c9a185e71f066bd354e5267875b7683fbc70a1d455e87' - }, - { - logbackFile: `${federatesLogbackPath}/logback-fed-2.xml`, - classpath: classpath, - configFile: `${nodesConfigPath}/rsk-reg-2.conf`, - publicKeys: { - btc: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', - rsk: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', - mst: '03c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04db', - }, - customConfig: { - 'federator.signers.BTC.type': 'keyFile', - 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`), - 'federator.signers.RSK.type': 'keyFile', - 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`), - 'federator.signers.MST.type': 'keyFile', - 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg2.key`) - }, - nodeId: 'c5946b3fbae03a654237da863c9ed534e0878657175b132b8ca630f245df04dbb0bde4f3854613b16032fb214f9cc00f75363976ee078cc4409cdc543036ccfd' - }, - { - logbackFile: `${federatesLogbackPath}/logback-fed-3.xml`, - classpath: classpath, - configFile: `${nodesConfigPath}/rsk-reg-3.conf`, - publicKeys: { - btc: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', - rsk: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', - mst: '02cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1', - }, - customConfig: { - 'federator.signers.BTC.type': 'keyFile', - 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`), - 'federator.signers.RSK.type': 'keyFile', - 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`), - 'federator.signers.MST.type': 'keyFile', - 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg3.key`) - }, - nodeId: 'cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be19e9da12b897b83765fbaebe717fab74fcb1b57c82f7978b8be3296239909e626' - } - ], - additionalFederateNodes: [ - { - logbackFile: `${federatesLogbackPath}/logback-fed-4.xml`, - classpath: classpath, - configFile: `${nodesConfigPath}/rsk-reg-4.conf`, - publicKeys: { - btc: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', - rsk: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', - mst: '031da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc5', - }, - customConfig: { - 'federator.signers.BTC.type': 'keyFile', - 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`), - 'federator.signers.RSK.type': 'keyFile', - 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`), - 'federator.signers.MST.type': 'keyFile', - 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg4.key`) - }, - nodeId: '1da807c71c2f303b7f409dd2605b297ac494a563be3b9ca5f52d95a43d183cc52191fc2bd3b06ece06b68390cbb3ba306284aed9ca7cb61dd6289e66e693126f' - }, - { - logbackFile: `${federatesLogbackPath}/logback-fed-5.xml`, - classpath: classpath, - configFile: `${nodesConfigPath}/rsk-reg-5.conf`, - publicKeys: { - btc: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', - rsk: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', - mst: '036bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a', - }, - customConfig: { - 'federator.signers.BTC.type': 'keyFile', - 'federator.signers.BTC.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`), - 'federator.signers.RSK.type': 'keyFile', - 'federator.signers.RSK.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`), - 'federator.signers.MST.type': 'keyFile', - 'federator.signers.MST.path': path.resolve(__dirname, `${keysPathResolve}/reg5.key`) - }, - nodeId: '6bb9eab797eadc8b697f0e82a01d01cabbfaaca37e5bafc06fdc6fdd38af894a9a8cbaf526d344b5df39b80433609e006586050fd2188d30ab000b0fb6a6baaf' - } - ] + federate: [1, 2, 3].map(generateFedConfig), + additionalFederateNodes: [4, 5].map(generateFedConfig), } \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9c38796..feb9346c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,7 +64,6 @@ jobs: context: .github/images tags: ${{ env.LATEST_TAG }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 load: true - name: GitHub container registry login @@ -92,7 +91,7 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Test RIT Action + - name: Test RIT Action id: test-rit-action uses: docker://ghcr.io/rsksmart/rootstock-integration-tests/rit:latest with: @@ -103,4 +102,4 @@ jobs: id: output run: | echo "RIT Status = ${{ steps.test-rit-action.outputs.status }}" - echo "RIT Message = ${{ steps.test-rit-action.outputs.message }}" \ No newline at end of file + echo "RIT Message = ${{ steps.test-rit-action.outputs.message }}" diff --git a/.gitignore b/.gitignore index 00497431..14024e55 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,4 @@ config/*.js **/*.bip39 logs .env -.DS_Store -.idea/ -.secrets \ No newline at end of file +.DS_Store \ No newline at end of file