Skip to content

Commit 5390898

Browse files
committed
adding many configs for the new version of the offhcain node repo
1 parent b18b613 commit 5390898

File tree

6 files changed

+209
-54
lines changed

6 files changed

+209
-54
lines changed

.prettierignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/allora/allora.ts

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,31 @@ new AlloraStack(app, 'allora-single-node', {
4747
throughput: process.env.EDGE_DATA_VOL_THROUGHPUT ? parseInt(process.env.EDGE_DATA_VOL_THROUGHPUT) : 700
4848
},
4949
alloraWorkerName: process.env.ALLORA_WORKER_NAME || 'aws',
50-
alloraTopicId: process.env.ALLORA_TOPIC_ID || '3',
5150
alloraEnv: process.env.ALLORA_ENV || 'dev',
52-
alloraNetworkName: process.env.ALLORA_NETWORK_NAME || 'edgenet',
53-
alloraAccountName: process.env.ALLORA_ACCOUNT_NAME || 'secret',
54-
alloraAccountMnemonic: process.env.ALLORA_ACCOUNT_MNEMONIC || 'secret',
55-
alloraAccountPassphrase: process.env.ALLORA_ACCOUNT_PASSPHRASE || 'secret',
56-
alloraNodeRpc: process.env.ALLORA_NODE_RPC || 'https://localhost:26657',
51+
52+
//Wallet config
53+
alloraWalletAddressKeyName: process.env.ALLORA_ACCOUNT_NAME || 'secret',
54+
alloraWalletAddressRestoreMnemonic: process.env.ALLORA_ACCOUNT_MNEMONIC || 'secret',
55+
alloraWalletHomeDir: process.env.ALLORA_WALLET_HOME_DIR || '',
56+
alloraWalletGas: process.env.ALLORA_WALLET_GAS || '1000000',
57+
alloraWalletGasAdjustment: process.env.ALLORA_WALLET_GAS_ADJUSTMENT || '1.0',
58+
alloraWalletNodeRpc: process.env.ALLORA_WALLET_NODE_RPC || 'https://localhost:26657',
59+
alloraWalletMaxRetries: process.env.ALLORA_WALLET_MAX_RETRIES || '1',
60+
alloraWalletDelay: process.env.ALLORA_WALLET_DELAY || '1',
61+
alloraWalletSubmitTx: process.env.ALLORA_WALLET_SUBMIT_TX || 'false',
62+
63+
//Worker Properties
64+
alloraWorkerTopicId: process.env.ALLORA_WORKER_TOPIC_ID || '1',
65+
alloraWorkerInferenceEntrypointName: process.env.ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME || 'api-worker-reputer',
66+
alloraWorkerInferenceEndpoint: process.env.ALLORA_WORKER_INFERENCE_ENDPOINT || 'http://source:8000/inference/{Token}',
67+
alloraWorkerLoopSeconds: process.env.ALLORA_WORKER_LOOP_SECONDS || '30',
68+
alloraWorkerToken: process.env.ALLORA_WORKER_TOKEN || 'ethereum',
69+
70+
//Reputer Properties
71+
alloraReputerTopicId: process.env.ALLORA_REPUTER_TOPIC_ID || '1',
72+
alloraReputerEntrypointName: process.env.ALLORA_REPUTER_ENTRYPOINT_NAME || 'api-worker-reputer',
73+
alloraReputerSourceOfTruthEndpoint: process.env.ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT || 'http://source:8888/truth/{Token}/{BlockHeight}',
74+
alloraReputerLoopSeconds: process.env.ALLORA_REPUTER_LOOP_SECONDS || '30',
75+
alloraReputerToken: process.env.ALLORA_REPUTER_TOKEN || 'ethereum',
76+
alloraReputerMinStake: process.env.ALLORA_REPUTER_MIN_STAKE || '100000',
5777
});

lib/allora/lib/allora-stack.ts

