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

BLUE-134 #44

Merged
merged 23 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
edc0074
fixing issue comment Pr review stuff
TieDyedSheep Jul 9, 2024
b8f3dcf
add codeowners and sync ci.yml
TieDyedSheep Jul 19, 2024
318f403
fix lint and add test scripts
TieDyedSheep Jul 19, 2024
776a128
prettier fixes
TieDyedSheep Jul 19, 2024
01faa5e
cleanup gitlab.ci
TieDyedSheep Jul 20, 2024
957856d
Revert "prettier fixes"
TieDyedSheep Jul 22, 2024
5f61735
Added the voteHashCalculation for new POQ-O receipt
jairajdev Jul 4, 2024
4bd1610
Added requiredVotesPercentage config
jairajdev Jul 9, 2024
1feccc0
Updated to use single index for each field
jairajdev Jul 19, 2024
9916d90
rename originalTxsData_txId index
jairajdev Jul 19, 2024
0512864
Updated to use ascending order index
jairajdev Jul 19, 2024
732ab1e
Added db profiler
jairajdev Jul 19, 2024
c1c4201
Fix StringUtils issue in the update-network-account script
jairajdev Jul 18, 2024
7175d87
Fix StringUtils missing issue in scripts
jairajdev Jul 22, 2024
1821e3f
- Restricted to only the first validator can forward the accounts dat…
jairajdev Jun 26, 2024
7c545c9
Remove fixAccountUint8Arrays from the scripts
jairajdev Jul 22, 2024
8ec0f5b
Created config for the number of cycles to keep shard calculations data
jairajdev Jul 2, 2024
3337549
Added debug logs for receipt processing time taken
jairajdev Jul 3, 2024
ab04c94
Updated to keep 10 CYCLE_SHARD_STORAGE_LIMIT
jairajdev Jul 3, 2024
dddd88a
Put the console logs behind the verbose flag
jairajdev Jul 22, 2024
6098cf7
Port the logic from shardus core to modify the network account itself…
jairajdev Jun 27, 2024
1e54848
Updated to adapt `configChangeMaxChangesToKeep` and `configChangeMaxC…
jairajdev Jun 28, 2024
e1eff93
Avoid timestamp update in network config change
jairajdev Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ on:
branches:
- dev
- main
issue_comment:
inputs:
workflowBranch:
description: 'Branch of the reusable workflow. Defaults to main, select dev for testing only.'
required: true
default: 'main'
type: choice
options:
- dev
- main
workflow_dispatch:
inputs:
workflowBranch:
Expand All @@ -22,11 +32,6 @@ on:
options:
- dev
- main

permissions:
issues: write
pull-requests: write

jobs:
echo-inputs:
name: Repo Workflow Debugging
Expand All @@ -41,9 +46,13 @@ jobs:
echo "Apply Patches Required: ${{ vars.IS_APPLY_PATCHES_REQUIRED }}"
echo "Unit Tests Required: ${{ vars.IS_UNIT_TESTS_REQUIRED }}"
echo "*** End - Check inputs in repo workflow ***"
ci-dev:
ci-test-only:
if: ${{ github.event.inputs.workflowBranch == 'dev' }}
uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@dev
permissions:
issues: write
pull-requests: write
contents: write
with:
node-version: ${{ vars.NODE_VERSION }}
lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }}
Expand All @@ -52,9 +61,13 @@ jobs:
unit-tests-required: ${{ vars.IS_UNIT_TESTS_REQUIRED == 'true' }}
secrets: inherit

ci-main:
ci:
if: ${{ github.event.inputs.workflowBranch == 'main' || !github.event.inputs.workflowBranch }}
uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@main
permissions:
issues: write
pull-requests: write
contents: write
with:
node-version: ${{ vars.NODE_VERSION }}
lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }}
Expand Down
69 changes: 0 additions & 69 deletions .gitlab-ci.yml

This file was deleted.

13 changes: 13 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CODEOWNERS file
# To add additional teams to any approval, include them on the same line separated by spaces
# It is best practice to assign a team as a code owner and not an invidual.
# Please submit requests for new teams to Systems and Automation

# Global approval (all files)
# * @shardeum/team-name

# Directory-level approval
/.github/ @shardeum/systems-and-automation

# Specific file rules
# README.md @shardeum/team-name
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
"scripts": {
"start": "npm run prepare && node build/server.js",
"release": "npm run prepare && np --no-cleanup --no-tests --no-yarn --any-branch",
"test": "echo \"Error: no test specified\" && exit 1",
"check": "gts check",
"clean": "npm-run-all clean:*",
"clean:typescript": "gts clean",
"lint": "eslint './src/**/*.ts'",
"lint-windows": "eslint ./src/**/*.ts",
"lint": "eslint \"./src/**/*.ts\"",
"test": "echo \"Error: no test specified\" && exit 1",
"format-check": "prettier --check './src/**/*.ts'",
"format-fix": "prettier --write './src/**/*.ts'",
"clean:artifacts": "shx rm -rf archiver-logs/ archiver-db/ data-logs/",
Expand Down
1 change: 1 addition & 0 deletions scripts/archiver_data_sync_check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { join } from 'path'
import { postJson } from '../src/P2P'
import { config, overrideDefaultConfig } from '../src/Config'
import { ArchiverNodeInfo } from '../src/State'
import { Utils as StringUtils } from '@shardus/types'

const configFile = join(process.cwd(), 'archiver-config.json')
overrideDefaultConfig(configFile)
Expand Down
1 change: 1 addition & 0 deletions scripts/create_shut_down_cycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as Logger from '../src/Logger'
import { P2P } from '@shardus/types'
import { addSigListeners } from '../src/State'
import { computeCycleMarker } from '../src/Data/Cycles'
import { Utils as StringUtils } from '@shardus/types'

const archiversAtShutdown = [
{
Expand Down
4 changes: 2 additions & 2 deletions scripts/repair_missing_cycle.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { readFileSync } from 'fs'
import { resolve } from 'path'
import { join } from 'path'
import { resolve, join } from 'path'
import { overrideDefaultConfig, config } from '../src/Config'
import * as Crypto from '../src/Crypto'
import * as db from '../src/dbstore/sqlite3storage'
import * as dbstore from '../src/dbstore'
import * as CycleDB from '../src/dbstore/cycles'
import { startSaving } from '../src/saveConsoleOutput'
import * as Logger from '../src/Logger'
import { Utils as StringUtils } from '@shardus/types'

const patchCycleData = false

Expand Down
1 change: 1 addition & 0 deletions scripts/update_network_account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { startSaving } from '../src/saveConsoleOutput'
import * as Logger from '../src/Logger'
import { accountSpecificHash } from '../src/shardeum/calculateAccountHash'
import { addSigListeners } from '../src/State'
import { Utils as StringUtils } from '@shardus/types'

const activeVersion = '1.9.0'
const latestVersion = '1.9.0'
Expand Down
12 changes: 1 addition & 11 deletions scripts/validate_archiver_receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { overrideDefaultConfig, config } from '../src/Config'
import * as Crypto from '../src/Crypto'
import * as Utils from '../src/Utils'
import * as Receipt from '../src/dbstore/receipts'
import { AccountType, accountSpecificHash, fixAccountUint8Arrays } from '../src/shardeum/calculateAccountHash'
import { AccountType, accountSpecificHash } from '../src/shardeum/calculateAccountHash'
import { ShardeumReceipt } from '../src/shardeum/verifyAppReceiptData'

// Add the full receipt data here
Expand Down Expand Up @@ -243,16 +243,6 @@ export const verifyAccountHash = (receipt: Receipt.ArchiverReceipt): boolean =>
try {
if (receipt.globalModification && config.skipGlobalTxReceiptVerification) return true // return true if global modification
for (const account of receipt.accounts) {
if (account.data.accountType === AccountType.Account) {
fixAccountUint8Arrays(account.data.account)
// console.dir(acc, { depth: null })
} else if (
account.data.accountType === AccountType.ContractCode ||
account.data.accountType === AccountType.ContractStorage
) {
fixAccountUint8Arrays(account.data)
// console.dir(acc, { depth: null })
}
const calculatedAccountHash = accountSpecificHash(account.data)
const indexOfAccount = receipt.appliedReceipt.appliedVote.account_id.indexOf(account.accountId)
if (indexOfAccount === -1) {
Expand Down
13 changes: 2 additions & 11 deletions scripts/verify_account_hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import * as dbstore from '../src/dbstore'
import * as AccountDB from '../src/dbstore/accounts'
import { startSaving } from '../src/saveConsoleOutput'
import * as Logger from '../src/Logger'
import { AccountType, fixAccountUint8Arrays, accountSpecificHash } from '../src/shardeum/calculateAccountHash'
import { AccountType, accountSpecificHash } from '../src/shardeum/calculateAccountHash'
import { addSigListeners } from '../src/State'
import { Utils as StringUtils } from '@shardus/types'

const updateHash = false
const runProgram = async (): Promise<void> => {
Expand Down Expand Up @@ -47,16 +48,6 @@ const runProgram = async (): Promise<void> => {
if (accountHash1 !== accountHash2) {
console.log(account.accountId, 'accountHash', accountHash1, 'accountHash2', accountHash2)
}
if (account.data.accountType === AccountType.Account) {
fixAccountUint8Arrays(account.data.account)
// console.dir(acc, { depth: null })
} else if (
account.data.accountType === AccountType.ContractCode ||
account.data.accountType === AccountType.ContractStorage
) {
fixAccountUint8Arrays(account.data)
// console.dir(acc, { depth: null })
}
const calculatedAccountHash = accountSpecificHash(account.data)

if (accountHash1 !== calculatedAccountHash) {
Expand Down
14 changes: 14 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ export interface Config {
saveOnlyGossipData: boolean
// For debugging purpose, set this to true to stop gossiping tx data
stopGossipTxData: boolean
usePOQo: boolean
// The percentage of votes required to confirm transaction
requiredVotesPercentage: number
// number of recent cycles of shard data to keep
CYCLE_SHARD_STORAGE_LIMIT: number
// the number of cycles within which we want to keep \changes to a config*/
configChangeMaxCyclesToKeep: number
// the number of config changes to keep*/
configChangeMaxChangesToKeep: number
}

let config: Config = {
Expand Down Expand Up @@ -126,6 +135,11 @@ let config: Config = {
extraConsensorsToSubscribe: 1,
saveOnlyGossipData: false,
stopGossipTxData: false,
usePOQo: true,
requiredVotesPercentage: 2 / 3,
CYCLE_SHARD_STORAGE_LIMIT: 10,
configChangeMaxCyclesToKeep: 5,
configChangeMaxChangesToKeep: 1000,
}
// Override default config params from config file, env vars, and cli args
export async function overrideDefaultConfig(file: string): Promise<void> {
Expand Down
Loading
Loading