Skip to content

Commit

Permalink
Add gas host call
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian50 committed Jan 21, 2025
1 parent 8e1af79 commit 5966286
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/packages/web-worker/command-handlers/host-call.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HostCallIdentifiers } from "@/types/pvm";
import { CommandStatus, PvmApiInterface, Storage } from "../types";
import { read, Registers, write, Memory } from "@typeberry/jam-host-calls";
import { read, Registers, write, Memory, gas } from "@typeberry/jam-host-calls";
import { WriteAccounts } from "@/packages/host-calls/write";
import { isInternalPvm } from "../utils";
import { ReadAccounts } from "@/packages/host-calls/read";
Expand Down Expand Up @@ -165,6 +165,12 @@ const hostCall = async ({
await jamHostCall.execute(getGasCounter(pvm), getRegisters(pvm), getMemory(pvm));

return { hostCallIdentifier, storage, status: CommandStatus.SUCCESS };
} else if (hostCallIdentifier === HostCallIdentifiers.GAS) {
const jamHostCall = new gas.Gas();

await jamHostCall.execute(getGasCounter(pvm), getRegisters(pvm));

return { hostCallIdentifier, status: CommandStatus.SUCCESS };
}

return { hostCallIdentifier, status: CommandStatus.ERROR, error: new Error("Unknown host call identifier") };
Expand Down

0 comments on commit 5966286

Please sign in to comment.