Skip to content

Commit

Permalink
chore: field encoding should use fromString instead of `fromHexStri…
Browse files Browse the repository at this point in the history
…ng` (#11585)

Related #10331
  • Loading branch information
sklppy88 authored Feb 3, 2025
1 parent dddab22 commit 43fdbb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/abi/encoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe('abi/encoder', () => {
};
const args = ['garbage'];

expect(() => encodeArguments(testFunctionAbi, args)).toThrow('Invalid hex-encoded string: "garbage"');
expect(() => encodeArguments(testFunctionAbi, args)).toThrow('Tried to create a Fr from an invalid string');
});

it('throws when passing string argument as integer', () => {
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/foundation/src/abi/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ArgumentEncoder {
} else if (typeof arg === 'bigint') {
this.flattened.push(new Fr(arg));
} else if (typeof arg === 'string') {
this.flattened.push(Fr.fromHexString(arg));
this.flattened.push(Fr.fromString(arg));
} else if (typeof arg === 'boolean') {
this.flattened.push(new Fr(arg ? 1n : 0n));
} else if (typeof arg === 'object') {
Expand Down

0 comments on commit 43fdbb1

Please sign in to comment.