Skip to content

Commit

Permalink
devex: switch Ropsten --> Goerli
Browse files Browse the repository at this point in the history
TODO: update delegatedSending, linearSR, and conditionalSR in `contracts.js`
  • Loading branch information
tomholford committed Oct 26, 2022
1 parent 6bf0691 commit b660379
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VITE_DEV_MNEMONIC='benefit crew supreme gesture quantum web media hazard theory mercy wing kitten'
VITE_DEV_GALAXY_TICKET='~wacfus-dabpex-danted-mosfep-pasrud-lavmer-nodtex-taslus-pactyp-milpub-pildeg-fornev-ralmed-dinfeb-fopbyr-sanbet-sovmyl-dozsut-mogsyx-mapwyc-sorrup-ricnec-marnys-lignex'
VITE_ROPSTEN_KEY='b7d2af9f01534031ba773374f766ef65'
VITE_GOERLI_KEY='b7d2af9f01534031ba773374f766ef65'
VITE_HD_PATH="m/44'/60'/0'/0/0"
VITE_STUB_LOCAL='false'
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/l2-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem. If possible, please also copy and paste any errors that appear in your browser's dev console. Here are [Chrome's docs](https://developers.google.com/web/tools/chrome-devtools/open) for using this feature.

**Ethereum network:**
Were you testing on Ropsten or mainnet?
Were you testing on Goerli or mainnet?

**Desktop (please complete the following information):**
- OS: [e.g. MacOS 10.15.3]
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ Automated tests for critical user journeys are coming Soon™️. Until then, he

"As a user, I can create a new invite"

First, in `Bridge.js`, set the `INITIAL_NETWORK_TYPE` to Ropsten:
First, in `Bridge.js`, set the `INITIAL_NETWORK_TYPE` to Goerli:
```js
const INITIAL_NETWORK_TYPE = NETWORK_TYPES.ROPSTEN;
const INITIAL_NETWORK_TYPE = NETWORK_TYPES.GOERLI;
```

Then, in `tank.js`, set the port to `3011`:
Expand All @@ -142,7 +142,7 @@ const baseUrl = 'https://gas-tank.urbit.org:3011';
3. Download the Passport file, then use the enclosed Master Ticket and ID to login to Bridge again
### Known Issues

When testing the invite acceptance and login flow on Ropsten, some of the Azimuth API calls will fail (e.g., `getConditional`).
When testing the invite acceptance and login flow on Goerli, some of the Azimuth API calls will fail (e.g., `getConditional`).

## Releases

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@
"preview:mainnet": "VITE_MAINNET=true vite preview --port 3000",
"start": "vite",
"build": "VITE_MAINNET=true vite build",
"build:ropsten": "VITE_ROPSTEN=true vite build",
"build:goerli": "VITE_GOERLI=true vite build",
"test": "echo 'TODO: set up vitest'",
"checksum": "cd build && find . -exec shasum -a256 {} ';' > ../checksums.txt && cd ..",
"zip": "BRIDGE_VERSION=${VITE_BRIDGE_VERSION:-$npm_package_version}; zip -ur bridge-$BRIDGE_VERSION.zip README.md bridge-https.py checksums.txt && cd build && zip -ur ../bridge-$BRIDGE_VERSION.zip ./* && cd ..",
"release": "npm install && npm run build && npm run checksum && npm run zip",
"release:ropsten": "export VITE_BRIDGE_VERSION=$npm_package_version\"r\"; npm install && npm run build:ropsten && npm run checksum && npm run zip",
"release:goerli": "export VITE_BRIDGE_VERSION=$npm_package_version\"r\"; npm install && npm run build:goerli && npm run checksum && npm run zip",
"pilot:ganache": "ganache-cli --blockTime 1 --networkId 5 --host '0.0.0.0' -m 'benefit crew supreme gesture quantum web media hazard theory mercy wing kitten' > /dev/null &",
"pilot:setup": "npm run pilot:ganache && truffle deploy",
"pilot": "HTTPS=true npm-run-all pilot:setup start pilot:cleanup --continue-on-error",
Expand All @@ -138,7 +138,7 @@
"pilot-residents": "WITH_TEST_STATE=RESIDENTS npm run pilot",
"pilot-l2": "BROWSER=NONE WITH_TEST_STATE=L2 HTTPS=false NODE_ENV=development npm-run-all pilot:setup start pilot:cleanup --continue-on-error",
"pilot-l2-local": "BROWSER=NONE VITE_L2=true HTTPS=false NODE_ENV=development npm run start --continue-on-error",
"pilot-ropsten": "VITE_ROPSTEN=true HTTPS=true npm-run-all start --continue-on-error",
"pilot-goerli": "VITE_GOERLI=true HTTPS=true npm-run-all start --continue-on-error",
"pilot:cleanup": "pkill -f ganache-cli",
"lint:check": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx}'",
Expand Down
6 changes: 3 additions & 3 deletions src/Bridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ROUTE_NAMES } from 'lib/routeNames';
import { ROUTES } from 'lib/router';
import { NETWORK_TYPES } from 'lib/network';
import { walletFromMnemonic } from 'lib/wallet';
import { isDevelopment, isMainnet, isRopsten } from 'lib/flags';
import { isDevelopment, isMainnet, isGoerli } from 'lib/flags';
import useImpliedTicket from 'lib/useImpliedTicket';
import useHasDisclaimed from 'lib/useHasDisclaimed';

