Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHARD-1098 - Tickets #106

Merged
merged 14 commits into from
Dec 2, 2024
41 changes: 40 additions & 1 deletion archiver-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,44 @@
}
],
"ARCHIVER_MODE": "release",
"DevPublicKey": ""
"DevPublicKey": "",
"tickets": {
"allowedTicketSigners": {
"0x002D3a2BfE09E3E29b6d38d58CaaD16EEe4C9BC5": 5,
"0x0a0844DA5e01E391d12999ca859Da8a897D5979A": 5,
"0x390878B18DeBe2A9f0d5c0252a109c84243D3beb": 5,
"0x32B6f2C027D4c9D99Ca07d047D17987390a5EB39": 5,
"0x80aF8E195B56aCC3b4ec8e2C99EC38957258635a": 5,
"0x7Efbb31431ac7C405E8eEba99531fF1254fCA3B6": 5,
"0xCc74bf387F6C102b5a7F828796C57A6D2D19Cb00": 5,
"0x4ed5C053BF2dA5F694b322EA93dce949F3276B85": 5,
"0xd31aBC7497aD8bC9fe8555C9eDe45DFd7FB3Bf6F": 5,
"0xe7e4cc292b424C6D50d16F1Bb5BAB2032c486980": 5,
"0xD815DA50966c19261B34Ffa3bE50A30A67D97456": 5,
"0xE856B2365641eba73Bc430AAC1E8F930dA513D9D": 5,
"0x8282F755e784414697421D4b59232E5d194e2262": 5,
"0x353Ad64Df4fAe5EffF717A1c41BE6dEBee543129": 5,
"0x9Ce1C3c114538c625aA2488b97fEb3723fdBB07B": 5,
"0x6A83e4e4eB0A2c8f562db6BB64b02a9A6237B314": 5,
"0x92E375E0c76CaE76D9DfBab17EE7B3B4EE407715": 5,
"0xBD79B430CA932e2D89bb77ACaE7367a07471c2eA": 5,
"0xEbe173a837Bc30BFEF6E13C9988a4771a4D83275": 5,
"0xfF2b584A947182c55BBc039BEAB78BC201D3AdDe": 5,
"0xCeA068d8DCB4B4020D30a9950C00cF8408611F67": 5,
"0x52F8d3DaA7b5FF25ca2bF7417E059aFe0bD5fB0E": 5,
"0x0341996A92193d8B7d80C4774fA2eff889e4b427": 5,
"0xF82BDA6Ef512e4219C6DCEea896E50e8180a5bff": 5,
"0xA04A1B214a2537139fE59488820D4dA06516933f": 5,
"0x550817e7B91244BBeFE2AD621ccD555A16B00405": 5,
"0x84C55a4bFfff1ADadb9C46e2B60979F519dAf874": 5,
"0x4563303BCE96D3f8d9C7fB94b36dfFC9d831871d": 5,
"0xdA058F9c7Ce86C1D21DD5DBDeBad5ab5c785520a": 5,
"0x891DF765C855E9848A18Ed18984B9f57cb3a4d47": 5,
"0x7Fb9b1C5E20bd250870F87659E46bED410221f17": 5,
"0x1e5e12568b7103E8B22cd680A6fa6256DD66ED76": 5,
"0xa58169308e7153B5Ce4ca5cA515cC4d0cBE7770B": 5
},
"minSigRequired": 1,
"requiredSecurityLevel": 5
}
}
13 changes: 11 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ module.exports = {
"**/?(*.)+(spec|test).+(ts|tsx|js)"
],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
"^.+\\.(ts|tsx)$": ["ts-jest", {
tsconfig: "test/tsconfig.json"
}]
},
};
moduleDirectories: ["node_modules", "src"],
globals: {
'ts-jest': {
isolatedModules: true
}
},
timers: 'fake'
}
98 changes: 98 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"pretest": "npm run compile",
"update-docker": "docker build -t registry.gitlab.com/shardus/archive/archive-server:dev3 . && docker push registry.gitlab.com/shardus/archive/archive-server:dev3",
"update-docker-dev": "docker build -t registry.gitlab.com/shardus/archive/archive-server:dev . && docker push registry.gitlab.com/shardus/archive/archive-server:dev",
"update-schemas": "typescript-json-schema tsconfig.json NewData -o src/Data/schemas/NewData.json & typescript-json-schema tsconfig.json DataResponse -o src/Data/schemas/DataResponse.json"
"update-schemas": "typescript-json-schema tsconfig.json NewData -o src/Data/schemas/NewData.json & typescript-json-schema tsconfig.json DataResponse -o src/Data/schemas/DataResponse.json",
"build": "tsc && npm run copy-static",
"copy-static": "cp -r static dist/"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -84,6 +86,7 @@
"@shardus/crypto-utils": "git+https://github.com/shardeum/lib-crypto-utils#v4.1.4",
"@shardus/types": "git+https://github.com/shardeum/lib-types#v1.2.21",
"deepmerge": "^4.2.2",
"ethers": "^6.13.4",
"fastify": "4.12.0",
"log4js": "6.9.1",
"log4js-extend": "^0.2.1",
Expand All @@ -100,4 +103,4 @@
"overrides": {
"axios": "1.6.1"
}
}
}
6 changes: 6 additions & 0 deletions src/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ import {
failureReceiptCount,
} from './primary-process'
import * as ServiceQueue from './ServiceQueue'
import { readFileSync } from 'fs'
import { join } from 'path'
import ticketRoutes from './routes/tickets'
const { version } = require('../package.json') // eslint-disable-line @typescript-eslint/no-var-requires

const TXID_LENGTH = 64
Expand Down Expand Up @@ -1268,6 +1271,9 @@ export function registerRoutes(server: FastifyInstance<Server, IncomingMessage,
// We might want to sign this response
reply.send(Crypto.sign(response))
})

// Register ticket routes
server.register(ticketRoutes, { prefix: '/tickets' })
}

export const validateRequestData = (
Expand Down
47 changes: 47 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as merge from 'deepmerge'
import * as minimist from 'minimist'
import { join } from 'path'
import { Utils as StringUtils } from '@shardus/types'
import { DevSecurityLevel } from './types/security'

export interface Config {
[index: string]: object | string | number | boolean
Expand Down Expand Up @@ -102,6 +103,13 @@ export interface Config {
disableOffloadReceipt: boolean // To disable offloading of receipts globally
disableOffloadReceiptForGlobalModification: boolean // To disable offloading of receipts for global modifications receipts
restoreNGTsFromSnapshot: boolean // To restore NGTs from snapshot
tickets: {
allowedTicketSigners: {
[pubkey: string]: number
}
minSigRequired: number
requiredSecurityLevel: number
}
maxRecordsPerRequest: number // this is the equiavlent of the accountBucketSize config variable used by the validators to fetch records from the archiver
}

Expand Down Expand Up @@ -196,6 +204,45 @@ let config: Config = {
disableOffloadReceipt: false,
disableOffloadReceiptForGlobalModification: true,
restoreNGTsFromSnapshot: false,
tickets: {
allowedTicketSigners: {
'0x002D3a2BfE09E3E29b6d38d58CaaD16EEe4C9BC5': 5,
'0x0a0844DA5e01E391d12999ca859Da8a897D5979A': 5,
'0x390878B18DeBe2A9f0d5c0252a109c84243D3beb': 5,
'0x32B6f2C027D4c9D99Ca07d047D17987390a5EB39': 5,
'0x80aF8E195B56aCC3b4ec8e2C99EC38957258635a': 5,
'0x7Efbb31431ac7C405E8eEba99531fF1254fCA3B6': 5,
'0xCc74bf387F6C102b5a7F828796C57A6D2D19Cb00': 5,
'0x4ed5C053BF2dA5F694b322EA93dce949F3276B85': 5,
'0xd31aBC7497aD8bC9fe8555C9eDe45DFd7FB3Bf6F': 5,
'0xe7e4cc292b424C6D50d16F1Bb5BAB2032c486980': 5,
'0xD815DA50966c19261B34Ffa3bE50A30A67D97456': 5,
'0xE856B2365641eba73Bc430AAC1E8F930dA513D9D': 5,
'0x8282F755e784414697421D4b59232E5d194e2262': 5,
'0x353Ad64Df4fAe5EffF717A1c41BE6dEBee543129': 5,
'0x9Ce1C3c114538c625aA2488b97fEb3723fdBB07B': 5,
'0x6A83e4e4eB0A2c8f562db6BB64b02a9A6237B314': 5,
'0x92E375E0c76CaE76D9DfBab17EE7B3B4EE407715': 5,
'0xBD79B430CA932e2D89bb77ACaE7367a07471c2eA': 5,
'0xEbe173a837Bc30BFEF6E13C9988a4771a4D83275': 5,
'0xfF2b584A947182c55BBc039BEAB78BC201D3AdDe': 5,
'0xCeA068d8DCB4B4020D30a9950C00cF8408611F67': 5,
'0x52F8d3DaA7b5FF25ca2bF7417E059aFe0bD5fB0E': 5,
'0x0341996A92193d8B7d80C4774fA2eff889e4b427': 5,
'0xF82BDA6Ef512e4219C6DCEea896E50e8180a5bff': 5,
'0xA04A1B214a2537139fE59488820D4dA06516933f': 5,
'0x550817e7B91244BBeFE2AD621ccD555A16B00405': 5,
'0x84C55a4bFfff1ADadb9C46e2B60979F519dAf874': 5,
'0x4563303BCE96D3f8d9C7fB94b36dfFC9d831871d': 5,
'0xdA058F9c7Ce86C1D21DD5DBDeBad5ab5c785520a': 5,
'0x891DF765C855E9848A18Ed18984B9f57cb3a4d47': 5,
'0x7Fb9b1C5E20bd250870F87659E46bED410221f17': 5,
'0x1e5e12568b7103E8B22cd680A6fa6256DD66ED76': 5,
'0xa58169308e7153B5Ce4ca5cA515cC4d0cBE7770B': 5,
},
minSigRequired: 1,
requiredSecurityLevel: 5
}
BelfordZ marked this conversation as resolved.
Show resolved Hide resolved
maxRecordsPerRequest: 200,
}
// Override default config params from config file, env vars, and cli args
Expand Down
Loading
Loading