Skip to content

Commit 99743ac

Browse files
committed
Update nitro-test-node to use new hashing scheme for address filter - NIT-4754
1 parent 5ecd80a commit 99743ac

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ services:
492492
MINIO_ROOT_PASSWORD: minioadmin
493493
command: server /data --console-address ":9001"
494494
healthcheck:
495-
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
495+
test: ["CMD", "mc", "ready", "local"]
496496
interval: 5s
497497
timeout: 5s
498498
retries: 5

scripts/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ export const initTxFilteringMinioCommand = {
873873
command: "init-tx-filtering-minio",
874874
describe: "initializes MinIO bucket and empty address hash list",
875875
handler: async () => {
876-
const salt = crypto.randomBytes(32).toString('hex');
876+
const salt = crypto.randomUUID();
877877
const initialAddressList = {
878878
"salt": salt,
879879
"hashing_scheme": "Sha256",
@@ -902,9 +902,9 @@ export const initTxFilteringMinioCommand = {
902902
}
903903

904904
function computeAddressHash(address: string, salt: string): string {
905-
const normalizedAddress = address.toLowerCase();
906-
const data = salt + normalizedAddress.replace('0x', '');
907-
const hash = crypto.createHash('sha256').update(Buffer.from(data, 'hex')).digest('hex');
905+
const normalizedAddress = address.toLowerCase().replace('0x', '');
906+
const hashInput = salt + '::0x' + normalizedAddress;
907+
const hash = crypto.createHash('sha256').update(hashInput).digest('hex');
908908
return hash;
909909
}
910910

0 commit comments

Comments
 (0)