Lines changed: 76 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,30 @@ export interface AlloraStackProps extends cdk.StackProps {
2626
dataVolume: configTypes.DataVolumeConfig;
2727
env: AlloraStackEnvironment
2828
alloraWorkerName: string;
29-
alloraTopicId: string;
3029
alloraEnv: string;
31-
alloraNetworkName: string;
32-
alloraAccountName: string;
33-
alloraAccountMnemonic: string;
34-
alloraAccountPassphrase: string;
35-
alloraNodeRpc: string;
30+
31+
alloraWalletAddressKeyName: string;
32+
alloraWalletAddressRestoreMnemonic: string;
33+
alloraWalletHomeDir: string;
34+
alloraWalletGas: string,
35+
alloraWalletGasAdjustment: string;
36+
alloraWalletNodeRpc: string;
37+
alloraWalletMaxRetries: string;
38+
alloraWalletDelay: string;
39+
alloraWalletSubmitTx: string;
40+
41+
alloraWorkerTopicId: string;
42+
alloraWorkerInferenceEntrypointName: string;
43+
alloraWorkerInferenceEndpoint: string;
44+
alloraWorkerLoopSeconds: string;
45+
alloraWorkerToken: string;
46+
47+
alloraReputerTopicId: string;
48+
alloraReputerEntrypointName: string;
49+
alloraReputerSourceOfTruthEndpoint: string;
50+
alloraReputerLoopSeconds: string;
51+
alloraReputerToken: string;
52+
alloraReputerMinStake: string;
3653
}
3754

3855

@@ -46,13 +63,33 @@ export class AlloraStack extends cdk.Stack {
4663
resourceNamePrefix,
4764
dataVolume,
4865
alloraWorkerName,
49-
alloraTopicId,
50-
alloraEnv,
51-
alloraNetworkName,
52-
alloraAccountName,
53-
alloraAccountMnemonic,
54-
alloraAccountPassphrase,
55-
alloraNodeRpc
66+
alloraEnv,
67+
68+
//wallet props
69+
alloraWalletAddressKeyName,
70+
alloraWalletAddressRestoreMnemonic,
71+
alloraWalletHomeDir,
72+
alloraWalletGas,
73+
alloraWalletGasAdjustment,
74+
alloraWalletNodeRpc,
75+
alloraWalletMaxRetries,
76+
alloraWalletDelay,
77+
alloraWalletSubmitTx,
78+
79+
//worker props
80+
alloraWorkerTopicId,
81+
alloraWorkerInferenceEntrypointName,
82+
alloraWorkerInferenceEndpoint,
83+
alloraWorkerLoopSeconds,
84+
alloraWorkerToken,
85+
86+
//reputer props
87+
alloraReputerTopicId,
88+
alloraReputerEntrypointName,
89+
alloraReputerSourceOfTruthEndpoint,
90+
alloraReputerLoopSeconds,
91+
alloraReputerToken,
92+
alloraReputerMinStake,
5693
} = props;
5794
const { region } = env;
5895

