Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mardizzone/hotfix (POS-623) #114

Merged
merged 8 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ SPRINT_SIZE=64 # sprint size (number of blocks for each bor sprint)
BLOCK_NUMBER=0 # comma separated values defining the block heights of bor where block time must change
BLOCK_TIME=2 # comma separated values defining the block times for the relative BLOCK_NUMBERs
BOR_REPO="https://github.com/maticnetwork/bor.git" # repo of bor project
BOR_BRANCH=develop # bor branch defining the version to be used in the devnet
BOR_BRANCH=c5569e4da9ebe0ce4e63aec571966c71234f7cfc # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved (bor branch defining the version to be used in the devnet)
HEIMDALL_REPO="https://github.com/maticnetwork/heimdall.git" # repo of heimdall project
HEIMDALL_BRANCH=develop # heimdall branch defining the version to be used in the devnet
CONTRACTS_BRANCH=mardizzone/node-upgrade # contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch
GENESIS_CONTRACTS_BRANCH=mardizzone/node-upgrade # Genesis contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/genesis-contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch
CONTRACTS_BRANCH=mardizzone/node-upgrade # contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch. todo change to master once contracts team merges the PR
GENESIS_CONTRACTS_BRANCH=mardizzone/node-upgrade # Genesis contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/genesis-contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch. todo change to master once contracts team merges the PR
MATIC_CLI_REPO="https://github.com/maticnetwork/matic-cli.git" # repo of matic-cli to run a specific version remotely using express-cli
MATIC_CLI_BRANCH=master # matic-cli branch used on the remote machines to start the environment
DEVNET_BOR_USERS=ubuntu,ubuntu,ubuntu #users' names of VMs for all the nodes (comma separated). Its length must be equal to "TF_VAR_VALIDATOR_COUNT + TF_VAR_SENTRY_COUNT"
BOR_DOCKER_BUILD_CONTEXT="https://github.com/maticnetwork/bor.git#develop" # docker build context for bor. Used in docker setup (TF_VAR_DOCKERIZED=yes)
BOR_DOCKER_BUILD_CONTEXT="https://github.com/maticnetwork/bor.git#c5569e4da9ebe0ce4e63aec571966c71234f7cfc" # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved (docker build context for bor. Used in docker setup (TF_VAR_DOCKERIZED=yes))
HEIMDALL_DOCKER_BUILD_CONTEXT="https://github.com/maticnetwork/heimdall.git#develop" # docker build context for heimdall. Used in docker setup (TF_VAR_DOCKERIZED=yes)
VERBOSE=true # if set to true will print logs also from remote machines

Expand Down
9 changes: 6 additions & 3 deletions configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,19 @@ devnetHeimdallUsers:
- ubuntu

# Branch of bor to use. Repository: https://github.com/maticnetwork/bor
borBranch: develop
borBranch: c5569e4da9ebe0ce4e63aec571966c71234f7cfc # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved

# Branch of Heimdall to use. Repository: https://github.com/maticnetwork/heimdall
heimdallBranch: develop

# Branch of contract to use. Repostiory: https://github.com/maticnetwork/contracts
contractsBranch: jc/v0.3.1-backport
contractsBranch: mardizzone/node-upgrade # todo change to master once contracts team merges the PR

# Branch of contract to use. Repostiory: https://github.com/maticnetwork/genesis-contracts
genesisContractsBranch: mardizzone/node-upgrade # todo change to master once contracts team merges the PR

# Docker build context for bor. Used in docker setup. When specified, borBranch will be ignored.
borDockerBuildContext: "https://github.com/maticnetwork/bor.git#develop"
borDockerBuildContext: "https://github.com/maticnetwork/bor.git#c5569e4da9ebe0ce4e63aec571966c71234f7cfc" # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved"

