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(protocol): fix issues in AssignmentHook #15486

Merged
merged 12 commits into from
Jan 13, 2024
Merged

Conversation

adaki2004
Copy link
Contributor

@adaki2004 adaki2004 commented Jan 12, 2024

From team SigP.:

  • fix bug in ERC20 proverFee payment (previous from TaikoL1, now from L2 block's coinbase address)
  • add L2's chain id and the hook address to the assignment hash calculation
  • check duplicate hooks
  • check TKO balance change strict using == rather than >=.

- add chainId to hashed assignment
- prevent replay and then repay of bind in the same assigmenthook array
Copy link

vercel bot commented Jan 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
bridge-ui-v2-a5 ✅ Ready (Inspect) Visit Preview Jan 13, 2024 7:54am
bridge-ui-v2-a6 ✅ Ready (Inspect) Visit Preview Jan 13, 2024 7:54am
bridge-ui-v2-internal ✅ Ready (Inspect) Visit Preview Jan 13, 2024 7:54am

@dantaik
Copy link
Contributor

dantaik commented Jan 12, 2024

  • remove metaHash in assignment since it is unused

It is not used in this hook, but maybe used in another.

@dantaik dantaik closed this Jan 12, 2024
@dantaik dantaik reopened this Jan 12, 2024
// have increased by the same amount as config.livenessBond (to prevent)
// multiple draining payments by a malicious proposer nesting the same
// hook.
if (tko.balanceOf(address(this)) != tkoBalance + config.livenessBond) {
Copy link
Contributor

Choose a reason for hiding this comment

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

check TKO balance change strict using == rather than >=.

Copy link
Contributor

Choose a reason for hiding this comment

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

@adaki2004 with this change, maybe we don't have to check "==" here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I still recommend having a strict equality, for two reasons
a) I don't see a benefit for transferring more than the liveness bond, it would increase the cost to the prover and the extra funds would be stuck in the TaikoL1 contract.
b) If multiple hooks are available which can transfer TKO to the TaikoL1 contract the proposer could attempt to use both e.g. If there is a third party hook, a proposer could attempt to use both hooks.

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 still recommend having a strict equality, for two reasons

I think this is a strict equalitsy, no ? (if NOT -> revert)
if (tko.balanceOf(address(this)) != tkoBalance + config.livenessBond) revert L1_LIVENESS_BOND_NOT_RECEIVED

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep this PR currently has a strict equality, which I currently see as a nicer solution. I was responding to @dantaik comment about potentially moving back to inequality.

@adaki2004 with this change, maybe we don't have to check "==" here?

Copy link
Member

@davidtaikocha davidtaikocha left a comment

Choose a reason for hiding this comment

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

And client updates are ready too: taikoxyz/taiko-client#502

@dantaik dantaik added this pull request to the merge queue Jan 13, 2024
Merged via the queue into alpha-6 with commit a394abd Jan 13, 2024
17 checks passed
@dantaik dantaik deleted the assignmenthook_fixes branch January 13, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants