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
9 changes: 8 additions & 1 deletion archiver-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,12 @@
}
],
"ARCHIVER_MODE": "release",
"DevPublicKey": ""
"DevPublicKey": "",
"tickets": {
"allowedTicketSigners": {
"0x891DF765C855E9848A18Ed18984B9f57cb3a4d47": 3
},
"minSigRequired": 1,
"requiredSecurityLevel": 3
}
}
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'
}
103 changes: 103 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.3.0",
"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 @@ -1261,6 +1264,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
12 changes: 12 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,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
}
}

let config: Config = {
Expand Down Expand Up @@ -195,6 +202,11 @@ let config: Config = {
disableOffloadReceipt: false,
disableOffloadReceiptForGlobalModification: true,
restoreNGTsFromSnapshot: false,
tickets: {
allowedTicketSigners: {},
minSigRequired: 5,
requiredSecurityLevel: 3
}
BelfordZ marked this conversation as resolved.
Show resolved Hide resolved
}
// Override default config params from config file, env vars, and cli args
export async function overrideDefaultConfig(file: string): Promise<void> {
Expand Down
Loading
Loading