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

RED-201: Network Generated Transactions #16

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as shardFunctionTypes_ from './state-manager/shardFunctionTypes'
import * as StateManagerTypes_ from './state-manager/StateManagerTypes'
import * as StateMetaDataTypes_ from './state-manager/StateMetaDataTypes'
import * as ModesTypes_ from './p2p/ModesTypes'
import * as ServiceQueueTypes_ from './p2p/ServiceQueueTypes'
import * as Utils_ from './utils/functions/stringify'

export type hexstring = string
Expand Down Expand Up @@ -51,6 +52,7 @@ export namespace P2P {
export import SyncTypes = SyncTypes_
export import TemplateTypes = TemplateTypes_
export import ModesTypes = ModesTypes_
export import ServiceQueueTypes = ServiceQueueTypes_
}

export namespace StateManager {
Expand Down
7 changes: 5 additions & 2 deletions src/p2p/CycleCreatorTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as SafetyMode from './SafetyModeTypes'
import * as Snapshot from './SnapshotTypes'
import * as Modes from './ModesTypes'
import * as LostArchivers from './LostArchiverTypes'
import * as ServiceQueue from './ServiceQueueTypes'

/** TYPES */

Expand Down Expand Up @@ -42,7 +43,8 @@ export type CycleTxs =
Lost.Txs &
Rotation.Txs &
CycleAutoScale.Txs &
LostArchivers.Txs
LostArchivers.Txs &
ServiceQueue.Txs
// don't forget to add new modules here

export type CycleRecord = BaseRecord &
Expand All @@ -68,7 +70,8 @@ export type CycleRecord = BaseRecord &
standbyNodeListHash: hexstring
} &
LostArchivers.Record &
{ random: number }
{ random: number } &
ServiceQueue.Record

export type CycleData = CycleRecord & {
marker: CycleMarker
Expand Down
1 change: 1 addition & 0 deletions src/p2p/P2PTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface P2PNode {
address: string
joinRequestTimestamp: number
activeTimestamp: number
activeCycle: number
syncingTimestamp: number
readyTimestamp: number
refreshedCounter?: number
Expand Down
33 changes: 33 additions & 0 deletions src/p2p/ServiceQueueTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { SignedObject } from "./P2PTypes"

export interface Txs {
txadd: AddNetworkTx[]
txremove: RemoveNetworkTx[]
}

export interface AddNetworkTx<T = any> {
hash: string
type: string
txData: T
cycle: number // cycle the tx was added
subQueueKey?: string
}

export interface RemoveNetworkTx {
txHash: string
cycle: number // cycle the tx was added
}

export type SignedAddNetworkTx = AddNetworkTx & SignedObject;
export type SignedRemoveNetworkTx = RemoveNetworkTx & SignedObject;

export interface NetworkTxEntry {
hash: string
tx: AddNetworkTx
}

export interface Record {
txadd: AddNetworkTx[]
txremove: RemoveNetworkTx[]
txlisthash: string
}
Loading