@@ -137,13 +174,33 @@ export class AlloraStack extends cdk.Stack {
137174
_STACK_NAME_: STACK_NAME,
138175
_STACK_ID_: STACK_ID,
139176
_ALLORA_WORKER_NAME_: alloraWorkerName,
140-
_ALLORA_TOPIC_ID_: alloraTopicId,
141177
_ALLORA_ENV_: alloraEnv,
142-
_ALLORA_NETWORK_NAME_ : alloraNetworkName,
143-
_ALLORA_ACCOUNT_NAME_ : alloraAccountName,
144-
_ALLORA_ACCOUNT_MNEMONIC_ : alloraAccountMnemonic,
145-
_ALLORA_ACCOUNT_PASSPHRASE_ : alloraAccountPassphrase,
146-
_ALLORA_NODE_RPC_ : alloraNodeRpc,
178+
179+
//wallet config
180+
_ALLORA_WALLET_ADDRESS_KEY_NAME_ : alloraWalletAddressKeyName,
181+
_ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC_ : alloraWalletAddressRestoreMnemonic,
182+
_ALLORA_WALLET_HOME_DIR_: alloraWalletHomeDir,
183+
_ALLORA_WALLET_GAS_: alloraWalletGas,
184+
_ALLORA_WALLET_GAS_ADJUSTMENT_: alloraWalletGasAdjustment,
185+
_ALLORA_WALLET_NODE_RPC_: alloraWalletNodeRpc,
186+
_ALLORA_WALLET_MAX_RETRIES_: alloraWalletMaxRetries,
187+
_ALLORA_WALLET_DELAY_: alloraWalletDelay,
188+
_ALLORA_WALLET_SUBMIT_TX_: alloraWalletSubmitTx,
189+
190+
//worker config
191+
_ALLORA_WORKER_TOPIC_ID: alloraWorkerTopicId,
192+
_ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME_: alloraWorkerInferenceEntrypointName,
193+
_ALLORA_WORKER_INFERENCE_ENDPOINT_: alloraWorkerInferenceEndpoint,
194+
_ALLORA_WORKER_LOOP_SECONDS_: alloraWorkerLoopSeconds,
195+
_ALLORA_WORKER_TOKEN_: alloraWorkerToken,
196+
197+
//reputer config
198+
_ALLORA_REPUTER_TOPIC_ID: alloraReputerTopicId,
199+
_ALLORA_REPUTER_ENTRYPOINT_NAME_: alloraReputerEntrypointName,
200+
_ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT_: alloraReputerSourceOfTruthEndpoint,
201+
_ALLORA_REPUTER_LOOP_SECONDS_: alloraReputerLoopSeconds,
202+
_ALLORA_REPUTER_TOKEN_: alloraReputerToken,
203+
_ALLORA_REPUTER_MIN_STAKE_: alloraReputerMinStake
147204
});
148205

149206
// Create UserData for EC2 instance

