Skip to content

Commit 68cd3b1

Browse files
authored
Merge pull request #131 from nimiq/fix/snapshot-bundled-validators
Fix snapshot sync with bundled validators
2 parents ed097a7 + e0dbee7 commit 68cd3b1

File tree

20 files changed

+160
-37
lines changed

20 files changed

+160
-37
lines changed

app/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const isActivitySync = computed(() => Boolean(status.value?.missingEpochs?.lengt
1010
const isScoreSync = computed(() => status.value?.missingScore === false)
1111
const isSynced = computed(() => isActivitySync.value && isScoreSync.value)
1212
13-
const { gitBranch, nimiqNetwork } = useRuntimeConfig().public
13+
const { gitBranch, nimiqNetwork } = useSafeRuntimeConfig().public
1414
1515
interface EnvItemType { branch: string, network: string, link: string }
1616

app/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const tooltips = {
3737
}
3838
3939
function useStats() {
40-
const network = useRuntimeConfig().public.nimiqNetwork as 'test-albatross' | 'main-albatross'
40+
const network = useSafeRuntimeConfig().public.nimiqNetwork as 'test-albatross' | 'main-albatross'
4141
4242
const averageScore = computed(() => {
4343
if (!validators?.value?.length)

eslint.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @ts-check
22
import antfu from '@antfu/eslint-config'
3+
import safeRuntimeConfig from 'nuxt-safe-runtime-config/eslint'
34
import withNuxt from './.nuxt/eslint.config.mjs'
45

56
export default withNuxt(
@@ -14,4 +15,5 @@ export default withNuxt(
1415
'vue/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
1516
},
1617
}),
18+
safeRuntimeConfig.configs.recommended,
1719
)

nuxt.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ export default defineNuxtConfig({
9090

9191
consola.info(`Nimiq network: \`${nimiqNetwork}\``)
9292
consola.info(`Git branch: \`${gitBranch}\``)
93-
94-
const { projectUrl, env } = nuxt.options.runtimeConfig.hub
95-
consola.info(`Remote NuxtHub: \`${projectUrl || 'local'}@${env}\``)
9693
},
9794
},
9895

packages/nimiq-validator-trustscore/src/range.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,12 @@ describe('get range with mock implementation', () => {
301301
})
302302
})
303303

304-
describe('get range without mocking', () => {
305-
const rpcUrl = env.ALBATROSS_RPC_NODE_URL
306-
const network = env.NUXT_PUBLIC_NIMIQ_NETWORK
304+
const rpcUrl = env.ALBATROSS_RPC_NODE_URL
305+
const network = env.NUXT_PUBLIC_NIMIQ_NETWORK
306+
const hasRpcEnv = Boolean(rpcUrl && network)
307+
const describeIf = hasRpcEnv ? describe : describe.skip
307308

309+
describeIf('get range without mocking', () => {
308310
it('env ok', () => {
309311
expect(rpcUrl).toBeDefined()
310312
expect(network).toBeDefined()

pnpm-lock.yaml

Lines changed: 75 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ catalog:
3535
nimiq-css: ^1.0.0-beta.61
3636
nimiq-rpc-client-ts: 1.0.0-beta.28
3737
nuxt: ^4.0.1
38-
nuxt-safe-runtime-config: ^0.0.3
38+
nuxt-safe-runtime-config: ^0.0.17
3939
ofetch: ^1.4.1
4040
pathe: ^2.0.3
4141
reka-ui: ^2.4.0

server/api/[version]/distribution.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default defineCachedEventHandler(async () => {
3333
if (!latestBlockOk)
3434
throw createError(latestBlockError)
3535

36-
const network = useRuntimeConfig().public.nimiqNetwork as 'test-albatross' | 'main-albatross'
36+
const network = useSafeRuntimeConfig().public.nimiqNetwork as 'test-albatross' | 'main-albatross'
3737
const circulating = posSupplyAt(latestBlock.timestamp, { network })
3838

3939
const stakedRatio = staked / circulating

server/api/[version]/status.get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineCachedEventHandler(async () => {
2828
throw createError('No Albatross RPC Node URL')
2929
initRpcClient({ url: rpcUrl })
3030

31-
const { nimiqNetwork: network } = useRuntimeConfig().public
31+
const { nimiqNetwork: network } = useSafeRuntimeConfig().public
3232

3333
// We get a "window" whose size is determined by the range
3434
const [rangeSuccess, errorRange, range] = await getRange({ network })

server/api/[version]/validators/[address].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default defineEventHandler(async (event) => {
1717
const isValid = ValidationUtils.isValidAddress(address)
1818
if (!isValid)
1919
throw createError({ statusCode: 400, statusMessage: 'Invalid address format' })
20-
const { nimiqNetwork: network } = useRuntimeConfig().public
20+
const { nimiqNetwork: network } = useSafeRuntimeConfig().public
2121

2222
const [rangeSuccess, errorRange, range] = await getRange({ network })
2323
if (!rangeSuccess || !range)

0 commit comments

Comments
 (0)