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

feat(types): use alloy/native types in types crate #802

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

dancoombs
Copy link
Collaborator

No description provided.

@dancoombs dancoombs changed the title feat(crates): use alloy/native types in types crate feat(types): use alloy/native types in types crate Sep 18, 2024
Copy link
Collaborator

@0xfourzerofour 0xfourzerofour left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

@@ -44,8 +43,83 @@ pub const ENTRY_POINT_INNER_GAS_OVERHEAD: U256 = U256([5_000, 0, 0, 0]);
/// paymaster_and_data = 32 bytes + 32 bytes num elems + var 32
/// signature = 32 bytes + 32 bytes num elems + var 32
///
/// 15 * 32 = 480
const ABI_ENCODED_USER_OPERATION_FIXED_LEN: usize = 480;
/// +1 for good luck? (aka this is what I got when I was testing)
Copy link
Collaborator

Choose a reason for hiding this comment

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

luck is on our side

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I couldn't figure this out, would love to look into it more but I trust the numbers coming out of alloy.

+ super::byte_array_abi_len(&self.packed.call_data)
+ super::byte_array_abi_len(&self.packed.paymaster_and_data)
+ super::byte_array_abi_len(&self.packed.initCode)
+ super::byte_array_abi_len(&self.packed.callData)
Copy link
Collaborator

Choose a reason for hiding this comment

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

hate that the sol stuff defaults to camelcase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same. It actually worked out somewhat okay because we wrap a lot of the onchain types in our own types where we use snake_case. So its isolated to a few files that deal with the onchain types.

@0xfourzerofour
Copy link
Collaborator

Looks like their might just be an issue with the build.rs stuff

@dancoombs
Copy link
Collaborator Author

Looks like their might just be an issue with the build.rs stuff

Hm, yeah it looks like Foundry isn't running for some reason in the contracts build.rs, I'll look into it but its unrelated to this PR.

let cgl = super::default_if_none_or_equal(self.call_gas_limit, max_call_gas, 0);
let vgl =
super::default_if_none_or_equal(self.verification_gas_limit, max_verification_gas, 0);
let pvg = super::default_if_none_or_equal(self.pre_verification_gas, max_call_gas, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

just curious, I find those 3 variables only used to construct UO below, is that possible to inline them like L418 to L424?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could, but they're pulled out specifically so that the comment above clearly applies to these conversations

max_verification_gas,
U128::zero(),
);
let cgl = super::default_if_none_or_equal(self.call_gas_limit, max_call_gas, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here.

@dancoombs dancoombs merged commit 819403f into feat/v0.4 Sep 19, 2024
3 of 7 checks passed
@dancoombs dancoombs deleted the danc/alloy-types-2 branch September 19, 2024 17:12
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.

3 participants