Skip to content

Commit

Permalink
Merge pull request #1414 from robrobbins/mina-signer-fixes
Browse files Browse the repository at this point in the history
Cleanups for mina-signer
  • Loading branch information
mitschabaude authored Feb 6, 2024
2 parents 3fe3392 + b67432f commit b5a1317
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 14 additions & 0 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,22 @@ npm run test
npm run test:unit
```

In order for the mina-signer tests to run you must also build from inside its subdirectory:

```sh
cd src/mina-signer
npm run build
cd ../..
```

This runs all the unit tests and provides you with a summary of the test results.

Note that you can run individual jest tests via the command:

```sh
./jest <path/to/test.ts>
```

You can also run integration tests by running:

```sh
Expand Down
7 changes: 4 additions & 3 deletions src/mina-signer/src/rosetta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ function fieldToHex<T extends Field | Scalar>(
) {
let bytes = binable.toBytes(x);
// set highest bit (which is empty)
bytes[bytes.length - 1] &= Number(paddingBit) << 7;
// map each byte to a hex string of length 2
bytes[bytes.length - 1] |= Number(paddingBit) << 7;
// map each byte to a 0-padded hex string of length 2
return bytes
.map((byte) => byte.toString(16).split('').reverse().join(''))
.map((byte) => byte.toString(16).padStart(2, '0').split('').reverse().join(''))
.join('');
}

function fieldFromHex<T extends Field | Scalar>(
binable: Binable<T>,
hex: string
Expand Down

0 comments on commit b5a1317

Please sign in to comment.