Skip to content

Commit

Permalink
complete generification of hashlib message hash functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Nov 3, 2024
1 parent 5f27e85 commit d306d74
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 78 deletions.
28 changes: 14 additions & 14 deletions snapshots/TheCompactTest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"basicTransfer": "56850",
"basicWithdrawal": "59816",
"batchClaim": "111889",
"batchClaimRegisteredWithDeposit": "111889",
"batchClaim": "111783",
"batchClaimRegisteredWithDeposit": "111783",
"batchClaimRegisteredWithDepositWithWitness": "112651",
"batchClaimWithWitness": "112645",
"batchDepositAndRegisterViaPermit2": "221877",
"batchDepositAndRegisterWithWitnessViaPermit2": "221855",
"batchTransfer": "81520",
"batchWithdrawal": "99951",
"claim": "56967",
"claimAndWithdraw": "73266",
"claim": "56784",
"claimAndWithdraw": "73083",
"claimWithWitness": "59432",
"depositAndRegisterViaPermit2": "124247",
"depositBatchSingleERC20": "67868",
Expand All @@ -22,20 +22,20 @@
"depositERC20ViaPermit2AndURI": "98289",
"depositETHAndURI": "26754",
"depositETHBasic": "28391",
"qualifiedBatchClaim": "113307",
"qualifiedBatchClaimWithWitness": "112762",
"qualifiedClaim": "60226",
"qualifiedClaimWithWitness": "58766",
"qualifiedSplitBatchClaim": "140881",
"qualifiedSplitBatchClaimWithWitness": "140864",
"qualifiedSplitClaim": "86502",
"qualifiedSplitClaimWithWitness": "86868",
"qualifiedBatchClaim": "113318",
"qualifiedBatchClaimWithWitness": "112858",
"qualifiedClaim": "60218",
"qualifiedClaimWithWitness": "58885",
"qualifiedSplitBatchClaim": "140892",
"qualifiedSplitBatchClaimWithWitness": "140960",
"qualifiedSplitClaim": "86543",
"qualifiedSplitClaimWithWitness": "86998",
"register": "25379",
"splitBatchClaim": "140343",
"splitBatchClaim": "140237",
"splitBatchClaimWithWitness": "140307",
"splitBatchTransfer": "110587",
"splitBatchWithdrawal": "139819",
"splitClaim": "86425",
"splitClaim": "86242",
"splitClaimWithWitness": "85906",
"splitTransfer": "82732",
"splitWithdrawal": "93702"
Expand Down
110 changes: 110 additions & 0 deletions src/lib/FunctionCastLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,116 @@ library FunctionCastLib {
}
}

function usingQualifiedMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (QualifiedMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingQualifiedSplitMultichainClaimWithWitness(function (QualifiedMultichainClaimWithWitness calldata) internal view returns (bytes32, bytes32, bytes32) fnIn)
internal
pure
returns (function (QualifiedSplitMultichainClaimWithWitness calldata) internal view returns (bytes32, bytes32, bytes32) fnOut)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingQualifiedBatchMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (QualifiedBatchMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingQualifiedSplitBatchMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (QualifiedSplitBatchMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingExogenousQualifiedMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (ExogenousQualifiedMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingExogenousQualifiedSplitMultichainClaimWithWitness(function (ExogenousQualifiedMultichainClaimWithWitness calldata) internal view returns (bytes32, bytes32, bytes32) fnIn)
internal
pure
returns (function (ExogenousQualifiedSplitMultichainClaimWithWitness calldata) internal view returns (bytes32, bytes32, bytes32) fnOut)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingExogenousQualifiedBatchMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (ExogenousQualifiedBatchMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingExogenousQualifiedSplitBatchMultichainClaimWithWitness(
function (uint256, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32) fnIn
)
internal
pure
returns (
function (ExogenousQualifiedSplitBatchMultichainClaimWithWitness calldata, uint256, function (uint256, uint256, bytes32, bytes32, uint256) internal view returns (bytes32)) internal view returns (bytes32, bytes32, bytes32)
fnOut
)
{
assembly ("memory-safe") {
fnOut := fnIn
}
}

function usingSplitTransfer(function (bytes32, address, BasicTransfer calldata) internal fnIn) internal pure returns (function (bytes32, address, SplitTransfer calldata) internal fnOut) {
assembly ("memory-safe") {
fnOut := fnIn
Expand Down
Loading

0 comments on commit d306d74

Please sign in to comment.