Closed pirapira closed 5 years ago
Package Deliverables ^^^^^^^^^^^^^^^^^^^^
raiden_contracts/contracts
raiden_contracts/data/contracts.json
raiden_contracts/data/deployment_*.json
, with Ethereum addresses, transaction data (transaction hash, block number, constructor arguments, gas cost)raiden_contracts/constants.py
raiden_contracts/deploy
raiden_contracts/tests
Package Release Process ^^^^^^^^^^^^^^^^^^^^^^^
When we want to release another version of the raiden-contracts
package, we need to:
Check if any source code changes have been done <check-source-changes>
_. If no, skip this step. yes If yes:Bump the version on the smart contracts <bump-contracts>
_ locally doneDeploy smart contracts <_deploy-contracts>
on all the supported chains and overwrite ``deployment*,json`` files with the new deployment data.Verify the deployed smart contracts on Etherscan <verify-contracts>
_ locally doneMeasure Gas Costs <measure-gas>
_ and update constants.py
; this likely annoys existing users. See #547 <https://github.com/raiden-network/raiden-contracts/issues/547>
__)Update Changelog <change-changelog>
_ doneBump the package version <bump-package>
_ doneRelease the new package version <_release-package>
_.. _check-source-changes:
First, identify the last release in the GitHub page <https://github.com/raiden-network/raiden-contracts/releases>
__ and find the corresponding tag in Git.
For a package release, source code changes imply changes in:
Compiled Data
The compiled data for all the contracts resides in the data/contracts.json
file.
Now, we do not manually need to check if the compiled data is correct, because this check is included in our Continuous Integration testing. Any source code change forces us to recompile the contracts with make compile_contracts
, otherwise our CI tests will fail: https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/tests/test_contracts_compilation.py. These tests check:
contracts_version
from contracts.json
matches the current CONTRACTS_VERSION
contracts_checksums
and overall_checksum
from contracts.json
matches the source code checksums, calculated in the test.Additionally, we test whether each contract source code contracts_version
matches the CONTRACTS_VERSION
. E.g. https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/tests/test_token_network.py#L16-L17
Deployment Data
Deployment data is kept in the data/deployment_[CHAIN_NAME].json
files.
We DO need to manually check whether source code changes have been done since the last release. We should add an automatic check here before releasing (e.g. checking that the contracts_version
here matches the one from data/contracts.json
)
.. _bump-contracts:
::
bumpversion --config-file ./.bumpversion_contracts.cfg [PART]
[PART]
can be major
, minor
, patch
.
CONTRACTS_VERSION
https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/constants.py#L4contract_version
constant from each contract source. E.g. https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/contracts/TokenNetwork.sol#L140.*
version. Our first major
bump will be made when a stable, not-limited version will be released on the main net.minor
bumps (for now) are made for contract ABI changes.patch
bumps are made for any fix that does not touch the ABI... _deploy-contracts:
Instructions for deploying the contracts can be found at https://github.com/raiden-network/raiden-contracts#deployment-on-a-testnet, using the python -m raiden_contracts.deploy
script.
We currently deploy on:
*Checking Validity of deployment_.json Data**
We have checks for:
contracts_version
: https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/deploy/__main__.py#L503chain_id
: https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/deploy/__main__.py#L503These checks are performed at the end of the deployment script. They can also be run independently with python -m raiden_contracts.deploy verify
, as described in the above link.
We also have CI tests that check whether the deployment data returned by the deployment script contains all necessary information, for all the contracts we need to deploy: https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/raiden_contracts/tests/test_deploy_script.py.
.. _verify-contracts:
Etherscan verification is documented here: https://github.com/raiden-network/raiden-contracts#verification-with-etherscan.
Note that we currently have some issues with the script: https://github.com/raiden-network/raiden-contracts/issues/349.
.. _measure-gas:
raiden_contracts
package provides some constants <https://github.com/raiden-network/raiden-contracts/blob/de13cf9aa7ad7ed230ff204e47103def6a14b0be/raiden_contracts/constants.py#L35>
__ showing the amount of gas that each operation requires. This information is manually updated. The amounts can be measured with a script
::
pytest -s raiden_contracts/tests/test_print_gas.py
The script prints many numbers like
GAS USED TokenNetwork.unlock 6 locks 66019
----------------------------------
.. _bump-package:
Before bumping the package version, git add
the deployment data at data/deployment_[CHAIN_NAME].json
. Also make sure MANIFEST.in
contains all the deployment JSON files. Then run
::
bumpversion --config-file ./.bumpversion.cfg [PART]
[PART]
can be major
, minor
, patch
.
0.*
version. Our first major
bump will be made when a stable, not-limited version will be released on the main net.minor
bumps are done if minor
or patch
smart contract bumps are done or when we introduce backwards incompatible changes to package deliverables (e.g. changing variable names or helper functions).patch
bumps are made for any other fixThis command triggers a commit and a local tag is created. A PR must be made with the commit changes.
.. _change-changelog:
Unreleased
section into a new release section... _release-package:
Push the newly created local tag (created at the previous step, e.g. v0.9.0
) directly to the master
branch. This will trigger travis
to upload the pypi package automatically, as seen here: https://github.com/raiden-network/raiden-contracts/blob/9fd2124eb648a629aee886f37ade5e502431371f/.travis.yml#L36-L47.
Ropsten deployment log
python -m raiden_contracts.deploy raiden --rpc-provider $ROPSTEN --private-key $ROPPRIV --gas-price 10 --gas-limit 6000000
{
"EndpointRegistry": "0xa647A5154b66452D85F194EB4A7F37EA8A629179",
"SecretRegistry": "0xD97F23e1DffacddE3162edfB36b98B5C520e01bd",
"TokenNetworkRegistry": "0x292Bf89bcf1DbbD3376C9ace2fc0508Cf4a77FdE"
}
python -m raiden_contracts.deploy token --rpc-provider $ROPSTEN --private-key $ROPPRIV --gas-price 12 --token-supply 20000000 --token-name ServiceToken --token-decimals 18 --token-symbol SVT
{
"CustomToken": "0xCba0eE5610622061D3967764A5aDf6e43AA440Bc"
}
python -m raiden_contracts.deploy services --rpc-provider $ROPSTEN --private-key $ROPPRIV --gas-price 12 --gas-limit 6000000 --token-address 0xCba0eE5610622061D3967764A5aDf6e43AA440Bc
{
"ServiceRegistry": "0x5d5a76e0A773ad776A4d352D87efaCcC7875C92B",
"UserDeposit": "0xCa8c271056AD479d2b11c39960b9eEAadC8b073B",
"MonitoringService": "0x266E4210297B0eb69E3A00b36739aA0273c04bEe",
"OneToN": "0x2b886eb4604C9d5f98E91942B0F609ECe4010307"
}
python -m raiden_contracts.deploy token --rpc-provider $ROPSTEN --private-key $ROPPRIV --gas-price 13 --token-supply 10000000 --token-name TestToken --token-decimals 18 --token-symbol TTT
{
"CustomToken": "0xb5cffC722D8b24cBfbb9D3f2690A2875CC79d2fC"
}
python -m raiden_contracts.deploy register --rpc-provider $ROPSTEN --private-key $ROPPRIV --gas-price 12 --token-address 0xb5cffC722D8b24cBfbb9D3f2690A2875CC79d2fC --registry-address 0x292Bf89bcf1DbbD3376C9ace2fc0508Cf4a77FdE
Rinkeby deployment log
python -m raiden_contracts.deploy raiden --rpc-provider $RINKEBY --private-key $RINKPRIV --gas-price 11 --gas-limit 6000000
{
"EndpointRegistry": "0x65a3006635771AB5f1996BCF6272C367386C0a0e",
"SecretRegistry": "0x6b24F2F359c58B111494D4C2Ed28cC237Dd84eDa",
"TokenNetworkRegistry": "0x4777a010E8De0DE5A88a74295AddDe9B2F41Abb1"
}
python -m raiden_contracts.deploy token --rpc-provider $RINKEBY --private-key $RINKPRIV --gas-price 12 --token-supply 20000000 --token-name ServiceToken --token-decimals 18 --token-symbol SVT
{
"CustomToken": "0x5c5A5356aBa7582C9C0AFD9d7a811e4d70d216c3"
}
python -m raiden_contracts.deploy services --rpc-provider $RINKEBY --private-key $RINKPRIV --gas-price 12 --gas-limit 6000000 --token-address 0x5c5A5356aBa7582C9C0AFD9d7a811e4d70d216c3
{
"ServiceRegistry": "0xc5C8B595f8A0fd3384517Fe2F1c93796a7389812",
"UserDeposit": "0x96E44f9BC38d2843F702df14103543654f0E41C9",
"MonitoringService": "0xB2d5c8f6f544112d6faBC5661bD1008158271583",
"OneToN": "0x3e7D70a72781aF9550dD475f70A4FfbA8E7EF344"
}
python -m raiden_contracts.deploy token --rpc-provider $RINKEBY --private-key $RINKPRIV --gas-price 13 --token-supply 10000000 --token-name TestToken --token-decimals 18 --token-symbol TTT
{
"CustomToken": "0xDA983981FDF10E75bd0b7eE436CDac712D3A5Bee"
}
python -m raiden_contracts.deploy register --rpc-provider $RINKEBY --private-key $RINKPRIV --gas-price 12 --token-address 0xDA983981FDF10E75bd0b7eE436CDac712D3A5Bee --registry-address 0x4777a010E8De0DE5A88a74295AddDe9B2F41Abb1
Kovan deployment log
export KOVAN=http://parity.kovan.ethnodes.brainbot.com:8545
export KOPRIV=/home/yoichi/import/parity/keys/kovan/UTC--2019-01-08T17-09-24Z--fcf0e5e3-7d74-7abc-773e-a2ccab085547
python -m raiden_contracts.deploy raiden --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 11 --gas-limit 6000000
{
"EndpointRegistry": "0xB652FE56950F621Fe10Ba2b45D56E7DA932793db",
"SecretRegistry": "0x0800D50749E4d48ed3994E7052748A51Dc4Ea5Cd",
"TokenNetworkRegistry": "0x73fC67791f1B0a7dFE07300C58502214eB0bC1AA"
}
python -m raiden_contracts.deploy token --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 12 --token-supply 20000000 --token-name ServiceToken --token-decimals 18 --token-symbol SVT
{
"CustomToken": "0x1365f343fdeC99EdE5674590e0284d0BddaB6f1e"
}
python -m raiden_contracts.deploy services --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 12 --gas-limit 6000000 --token-address 0x1365f343fdeC99EdE5674590e0284d0BddaB6f1e
{
"ServiceRegistry": "0x573C8c23A57033888707943feb599F3cEE153687",
"UserDeposit": "0x417c7AA2516a66A485bd116d262830e78A6987Cf",
"MonitoringService": "0x7619D6af3A615A19A285b01C680A48253bBaAFac",
"OneToN": "0xf70c64f5808B52200158058038D393D94809AbD4"
}
python -m raiden_contracts.deploy token --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 13 --token-supply 10000000 --token-name TestToken --token-decimals 18 --token-symbol TTT
{
"CustomToken": "0x933caca11b25DD0Fee508d4954Df3b3612CCf2A0"
}
python -m raiden_contracts.deploy register --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 12 --token-address 0x933caca11b25DD0Fee508d4954Df3b3612CCf2A0 --registry-address 0x73fC67791f1B0a7dFE07300C58502214eB0bC1AA
raiden-contracts 0.11.0 is visible on PyPI.
The 0.11.0 release is to use a new fake token instead of testnets WETHs.