Skip to content

Commit 73d3ad1

Browse files
authored
🪦 poa ganache (#11367)
1 parent f74778f commit 73d3ad1

13 files changed

+36
-119
lines changed

.circleci/config.yml

-5
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,10 @@ workflows:
337337
comms/.* run-discovery-workflow true
338338
packages/identity-service/.* run-identity-workflow true
339339
eth-contracts/.* run-eth-contracts-workflow true
340-
contracts/.* run-contracts-workflow true
341340
.circleci/.* run-discovery-workflow true
342341
.circleci/.* run-identity-workflow true
343342
.circleci/.* run-eth-contracts-workflow true
344343
.circleci/.* run-protocol-dashboard-workflow true
345-
.circleci/.* run-contracts-workflow true
346344
.circleci/.* run-sdk-workflow true
347345
.circleci/.* run-web-workflow true
348346
.circleci/.* run-mobile-workflow true
@@ -389,12 +387,10 @@ workflows:
389387
comms/.* run-discovery-workflow true
390388
packages/identity-service/.* run-identity-workflow true
391389
eth-contracts/.* run-eth-contracts-workflow true
392-
contracts/.* run-contracts-workflow true
393390
.circleci/.* run-discovery-workflow true
394391
.circleci/.* run-identity-workflow true
395392
.circleci/.* run-eth-contracts-workflow true
396393
.circleci/.* run-protocol-dashboard-workflow true
397-
.circleci/.* run-contracts-workflow true
398394
.circleci/.* run-sdk-workflow true
399395
.circleci/.* run-web-workflow true
400396
.circleci/.* run-mobile-workflow true
@@ -437,7 +433,6 @@ workflows:
437433
mapping: |
438434
.* run-integration-workflow true
439435
.* run-eth-contracts-workflow true
440-
.* run-contracts-workflow true
441436
.* run-release-workflow true
442437
.* run-sdk-workflow true
443438
requires:

.circleci/src/workflows/contracts.yml

-6
This file was deleted.

dev-tools/audius-compose

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ audius-protocol-creator-node-1 audius-protocol-creator-node-2 audius-protocol-cr
2121
audius-protocol-identity-service-1 \
2222
audius-protocol-solana-test-validator-1 \
2323
audius-protocol-eth-ganache-1 \
24-
audius-protocol-poa-ganache-1 \
2524
audius-protocol-pedalboard \
2625
audius-protocol-anti-abuse-oracle-1 \
2726
audius-protocol-discovery-provider-redis-1 \

dev-tools/compose/docker-compose.blockchain.yml

-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
version: '3.9'
22

33
services:
4-
poa-ganache:
5-
image: audius/poa-ganache:latest
6-
command: bash /tmp/dev-tools/startup/poa-ganache.sh
7-
volumes:
8-
- poa-contracts-abis:/usr/src/app/build/contracts
9-
- ${PROJECT_ROOT}/dev-tools:/tmp/dev-tools
10-
ports:
11-
- '8545:8545'
12-
deploy:
13-
mode: global
14-
profiles:
15-
- chain
164

175
eth-ganache:
186
image: audius/eth-ganache:latest

dev-tools/compose/docker-compose.discovery.prod.yml

-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ services:
157157
depends_on:
158158
db:
159159
condition: service_healthy
160-
poa-ganache:
161-
condition: service_healthy
162160
eth-ganache:
163161
condition: service_healthy
164162
solana-test-validator:

dev-tools/compose/docker-compose.identity.prod.yml

-2
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ services:
8383
condition: service_healthy
8484
identity-service-redis:
8585
condition: service_healthy
86-
poa-ganache:
87-
condition: service_healthy
8886
eth-ganache:
8987
condition: service_healthy
9088
solana-test-validator:

dev-tools/compose/docker-compose.pedalboard.prod.yml

-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ services:
6767
condition: service_healthy
6868
discovery-provider-redis:
6969
condition: service_healthy
70-
poa-ganache:
71-
condition: service_healthy
7270

7371
solana-relay:
7472
build:

dev-tools/compose/docker-compose.test.yml

-37
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ services:
4848
limits:
4949
memory: 3G
5050

51-
poa-ganache:
52-
image: audius/poa-ganache:latest
53-
command: bash /tmp/dev-tools/startup/poa-ganache.sh
54-
volumes:
55-
- poa-contracts-abis:/usr/src/app/build/contracts
56-
- ${PROJECT_ROOT}/dev-tools:/tmp/dev-tools
57-
logging: *default-logging
58-
deploy:
59-
mode: global
60-
profiles:
61-
- tests
62-
- chain
63-
- poa
64-
6551
eth-ganache:
6652
image: audius/eth-ganache:latest
6753
command: bash /tmp/dev-tools/startup/eth-ganache.sh
@@ -205,29 +191,6 @@ services:
205191
profiles:
206192
- tests
207193

208-
# contracts
209-
test-contracts:
210-
user: ${DOCKER_UID:-root}:${DOCKER_GID:-root}
211-
build:
212-
context: ${PROJECT_ROOT}/contracts
213-
dockerfile: Dockerfile
214-
args:
215-
bootstrapSPIds: ${BOOTSTRAP_SP_IDS}
216-
bootstrapSPDelegateWallets: ${BOOTSTRAP_SP_DELEGATE_WALLETS}
217-
bootstrapSPOwnerWallets: ${BOOTSTRAP_SP_OWNER_WALLETS}
218-
entrypoint: sh -c '[ "$$1" = "test" ] || sleep inf && (shift; npm run test)' -
219-
logging: *default-logging
220-
deploy:
221-
mode: global
222-
depends_on:
223-
poa-ganache:
224-
condition: service_healthy
225-
profiles:
226-
- poa
227-
volumes:
228-
- ${PROJECT_ROOT}/contracts:/usr/src/app
229-
- /usr/src/app/node_modules
230-
231194
# eth-contracts
232195
test-eth-contracts:
233196
user: ${DOCKER_UID:-root}:${DOCKER_GID:-root}

dev-tools/compose/docker-compose.yml

-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ x-common: &common
2323
- 'audius-protocol-identity-service-1:host-gateway'
2424
- 'audius-protocol-solana-test-validator-1:host-gateway'
2525
- 'audius-protocol-eth-ganache-1:host-gateway'
26-
- 'audius-protocol-poa-ganache-1:host-gateway'
2726
- 'audius-protocol-pedalboard:host-gateway'
2827
deploy:
2928
resources:
@@ -218,12 +217,6 @@ services:
218217

219218
# Blockchain
220219

221-
poa-ganache:
222-
extends:
223-
file: docker-compose.blockchain.yml
224-
service: poa-ganache
225-
<<: *common
226-
227220
eth-ganache:
228221
extends:
229222
file: docker-compose.blockchain.yml

dev-tools/compose/nginx_ingress.conf

-19
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ server {
2828
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2929
}
3030

31-
location ~ ^/chain(/.*)?$ {
32-
resolver 127.0.0.11 valid=30s;
33-
proxy_pass http://audius-protocol-poa-ganache-1:8545/$1;
34-
proxy_set_header Host $http_host;
35-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36-
}
37-
3831
location ~ ^/relay(/.*)?$ {
3932
resolver 127.0.0.11 valid=30s;
4033
proxy_pass http://audius-protocol-relay-1:6001/relay$1;
@@ -250,18 +243,6 @@ server {
250243
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
251244
}
252245
}
253-
server {
254-
listen 80;
255-
server_name audius-protocol-poa-ganache-1;
256-
257-
location / {
258-
resolver 127.0.0.11 valid=30s;
259-
set $upstream audius-protocol-poa-ganache-1:8545;
260-
proxy_pass http://$upstream;
261-
proxy_set_header Host $http_host;
262-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
263-
}
264-
}
265246
server {
266247
listen 80;
267248
server_name audius-protocol-solana-test-validator-1;

packages/discovery-provider/plugins/pedalboard/apps/relay/src/index.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,16 @@ export let web3: providers.JsonRpcProvider
2626
export let wallets: WalletManager
2727

2828
const main = async () => {
29-
// async config
30-
const connectedWeb3 = await connectWeb3(config)
31-
web3 = connectedWeb3.web3
32-
config.acdcChainId = connectedWeb3.chainId.toString()
33-
wallets = new WalletManager(web3)
29+
if (config.environment !== "dev") {
30+
// async config
31+
const connectedWeb3 = await connectWeb3(config)
32+
web3 = connectedWeb3.web3
33+
config.acdcChainId = connectedWeb3.chainId.toString()
34+
wallets = new WalletManager(web3)
35+
} else {
36+
// needs to stay so decoding can happen correctly
37+
config.acdcChainId = "1337"
38+
}
3439

3540
// start webserver after async config
3641
const { serverHost, serverPort } = config

packages/discovery-provider/plugins/pedalboard/apps/relay/src/txRelay.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export const relayTransaction = async (
2424
const { validatedRelayRequest, logger, requestId } = res.locals.ctx
2525
const { encodedABI, gasLimit, contractAddress } = validatedRelayRequest
2626

27-
const senderWallet = wallets.selectNextWallet()
28-
const address = await senderWallet.getAddress()
2927
let nonce = undefined
3028
let submit = undefined
3129
try {
@@ -43,6 +41,9 @@ export const relayTransaction = async (
4341
}
4442
}
4543

44+
const senderWallet = wallets.selectNextWallet()
45+
const address = await senderWallet.getAddress()
46+
4647
// gather some transaction params
4748
nonce = await retryPromise(() => web3.getTransactionCount(address))
4849

@@ -63,7 +64,6 @@ export const relayTransaction = async (
6364
receipt.blockNumber += config.finalPoaBlock
6465
logger.info(
6566
{
66-
senderWallet: address,
6767
nonce,
6868
txHash: submit?.hash,
6969
blocknumber: receipt.blockNumber
@@ -73,7 +73,7 @@ export const relayTransaction = async (
7373
res.send({ receipt })
7474
} catch (e) {
7575
logger.error(
76-
{ senderWallet: address, nonce, txHash: submit?.hash },
76+
{ nonce, txHash: submit?.hash },
7777
'transaction submission failed'
7878
)
7979
internalError(next, e)

packages/identity-service/src/audiusLibsInstance.js

+22-17
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,27 @@ class AudiusLibsWrapper {
1818
}
1919

2020
async init() {
21-
const dataWeb3 = await AudiusLibs.Utils.configureWeb3(
22-
web3ProviderUrl,
23-
null,
24-
false
25-
)
26-
if (!dataWeb3) throw new Error('Web3 incorrectly configured')
21+
let web3Config
22+
if (config.get('environment') !== 'development') {
23+
const dataWeb3 = await AudiusLibs.Utils.configureWeb3(
24+
web3ProviderUrl,
25+
null,
26+
false
27+
)
28+
if (!dataWeb3) throw new Error('Web3 incorrectly configured')
29+
30+
web3Config = {
31+
registryAddress,
32+
useExternalWeb3: true,
33+
externalWeb3Config: {
34+
web3: dataWeb3,
35+
// this is a stopgap since libs external web3 init requires an ownerWallet
36+
// this is never actually used in the service's libs calls
37+
ownerWallet: config.get('relayerPublicKey')
38+
},
39+
entityManagerAddress
40+
}
41+
}
2742

2843
const discoveryProviderWhitelist = config.get('discoveryProviderWhitelist')
2944
? new Set(config.get('discoveryProviderWhitelist').split(','))
@@ -71,17 +86,7 @@ class AudiusLibsWrapper {
7186
config.get('ethProviderUrl'),
7287
config.get('ethOwnerWallet')
7388
),
74-
web3Config: {
75-
registryAddress,
76-
useExternalWeb3: true,
77-
externalWeb3Config: {
78-
web3: dataWeb3,
79-
// this is a stopgap since libs external web3 init requires an ownerWallet
80-
// this is never actually used in the service's libs calls
81-
ownerWallet: config.get('relayerPublicKey')
82-
},
83-
entityManagerAddress
84-
},
89+
web3Config,
8590
isServer: true,
8691
captchaConfig: { serviceKey: config.get('recaptchaServiceKey') },
8792
solanaWeb3Config,

0 commit comments

Comments
 (0)