# Docker build context for heimdall. Used in docker setup. When specified, heimdallBranch will be ignored.
heimdallDockerBuildContext: "https://github.com/maticnetwork/heimdall.git#develop"
Expand Down
8 changes: 4 additions & 4 deletions configs/devnet/docker-setup-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ defaultStake: 10000
defaultFee: 2000
borChainId: 15005
heimdallChainId: heimdall-4052
borBranch: develop
borBranch: c5569e4da9ebe0ce4e63aec571966c71234f7cfc # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved
heimdallBranch: develop
contractsBranch: jc/v0.3.1-backport
genesisContractsBranch: mardizzone/node-upgrade
contractsBranch: mardizzone/node-upgrade # todo change to master once contracts team merges the PR
genesisContractsBranch: mardizzone/node-upgrade # todo change to master once contracts team merges the PR
sprintSize: 64
blockNumber: '0'
blockTime: '2'
Expand All @@ -14,7 +14,7 @@ numOfNonValidators: 1
ethURL: http://ganache:9545
ethHostUser: ubuntu
devnetType: docker
borDockerBuildContext: https://github.com/maticnetwork/bor.git#develop
borDockerBuildContext: https://github.com/maticnetwork/bor.git#c5569e4da9ebe0ce4e63aec571966c71234f7cfc # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved
heimdallDockerBuildContext: https://github.com/maticnetwork/heimdall.git#develop
devnetBorUsers: ubuntu,ubuntu
devnetBorHosts:
Expand Down
4 changes: 2 additions & 2 deletions configs/devnet/remote-setup-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ defaultStake: 10000
defaultFee: 2000
borChainId: 15005
heimdallChainId: heimdall-4052
borBranch: develop
borBranch: c5569e4da9ebe0ce4e63aec571966c71234f7cfc
heimdallBranch: develop
contractsBranch: jc/v0.3.1-backport
contractsBranch: mardizzone/node-upgrade
genesisContractsBranch: mardizzone/node-upgrade
sprintSize: 64
blockNumber: '0'
Expand Down
4 changes: 2 additions & 2 deletions src/express/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ export async function start() {
devnetType = "remote"
}

console.log("📍Waiting 15s for the VMs to initialize...")
await timer(15000)
console.log("📍Waiting 30s for the VMs to initialize...")
await timer(30000)

await installRequiredSoftwareOnRemoteMachines(ips, devnetType)

Expand Down
5 changes: 2 additions & 3 deletions src/express/common/remote-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ export async function runSshCommand(ip, command, retries) {
ip, command + ` && exit`],
{stdio: getRemoteStdio()})
} catch (error) {
console.log("❌ Error while executing command: '" + command + "' : \n", error)
if (retries - 1 > 0) {
await runSshCommand(ip, command, retries - 1)
} else {
console.log("❌ SSH command " + command + " failed too many times, exiting... \n")
console.log("❌ Command \n `" + command + "`\n failed too many times with error : \n", error)
process.exit(1)
}
}
Expand All @@ -51,4 +50,4 @@ export async function runScpCommand(src, dest, retries) {
process.exit(1)
}
}
}
}
19 changes: 10 additions & 9 deletions src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@ export async function cloneRepository(name, branch, url, targetDirectory) {
// create target directory
await execa("mkdir", ["-p", targetDirectory]);

let cloneResult, fetchResult
// check if directory exists or not
if (!fs.existsSync(repoPath)) {
result = await execa("git", ["clone", "-b", branch, url, name], {
cloneResult = await execa("git", ["clone", url, name], {
cwd: targetDirectory,
});
} else {
result = await execa("git", ["fetch"], {
}

fetchResult = await execa("git", ["fetch"], {
cwd: repoPath,
}).then(() => {
return execa("git", ["checkout", branch], {
cwd: repoPath,
}).then(() => {
return execa("git", ["checkout", branch], {
cwd: repoPath,
});
});
}
});

if (result && result.failed) {
if ((cloneResult && cloneResult.failed) || (fetchResult && fetchResult.failed)) {
return Promise.reject(new Error(`Failed to clone or pull ${name}`));
}
}
Expand Down