Skip to content
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

refactor: representing TxHash as Fr #10954

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

benesjan
Copy link
Contributor

@benesjan benesjan commented Dec 23, 2024

TxHash used to be representing as Buffer32 and it did not make sense as it's an Fr.

+ typo fixes

Note

The failing docs CI task is unrelated to this PR (Sean is just working on fixing it).

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benesjan benesjan changed the title refactor: represetnting tx hahs as Fr refactor: representing TxHash as Fr Dec 23, 2024
@@ -15,6 +15,6 @@ struct ProposeArgs {

library ProposeLib {
function digest(ProposeArgs memory _args) internal pure returns (bytes32) {
return keccak256(abi.encode(SignatureLib.SignatureDomainSeperator.blockAttestation, _args));
return keccak256(abi.encode(SignatureLib.SignatureDomainSeparator.blockAttestation, _args));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This typo was in a lot of places and it bothered me. Sorry for the messy diff

const owner = AztecAddress.fromBuffer(reader);
const contractAddress = AztecAddress.fromBuffer(reader);
const storageSlot = Fr.fromBuffer(reader);
const note = reader.readObject(Note);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change but I thought it will make it cuter

@benesjan benesjan force-pushed the 12-23-refactor_represetnting_tx_hahs_as_fr branch from a40b524 to 1c42401 Compare January 2, 2025 15:51
@@ -17,6 +17,7 @@
"build": "yarn clean && tsc -b",
"start": "node --no-warnings ./dest/bin",
"start:debug": "node --inspect=0.0.0.0:9221 --no-warnings ./dest/bin",
"start:sandbox": "ETHEREUM_HOST=http://0.0.0.0:8545/ && yarn start start --sandbox",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sneaked this in because of this discussion on slack.

@benesjan benesjan force-pushed the 12-23-refactor_represetnting_tx_hahs_as_fr branch from 1c42401 to 6d9067a Compare January 2, 2025 17:05
Comment on lines 54 to 58
return z
.object({
hash: schemas.Fr,
})
.transform(({ hash }) => new TxHash(hash));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this change. Before, a TxHash would be represented as just a string like 0x1234, but with this change it'd be an object like { "hash": "0x1234" }. Personally I'd prefer the more compact representation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought that's what I need to do when doing the change to Fr (didn't really understand the schemas when first fiddling with it). I see that it was unnecessary so I reverted it in 2c021b7

Thanks for the feedback and the quick review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants