Skip to content

Commit

Permalink
refactor(protocol): optimize signature verification in AssignmentHook (
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik authored Jun 6, 2024
1 parent 0b1ab18 commit cc77898
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/protocol/contracts/L1/hooks/AssignmentHook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,16 @@ contract AssignmentHook is EssentialContract, IHook {
assignment, msg.sender, _meta.sender, _blk.assignedProver, _meta.blobHash
);

if (!_blk.assignedProver.isValidSignatureNow(hash, assignment.signature)) {
revert HOOK_ASSIGNMENT_INVALID_SIG();
if (Address.isContract(_blk.assignedProver)) {
if (!_blk.assignedProver.isValidERC1271SignatureNow(hash, assignment.signature)) {
revert HOOK_ASSIGNMENT_INVALID_SIG();
}
} else {
(address recovered, ECDSA.RecoverError error) =
ECDSA.tryRecover(hash, assignment.signature);
if (recovered != _blk.assignedProver || error != ECDSA.RecoverError.NoError) {
revert HOOK_ASSIGNMENT_INVALID_SIG();
}
}

// Send the liveness bond to the Taiko contract
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/deployments/mainnet-contract-logs-L1.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
- deployed on May 1, 2024 @commit`56dddf2b6`
- Upgraded from `0x4f664222C3fF6207558A745648B568D095dDA170` to `0xe226fAd08E2f0AE68C32Eb5d8210fFeDB736Fb0d` @commit`b90b932` @tx`0x416560cd96dc75ccffebe889e8d1ab3e08b33f814dc4a2bf7c6f9555071d1f6f`
- todo:
- upgrade assignment hook
- upgrade assignment hook again for signature check improvement

#### tier_provider

Expand Down

0 comments on commit cc77898

Please sign in to comment.