Skip to content

Commit

Permalink
Merge pull request #60 from maticnetwork/raneet10/genesis-upgrade
Browse files Browse the repository at this point in the history
Sprint length changes in genesis
  • Loading branch information
Raneet10 authored Jan 13, 2023
2 parents 069e55f + b85e584 commit d1b6fa5
Show file tree
Hide file tree
Showing 12 changed files with 15,603 additions and 2,696 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Update Path
run: echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)" >> $GITHUB_PATH # Make it accessible from runner
- name: Install solc
run: |
set -x
wget -c https://github.com/ethereum/solidity/releases/download/v0.5.12/solc-static-linux
wget -c https://github.com/ethereum/solidity/releases/download/v0.5.17/solc-static-linux
mv solc-static-linux solc
chmod +x solc
solc --version
- name: Setup Node.js environment
uses: actions/[email protected]
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- name: Generate genesis file
run: bash generate.sh 15001 heimdall-15001
- name: Run tests
run: npm run test:ci
run: npm run test:ci
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ contracts/BorValidatorSet.sol
pids
logs
genesis.json

.idea
6 changes: 3 additions & 3 deletions generate-genesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ const web3 = require("web3")

const validators = require("./validators")
const blocks = require("./blocks");
const sprintSizes = require("./sprintSizes");

// load and execute bor validator set
require("./generate-borvalidatorset")

program.version("0.0.1")
program.option("-c, --bor-chain-id <bor-chain-id>", "Bor chain id", "15001")
program.option("-s, --sprint-size <sprint-size>", "Sprint size", "64")
program.option(
"-o, --output <output-file>",
"Genesis json file",
Expand Down Expand Up @@ -97,8 +97,8 @@ Promise.all([
maticChildERC20ContractBalance: web3.utils.toHex(
web3.utils.toWei(contractBalance.toString())
),
sprintSize: program.sprintSize,
blocks: blocks
blocks: blocks,
sprintSizes: sprintSizes
}

result.forEach(r => {
Expand Down
14 changes: 11 additions & 3 deletions genesis-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@
{% else %}"{{block.number}}": {{block.time}},{% endif %}
{% endfor %}
},
"producerDelay": {% for block in blocks| sort(false, false) %}{% endfor %}{{blocks[blocks.length -1].time}},
"sprint": {{sprintSize}},
"producerDelay": {
{% for block in blocks %}{% if block === blocks[blocks.length -1] %}"{{block.number}}": {{block.time}}
{% else %}"{{block.number}}": {{block.time}},{% endif %}
{% endfor %}
},
"sprint": {
{% for sprintSize in sprintSizes %}{% if sprintSize === sprintSizes[sprintSizes.length -1] %}"{{sprintSize.number}}": {{sprintSize.sprintSize}}
{% else %}"{{sprintSize.number}}": {{sprintSize.sprintSize}},{% endif %}
{% endfor %}
},
"backupMultiplier": {
{% for block in blocks %}{% if block === blocks[blocks.length -1] %}"{{block.number}}": {{block.time}}
{% else %}"{{block.number}}": {{block.time}},{% endif %}
Expand Down Expand Up @@ -61,4 +69,4 @@
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
}
2 changes: 1 addition & 1 deletion matic-contracts
Submodule matic-contracts updated 122 files
20 changes: 9 additions & 11 deletions migrations/2_genesis_contracts_deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@ const libDeps = [
module.exports = async function (deployer, network) {
deployer.then(async () => {
console.log('linking libs...')
await bluebird.map(libDeps, async e => {
for (let e of libDeps) {
await deployer.deploy(e.lib)
deployer.link(e.lib, e.contracts)
})
}

console.log("Deploying contracts...")
await Promise.all([
deployer.deploy(BorValidatorSet),
deployer.deploy(TestBorValidatorSet),
deployer.deploy(StateReciever),
deployer.deploy(TestStateReceiver),
deployer.deploy(System),
deployer.deploy(ValidatorVerifier),
deployer.deploy(TestCommitState)
])
await deployer.deploy(BorValidatorSet)
await deployer.deploy(TestBorValidatorSet)
await deployer.deploy(StateReciever)
await deployer.deploy(TestStateReceiver)
await deployer.deploy(System)
await deployer.deploy(ValidatorVerifier)
await deployer.deploy(TestCommitState)
})
}
Loading

0 comments on commit d1b6fa5

Please sign in to comment.