Skip to content

WIP: Incoporate learnings into a new iteration of AllowanceHolder#246

Draft
duncancmt wants to merge 32 commits into
masterfrom
dcmt/allowanceholder2
Draft

WIP: Incoporate learnings into a new iteration of AllowanceHolder#246
duncancmt wants to merge 32 commits into
masterfrom
dcmt/allowanceholder2

Conversation

@duncancmt

Copy link
Copy Markdown
Collaborator

No description provided.

@duncancmt duncancmt mentioned this pull request Oct 16, 2024
@duncancmt duncancmt force-pushed the dcmt/allowanceholder2 branch from 4c54af8 to 1444d8c Compare October 16, 2024 10:44
@duncancmt duncancmt changed the base branch from dcmt/golf to dcmt/golf2 October 16, 2024 10:45
@duncancmt duncancmt changed the title WIP: Incoporate learnings into a new iteration of AllowanceHolder Incoporate learnings into a new iteration of AllowanceHolder Oct 16, 2024
@duncancmt duncancmt marked this pull request as ready for review October 16, 2024 10:45
Base automatically changed from dcmt/golf2 to master October 29, 2024 13:03
@duncancmt duncancmt marked this pull request as draft January 24, 2025 18:16
@duncancmt duncancmt changed the title Incoporate learnings into a new iteration of AllowanceHolder WIP: Incoporate learnings into a new iteration of AllowanceHolder Jan 24, 2025
Comment thread src/allowanceholder/AllowanceHolderBase.sol Outdated
mstore(add(0x24, testData), target)
mstore(add(0x10, testData), 0x70a08231000000000000000000000000)
mstore(testData, 0x24)
mstore(0x40, add(0x60, testData))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you doing 0x60 to keep the memory alignment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still wondering why not

Suggested change
mstore(0x40, add(0x60, testData))
mstore(0x40, add(0x44, testData))

Comment on lines +210 to +216
// Pad `returndata` to a multiple of 32 bytes.
let len := mload(result)
let m := and(0x1f, len)
if m {
mstore(add(add(0x20, result), len), 0x00)
len := add(sub(0x20, m), len)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what made you add this padding here?

target := calldataload(add(0x04, data.offset))
// `shl(0x08, data.length)` can't overflow because we're going to
// `calldatacopy(..., data.length)` later. It would OOG.
let mask := shr(shl(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)

@e1Ru1o e1Ru1o Aug 5, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be mul? or shr(0x03, ...)

Suggested change
let mask := shr(shl(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
let mask := shr(mul(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah it should be shl(0x03, ...)

@duncancmt duncancmt force-pushed the master branch 6 times, most recently from b8e3001 to af9b948 Compare January 16, 2026 17:34
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