-
Notifications
You must be signed in to change notification settings - Fork 550
feat: add support for Batch amendment #2801
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
Changes from all commits
4803cdc
84c8900
6ca94b7
810bc42
dce0947
bac69ca
7866790
768eb08
8df48e2
e1747a9
9d69271
78e3d05
dc98b1b
fe08836
4fe1986
e696113
ab8d1b1
66dc844
25ccc09
7597807
ef4ab32
762e57e
28bce04
f671532
9643508
e743ddc
826fff8
ab09e38
a4b55e2
7d7acae
8fc2600
0d86085
438a9d2
591af47
9b8c819
78e3ad9
4e3a5fb
7fb9927
447c747
4d84930
f120ea6
1772b45
009e98f
211d46a
ff9929c
29991c2
fcd579a
3818b29
7212c5e
39c7ef5
3903599
e5f5d3c
ec24418
f8376eb
260bc32
bf19d12
6b03f91
6d63995
4a22d5b
e084f43
0d08deb
f427bc4
2280b95
a5d72f9
08543fc
d243ecc
503cf6c
b3b2c4c
b092a94
c48957d
b519151
793d42f
f06e83c
dd36b47
60940fa
021999e
1f7c48c
1773246
27a39bf
4c36d4d
357b5b0
5d4efda
23e3e07
ae20b6b
3c56343
3b899a7
82de5ac
c4a1b21
646f71e
916b4a6
0e49ebf
f9afbfd
0b8ecf8
027861e
3021822
335eafe
9a54bec
b8db856
27efb57
cffc141
b612edc
c3405e0
f20f16c
808748d
d1a4a41
b2e1122
a707718
e19cc51
ee1a7ed
2d75bd0
b373a1c
5cbeee2
b360cdf
bee8240
97f454c
abd3c1c
cd4f226
bba11c4
ac3c5e2
0b58072
7b9d8ab
661fa4f
20fbafe
21cffbf
1b637b9
beb1762
2971417
5b7569e
b0765dc
0bf4a7b
e4f7adf
5c688c9
55c4080
7e806b0
88a596a
5119cca
980309d
e44e400
7bf7730
e433d6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { Comparable } from './serialized-type' | ||
import { BinaryParser } from '../serdes/binary-parser' | ||
import { hexToBytes } from '@xrplf/isomorphic/utils' | ||
import { HEX_REGEX, hexToBytes } from '@xrplf/isomorphic/utils' | ||
import { compare } from '../utils' | ||
|
||
/** | ||
|
@@ -27,6 +27,9 @@ class Hash extends Comparable<Hash | string> { | |
} | ||
|
||
if (typeof value === 'string') { | ||
if (!HEX_REGEX.test(value)) { | ||
throw new Error(`Invalid hash string ${value}`) | ||
} | ||
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainExcellent defensive programming practice. The hexadecimal validation prevents invalid strings from being processed, which is crucial for maintaining data integrity in hash operations. The error message is descriptive and will help with debugging. Note that the 🏁 Script executed: #!/bin/bash
# Verify if empty strings should be allowed as valid hash inputs
echo "Checking HEX_REGEX pattern and testing empty string behavior..."
# Check the regex pattern definition
rg -A 2 -B 2 "HEX_REGEX.*=" packages/isomorphic/src/utils/shared.ts
# Search for any existing hash creation with empty strings to understand expected behavior
rg -A 3 -B 3 "Hash\.from\(\s*['\"][\s]*['\"]"
rg -A 3 -B 3 "new.*Hash.*['\"][\s]*['\"]" Length of output: 48187 Ensure HEX_REGEX doesn’t inadvertently allow empty strings Great defensive programming here—the check and error are clear and helpful. However, the current pattern in export const HEX_REGEX = /^[A-F0-9]*$/iu The -export const HEX_REGEX = /^[A-F0-9]*$/iu
+export const HEX_REGEX = /^[A-F0-9]+$/iu • File to update:
• Change If you do intend to allow empty hashes, please add a comment to clarify this special case. 🤖 Prompt for AI Agents
|
||
return new this(hexToBytes(value)) | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.