Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
adraffy committed Oct 13, 2024
1 parent b8e6a34 commit 49ed5da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export class ProgramReader {
this.checkRead(n);
return hexlify(this.ops.subarray(this.pos, (this.pos += n)));
}
readWordSize() {
readUint() {
const n = this.readByte();
if (n > 32) throw new Error(`expected word size: ${n}`);
return n ? parseInt(this.readBytes(n)) : 0;
if (n > 32) throw new Error(`expected word size: ${n}`);
return n ? BigInt(this.readBytes(n)) : 0n;
}
readSmallStr() {
return toUtf8String(this.readBytes(this.readByte()));
Expand Down Expand Up @@ -96,7 +96,7 @@ export class ProgramReader {
case OP.PUSH_32:
return { bytes: this.readBytes(op) };
case OP.PUSH_BYTES:
return { bytes: this.readBytes(this.readWordSize()) };
return { bytes: this.readBytes(Number(this.readUint())) };
case OP.EVAL_LOOP:
return { flags: this.readByte() };
case OP.ASSERT:
Expand Down
2 changes: 1 addition & 1 deletion src/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export abstract class AbstractProver {
case OP.PUSH_BYTES: {
vm.push(
reader.readBytes(
checkSize(reader.readWordSize(), this.maxAssembleBytes)
checkSize(reader.readUint(), this.maxAssembleBytes)
)
);
continue;
Expand Down
4 changes: 3 additions & 1 deletion test/debug/decompile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const req = new GatewayRequest(2)
.pushBytes('0xDEADBEEF')
.setOutput(1)
.push(true)
.assertNonzero(1);
.assertNonzero(1)
.requireContract(2)
.requireNonzero(3);

//console.log(req.toTuple());

Expand Down

0 comments on commit 49ed5da

Please sign in to comment.