@xyo-network/chain-services 1.17.7 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/AccountBalance/accountBalanceServiceFromArchivist.d.ts +3 -3
- package/dist/neutral/AccountBalance/accountBalanceServiceFromArchivist.d.ts.map +1 -1
- package/dist/neutral/BaseService.d.ts +2 -2
- package/dist/neutral/BaseService.d.ts.map +1 -1
- package/dist/neutral/ChainService/Evm/Evm.d.ts +3 -4
- package/dist/neutral/ChainService/Evm/Evm.d.ts.map +1 -1
- package/dist/neutral/ChainService/Memory/Memory.d.ts +3 -4
- package/dist/neutral/ChainService/Memory/Memory.d.ts.map +1 -1
- package/dist/neutral/ChainValidator/XyoValidator.d.ts +4 -2
- package/dist/neutral/ChainValidator/XyoValidator.d.ts.map +1 -1
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts +0 -1
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts.map +1 -1
- package/dist/neutral/Schemas/BaseSchemasService.d.ts +1 -1
- package/dist/neutral/Schemas/BaseSchemasService.d.ts.map +1 -1
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts +5 -3
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts.map +1 -1
- package/dist/neutral/blockViewerFromChainIteratorAndArchivist.d.ts.map +1 -1
- package/dist/neutral/implementation/chain/evm.d.ts +2 -2
- package/dist/neutral/implementation/chain/evm.d.ts.map +1 -1
- package/dist/neutral/implementation/chain/index.d.ts +2 -3
- package/dist/neutral/implementation/chain/index.d.ts.map +1 -1
- package/dist/neutral/implementation/head/createBootstrapHead.d.ts +3 -3
- package/dist/neutral/implementation/head/createBootstrapHead.d.ts.map +1 -1
- package/dist/neutral/implementation/head/index.d.ts +1 -1
- package/dist/neutral/implementation/head/index.d.ts.map +1 -1
- package/dist/neutral/implementation/index.d.ts +0 -9
- package/dist/neutral/implementation/index.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +0 -2
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +378 -997
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/Params.d.ts +3 -4
- package/dist/neutral/model/Params.d.ts.map +1 -1
- package/dist/neutral/simple/block/runner/SimpleBlockRunner.d.ts +25 -33
- package/dist/neutral/simple/block/runner/SimpleBlockRunner.d.ts.map +1 -1
- package/package.json +15 -17
- package/src/AccountBalance/accountBalanceServiceFromArchivist.ts +10 -16
- package/src/BaseService.ts +3 -2
- package/src/ChainService/Evm/Evm.ts +24 -37
- package/src/ChainService/Memory/Memory.ts +6 -12
- package/src/ChainValidator/XyoValidator.ts +11 -4
- package/src/PendingTransactions/BasePendingTransactions.ts +2 -6
- package/src/Schemas/BaseSchemasService.ts +2 -2
- package/src/StakeIntent/XyoStakeIntentService.ts +12 -8
- package/src/blockViewerFromChainIteratorAndArchivist.ts +9 -0
- package/src/implementation/chain/evm.ts +5 -5
- package/src/implementation/chain/index.ts +12 -14
- package/src/implementation/head/createBootstrapHead.ts +13 -8
- package/src/implementation/head/index.ts +1 -1
- package/src/implementation/index.ts +0 -9
- package/src/index.ts +0 -2
- package/src/model/Params.ts +4 -4
- package/src/simple/block/runner/SimpleBlockRunner.ts +122 -122
- package/dist/neutral/ChainBlockNumberIteration/ChainBlockNumberIterationService.d.ts +0 -50
- package/dist/neutral/ChainBlockNumberIteration/ChainBlockNumberIterationService.d.ts.map +0 -1
- package/dist/neutral/ChainBlockNumberIteration/index.d.ts +0 -3
- package/dist/neutral/ChainBlockNumberIteration/index.d.ts.map +0 -1
- package/dist/neutral/ChainBlockNumberIteration/model/BlockNumberIteration.d.ts +0 -7
- package/dist/neutral/ChainBlockNumberIteration/model/BlockNumberIteration.d.ts.map +0 -1
- package/dist/neutral/ChainBlockNumberIteration/model/Params.d.ts +0 -9
- package/dist/neutral/ChainBlockNumberIteration/model/Params.d.ts.map +0 -1
- package/dist/neutral/ChainBlockNumberIteration/model/index.d.ts +0 -3
- package/dist/neutral/ChainBlockNumberIteration/model/index.d.ts.map +0 -1
- package/dist/neutral/Time/BaseTimeSyncService.d.ts +0 -24
- package/dist/neutral/Time/BaseTimeSyncService.d.ts.map +0 -1
- package/dist/neutral/Time/index.d.ts +0 -2
- package/dist/neutral/Time/index.d.ts.map +0 -1
- package/dist/neutral/implementation/accountBalance.d.ts +0 -7
- package/dist/neutral/implementation/accountBalance.d.ts.map +0 -1
- package/dist/neutral/implementation/blockViewer.d.ts +0 -7
- package/dist/neutral/implementation/blockViewer.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/config/getBridgeDestinationDetails.d.ts +0 -8
- package/dist/neutral/implementation/head/createForkedHead/config/getBridgeDestinationDetails.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/config/getBridgeSourceDetails.d.ts +0 -9
- package/dist/neutral/implementation/head/createForkedHead/config/getBridgeSourceDetails.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/config/getForkDetails.d.ts +0 -4
- package/dist/neutral/implementation/head/createForkedHead/config/getForkDetails.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/config/index.d.ts +0 -4
- package/dist/neutral/implementation/head/createForkedHead/config/index.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/createForkedHead.d.ts +0 -5
- package/dist/neutral/implementation/head/createForkedHead/createForkedHead.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/getBridgeDestinationObservation.d.ts +0 -11
- package/dist/neutral/implementation/head/createForkedHead/getBridgeDestinationObservation.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/getBridgeIntent.d.ts +0 -11
- package/dist/neutral/implementation/head/createForkedHead/getBridgeIntent.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/getBridgeSourceObservation.d.ts +0 -11
- package/dist/neutral/implementation/head/createForkedHead/getBridgeSourceObservation.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/getFirstBlockForNewChain.d.ts +0 -13
- package/dist/neutral/implementation/head/createForkedHead/getFirstBlockForNewChain.d.ts.map +0 -1
- package/dist/neutral/implementation/head/createForkedHead/index.d.ts +0 -2
- package/dist/neutral/implementation/head/createForkedHead/index.d.ts.map +0 -1
- package/dist/neutral/implementation/head/getForkFromBlock.d.ts +0 -12
- package/dist/neutral/implementation/head/getForkFromBlock.d.ts.map +0 -1
- package/dist/neutral/implementation/head/head.d.ts +0 -11
- package/dist/neutral/implementation/head/head.d.ts.map +0 -1
- package/dist/neutral/implementation/head/submitNewChain.d.ts +0 -10
- package/dist/neutral/implementation/head/submitNewChain.d.ts.map +0 -1
- package/dist/neutral/implementation/mempoolRunner.d.ts +0 -7
- package/dist/neutral/implementation/mempoolRunner.d.ts.map +0 -1
- package/dist/neutral/implementation/mempoolViewer.d.ts +0 -7
- package/dist/neutral/implementation/mempoolViewer.d.ts.map +0 -1
- package/dist/neutral/implementation/pendingTransactions.d.ts +0 -9
- package/dist/neutral/implementation/pendingTransactions.d.ts.map +0 -1
- package/dist/neutral/implementation/producer.d.ts +0 -5
- package/dist/neutral/implementation/producer.d.ts.map +0 -1
- package/dist/neutral/implementation/reward.d.ts +0 -14
- package/dist/neutral/implementation/reward.d.ts.map +0 -1
- package/dist/neutral/implementation/time.d.ts +0 -6
- package/dist/neutral/implementation/time.d.ts.map +0 -1
- package/dist/neutral/implementation/validator.d.ts +0 -5
- package/dist/neutral/implementation/validator.d.ts.map +0 -1
- package/dist/neutral/simple/block/runner/spec/SimpleBlockRunner.d.ts +0 -2
- package/dist/neutral/simple/block/runner/spec/SimpleBlockRunner.d.ts.map +0 -1
- package/src/ChainBlockNumberIteration/ChainBlockNumberIterationService.ts +0 -176
- package/src/ChainBlockNumberIteration/index.ts +0 -2
- package/src/ChainBlockNumberIteration/model/BlockNumberIteration.ts +0 -7
- package/src/ChainBlockNumberIteration/model/Params.ts +0 -10
- package/src/ChainBlockNumberIteration/model/index.ts +0 -2
- package/src/Time/BaseTimeSyncService.ts +0 -54
- package/src/Time/index.ts +0 -1
- package/src/implementation/accountBalance.ts +0 -29
- package/src/implementation/blockViewer.ts +0 -29
- package/src/implementation/head/createForkedHead/config/getBridgeDestinationDetails.ts +0 -27
- package/src/implementation/head/createForkedHead/config/getBridgeSourceDetails.ts +0 -19
- package/src/implementation/head/createForkedHead/config/getForkDetails.ts +0 -10
- package/src/implementation/head/createForkedHead/config/index.ts +0 -3
- package/src/implementation/head/createForkedHead/createForkedHead.ts +0 -29
- package/src/implementation/head/createForkedHead/getBridgeDestinationObservation.ts +0 -42
- package/src/implementation/head/createForkedHead/getBridgeIntent.ts +0 -51
- package/src/implementation/head/createForkedHead/getBridgeSourceObservation.ts +0 -46
- package/src/implementation/head/createForkedHead/getFirstBlockForNewChain.ts +0 -41
- package/src/implementation/head/createForkedHead/index.ts +0 -1
- package/src/implementation/head/getForkFromBlock.ts +0 -43
- package/src/implementation/head/head.ts +0 -49
- package/src/implementation/head/submitNewChain.ts +0 -27
- package/src/implementation/mempoolRunner.ts +0 -29
- package/src/implementation/mempoolViewer.ts +0 -29
- package/src/implementation/pendingTransactions.ts +0 -36
- package/src/implementation/producer.ts +0 -16
- package/src/implementation/reward.ts +0 -53
- package/src/implementation/time.ts +0 -26
- package/src/implementation/validator.ts +0 -15
- package/src/simple/block/runner/spec/SimpleBlockRunner.ts +0 -418
|
@@ -59,6 +59,15 @@ export function blockViewerFromChainIteratorAndArchivist(
|
|
|
59
59
|
}
|
|
60
60
|
return results
|
|
61
61
|
},
|
|
62
|
+
chainId: async function (blockNumber: XL1BlockNumber | 'latest' = 'latest') {
|
|
63
|
+
const block = blockNumber === 'latest'
|
|
64
|
+
? await this.currentBlock()
|
|
65
|
+
: await this.blockByNumber(blockNumber)
|
|
66
|
+
if (!block) {
|
|
67
|
+
throw new Error(`Block not found for block number: ${blockNumber}`)
|
|
68
|
+
}
|
|
69
|
+
return block[0].chain
|
|
70
|
+
},
|
|
62
71
|
currentBlock: async function (): Promise<SignedHydratedBlockWithHashMeta> {
|
|
63
72
|
const head = await chainIterator.head()
|
|
64
73
|
return this.blockByHash(head._hash) as Promise<SignedHydratedBlockWithHashMeta>
|
|
@@ -7,19 +7,19 @@ import type { Config } from '@xyo-network/xl1-protocol-sdk'
|
|
|
7
7
|
import type { ContractRunner } from 'ethers'
|
|
8
8
|
import { Wallet } from 'ethers/wallet'
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { EvmChainViewer } from '../../ChainService/index.ts'
|
|
11
11
|
import type { BaseAccountableServiceParams } from '../../model/index.ts'
|
|
12
12
|
import { canUseEvmProvider, initEvmProvider } from '../evm/index.ts'
|
|
13
13
|
|
|
14
|
-
let chainStakeServiceSingleton: Promisable<
|
|
14
|
+
let chainStakeServiceSingleton: Promisable<EvmChainViewer> | undefined
|
|
15
15
|
|
|
16
16
|
export const canUseEvmContractChainService = (config: Pick<Config, 'chain' | 'evm'>) => {
|
|
17
17
|
const { id } = config.chain
|
|
18
18
|
return isDefined(id) && id !== ZERO_ADDRESS && canUseEvmProvider({ config })
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const initEvmContractChainService: Initializable<BaseAccountableServiceParams
|
|
22
|
-
account, config, traceProvider, meterProvider, logger,
|
|
21
|
+
export const initEvmContractChainService: Initializable<BaseAccountableServiceParams, EvmChainViewer> = async ({
|
|
22
|
+
account, context: { config }, traceProvider, meterProvider, logger,
|
|
23
23
|
}) => {
|
|
24
24
|
if (chainStakeServiceSingleton) return chainStakeServiceSingleton
|
|
25
25
|
// Parse config
|
|
@@ -30,7 +30,7 @@ export const initEvmContractChainService: Initializable<BaseAccountableServicePa
|
|
|
30
30
|
const privateKey = assertEx(account.private?.hex, () => 'Account does not have a private key')
|
|
31
31
|
const runner: ContractRunner = new Wallet(privateKey, provider)
|
|
32
32
|
// Create service
|
|
33
|
-
chainStakeServiceSingleton =
|
|
33
|
+
chainStakeServiceSingleton = EvmChainViewer.create({
|
|
34
34
|
id, runner, traceProvider, meterProvider, logger,
|
|
35
35
|
})
|
|
36
36
|
const result = await chainStakeServiceSingleton
|
|
@@ -3,41 +3,39 @@ import {
|
|
|
3
3
|
} from '@xylabs/sdk-js'
|
|
4
4
|
import type { Initializable } from '@xyo-network/xl1-protocol'
|
|
5
5
|
import type { ChainService } from '@xyo-network/xl1-protocol-sdk'
|
|
6
|
-
import type { Config } from 'cosmiconfig'
|
|
7
6
|
|
|
8
|
-
import {
|
|
7
|
+
import { MemoryChainViewer } from '../../ChainService/index.ts'
|
|
9
8
|
import type { BaseAccountableServiceParams } from '../../model/index.ts'
|
|
10
9
|
import { canUseEvmContractChainService, initEvmContractChainService } from './evm.ts'
|
|
11
10
|
|
|
12
11
|
let chainStakeServiceSingleton: Promisable<ChainService> | undefined
|
|
13
12
|
|
|
14
|
-
export const initChainService: Initializable<BaseAccountableServiceParams
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
account, config, logger,
|
|
18
|
-
}) => {
|
|
13
|
+
export const initChainService: Initializable<BaseAccountableServiceParams,
|
|
14
|
+
ChainService> = ({ account, context }) => {
|
|
15
|
+
const { logger } = context
|
|
19
16
|
logger?.log('ChainService: Initializing...')
|
|
20
17
|
const result = init({
|
|
21
|
-
|
|
18
|
+
context,
|
|
19
|
+
name: 'ChainService' as CreatableName,
|
|
20
|
+
account,
|
|
22
21
|
})
|
|
23
22
|
logger?.log('ChainService: Initialized')
|
|
24
23
|
return result
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
export const initMemoryChainService: Initializable<BaseAccountableServiceParams
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
config,
|
|
26
|
+
export const initMemoryChainService: Initializable<BaseAccountableServiceParams, ChainService> = async ({ context }) => {
|
|
27
|
+
const result = await MemoryChainViewer.create({
|
|
28
|
+
context,
|
|
31
29
|
name: 'MemoryChainService' as CreatableName,
|
|
32
30
|
})
|
|
33
31
|
assertEx(await result.start(), () => 'Failed to start MemoryChainService')
|
|
34
32
|
return result
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
const init: Initializable<BaseAccountableServiceParams
|
|
35
|
+
const init: Initializable<BaseAccountableServiceParams,
|
|
38
36
|
ChainService> = async (params): Promise<ChainService> => {
|
|
39
37
|
if (chainStakeServiceSingleton) return chainStakeServiceSingleton
|
|
40
|
-
const { config } = params
|
|
38
|
+
const { config } = params.context
|
|
41
39
|
chainStakeServiceSingleton = canUseEvmContractChainService(config)
|
|
42
40
|
? await initEvmContractChainService({ ...params, name: 'ChainStakeService' as CreatableName })
|
|
43
41
|
: await initMemoryChainService(params)
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from '@xyo-network/chain-protocol'
|
|
1
|
+
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
+
import { buildNextBlock, createGenesisBlock } from '@xyo-network/chain-protocol'
|
|
4
3
|
import type { WalletInstance } from '@xyo-network/wallet-model'
|
|
5
|
-
import type {
|
|
6
|
-
|
|
4
|
+
import type {
|
|
5
|
+
AttoXL1, ChainId, SignedHydratedBlockWithHashMeta,
|
|
6
|
+
} from '@xyo-network/xl1-protocol'
|
|
7
|
+
import { createDeclarationIntent } from '@xyo-network/xl1-protocol-sdk'
|
|
7
8
|
|
|
8
|
-
export const createBootstrapHead = async (
|
|
9
|
-
|
|
9
|
+
export const createBootstrapHead = async (
|
|
10
|
+
account: WalletInstance,
|
|
11
|
+
chainId: ChainId,
|
|
12
|
+
genesisBlockRewardAmount: AttoXL1,
|
|
13
|
+
genesisBlockRewardAddress: Address,
|
|
14
|
+
): Promise<SignedHydratedBlockWithHashMeta[]> => {
|
|
10
15
|
const chain: SignedHydratedBlockWithHashMeta[] = []
|
|
11
16
|
|
|
12
17
|
// Create genesis block
|
|
13
|
-
const genesisBlock = await createGenesisBlock(account, chainId,
|
|
18
|
+
const genesisBlock = await createGenesisBlock(account, chainId, genesisBlockRewardAmount, genesisBlockRewardAddress)
|
|
14
19
|
chain.push(genesisBlock)
|
|
15
20
|
|
|
16
21
|
// Create producer declaration block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './createBootstrapHead.ts'
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export * from './accountBalance.ts'
|
|
2
|
-
export * from './blockViewer.ts'
|
|
3
1
|
export * from './chain/index.ts'
|
|
4
2
|
export * from './evm/index.ts'
|
|
5
3
|
export * from './head/index.ts'
|
|
6
|
-
export * from './mempoolRunner.ts'
|
|
7
|
-
export * from './mempoolViewer.ts'
|
|
8
|
-
export * from './pendingTransactions.ts'
|
|
9
|
-
export * from './producer.ts'
|
|
10
|
-
export * from './reward.ts'
|
|
11
|
-
export * from './time.ts'
|
|
12
|
-
export * from './validator.ts'
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './AccountBalance/index.ts'
|
|
|
2
2
|
export * from './BaseService.ts'
|
|
3
3
|
export * from './BlockReward/index.ts'
|
|
4
4
|
export * from './blockViewerFromChainIteratorAndArchivist.ts'
|
|
5
|
-
export * from './ChainBlockNumberIteration/index.ts'
|
|
6
5
|
export * from './ChainService/index.ts'
|
|
7
6
|
export * from './ChainValidator/index.ts'
|
|
8
7
|
export * from './Election/index.ts'
|
|
@@ -14,4 +13,3 @@ export * from './Schemas/index.ts'
|
|
|
14
13
|
export * from './simple/index.ts'
|
|
15
14
|
export * from './StakeIntent/index.ts'
|
|
16
15
|
export * from './StepStake/index.ts'
|
|
17
|
-
export * from './Time/index.ts'
|
package/src/model/Params.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CreatableParams, EmptyObject } from '@xylabs/sdk-js'
|
|
2
1
|
import type { AccountInstance } from '@xyo-network/account-model'
|
|
3
2
|
import type { OpenTelemetryProviders } from '@xyo-network/xl1-protocol'
|
|
3
|
+
import type { CreatableProviderParams } from '@xyo-network/xl1-protocol-sdk'
|
|
4
|
+
|
|
5
|
+
export interface BaseServiceParams extends CreatableProviderParams, OpenTelemetryProviders {
|
|
4
6
|
|
|
5
|
-
export interface BaseServiceParams<TConfig extends EmptyObject = EmptyObject> extends CreatableParams, OpenTelemetryProviders {
|
|
6
|
-
config: TConfig
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface BaseAccountableServiceParams
|
|
9
|
+
export interface BaseAccountableServiceParams extends BaseServiceParams {
|
|
10
10
|
account: AccountInstance
|
|
11
11
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AbstractCreatable,
|
|
3
2
|
Address,
|
|
4
|
-
|
|
3
|
+
assertEx, exists, Hex, hexToBigInt, isDefined, Promisable,
|
|
5
4
|
} from '@xylabs/sdk-js'
|
|
6
5
|
import { AccountInstance } from '@xyo-network/account-model'
|
|
7
6
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
@@ -9,24 +8,36 @@ import { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
|
9
8
|
import {
|
|
10
9
|
BlockRewardDiviner, FixedPercentageBlockRewardDiviner, FixedPercentageBlockRewardDivinerConfigSchema,
|
|
11
10
|
} from '@xyo-network/chain-modules'
|
|
12
|
-
import { buildNextBlock
|
|
11
|
+
import { buildNextBlock } from '@xyo-network/chain-protocol'
|
|
13
12
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
14
13
|
import { WithHashMeta } from '@xyo-network/payload-model'
|
|
15
14
|
import {
|
|
16
15
|
AllowedBlockPayload, asBlockBoundWitness, AttoXL1, BlockBoundWitness, BlockNumberPayload, BlockNumberSchema,
|
|
17
|
-
ChainId,
|
|
18
16
|
ChainStakeIntent, defaultRewardRatio, SignedBlockBoundWitnessWithHashMeta,
|
|
19
|
-
SignedHydratedBlockWithHashMeta, SignedHydratedTransaction,
|
|
17
|
+
SignedHydratedBlockWithHashMeta, SignedHydratedTransaction,
|
|
20
18
|
Transfer, XYO_STEP_REWARD_ADDRESS,
|
|
21
19
|
} from '@xyo-network/xl1-protocol'
|
|
22
20
|
import {
|
|
23
|
-
|
|
21
|
+
AbstractCreatableProvider,
|
|
22
|
+
AccountBalanceViewer,
|
|
23
|
+
AccountBalanceViewerMoniker,
|
|
24
|
+
BlockRewardViewer,
|
|
25
|
+
BlockRewardViewerMoniker,
|
|
26
|
+
BlockRunner,
|
|
27
|
+
BlockRunnerMoniker,
|
|
28
|
+
BlockValidationViewer,
|
|
29
|
+
BlockValidationViewerMoniker,
|
|
30
|
+
creatableProvider,
|
|
31
|
+
CreatableProviderParams,
|
|
32
|
+
createDeclarationIntent,
|
|
24
33
|
HydratedBlockStateValidationFunction,
|
|
25
34
|
MempoolRunner,
|
|
35
|
+
MempoolRunnerMoniker,
|
|
26
36
|
MempoolViewer,
|
|
37
|
+
MempoolViewerMoniker,
|
|
27
38
|
TimeSyncViewer,
|
|
39
|
+
TimeSyncViewerMoniker,
|
|
28
40
|
} from '@xyo-network/xl1-protocol-sdk'
|
|
29
|
-
import z from 'zod'
|
|
30
41
|
|
|
31
42
|
import { generateTransactionFeeTransfers } from './generateTransactionFeeTransfers.ts'
|
|
32
43
|
|
|
@@ -46,38 +57,32 @@ export const XYO_PRODUCER_REDECLARATION_DURATION = 10_000
|
|
|
46
57
|
*/
|
|
47
58
|
export const XYO_PRODUCER_REDECLARATION_WINDOW = 500
|
|
48
59
|
|
|
49
|
-
export
|
|
50
|
-
balanceViewer: z.object().loose(),
|
|
51
|
-
blockRewardViewer: z.object().loose(),
|
|
52
|
-
chainId: z.string(),
|
|
53
|
-
config: z.object().loose(),
|
|
54
|
-
mempoolViewer: z.object().loose(),
|
|
55
|
-
mempoolRunner: z.object().loose(),
|
|
56
|
-
rejectedTransactionsArchivist: z.object().loose().optional(),
|
|
57
|
-
rewardAddress: AddressZod,
|
|
58
|
-
time: z.object().loose(),
|
|
59
|
-
validateHydratedBlockState: z.function().optional(),
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
export type SimpleBlockRunnerParams = CreatableParams & {
|
|
60
|
+
export type SimpleBlockRunnerParams = CreatableProviderParams & {
|
|
63
61
|
account: AccountInstance
|
|
64
|
-
balanceViewer: AccountBalanceViewer
|
|
65
|
-
blockRewardViewer: BlockRewardViewer
|
|
66
|
-
chainId: ChainId
|
|
67
|
-
config: Config
|
|
68
|
-
mempoolRunner: MempoolRunner
|
|
69
|
-
mempoolViewer: MempoolViewer
|
|
70
62
|
rejectedTransactionsArchivist?: ArchivistInstance
|
|
71
63
|
rewardAddress: Address
|
|
72
|
-
time: TimeSyncViewer
|
|
73
64
|
validateHydratedBlockState?: HydratedBlockStateValidationFunction
|
|
74
65
|
}
|
|
75
66
|
|
|
76
|
-
@
|
|
77
|
-
export class SimpleBlockRunner extends
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
@creatableProvider()
|
|
68
|
+
export class SimpleBlockRunner extends AbstractCreatableProvider<SimpleBlockRunnerParams> implements BlockRunner {
|
|
69
|
+
static readonly defaultMoniker = BlockRunnerMoniker
|
|
70
|
+
static readonly monikers = [BlockRunnerMoniker]
|
|
71
|
+
moniker = SimpleBlockRunner.defaultMoniker
|
|
72
|
+
|
|
73
|
+
protected _blockRewardDiviner?: BlockRewardDiviner
|
|
74
|
+
protected _lastRedeclarationBlock?: number
|
|
75
|
+
protected _rejectedTransactionsArchivist?: ArchivistInstance
|
|
76
|
+
|
|
77
|
+
private _account?: AccountInstance
|
|
78
|
+
private _accountBalanceViewer?: AccountBalanceViewer
|
|
79
|
+
private _address?: Address
|
|
80
|
+
private _blockRewardViewer?: BlockRewardViewer
|
|
81
|
+
private _blockValidationViewer?: BlockValidationViewer
|
|
82
|
+
private _mempoolRunner?: MempoolRunner
|
|
83
|
+
private _mempoolViewer?: MempoolViewer
|
|
84
|
+
private _rewardAddress?: Address
|
|
85
|
+
private _timeSyncViewer?: TimeSyncViewer
|
|
81
86
|
|
|
82
87
|
/**
|
|
83
88
|
* The default block size for a block
|
|
@@ -102,24 +107,24 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
102
107
|
return XYO_PRODUCER_REDECLARATION_WINDOW
|
|
103
108
|
}
|
|
104
109
|
|
|
105
|
-
get
|
|
106
|
-
return this.
|
|
110
|
+
protected get account() {
|
|
111
|
+
return this._account!
|
|
107
112
|
}
|
|
108
113
|
|
|
109
|
-
protected get
|
|
110
|
-
return
|
|
114
|
+
protected get accountBalanceViewer() {
|
|
115
|
+
return this._accountBalanceViewer!
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
protected get
|
|
114
|
-
return
|
|
118
|
+
protected get address() {
|
|
119
|
+
return this._address!
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
protected get blockRewardViewer() {
|
|
118
|
-
return
|
|
123
|
+
return this._blockRewardViewer!
|
|
119
124
|
}
|
|
120
125
|
|
|
121
|
-
protected get
|
|
122
|
-
return
|
|
126
|
+
protected get blockValidationViewer() {
|
|
127
|
+
return this._blockValidationViewer!
|
|
123
128
|
}
|
|
124
129
|
|
|
125
130
|
// protected get electionService() {
|
|
@@ -127,11 +132,11 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
127
132
|
// }
|
|
128
133
|
|
|
129
134
|
protected get mempoolRunner() {
|
|
130
|
-
return
|
|
135
|
+
return this._mempoolRunner!
|
|
131
136
|
}
|
|
132
137
|
|
|
133
138
|
protected get mempoolViewer() {
|
|
134
|
-
return
|
|
139
|
+
return this._mempoolViewer!
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
// protected get pendingTransactionsService() {
|
|
@@ -150,26 +155,30 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
150
155
|
// return assertEx(this.params.stakeIntentService, () => 'No StakeIntentService provided')
|
|
151
156
|
// }
|
|
152
157
|
|
|
153
|
-
protected get
|
|
154
|
-
return
|
|
158
|
+
protected get timeSyncViewer(): TimeSyncViewer {
|
|
159
|
+
return this._timeSyncViewer!
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
// protected get validateHydratedBlockState() {
|
|
158
163
|
// return assertEx(this.params.validateHydratedBlockState, () => 'validateHydratedBlockState is required')
|
|
159
164
|
// }
|
|
160
165
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
override async createHandler() {
|
|
167
|
+
this._rejectedTransactionsArchivist = this.params.rejectedTransactionsArchivist ?? await MemoryArchivist.create()
|
|
168
|
+
this._account = assertEx(this.params.account, () => 'Account is required')
|
|
169
|
+
this._rewardAddress = assertEx(this.params.rewardAddress, () => 'No reward address provided')
|
|
170
|
+
this._address = this.account.address
|
|
171
|
+
this._accountBalanceViewer = await this.locateAndCreate<AccountBalanceViewer>(AccountBalanceViewerMoniker)
|
|
172
|
+
this._blockRewardViewer = await this.locateAndCreate<BlockRewardViewer>(BlockRewardViewerMoniker)
|
|
173
|
+
this._blockValidationViewer = await this.locator.getInstance<BlockValidationViewer>(BlockValidationViewerMoniker)
|
|
174
|
+
this._mempoolRunner = await this.locateAndCreate<MempoolRunner>(MempoolRunnerMoniker)
|
|
175
|
+
this._mempoolViewer = await this.locateAndCreate<MempoolViewer>(MempoolViewerMoniker)
|
|
176
|
+
this._timeSyncViewer = await this.locateAndCreate<TimeSyncViewer>(TimeSyncViewerMoniker)
|
|
168
177
|
}
|
|
169
178
|
|
|
170
179
|
async next(head: WithHashMeta<BlockBoundWitness>): Promise<SignedHydratedBlockWithHashMeta | undefined> {
|
|
171
180
|
// If the block is for another chain, ignore
|
|
172
|
-
if (head.chain !== this.chainId) return
|
|
181
|
+
// if (head.chain !== this.chainId) return
|
|
173
182
|
// const leadersStart = Date.now()
|
|
174
183
|
// const leaders = await this.electionService.getCreatorCommitteeForNextBlock(head)
|
|
175
184
|
// const leadersDuration = Date.now() - leadersStart
|
|
@@ -186,7 +195,7 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
186
195
|
async produceNextBlock(head: SignedBlockBoundWitnessWithHashMeta, force: true): Promise<SignedHydratedBlockWithHashMeta>
|
|
187
196
|
async produceNextBlock(head: SignedBlockBoundWitnessWithHashMeta, force?: false): Promise<SignedHydratedBlockWithHashMeta | undefined>
|
|
188
197
|
async produceNextBlock(head: SignedBlockBoundWitnessWithHashMeta, force?: boolean): Promise<SignedHydratedBlockWithHashMeta | undefined> {
|
|
189
|
-
assertEx(head.chain === this.chainId, () => 'Block chain ID does not match')
|
|
198
|
+
// assertEx(head.chain === this.chainId, () => 'Block chain ID does not match')
|
|
190
199
|
const result = await this.proposeNextValidBlock(head)
|
|
191
200
|
return force ? assertEx(result, () => 'Failed to produce next block') : result
|
|
192
201
|
}
|
|
@@ -218,7 +227,7 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
218
227
|
protected getProducerRedeclaration(head: WithHashMeta<BlockBoundWitness>): Promisable<ChainStakeIntent | undefined> {
|
|
219
228
|
// TODO: Do not redeclare on every block
|
|
220
229
|
// Decide if we should redeclare intent
|
|
221
|
-
if (this.params.config.producer.disableIntentRedeclaration) return
|
|
230
|
+
if (this.params.context.config.producer.disableIntentRedeclaration) return
|
|
222
231
|
// Decide if we need to redeclare intent
|
|
223
232
|
// const ranges = await this.stakeIntentService.getDeclaredCandidateRanges(this.address, 'producer')
|
|
224
233
|
// TODO: This doesn't handle the case where the producer had declared a range for the future
|
|
@@ -234,65 +243,68 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
234
243
|
}
|
|
235
244
|
|
|
236
245
|
protected async proposeNextValidBlock(head: WithHashMeta<BlockBoundWitness>, validateBalances = false, force = false) {
|
|
246
|
+
// eslint-disable-next-line max-statements
|
|
237
247
|
return await this.spanAsync('proposeNextValidBlock', async () => {
|
|
248
|
+
try {
|
|
238
249
|
// Calculate the next block components
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const nextBlockTransactions = await this.mempoolViewer.pendingTransactions({ limit: SimpleBlockRunner.DefaultBlockSize })
|
|
243
|
-
const nextBlockTransactionsDuration = Date.now() - nextBlockTransactionsStart
|
|
244
|
-
if (nextBlockTransactionsDuration > 200) {
|
|
245
|
-
this.logger?.warn(`[Slow] Fetched ${nextBlockTransactions.length} pending transactions in ${nextBlockTransactionsDuration}ms}`)
|
|
246
|
-
}
|
|
250
|
+
const { block: previousBlock } = assertEx(asBlockBoundWitness(head), () => 'Invalid head block')
|
|
251
|
+
const nextBlock = previousBlock + 1
|
|
252
|
+
const nextBlockTransactions = await this.mempoolViewer.pendingTransactions({ limit: SimpleBlockRunner.DefaultBlockSize })
|
|
247
253
|
|
|
248
|
-
|
|
254
|
+
this.logger?.info(`Pending Tx Count ${nextBlockTransactions.length}`)
|
|
249
255
|
|
|
250
|
-
|
|
251
|
-
const producerRedeclarationPayload = await this.getProducerRedeclaration(head)
|
|
252
|
-
if (producerRedeclarationPayload) blockPayloads.push(producerRedeclarationPayload)
|
|
256
|
+
const blockPayloads: AllowedBlockPayload[] = []
|
|
253
257
|
|
|
254
|
-
|
|
255
|
-
|
|
258
|
+
// Calculate the optional producer redeclaration and add it if necessary
|
|
259
|
+
const producerRedeclarationPayload = await this.getProducerRedeclaration(head)
|
|
260
|
+
if (producerRedeclarationPayload) blockPayloads.push(producerRedeclarationPayload)
|
|
256
261
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
blockPayloads.push(...rewardTransferPayloads)
|
|
262
|
+
// If there are no transactions, no payloads and no heartbeat required, we don't need to create a block
|
|
263
|
+
if (nextBlockTransactions.length === 0 && !this.heartbeatRequired(head) && !force) return
|
|
260
264
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
265
|
+
// Calculate the optional block reward transfer and add if necessary
|
|
266
|
+
const rewardTransferPayloads = await this.getBlockRewardTransfers(nextBlock)
|
|
267
|
+
blockPayloads.push(...rewardTransferPayloads)
|
|
268
|
+
|
|
269
|
+
const transactionTransfers = await generateTransactionFeeTransfers(this.address, nextBlockTransactions)
|
|
270
|
+
const timeStart = Date.now()
|
|
271
|
+
const timePayload = await this.generateTimePayload(head)
|
|
272
|
+
const timeDuration = Date.now() - timeStart
|
|
273
|
+
if (timeDuration > 100) {
|
|
274
|
+
this.logger?.warn(`[Slow] Generated time payload in ${timeDuration}ms`)
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const [fundedNextBlockTransactions, fundedTransfers] = await this.filterByFunded(head, nextBlockTransactions, transactionTransfers, validateBalances)
|
|
268
278
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
279
|
+
blockPayloads.push(...fundedTransfers, timePayload)
|
|
280
|
+
|
|
281
|
+
// Build the block
|
|
282
|
+
this.logger?.info(`Building block ${head.block + 1}`)
|
|
283
|
+
const startBuild = Date.now()
|
|
284
|
+
const stepRewardPoolBalance = (await this.accountBalanceViewer.accountBalances([XYO_STEP_REWARD_ADDRESS]))[XYO_STEP_REWARD_ADDRESS]
|
|
285
|
+
const block = await buildNextBlock(head, fundedNextBlockTransactions, blockPayloads, [this.account], XYO_STEP_REWARD_ADDRESS, stepRewardPoolBalance)
|
|
286
|
+
|
|
287
|
+
this.logger?.info(
|
|
288
|
+
`Built block ${block[0].block} in ${Date.now() - startBuild}ms with ${block[1].length} payloads`,
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
this.logger?.info(`Validating block ${block[0].block} with ${block[1].length} payloads`)
|
|
292
|
+
const startValidate = Date.now()
|
|
293
|
+
const errors = await this.blockValidationViewer.validateBlock(block)
|
|
294
|
+
this.logger?.info(`Validated block ${block[0].block} in ${Date.now() - startValidate}ms with ${block[1].length} payloads`)
|
|
295
|
+
|
|
296
|
+
if (errors.length > 0) {
|
|
297
|
+
this.logger?.warn(`Validation of produced block failed: ${errors.at(0)?.message}`)
|
|
298
|
+
const rejectedTransactions = block[1]
|
|
299
|
+
await this.rejectedTransactionsArchivist.insert(rejectedTransactions)
|
|
300
|
+
} else {
|
|
301
|
+
await this.mempoolRunner.submitBlocks([block])
|
|
302
|
+
return block
|
|
303
|
+
}
|
|
304
|
+
} catch (error) {
|
|
305
|
+
this.logger?.error(`Error proposing next valid block: ${(error as Error).message}`)
|
|
306
|
+
throw error
|
|
307
|
+
}
|
|
296
308
|
})
|
|
297
309
|
}
|
|
298
310
|
|
|
@@ -309,7 +321,7 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
309
321
|
if (!transfer) return
|
|
310
322
|
const totalTransferCost = Object.values(transfer?.transfers).reduce((acc, t) => acc + hexToBigInt(t ?? '00' as Hex), 0n)
|
|
311
323
|
if (validateBalances) {
|
|
312
|
-
const balance = (await this.
|
|
324
|
+
const balance = (await this.accountBalanceViewer.accountBalances([transfer.from]))[transfer.from] ?? AttoXL1(0n)
|
|
313
325
|
if (balance >= totalTransferCost) {
|
|
314
326
|
fundedTransfers.push(transfer)
|
|
315
327
|
return tx
|
|
@@ -323,19 +335,7 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
323
335
|
}
|
|
324
336
|
|
|
325
337
|
private async generateTimePayload(head: WithHashMeta<BlockBoundWitness>) {
|
|
326
|
-
|
|
327
|
-
const ethereumHash = asHash(ethHashOrNull, () => 'No ethereum hash available from time sync service')
|
|
328
|
-
const timePayload: TimePayload = {
|
|
329
|
-
schema: TimeSchema,
|
|
330
|
-
// this is for the previous block
|
|
331
|
-
xl1: head.block,
|
|
332
|
-
// this is for the previous block
|
|
333
|
-
xl1Hash: head._hash,
|
|
334
|
-
ethereum,
|
|
335
|
-
ethereumHash,
|
|
336
|
-
epoch: Date.now(),
|
|
337
|
-
}
|
|
338
|
-
return timePayload
|
|
338
|
+
return await this.timeSyncViewer.currentTimePayload()
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
/**
|
|
@@ -346,7 +346,7 @@ export class SimpleBlockRunner extends AbstractCreatable<SimpleBlockRunnerParams
|
|
|
346
346
|
private heartbeatRequired(head: WithHashMeta<BlockBoundWitness>): boolean {
|
|
347
347
|
const epoch = head.$epoch
|
|
348
348
|
if (isDefined(epoch)) {
|
|
349
|
-
const { heartbeatInterval } = this.params.config.producer
|
|
349
|
+
const { heartbeatInterval } = this.params.context.config.producer
|
|
350
350
|
if (Date.now() - epoch > heartbeatInterval) {
|
|
351
351
|
return true
|
|
352
352
|
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Hash, Hex, Promisable } from '@xylabs/sdk-js';
|
|
2
|
-
import type { Payload, WithHashMeta, WithStorageMeta } from '@xyo-network/payload-model';
|
|
3
|
-
import type { BlockBoundWitness, SignedHydratedBlockWithHashMeta, XL1BlockNumber } from '@xyo-network/xl1-protocol';
|
|
4
|
-
import type { BlockViewer, ChainIteratorServiceEventData, PayloadMapRead } from '@xyo-network/xl1-protocol-sdk';
|
|
5
|
-
import { LRUCache } from 'lru-cache';
|
|
6
|
-
import { BaseService } from '../BaseService.ts';
|
|
7
|
-
import type { XyoChainIteratorParams } from './model/index.ts';
|
|
8
|
-
export declare class ChainBlockNumberIterationService extends BaseService<XyoChainIteratorParams, ChainIteratorServiceEventData> implements BlockViewer {
|
|
9
|
-
static readonly defaultMoniker: "BlockViewer";
|
|
10
|
-
static readonly monikers: "BlockViewer"[];
|
|
11
|
-
moniker: "BlockViewer";
|
|
12
|
-
protected _blocksByBlockNumber: LRUCache<number, WithStorageMeta<{
|
|
13
|
-
schema: "network.xyo.boundwitness";
|
|
14
|
-
addresses: import("@xylabs/sdk-js").Address[];
|
|
15
|
-
payload_hashes: Hash[];
|
|
16
|
-
payload_schemas: string[];
|
|
17
|
-
previous_hashes: (Hash | null)[];
|
|
18
|
-
$signatures: (Hex | null)[];
|
|
19
|
-
block: XL1BlockNumber;
|
|
20
|
-
chain: Hex;
|
|
21
|
-
previous: Hash | null;
|
|
22
|
-
$epoch: number;
|
|
23
|
-
$destination?: import("@xylabs/sdk-js").Address | undefined;
|
|
24
|
-
$sourceQuery?: Hash | undefined;
|
|
25
|
-
protocol?: number | undefined;
|
|
26
|
-
step_hashes?: Hash[] | undefined;
|
|
27
|
-
}>, unknown>;
|
|
28
|
-
protected _currentHead: WithStorageMeta<BlockBoundWitness> | undefined;
|
|
29
|
-
get chainId(): Hex;
|
|
30
|
-
get chainMap(): PayloadMapRead<WithStorageMeta<Payload>>;
|
|
31
|
-
get chainStoreRead(): {
|
|
32
|
-
chainMap: PayloadMapRead<WithStorageMeta<Payload>>;
|
|
33
|
-
};
|
|
34
|
-
blockByHash(hash: Hash): Promise<SignedHydratedBlockWithHashMeta | null>;
|
|
35
|
-
blockByNumber(block: XL1BlockNumber): Promise<SignedHydratedBlockWithHashMeta | null>;
|
|
36
|
-
blocksByHash(hash: Hash, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
|
|
37
|
-
blocksByNumber(blockNumber: XL1BlockNumber, limit?: number): Promise<SignedHydratedBlockWithHashMeta[]>;
|
|
38
|
-
currentBlock(): Promise<SignedHydratedBlockWithHashMeta>;
|
|
39
|
-
currentBlockHash(): Promise<Hash>;
|
|
40
|
-
currentBlockNumber(): Promise<XL1BlockNumber>;
|
|
41
|
-
get(block: number): Promise<WithStorageMeta<BlockBoundWitness>>;
|
|
42
|
-
head(): Promise<WithStorageMeta<BlockBoundWitness>>;
|
|
43
|
-
next(block: number): Promise<WithStorageMeta<BlockBoundWitness> | undefined>;
|
|
44
|
-
payloadByHash(_hash: Hash): Promisable<WithHashMeta<Payload> | null>;
|
|
45
|
-
payloadsByHash(_hashes: Hash[]): Promisable<WithHashMeta<Payload>[]>;
|
|
46
|
-
previous(block?: number | undefined, count?: number): Promise<WithStorageMeta<BlockBoundWitness>[]>;
|
|
47
|
-
updateHead(head: BlockBoundWitness): Promise<void>;
|
|
48
|
-
private getBoundWitnessAsBlockBoundWitnessWithStorageMeta;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=ChainBlockNumberIterationService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChainBlockNumberIterationService.d.ts","sourceRoot":"","sources":["../../../src/ChainBlockNumberIteration/ChainBlockNumberIterationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EAAE,GAAG,EAAE,UAAU,EACtB,MAAM,gBAAgB,CAAA;AAMvB,OAAO,KAAK,EACV,OAAO,EAAE,YAAY,EAAE,eAAe,EACvC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACV,iBAAiB,EAAE,+BAA+B,EAAE,cAAc,EACnE,MAAM,2BAA2B,CAAA;AAIlC,OAAO,KAAK,EACV,WAAW,EACX,6BAA6B,EAE7B,cAAc,EACf,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAE9D,qBAAa,gCAAiC,SAAQ,WAAW,CAAC,sBAAsB,EAAE,6BAA6B,CACrH,YAAW,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,cAAc,gBAAqB;IACnD,MAAM,CAAC,QAAQ,CAAC,QAAQ,kBAAuB;IAC/C,OAAO,gBAAkD;IAEzD,SAAS,CAAC,oBAAoB;;;;;;;;;;;;;;;iBAA4E;IAC1G,SAAS,CAAC,YAAY,EAAE,eAAe,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAA;IAEtE,IAAI,OAAO,IAAI,GAAG,CAA2G;IAE7H,IAAI,QAAQ,IAAI,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAA0C;IAElG,IAAI,cAAc;;MAEjB;IAEK,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC;IAIxE,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC;IAIrF,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,+BAA+B,EAAE,CAAC;IAYzF,cAAc,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,+BAA+B,EAAE,CAAC;IAY5G,YAAY,IAAI,OAAO,CAAC,+BAA+B,CAAC;IAIxD,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC;IAK7C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;IA0B/D,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC,CAAC;IAUnD,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;IAMlF,aAAa,CAAC,KAAK,EAAE,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAIpE,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;IAM9D,QAAQ,CAAC,KAAK,GAAE,MAAM,GAAG,SAAqB,EAAE,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAkBjH,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;YAM1C,iDAAiD;CAOhE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ChainBlockNumberIteration/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAA;AACrD,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Promisable } from '@xylabs/sdk-js';
|
|
2
|
-
import type { BlockBoundWitness, SignedHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-protocol';
|
|
3
|
-
export interface BlockNumberIteration {
|
|
4
|
-
validatePendingBlock(block: BlockBoundWitness): Promisable<Error[]>;
|
|
5
|
-
validatePendingTransaction(tx: SignedHydratedTransactionWithStorageMeta): Promise<boolean>;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=BlockNumberIteration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlockNumberIteration.d.ts","sourceRoot":"","sources":["../../../../src/ChainBlockNumberIteration/model/BlockNumberIteration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,wCAAwC,EAAE,MAAM,2BAA2B,CAAA;AAE5G,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC,CAAA;IACnE,0BAA0B,CAAC,EAAE,EAAE,wCAAwC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3F"}
|