Skip to content

Commit

Permalink
perf: minimze communication between host and WASM module #284 - part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
ppedziwiatr committed Dec 4, 2022
1 parent 402e6fc commit 99d6076
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 118 deletions.
8 changes: 4 additions & 4 deletions src/contract/HandlerBasedContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,8 @@ export class HandlerBasedContract<State> implements Contract<State> {

const handleResult = await this.evalInteraction<Input, View>(
{
interaction,
interactionTx: dummyTx,
action: interaction,
interaction: dummyTx,
currentTx: []
},
executionContext,
Expand Down Expand Up @@ -658,8 +658,8 @@ export class HandlerBasedContract<State> implements Contract<State> {
};

const interactionData: InteractionData<Input> = {
interaction,
interactionTx,
action: interaction,
interaction: interactionTx,
currentTx
};

Expand Down
21 changes: 10 additions & 11 deletions src/core/ContractCallRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ export class ContractCallRecord {
}

addInteractionData(interactionData: InteractionData<any>): InteractionCall {
const { interaction, interactionTx } = interactionData;
const { action, interaction } = interactionData;

const interactionCall = InteractionCall.create(
new InteractionInput(
interactionTx.id,
interactionTx.sortKey,
interactionTx.block.height,
interactionTx.block.timestamp,
interaction?.caller,
interaction?.input.function,
interaction?.input,
interactionTx.dry,
interaction.id,
interaction.sortKey,
interaction.block.height,
interaction.block.timestamp,
action?.caller,
action?.input.function,
action?.input,
interaction.dry,
{}
)
);

this.interactions[interactionTx.id] = interactionCall;
this.interactions[interaction.id] = interactionCall;

return interactionCall;
}
Expand Down Expand Up @@ -72,7 +72,6 @@ export class InteractionInput {
export class InteractionOutput {
constructor(
public readonly cacheHit: boolean,
public readonly outputState: any,
public readonly executionTime: number,
public readonly valid: boolean,
public readonly errorMessage: string = '',
Expand Down
7 changes: 7 additions & 0 deletions src/core/WarpPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ export interface WarpPlugin<T, R> {

process(input: T): R;
}

export type EvaluationProgressInput = {
contractTxId: string;
currentInteraction: number;
allInteractions: number;
lastInteractionProcessingTime: string;
}
Loading

0 comments on commit 99d6076

Please sign in to comment.