fix page zktrie: change the domain of nodeKey hashing to 512 instead of 256 #282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closing issues
closes #281
Description
The docs states the domain used in creating the nodeKey is 256 but its actually 512.
In the zktrie repo nodekeys are hashed with ToSecureKey() in type/util.go.
ToSecureKey() uses Hash() in types/bytes32.go which uses HASH_DOMAIN_BYTE32 as domain which is 256 *2 (=512).
ToSecureKey: https://github.com/scroll-tech/zktrie/blob/23181f209e94137f74337b150179aeb80c72e7c8/types/util.go#L107
HASH_DOMAIN_BYTES32: https://github.com/scroll-tech/zktrie/blob/23181f209e94137f74337b150179aeb80c72e7c8/types/hash.go#L16
Am also making a storage prover and here is where i did my test in noir :D (account leaf is lower in same file).
https://github.com/jimjimvalkema/scrollZkStorageProofs/blob/bcdd922405e046e99787b8b47f374befac170779/ScrollStorageProver/src/main.nr#L168
...
Changes
Changed domain value for the nodeKey mentioned in account leaf and storage leaf section.
Changed the domain from 256 to 512