lib/allora/lib/assets/user-data/node.sh

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,34 @@ echo "ASSETS_S3_PATH=${_ASSETS_S3_PATH_}" >> /etc/environment
88
echo "RESOURCE_ID=${_NODE_CF_LOGICAL_ID_}" >> /etc/environment
99
echo "STACK_NAME=${_STACK_NAME_}" >> /etc/environment
1010
echo "STACK_ID=${_STACK_ID_}" >> /etc/environment
11+
1112
echo "ALLORA_WORKER_NAME=${_ALLORA_WORKER_NAME_}" >> /etc/environment
12-
echo "ALLORA_TOPIC_ID=${_ALLORA_TOPIC_ID_}" >> /etc/environment
1313
echo "ALLORA_ENV=${_ALLORA_ENV_}" >> /etc/environment
14-
echo "ALLORA_NETWORK_NAME=${_ALLORA_NETWORK_NAME_}" >> /etc/environment
15-
echo "ALLORA_ACCOUNT_NAME=${_ALLORA_ACCOUNT_NAME_}" >> /etc/environment
16-
echo "ALLORA_ACCOUNT_MNEMONIC=${_ALLORA_ACCOUNT_MNEMONIC_}" >> /etc/environment
17-
echo "ALLORA_ACCOUNT_PASSPHRASE=${_ALLORA_ACCOUNT_PASSPHRASE_}" >> /etc/environment
18-
echo "ALLORA_NODE_RPC=${_ALLORA_NODE_RPC_}" >> /etc/environment
14+
15+
16+
echo "ALLORA_WALLET_ADDRESS_KEY_NAME=${_ALLORA_WALLET_ADDRESS_KEY_NAME_}" >> /etc/environment
17+
echo "ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC=${_ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC_}" >> /etc/environment
18+
echo "ALLORA_WALLET_HOME_DIR=${_ALLORA_WALLET_HOME_DIR_}" >> /etc/environment
19+
echo "ALLORA_WALLET_GAS=${_ALLORA_WALLET_GAS_}" >> /etc/environment
20+
echo "ALLORA_WALLET_GAS_ADJUSTMENT=${_ALLORA_WALLET_GAS_ADJUSTMENT_}" >> /etc/environment
21+
echo "ALLORA_WALLET_NODE_RPC=${_ALLORA_WALLET_NODE_RPC_}" >> /etc/environment
22+
echo "ALLORA_WALLET_MAX_RETRIES=${_ALLORA_WALLET_MAX_RETRIES_}" >> /etc/environment
23+
echo "ALLORA_WALLET_DELAY=${_ALLORA_WALLET_DELAY_}" >> /etc/environment
24+
echo "ALLORA_WALLET_SUBMIT_TX=${_ALLORA_WALLET_SUBMIT_TX_}" >> /etc/environment
25+
26+
echo "ALLORA_WORKER_TOPIC_ID=${_ALLORA_WORKER_TOPIC_ID_}" >> /etc/environment
27+
echo "ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME=${_ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME_}" >> /etc/environment
28+
echo "ALLORA_WORKER_INFERENCE_ENDPOINT=${_ALLORA_WORKER_INFERENCE_ENDPOINT_}" >> /etc/environment
29+
echo "ALLORA_WORKER_LOOP_SECONDS=${_ALLORA_WORKER_LOOP_SECONDS_}" >> /etc/environment
30+
echo "ALLORA_WORKER_TOKEN=${_ALLORA_WORKER_TOKEN_}" >> /etc/environment
31+
32+
echo "ALLORA_REPUTER_TOPIC_ID=${_ALLORA_REPUTER_TOPIC_ID_}" >> /etc/environment
33+
echo "ALLORA_REPUTER_ENTRYPOINT_NAME=${_ALLORA_REPUTER_ENTRYPOINT_NAME_}" >> /etc/environment
34+
echo "ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT=${_ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT_}" >> /etc/environment
35+
echo "ALLORA_REPUTER_LOOP_SECONDS=${_ALLORA_REPUTER_LOOP_SECONDS_}" >> /etc/environment
36+
echo "ALLORA_REPUTER_TOKEN=${_ALLORA_REPUTER_TOKEN_}" >> /etc/environment
37+
echo "ALLORA_REPUTER_MIN_STAKE=${_ALLORA_REPUTER_MIN_STAKE_}" >> /etc/environment
38+
1939

2040
source /etc/environment
2141

