Skip to content

Commit

Permalink
refactor: rename wipe message
Browse files Browse the repository at this point in the history
Rename the `WIPE_EXECUTION_STATE` message to `WIPE_APPLY`. This is
because all other message follow a `NOUN_VERB_MESSAGE` structure, so we
should follow it for wipe as well.

The problem with mentioning execution state is it suggests that we are
dealing with a execution state level message. In reality `WIPE` is its
own world.
  • Loading branch information
kanej committed Sep 7, 2023
1 parent b9c539b commit 33b2ec2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function deploymentStateReducer(
};
}

if (action.type === JournalMessageType.WIPE_EXECUTION_STATE) {
if (action.type === JournalMessageType.WIPE_APPLY) {
return wipeExecutionState(state, action);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/internal/execution/types/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export type JournalMessage =
*/
export enum JournalMessageType {
RUN_START = "RUN_START",
WIPE_EXECUTION_STATE = "WIPE_EXECUTION_STATE",
WIPE_APPLY = "WIPE_APPLY",
DEPLOYMENT_EXECUTION_STATE_INITIALIZE = "DEPLOYMENT_EXECUTION_STATE_INITIALIZE",
DEPLOYMENT_EXECUTION_STATE_COMPLETE = "DEPLOYMENT_EXECUTION_STATE_COMPLETE",
CALL_EXECUTION_STATE_INITIALIZE = "CALL_EXECUTION_STATE_INITIALIZE",
Expand Down Expand Up @@ -228,6 +228,6 @@ export interface OnchainInteractionTimeoutMessage {
}

export interface WipeExecutionStateMessage {
type: JournalMessageType.WIPE_EXECUTION_STATE;
type: JournalMessageType.WIPE_APPLY;
futureId: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export function emitExecutionEvent(
});
break;
}
case JournalMessageType.WIPE_EXECUTION_STATE: {
executionEventListener[ExecutionEventType.WIPE_EXECUTION_STATE]({
type: ExecutionEventType.WIPE_EXECUTION_STATE,
case JournalMessageType.WIPE_APPLY: {
executionEventListener[ExecutionEventType.WIPE_APPLY]({
type: ExecutionEventType.WIPE_APPLY,
futureId: message.futureId,
});
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/internal/journal/utils/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function logJournalableMessage(message: JournalMessage): void {
console.log(`Deployment started`);
break;

case JournalMessageType.WIPE_EXECUTION_STATE: {
case JournalMessageType.WIPE_APPLY: {
console.log(
`Removing the execution of future ${message.futureId} from the journal`
);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/internal/wiper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Wiper {
}

const wipeMessage: WipeExecutionStateMessage = {
type: JournalMessageType.WIPE_EXECUTION_STATE,
type: JournalMessageType.WIPE_APPLY,
futureId,
};

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/types/execution-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type ExecutionEvent =
*/
export enum ExecutionEventType {
RUN_START = "RUN_START",
WIPE_EXECUTION_STATE = "WIPE_EXECUTION_STATE",
WIPE_APPLY = "WIPE_APPLY",
DEPLOYMENT_EXECUTION_STATE_INITIALIZE = "DEPLOYMENT_EXECUTION_STATE_INITIALIZE",
DEPLOYMENT_EXECUTION_STATE_COMPLETE = "DEPLOYMENT_EXECUTION_STATE_COMPLETE",
CALL_EXECUTION_STATE_INITIALIZE = "CALL_EXECUTION_STATE_INITIALIZE",
Expand Down Expand Up @@ -239,7 +239,7 @@ export interface ReadEventArgExecutionStateInitializeEvent {
* @beta
*/
export interface WipeExecutionStateEvent {
type: ExecutionEventType.WIPE_EXECUTION_STATE;
type: ExecutionEventType.WIPE_APPLY;
futureId: string;
}

Expand Down Expand Up @@ -396,7 +396,7 @@ export interface ExecutionEventError {
*/
export interface ExecutionEventTypeMap {
[ExecutionEventType.RUN_START]: RunStartEvent;
[ExecutionEventType.WIPE_EXECUTION_STATE]: WipeExecutionStateEvent;
[ExecutionEventType.WIPE_APPLY]: WipeExecutionStateEvent;
[ExecutionEventType.DEPLOYMENT_EXECUTION_STATE_INITIALIZE]: DeploymentExecutionStateInitializeEvent;
[ExecutionEventType.DEPLOYMENT_EXECUTION_STATE_COMPLETE]: DeploymentExecutionStateCompleteEvent;
[ExecutionEventType.CALL_EXECUTION_STATE_INITIALIZE]: CallExecutionStateInitializeEvent;
Expand Down
4 changes: 1 addition & 3 deletions packages/hardhat-plugin/src/ui/UiEventHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ export class UiEventHandler implements ExecutionEventListener {
};
}

public [ExecutionEventType.WIPE_EXECUTION_STATE](
event: WipeExecutionStateEvent
): void {
public [ExecutionEventType.WIPE_APPLY](event: WipeExecutionStateEvent): void {
const batches: UiBatches = [];

for (const batch of this.state.batches) {
Expand Down
4 changes: 1 addition & 3 deletions packages/hardhat-plugin/src/ui/VerboseEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export class VerboseEventHandler implements ExecutionEventListener {
console.log(`Deployment started for chainId: ${event.chainId}`);
}

public [ExecutionEventType.WIPE_EXECUTION_STATE](
event: WipeExecutionStateEvent
): void {
public [ExecutionEventType.WIPE_APPLY](event: WipeExecutionStateEvent): void {
console.log(`Removing the execution of future ${event.futureId}`);
}

Expand Down

0 comments on commit 33b2ec2

Please sign in to comment.