openethereum / parity-deploy

Parity deployment script.
Apache License 2.0
81 stars 52 forks source link

make config pieces JSON compliant / (FR) allow to change spec parameters #60

Closed drandreaskrueger closed 6 years ago

drandreaskrueger commented 6 years ago

I cannot get past this:

jq '.genesis.gasLimit = "0x2625A00"' config/spec/genesis/aura

and I suppose that is because the file looks like this:

    "genesis": {
        "seal": {
            "authorityRound": {
                "step": "0x0",
                "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
            }
        },
        "difficulty": "0x20000",
        "gasLimit": "0x1312D00"
    },

and not like this

{   "genesis": {
        "seal": {
            "authorityRound": {
                "step": "0x0",
                "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
            }
        },
        "difficulty": "0x20000",
        "gasLimit": "0x1312D00"
    }}

Could you perhaps in a future version make the separate config pieces JSON compliant? Then parameters are easier to change:

jq '.genesis.gasLimit = "0x2625A00"' ~/tmp.txt 
{
  "genesis": {
    "seal": {
      "authorityRound": {
        "step": "0x0",
        "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x20000",
    "gasLimit": "0x2625A00"
  }
}

And/or:

(How) can I change the genesis parameter on the commandline

DEPLOYARGS="--nodes 4 --config aura --name myaura"
NODEARGS="--geth --jsonrpc-server-threads 10 --tx-queue-size 20000 --cache-size 4096 --gas-floor-target 40000000 --tx-queue-mem-limit 0"
./parity-deploy.sh $DEPLOYARGS $NODEARGS 

perhaps like this?

SPEC='.genesis.gasLimit = "0x2625A00"'
./parity-deploy.sh $DEPLOYARGS --spec $SPEC $NODEARGS 
drandreaskrueger commented 6 years ago

Thx!

Great tool.

drandreaskrueger commented 6 years ago

My workaround for now:

sed -i 's/0x1312D00/0x2625A00/g' config/spec/genesis/aura

though not elegant nor universal

ddorgan commented 6 years ago

They're intended to be either 1) templated or 2) using a command line option that already exists in the parity cli since they can be added to the end of the command.

drandreaskrueger commented 6 years ago

Have a look at this: https://gitlab.com/electronDLT/chainhammer/blob/master/parity.md#run-13

To change the blocktime on the fly, I am using jq to directly manipulate the spec.json AFTER having called ./parity-deploy.sh ...

(AFTER because BEFORE ... the template which contains stepDuration (config/spec/engine/aura) ... is not JSON compliant - so jq does not work).

sudo apt install jq
jq ".engine.authorityRound.params.stepDuration = 5" deployment/chain/spec.json > tmp; mv tmp deployment/chain/spec.json

As there is no commandline switch (or is there?) that case could only fall under "1) templated" - right?

ddorgan commented 6 years ago

You can also use the custom_chain.toml which is a chain spec and node config within one file. There's example in the customchain directory.

For any additional arguments just add it to the end of the ./parity-deploy.sh command and it will be used on all containers.

drandreaskrueger commented 6 years ago

--config custom_chain.toml

ah, nice one. I had overlooked that until now. Might try. But my tweaking of deployment/chain/spec.json after running parity-deploy.sh ... does the trick actually. I only just want to change small pieces, like "gasLimit": "20000000"