@@ -63,12 +83,35 @@ cfn-signal -e $? --stack $STACK_NAME --resource $RESOURCE_ID --region $AWS_REGIO
6383
cd ~
6484
git clone https://github.com/allora-network/allora-offchain-node.git node-repo
6585
cd node-repo
66-
67-
touch .env
68-
echo "ALLORA_ACCOUNT_NAME=$ALLORA_ACCOUNT_NAME" >> .env
69-
echo "ALLORA_ACCOUNT_MNEMONIC=$ALLORA_ACCOUNT_MNEMONIC" >> .env
70-
echo "ALLORA_ACCOUNT_PASSPHRASE=$ALLORA_ACCOUNT_PASSPHRASE" >> .env
71-
echo "ALLORA_NODE_RPC=$ALLORA_NODE_RPC" >> .env
86+
git checkout $ALLORA_ENV
87+
88+
cp config.cdk.json.template config.json
89+
90+
#wallet config str replace
91+
sed -i "s/_ALLORA_WALLET_ADDRESS_KEY_NAME_/$ALLORA_WALLET_ADDRESS_KEY_NAME/" config.json
92+
sed -i "s/_ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC_/$ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC/" config.json
93+
sed -i "s/_ALLORA_WALLET_HOME_DIR_/$ALLORA_WALLET_HOME_DIR/" config.json
94+
sed -i "s/_ALLORA_WALLET_GAS_/$ALLORA_WALLET_GAS/" config.json
95+
sed -i "s/_ALLORA_WALLET_GAS_ADJUSTMENT_/$ALLORA_WALLET_GAS_ADJUSTMENT/" config.json
96+
sed -i "s/_ALLORA_WALLET_NODE_RPC_/$ALLORA_WALLET_NODE_RPC/" config.json
97+
sed -i "s/_ALLORA_WALLET_MAX_RETRIES_/$ALLORA_WALLET_MAX_RETRIES/" config.json
98+
sed -i "s/_ALLORA_WALLET_DELAY_/$ALLORA_WALLET_DELAY/" config.json
99+
sed -i "s/_ALLORA_WALLET_SUBMIT_TX_/$ALLORA_WALLET_SUBMIT_TX/" config.json
100+
101+
#worker config str replace
102+
sed -i "s/_ALLORA_WORKER_TOPIC_ID_/$ALLORA_WORKER_TOPIC_ID/" config.json
103+
sed -i "s/_ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME_/$ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME/" config.json
104+
sed -i "s/_ALLORA_WORKER_INFERENCE_ENDPOINT_/$ALLORA_WORKER_INFERENCE_ENDPOINT/" config.json
105+
sed -i "s/_ALLORA_WORKER_LOOP_SECONDS_/$ALLORA_WORKER_LOOP_SECONDS/" config.json
106+
sed -i "s/_ALLORA_WORKER_TOKEN_/$ALLORA_WORKER_TOKEN/" config.json
107+
108+
#reputer config str replace
109+
sed -i "s/_ALLORA_REPUTER_TOPIC_ID_/$ALLORA_REPUTER_TOPIC_ID/" config.json
110+
sed -i "s/_ALLORA_REPUTER_ENTRYPOINT_NAME_/$ALLORA_REPUTER_ENTRYPOINT_NAME/" config.json
111+
sed -i "s/_ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT_/$ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT/" config.json
112+
sed -i "s/_ALLORA_REPUTER_LOOP_SECONDS_/$ALLORA_REPUTER_LOOP_SECONDS/" config.json
113+
sed -i "s/_ALLORA_REPUTER_TOKEN_/$ALLORA_REPUTER_TOKEN/" config.json
114+
sed -i "s/_ALLORA_REPUTER_MIN_STAKE_/$ALLORA_REPUTER_MIN_STAKE/" config.json
72115

73116
docker-compose up --build
74117

lib/allora/sample-configs/.env-sample-full

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#allora node run config
22

33
#Must fill all these in
4-
ALLORA_ACCOUNT_NAME="xxxxxxxxxxx"
5-
ALLORA_ACCOUNT_MNEMONIC="xxxxxxxxxxx"
6-
ALLORA_ACCOUNT_PASSPHRASE="xxxxxxxxxxx"
4+
ALLORA_WALLET_ADDRESS_KEY_NAME="xxxxxxxxxxx"
5+
ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC="xxxxxxxxxxx"
76
AWS_ACCOUNT_ID="xxxxxxxxxxx"
87
###############################
98

10-
ALLORA_NODE_RPC=https://localhost:26657
119
AWS_RESOURCE_NAME_PREFIX="AlloraWorkerx"
1210
AWS_REGION="us-east-1"
1311
AWS_INSTANCE_TYPE="t3.medium"
@@ -23,6 +21,28 @@ EDGE_DATA_VOL_THROUGHPUT="125"
2321

