Skip to content

Commit 3b78bb1

Browse files
committed
fixed merge conflict
2 parents 2b1847b + 953cb6c commit 3b78bb1

6 files changed

Lines changed: 56 additions & 135 deletions

File tree

.github/workflows/deployDev.yml

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,12 @@ name: Deploy
22

33
on:
44
push:
5-
branches:
6-
-dev
5+
branches: -dev
76

87
# Allows you to run this workflow manually from the Actions tab
98
workflow_dispatch:
109

1110
jobs:
12-
binaries:
13-
name: Build release binaries.
14-
runs-on: ubuntu-latest
15-
16-
steps:
17-
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v2
19-
20-
- name: Install yarn.
21-
run: npm install -g yarn
22-
- name: Install dependencies.
23-
run: yarn install
24-
- name: Build.
25-
run: yarn build:binaries
26-
27-
- uses: actions/upload-artifact@v2
28-
with:
29-
name: kyve-evm-linux
30-
path: ./out/index-linux
31-
- uses: actions/upload-artifact@v2
32-
with:
33-
name: kyve-evm-macos
34-
path: ./out/index-macos
35-
- uses: actions/upload-artifact@v2
36-
with:
37-
name: kyve-evm-win.exe
38-
path: ./out/index-win.exe
39-
4011
docker:
4112
name: Build and publish Docker container.
4213
runs-on: ubuntu-latest
@@ -48,7 +19,7 @@ jobs:
4819
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
4920

5021
- name: Build the Docker image.
51-
run: docker build -t kyve/evm-dev:${GITHUB_REF#refs/tags/} -t kyve/evm-dev:latest .
22+
run: docker build -t kyve/evm-dev:latest .
5223

5324
- name: Push to Docker hub.
5425
run: docker push -a kyve/evm-dev

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
"license": "MIT",
55
"scripts": {
66
"build": "tsc",
7-
"build:binaries": "tsc && pkg ./dist/src/index.js --out-path out",
7+
"build:binaries": "yarn build && pkg ./dist/src/index.js --targets latest-linux-x64,latest-macos-x64,latest-win-x64 --out-path out",
88
"start": "node ./dist/src/index.js",
99
"format": "prettier --write ."
1010
},
1111
"dependencies": {
12-
"@kyve/core": "^0.0.13",
13-
"commander": "^8.2.0",
12+
"@kyve/core": "^0.1.0",
1413
"ethers": "^5.5.1",
1514
"object-hash": "^2.2.0"
1615
},

src/index.ts

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,12 @@
11
import KYVE from "@kyve/core";
2-
import { Command } from "commander";
3-
import { readFileSync } from "fs";
42
import { version } from "../package.json";
53
import uploadFunction from "./upload";
64
import validateFunction from "./validate";
75

8-
const cli = new Command("@kyve/evm");
9-
cli.requiredOption(
10-
"-p, --pool <string>",
11-
"The address of the pool you want to run on."
12-
);
13-
cli.requiredOption(
14-
"-s, --stake <number>",
15-
"The amount of tokens you want to stake."
16-
);
17-
cli.requiredOption(
18-
"-pk, --private-key <string>",
19-
"Your Ethereum private key that holds $KYVE."
20-
);
21-
cli.option(
22-
"-k, --keyfile <string>",
23-
"The path to your Arweave keyfile. [optional]"
24-
);
25-
cli.option(
26-
"-n, --name <string>",
27-
"The identifier name of the node. [optional, default = random]"
28-
);
29-
cli.option(
30-
"-e, --endpoint <string>",
31-
"A custom Moonbase Alpha endpoint. [optional]"
32-
);
33-
cli.option(
34-
"-g, --gas-multiplier <string>",
35-
"The amount that you want to multiply the default gas price by. [optional]"
36-
);
37-
cli.option(
38-
"-st, --send-statistics <boolean>",
39-
"Send statistics. [optional, default = true]",
40-
true
41-
);
42-
cli.version(version, "-v, --version");
6+
process.env.KYVE_RUNTIME = "@kyve/evm";
7+
process.env.KYVE_VERSION = version;
438

449
(async () => {
45-
await cli.parseAsync();
46-
const options = cli.opts();
47-
48-
const node = new KYVE(
49-
options.pool,
50-
"@kyve/evm",
51-
version,
52-
options.stake,
53-
options.privateKey,
54-
options.keyfile && JSON.parse(readFileSync(options.keyfile, "utf-8")),
55-
options.name,
56-
options.endpoint,
57-
options.gasMultiplier
58-
);
59-
10+
const { node } = await KYVE.generate();
6011
node.run(uploadFunction, validateFunction);
6112
})();

src/upload.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Logger } from "tslog";
44
import { ConfigType } from "./faces";
55

