Skip to content

Commit

Permalink
Applying changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
fmacleal committed Jul 3, 2024
1 parent 30678ff commit bb9b23a
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
RIT_LOG_LEVEL: ${{ inputs.rit-log-level }}
8 changes: 4 additions & 4 deletions .github/images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------------
Expand Down Expand Up @@ -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 \
Expand All @@ -62,4 +62,4 @@ RUN chmod +x /usr/src/entrypoint.sh \

ENTRYPOINT ["/usr/src/entrypoint.sh"]

EXPOSE 18332
EXPOSE 18332
13 changes: 6 additions & 7 deletions .github/images/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<appender name="FILE-AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-1.log</file>
<file>/usr/src/logs/rsk-fed-1.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<appender name="FILE-AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-2.log</file>
<file>/usr/src/logs/rsk-fed-2.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<appender name="FILE-AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-3.log</file>
<file>/usr/src/logs/rsk-fed-3.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<appender name="FILE-AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-4.log</file>
<file>/usr/src/logs/rsk-fed-4.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<appender name="FILE-AUDIT"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/Users/fredrhae/Documents/repos/powpeg-config/logs/rsk-fed-5.log</file>
<file>/usr/src/logs/rsk-fed-5.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n
Expand Down
138 changes: 39 additions & 99 deletions .github/images/rit-local-configs/regtest-all-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
}
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 }}"
echo "RIT Message = ${{ steps.test-rit-action.outputs.message }}"
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ config/*.js
**/*.bip39
logs
.env
.DS_Store
.idea/
.secrets
.DS_Store

0 comments on commit bb9b23a

Please sign in to comment.