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

perf: minimze communication between host and WASM module #284 - part 1 #288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 4 additions & 5 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 Expand Up @@ -689,7 +689,6 @@ export class HandlerBasedContract<State> implements Contract<State> {

interactionCall.update({
cacheHit: false,
outputState: this._evaluationOptions.stackTrace.saveState ? result.state : undefined,
executionTime: benchmark.elapsed(true) as number,
valid: result.type === 'ok',
errorMessage: result.errorMessage,
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