Skip to content
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
22 changes: 21 additions & 1 deletion src/event-stream/msg-parsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,28 @@
mockBlock: ReturnType<typeof parseMockBlock>;
}

// https://github.com/stacks-network/stacks-core/blob/9d4cc3acd2c07d103b16750c1f3bdd6bf99a5232/libsigner/src/v0/messages.rs#L551
export interface StateMachineUpdate extends ChunkMetadata {
messageType: 'StateMachineUpdate';

// burn_block: ConsensusHash,
// burn_block_height: u64,
// current_miner_pkh: Hash160,
// parent_tenure_id: ConsensusHash,
// parent_tenure_last_block: StacksBlockId,
// parent_tenure_last_block_height: u64,
// active_signer_protocol_version: u64,
// local_supported_signer_protocol_version: u64,
}

Check warning on line 104 in src/event-stream/msg-parsing.ts

View check run for this annotation

Codecov / codecov/patch

src/event-stream/msg-parsing.ts#L91-L104

Added lines #L91 - L104 were not covered by tests
export type ParsedStackerDbChunk =
| BlockProposalChunkType
| BlockResponseChunkType
| BlockPushedChunkType
| MockProposalChunkType
| MockSignatureChunkType
| MockBlockChunkType;
| MockBlockChunkType
| StateMachineUpdate;

Check warning on line 112 in src/event-stream/msg-parsing.ts

View check run for this annotation

Codecov / codecov/patch

src/event-stream/msg-parsing.ts#L111-L112

Added lines #L111 - L112 were not covered by tests

export function parseStackerDbChunk(chunk: StackerDbChunk): ParsedStackerDbChunk[] {
return chunk.modified_slots.flatMap(msg => {
Expand Down Expand Up @@ -128,6 +143,7 @@
MockProposal = 3,
MockSignature = 4,
MockBlock = 5,
StateMachineUpdate = 6,

Check warning on line 146 in src/event-stream/msg-parsing.ts

View check run for this annotation

Codecov / codecov/patch

src/event-stream/msg-parsing.ts#L146

Added line #L146 was not covered by tests
}

// https://github.com/stacks-network/stacks-core/blob/cd702e7dfba71456e4983cf530d5b174e34507dc/libsigner/src/v0/messages.rs#L206
Expand Down Expand Up @@ -166,6 +182,10 @@
messageType: 'MockBlock',
mockBlock: parseMockBlock(cursor),
} as const;
case SignerMessageTypePrefix.StateMachineUpdate:
return {
messageType: 'StateMachineUpdate',
} as const;

Check warning on line 188 in src/event-stream/msg-parsing.ts

View check run for this annotation

Codecov / codecov/patch

src/event-stream/msg-parsing.ts#L185-L188

Added lines #L185 - L188 were not covered by tests
default:
throw new Error(`Unknown message type prefix: ${messageType}`);
}
Expand Down
4 changes: 4 additions & 0 deletions src/pg/ingestion/pg-write-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
// ignore
break;
}
case 'StateMachineUpdate': {
// ignore
break;
}

Check warning on line 108 in src/pg/ingestion/pg-write-store.ts

View check run for this annotation

Codecov / codecov/patch

src/pg/ingestion/pg-write-store.ts#L105-L108

Added lines #L105 - L108 were not covered by tests
default: {
this.logger.error(chunk, `Unknown StackerDB event type`);
break;
Expand Down