Expand All @@ -26,8 +26,8 @@ import { Box } from '@tlon/indigo-react';
import LoadingOverlay from 'components/L2/LoadingOverlay';
import { useRollerPoller } from 'lib/useRollerPoller';

const INITIAL_NETWORK_TYPE = isRopsten
? NETWORK_TYPES.ROPSTEN
const INITIAL_NETWORK_TYPE = isGoerli
? NETWORK_TYPES.GOERLI
: isDevelopment && !isMainnet
? NETWORK_TYPES.LOCAL
: NETWORK_TYPES.MAINNET;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const NONCUSTODIAL_WALLETS = new Set([

const ROLLER_HOSTS = {
LOCAL: 'localhost',
ROPSTEN: 'roller-tmp.urbit.org',
GOERLI: 'roller-tmp.urbit.org',
MAINNET: 'roller.urbit.org',
};

Expand Down
10 changes: 5 additions & 5 deletions src/lib/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const CONTRACT_ADDRESSES = {
linearSR: '0x03C3dC12BE658158D1d7F9e66E08ec4099c568e4',
conditionalSR: '0x35EB3B102d9C1B69Ac1469C1B1FE1799850CD3EB',
},
ROPSTEN: {
azimuth: '0x308ab6a6024cf198b57e008d0ac9ad0219886579',
delegatedSending: '0x3e8ca510354bc2fdbbd6150252d93105c9c27bbe',
linearSR: '0x1f8edd031ee414740aedb39b84fb8f2f66ca422f',
conditionalSR: '0x1f8edd031ee414740aedb39b84fb8f2f66ca422f',
GOERLI: {
azimuth: '0xbB61Fa683E4B910418E27b00a1438a936234df52',
delegatedSending: '0x3e8ca510354bc2fdbbd6150252d93105c9c27bbe', // TODO
linearSR: '0x1f8edd031ee414740aedb39b84fb8f2f66ca422f', // TODO
conditionalSR: '0x1f8edd031ee414740aedb39b84fb8f2f66ca422f', // TODO
},
MAINNET: {
azimuth: '0x223c067f8cf28ae173ee5cafea60ca44c335fecb',
Expand Down
4 changes: 2 additions & 2 deletions src/lib/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function useEtherscanDomain() {
const { networkType } = useNetwork();

switch (networkType) {
case NETWORK_TYPES.ROPSTEN:
return 'https://ropsten.etherscan.io';
case NETWORK_TYPES.GOERLI:
return 'https://goerli.etherscan.io';
case NETWORK_TYPES.OFFLINE:
case NETWORK_TYPES.MAINNET:
case NETWORK_TYPES.LOCAL:
Expand Down
4 changes: 2 additions & 2 deletions src/lib/flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { version } from '../../package.json';

// are we running bridge in a development build
export const isDevelopment = import.meta.env.DEV === 'development';
export const isRopsten = import.meta.env.VITE_ROPSTEN === 'true';
export const isGoerli = import.meta.env.VITE_GOERLI === 'true';
export const isMainnet = import.meta.env.VITE_MAINNET === 'true';
export const versionLabel =
import.meta.env.VITE_BRIDGE_VERSION || `${version}${isRopsten ? 'r' : ''}`;
import.meta.env.VITE_BRIDGE_VERSION || `${version}${isGoerli ? 'g' : ''}`;
export const providedRollerOptions = {
host: import.meta.env.VITE_ROLLER_HOST,
port: import.meta.env.VITE_ROLLER_PORT,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/getSuggestedGasPrice.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const defaultGasValues = value => ({

export default async function getSuggestedGasPrice(networkType) {
switch (networkType) {
case NETWORK_TYPES.ROPSTEN:
case NETWORK_TYPES.GOERLI:
return defaultGasValues(10);
case NETWORK_TYPES.OFFLINE:
return defaultGasValues(DEFAULT_GAS_PRICE_GWEI);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/inviteMail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// did not succeed", you might need to visit localhost:3001 or whatever
// explicitly and tell your browser that's safe to access.
// https://stackoverflow.com/a/53011185/1334324
import { isRopsten } from './flags';
import { isGoerli } from './flags';

const port = isRopsten ? '3012' : '3002';
const port = isGoerli ? '3012' : '3002';
const baseUrl = `https://onboarding-emails.urbit.org:${port}`;

function sendRequest(where, what) {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/network.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
const NETWORK_TYPES = {
OFFLINE: Symbol('OFFLINE'),
LOCAL: Symbol('LOCAL'),
ROPSTEN: Symbol('ROPSTEN'),
GOERLI: Symbol('GOERLI'),
MAINNET: Symbol('MAINNET'),
};

const renderNetworkType = network =>
network === NETWORK_TYPES.OFFLINE
? 'Offline'
: network === NETWORK_TYPES.ROPSTEN
? 'Ropsten'
: network === NETWORK_TYPES.GOERLI
? 'Goerli'
: network === NETWORK_TYPES.MAINNET
? 'Main Network'
: network === NETWORK_TYPES.LOCAL
Expand All @@ -20,8 +20,8 @@ const chainIdToNetworkType = chainId => {
switch (chainId) {
case '0x1':
return NETWORK_TYPES.MAINNET;
case '0x3':
return NETWORK_TYPES.ROPSTEN;
case '0x5':
return NETWORK_TYPES.GOERLI;
default:
return NETWORK_TYPES.LOCAL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/tank.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import retry from 'async-retry';
import { toBN } from 'web3-utils';
import { RETRY_OPTIONS, waitForTransactionConfirm } from './txn';
import { isRopsten } from './flags';
import { isGoerli } from './flags';

const TANK_ADDRESS = '0x40f0A6db85f8D7A54fF3eA915b040dE8Cd4A0Eb5';

//NOTE if accessing this in a localhost configuration fails with "CORS request
// did not succeed", you might need to visit localhost:3001 or whatever
// explicitly and tell your browser that's safe to access.
// https://stackoverflow.com/a/53011185/1334324
const port = isRopsten ? '3011' : '3001';
const port = isGoerli ? '3011' : '3001';
const baseUrl = `https://gas-tank.urbit.org:${port}`;

function sendRequest(where, what) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib/txn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ const signTransaction = async ({
type: toHex(EIP1559_TRANSACTION_TYPE),
}

// TODO: Ropsten will sunset Q4 2022, need to replace w/ support for Goerli
const chain =
networkType === NETWORK_TYPES.ROPSTEN ? Chain.Ropsten : Chain.Mainnet;
networkType === NETWORK_TYPES.GOERLI ? Chain.Goerli : Chain.Mainnet;

const txConfig: TxOptions = {
freeze: false,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/useRollerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Options } from '@urbit/roller-api';
import { useMemo } from 'react';
import { ROLLER_HOSTS, ROLLER_PATH } from './constants';
import { convertToInt } from './convertToInt';
import { isMainnet, isRopsten, providedRollerOptions } from './flags';
import { isMainnet, isGoerli, providedRollerOptions } from './flags';

type TransportType =
| 'websocket'
Expand Down Expand Up @@ -30,17 +30,17 @@ export const useRollerOptions = () => {
const options: Options = useMemo(() => {
const type =
(providedType as TransportType | undefined) ||
(isMainnet || isRopsten ? 'https' : 'http');
(isMainnet || isGoerli ? 'https' : 'http');
const host =
providedHost ||
(isMainnet
? ROLLER_HOSTS.MAINNET
: isRopsten
? ROLLER_HOSTS.ROPSTEN
: isGoerli
? ROLLER_HOSTS.GOERLI
: ROLLER_HOSTS.LOCAL);
const port =
(providedPort && convertToInt(providedPort, 10)) ||
(isMainnet || isRopsten ? 443 : 8080);
(isMainnet || isGoerli ? 443 : 8080);
const path = ROLLER_PATH;

return {
Expand Down
6 changes: 3 additions & 3 deletions src/store/network.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ function _useNetwork(initialNetworkType = null) {
);
return;
}
case NETWORK_TYPES.ROPSTEN: {
const endpoint = `https://ropsten.infura.io/v3/${import.meta.env.VITE_INFURA_ENDPOINT}`;
case NETWORK_TYPES.GOERLI: {
const endpoint = `https://goerli.infura.io/v3/${import.meta.env.VITE_INFURA_ENDPOINT}`;

initWeb3(
new Web3.providers.HttpProvider(endpoint),
CONTRACT_ADDRESSES.ROPSTEN
CONTRACT_ADDRESSES.GOERLI
);
return;
}
Expand Down

0 comments on commit b660379

Please sign in to comment.