66
const uploadFunction = (
7-
subscriber: UploadFunctionSubscriber,
7+
uploader: UploadFunctionSubscriber,
88
config: ConfigType,
99
logger: Logger
1010
) => {
@@ -27,9 +27,8 @@ const uploadFunction = (
2727

2828
// Subscribe to new blocks.
2929
client.on("block", async (height: number) => {
30-
logger.info(`🆕 Received a new block. Height = ${height}`);
31-
3230
const block = await client.getBlockWithTransactions(height);
31+
3332
if (block.transactions.length) {
3433
block.transactions.forEach(
3534
// @ts-ignore
@@ -50,7 +49,7 @@ const uploadFunction = (
5049
);
5150
}
5251

53-
subscriber.next({ data: JSON.stringify(block), tags });
52+
uploader.upload({ data: JSON.stringify(block), tags });
5453
});
5554
};
5655

src/validate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { getTagByName } from "@kyve/core";
12
import {
23
ListenFunctionObservable,
34
ValidateFunctionSubscriber,
@@ -9,7 +10,7 @@ import { ConfigType } from "./faces";
910

1011
const validateFunction = (
1112
listener: ListenFunctionObservable,
12-
subscriber: ValidateFunctionSubscriber,
13+
validator: ValidateFunctionSubscriber,
1314
config: ConfigType,
1415
logger: Logger
1516
) => {
@@ -24,8 +25,7 @@ const validateFunction = (
2425
// Subscribe to the listener.
2526
listener.subscribe(async (res) => {
2627
for (const item of res.bundle) {
27-
const blockHash = (item.tags || []).find((tag) => tag.name === "Block")
28-
?.value!;
28+
const blockHash = getTagByName("Block", item.tags)!;
2929

3030
logger.debug(`Found block. Hash = ${blockHash}`);
3131

@@ -41,15 +41,15 @@ const validateFunction = (
4141
const uploaderHash = hash(JSON.parse(item.data));
4242

4343
if (localHash !== uploaderHash) {
44-
subscriber.next({
44+
validator.vote({
4545
transaction: res.transaction,
4646
valid: false,
4747
});
4848
return;
4949
}
5050
}
5151

52-
subscriber.next({
52+
validator.vote({
5353
transaction: res.transaction,
5454
valid: true,
5555
});

yarn.lock

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,15 @@
361361
"@ethersproject/properties" "^5.5.0"
362362
"@ethersproject/strings" "^5.5.0"
363363

364-
"@kyve/core@^0.0.13":
365-
version "0.0.13"
366-
resolved "https://registry.yarnpkg.com/@kyve/core/-/core-0.0.13.tgz#2137b4381714e63d3d63842cbaafafaca3b6c273"
367-
integrity sha512-d2tK91iPnRQAWeFrGY2a3VYE2CKccmLdnDNeTg1uwhqJV6u/VFILaBha6jm2cr8JSdoAWEfn/dNaF9zOJMc/6A==
364+
"@kyve/core@^0.1.0":
365+
version "0.1.0"
366+
resolved "https://registry.yarnpkg.com/@kyve/core/-/core-0.1.0.tgz#7bf065674a0682b3b92dfd95809a11c8edbd22db"
367+
integrity sha512-LgkLDiJZM39V+p3ERjBsfxfDFZfCA12xMF/kYbWZa7slLLS6XYUS5CHvL3fbHL+QMt0Z96H57V/79wb4Hdhf+w==
368368
dependencies:
369369
arweave "^1.10.17"
370370
base64url "^3.0.1"
371371
bignumber.js "^9.0.1"
372+
commander "^8.3.0"
372373
ethers "^5.5.1"
373374
prando "^6.0.1"
374375
rxjs "^7.4.0"
@@ -398,9 +399,9 @@
398399
fastq "^1.6.0"
399400

400401
"@types/node@^16.10.3":
401-
version "16.11.1"
402-
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.1.tgz#2e50a649a50fc403433a14f829eface1a3443e97"
403-
integrity sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==
402+
version "16.11.9"
403+
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.9.tgz#879be3ad7af29f4c1a5c433421bf99fab7047185"
404+
integrity sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==
404405

405406
"@types/object-hash@^2.2.1":
406407
version "2.2.1"
@@ -592,10 +593,10 @@ color-name@~1.1.4:
592593
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
593594
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
594595

595-
commander@^8.2.0:
596-
version "8.2.0"
597-
resolved "https://registry.yarnpkg.com/commander/-/commander-8.2.0.tgz#37fe2bde301d87d47a53adeff8b5915db1381ca8"
598-
integrity sha512-LLKxDvHeL91/8MIyTAD5BFMNtoIwztGPMiM/7Bl8rIPmHCZXRxmSWr91h57dpOpnQ6jIUqEWdXE/uBYMfiVZDA==
596+
commander@^8.3.0:
597+
version "8.3.0"
598+
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
599+
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
599600

600601
console-control-strings@^1.0.0, console-control-strings@~1.1.0:
601602
version "1.1.0"
@@ -696,9 +697,9 @@ esprima@^4.0.1:
696697
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
697698

698699
estraverse@^5.2.0:
699-
version "5.2.0"
700-
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880"
701-
integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==
700+
version "5.3.0"
701+
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
702+
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
702703

703704
esutils@^2.0.2:
704705
version "2.0.3"
@@ -777,9 +778,9 @@ fill-range@^7.0.1:
777778
to-regex-range "^5.0.1"
778779

779780
follow-redirects@^1.14.4:
780-
version "1.14.4"
781-
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.4.tgz#838fdf48a8bbdd79e52ee51fb1c94e3ed98b9379"
782-
integrity sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==
781+
version "1.14.5"
782+
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
783+
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
783784

784785
from2@^2.3.0:
785786
version "2.3.0"
@@ -905,9 +906,9 @@ ieee754@^1.1.13:
905906
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
906907

907908
ignore@^5.1.4:
908-
version "5.1.8"
909-
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
910-
integrity sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==
909+
version "5.1.9"
910+
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.9.tgz#9ec1a5cbe8e1446ec60d4420060d43aa6e7382fb"
911+
integrity sha512-2zeMQpbKz5dhZ9IwL0gbxSW5w0NK/MSAMtNuhgIHEPmaU3vPdKPL0UdvUCXs5SS4JAwsBxysK5sFMW8ocFiVjQ==
911912

912913
inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3:
913914
version "2.0.4"
@@ -1066,9 +1067,9 @@ node-abi@^2.7.0:
10661067
semver "^5.4.1"
10671068

10681069
node-fetch@^2.6.1:
1069-
version "2.6.5"
1070-
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.5.tgz#42735537d7f080a7e5f78b6c549b7146be1742fd"
1071-
integrity sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==
1070+
version "2.6.6"
1071+
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
1072+
integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
10721073
dependencies:
10731074
whatwg-url "^5.0.0"
10741075

@@ -1141,10 +1142,10 @@ picomatch@^2.2.3:
11411142
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
11421143
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
11431144

1144-
pkg-fetch@3.2.3:
1145-
version "3.2.3"
1146-
resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.2.3.tgz#9825febf4eadd470c126d3f6bdc2cb6996861d36"
1147-
integrity sha512-bv9vYANgAZ2Lvxn5Dsq7E0rLqzcqYkV4gnwe2f7oHV9N4SVMfDOIjjFCRuuTltop5EmsOcu7XkQpB5A/pIgC1g==
1145+
pkg-fetch@3.2.4:
1146+
version "3.2.4"
1147+
resolved "https://registry.yarnpkg.com/pkg-fetch/-/pkg-fetch-3.2.4.tgz#5372734b12167d4bacd872be348217461b517390"
1148+
integrity sha512-ewUD26GP86/8+Fu93zrb30CpJjKOtT4maSgm4SwTX9Ujy1pfdUdv+1PubsY9tTJES0iBYItAtqbfkf7Wu5LV9w==
11481149
dependencies:
11491150
chalk "^4.1.0"
11501151
fs-extra "^9.1.0"
@@ -1155,9 +1156,9 @@ pkg-fetch@3.2.3:
11551156
yargs "^16.2.0"
11561157

11571158
pkg@^5.3.3:
1158-
version "5.3.3"
1159-
resolved "https://registry.yarnpkg.com/pkg/-/pkg-5.3.3.tgz#5ad1dadfc4e55169f0e1046626e669e0428d4cd7"
1160-
integrity sha512-48qPxwyPvKfUuXxeK+kS3mBvfWWTX2khAdceDThbWCc8OUz3RFyO1Ft8SVkq2gQfPU2DtiPtWaf2SKH0Dlx59g==
1159+
version "5.4.1"
1160+
resolved "https://registry.yarnpkg.com/pkg/-/pkg-5.4.1.tgz#4d824e42c454f32131e471d7cd8d14bfdb3e1c4c"
1161+
integrity sha512-iJs3W6MCgeZ4MrH7iZtX6HTqsNzoh2U9rGILL3eOLbQFV43U8WPAzrqRK7cBQGuHx38UXxcGT6G/2yDl/GveRg==
11611162
dependencies:
11621163
"@babel/parser" "7.13.13"
11631164
"@babel/types" "7.13.12"
@@ -1168,7 +1169,7 @@ pkg@^5.3.3:
11681169
into-stream "^6.0.0"
11691170
minimist "^1.2.5"
11701171
multistream "^4.1.0"
1171-
pkg-fetch "3.2.3"
1172+
pkg-fetch "3.2.4"
11721173
prebuild-install "6.0.1"
11731174
progress "^2.0.3"
11741175
resolve "^1.20.0"
@@ -1336,9 +1337,9 @@ set-blocking@~2.0.0:
13361337
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
13371338

13381339
signal-exit@^3.0.0:
1339-
version "3.0.5"
1340-
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f"
1341-
integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==
1340+
version "3.0.6"
1341+
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af"
1342+
integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==
13421343

13431344
simple-concat@^1.0.0:
13441345
version "1.0.1"
@@ -1365,9 +1366,9 @@ snekfetch@^3.6.4:
13651366
integrity sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw==
13661367

13671368
source-map-support@^0.5.19:
1368-
version "0.5.20"
1369-
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.20.tgz#12166089f8f5e5e8c56926b377633392dd2cb6c9"
1370-
integrity sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==
1369+
version "0.5.21"
1370+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
1371+
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
13711372
dependencies:
13721373
buffer-from "^1.0.0"
13731374
source-map "^0.6.0"
@@ -1507,9 +1508,9 @@ type-check@~0.3.2:
15071508
prelude-ls "~1.1.2"
15081509

15091510
typescript@^4.4.3:
1510-
version "4.4.4"
1511-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
1512-
integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
1511+
version "4.5.2"
1512+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998"
1513+
integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==
15131514

15141515
unique-names-generator@^4.6.0:
15151516
version "4.6.0"

0 commit comments

Comments
 (0)