2422
#Allora Node Worker Generation Config
2523
ALLORA_WORKER_NAME="aws"
26-
ALLORA_TOPIC_ID="3"
2724
ALLORA_ENV="dev"
28-
ALLORA_NETWORK_NAME="edgenet"
25+
26+
#wallet config
27+
ALLORA_WALLET_HOME_DIR=""
28+
ALLORA_WALLET_GAS="1000000"
29+
ALLORA_WALLET_GAS_ADJUSTMENT="1.0"
30+
ALLORA_WALLET_NODE_RPC="https://localhost:26657"
31+
ALLORA_WALLET_MAX_RETRIES="1"
32+
ALLORA_WALLET_DELAY="1"
33+
ALLORA_WALLET_SUBMIT_TX="false"
34+
35+
#worker config
36+
ALLORA_WORKER_TOPIC_ID="1"
37+
ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME="api-worker-reputer"
38+
ALLORA_WORKER_INFERENCE_ENDPOINT="http://source:8000/inference/{Token}"
39+
ALLORA_WORKER_LOOP_SECONDS="30"
40+
ALLORA_WORKER_TOKEN="ethereum"
41+
42+
#reputer config
43+
ALLORA_REPUTER_TOPIC_ID="1"
44+
ALLORA_REPUTER_ENTRYPOINT_NAME="api-worker-reputer"
45+
ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT="http://source:8888/truth/{Token}/{BlockHeight}"
46+
ALLORA_REPUTER_LOOP_SECONDS="30"
47+
ALLORA_REPUTER_TOKEN="ethereum"
48+
ALLORA_REPUTER_MIN_STAKE="100000"

lib/allora/test/.env-test

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#allora node run config
22

33
#Must fill all these in
4-
ALLORA_ACCOUNT_NAME="xxxxxxxxxxx"
5-
ALLORA_ACCOUNT_MNEMONIC="xxxxxxxxxxx"
6-
ALLORA_ACCOUNT_PASSPHRASE="xxxxxxxxxxx"
4+
ALLORA_WALLET_ADDRESS_KEY_NAME="xxxxxxxxxxx"
5+
ALLORA_WALLET_ADDRESS_RESTORE_MNEMONIC="xxxxxxxxxxx"
76
AWS_ACCOUNT_ID="xxxxxxxxxxx"
87
###############################
98

10-
ALLORA_NODE_RPC=https://localhost:26657
119
AWS_RESOURCE_NAME_PREFIX="AlloraWorkerx"
1210
AWS_REGION="us-east-1"
1311
AWS_INSTANCE_TYPE="t3.medium"
@@ -23,6 +21,28 @@ EDGE_DATA_VOL_THROUGHPUT="125"
2321

2422
#Allora Node Worker Generation Config
2523
ALLORA_WORKER_NAME="aws"
26-
ALLORA_TOPIC_ID="3"
2724
ALLORA_ENV="dev"
28-
ALLORA_NETWORK_NAME="edgenet"
25+
26+
#wallet config
27+
ALLORA_WALLET_HOME_DIR=""
28+
ALLORA_WALLET_GAS="1000000"
29+
ALLORA_WALLET_GAS_ADJUSTMENT="1.0"
30+
ALLORA_WALLET_NODE_RPC="https://localhost:26657"
31+
ALLORA_WALLET_MAX_RETRIES="1"
32+
ALLORA_WALLET_DELAY="1"
33+
ALLORA_WALLET_SUBMIT_TX="false"
34+
35+
#worker config
36+
ALLORA_WORKER_TOPIC_ID="1"
37+
ALLORA_WORKER_INFERENCE_ENTRYPOINT_NAME="api-worker-reputer"
38+
ALLORA_WORKER_INFERENCE_ENDPOINT="http://source:8000/inference/{Token}"
39+
ALLORA_WORKER_LOOP_SECONDS="30"
40+
ALLORA_WORKER_TOKEN="ethereum"
41+
42+
#reputer config
43+
ALLORA_REPUTER_TOPIC_ID="1"
44+
ALLORA_REPUTER_ENTRYPOINT_NAME="api-worker-reputer"
45+
ALLORA_REPUTER_SOURCE_OF_TRUTH_ENDPOINT="http://source:8888/truth/{Token}/{BlockHeight}"
46+
ALLORA_REPUTER_LOOP_SECONDS="30"
47+
ALLORA_REPUTER_TOKEN="ethereum"
48+
ALLORA_REPUTER_MIN_STAKE="100000"

0 commit comments

Comments
 (0)