Development
TODO: update links from old monorepo
Deploying Dev Setup
This section goes through the steps of adding a new development network to nomad-deploy
and deploying a new set of dev contracts. If you will not be adding a new network, please skip to Deploying the Contracts to Dev. If you are looking to deploy a new network to the production setup, please refer to the separate page on deploying new contracts to production.
Add a New Network Config
If you are looking to add a new network to your dev setup, you will need to create a new config file for that network in typescript/nomad-deploy/config/testnets
.
Copy the contents of one of the existing network's files into a new file titled
<new_network_name>.ts
.Rename the
process.env
variables (deployer key and RPC URL) such that they pull from the.env
variables for your new network.Set the
chainJson
fields appropriately. For dev, this usually just means updating the following fields:name
,domain
,timelag
.Set the
devConfig
andstagingConfig
object fields appropriately. In practice, for dev, you leavedevConfig
the same and only updatestagingConfig.optimisticSeconds
.
Writing a New Deploy Script
Now that you've added a new network config, you must write a new deploy script that includes your new network.
Duplicate the contents of an existing folder in
typescript/nomad-deploy/scripts
(core.ts
andbridge.ts
) and put them in a new folder for your new deploy script.In
core.ts
andbridge.ts
adjust any import paths to pull in your new network config fromtypescript/nomad-deploy/config/testnets
.Add or remove any other existing networks in
core.ts
andbridge.ts
and ensure that theCoreDeploy
objects for the desired networks are used in thedeployTwoChains
ordeployNChains
calls at the bottom of the files.Add new npm scripts to
typescript/nomad-deploy/package.json
that execute your newcore.ts
andbridge.ts
files. The scripts will look like the following:
Deploying the Contracts to Dev
The following section walks through the steps for deploying a new set of contracts to dev.
Clone the monorepo and take a look at nomad-deploy.
Populate
.env.example
with the required RPC endpoints and funded deployer keys -- place it attypescript/nomad-deploy/.env
, see the examplePrepare Local Dependencies
nomad-deploy
is configured to use the local versions of the Nomad typechain interface and the Nomad SDK, as such the local Node modules must be initialized.
Install Dependencies
Execute a Deploy Script
Note: See below for more details about the available deployment scripts.
Commit Outputted Configs
If all goes according to plan, you will have a new folder at rust/config/<timestamp>
containing JSON files that are used by the Off-Chain Agents. Please rename this folder appropriately (development
if this will become the new dev setup). When committed to the monorepo, the config files are automatically bundled into the resultant Agent docker image in CI.
Note: Deployment environments may be overridden by replacing the environment's config folder with the contents of your new timestamped configuration.
Updating Nomad SDK Dev Addresses
If your newly deployed setup will become the new dev setup, you will need to adjust the hardcoded domains, indexing parameters, and addresses in the Nomad SDK. Go to typescript/nomad-sdk/src/nomad/domains/dev.ts
. For each NomadDomain
object:
Update the indexing parameters (
blocks
andfrom
) with thechunk
andfrom
fields fromrust/config/development/<network>_config.json
.Replace all addresses with those in the the newly outputted config file
rust/config/development/<network>_contracts.json
. For the home and replica addresses, use the proxy addresses.If you deployed a new network that has not been seen before, add a new
NomadDomain
object and fill it with the correct fields.
Last updated