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: (txsink) add tx sink deny list implementation and add new server component for it #1782

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

JayT106
Copy link

@JayT106 JayT106 commented Apr 23, 2024

What ❔

  • Add a new txsink implementation for rejecting the L2 transaction by filtering the sender's address in the API server.
  • New tx sink env config for the tx sink component read.
  • Define new TxSinkDenyList component and can be added when launch the server.

For running server with the deny list tx sink, should execute

zk server --components api,tree,eth,state_keeper,housekeeper,commitment_generator,txsink_denylist

And in the env files (i.e. dev.env) should add TX_SINK_DINY_LIST="deny addresses separated by comma"

Why ❔

We need a mechanism to be able to block some addresses has potential attack/hack risks through L2 transactions, i.e. blocking fund withdraw from L2 to L1 or other factors.

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk fmt and zk lint.
  • Spellcheck has been run via zk spellcheck.
  • Linkcheck has been run via zk linkcheck.

) -> anyhow::Result<()> {
let config = TxSenderBuilderConfigs {
tx_sender_config: tx_sender_config.clone(),

Choose a reason for hiding this comment

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

Why clone?

Copy link
Author

@JayT106 JayT106 Apr 25, 2024

Choose a reason for hiding this comment

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

To construct the TxSenderBuilderConfigs takes the ownership of the value in tx_sender_config (it's a reference). So the compiler requires clone the value.

If there any better way to construct the struct and assign it to build_tx_sender? I made this change because of the linting error (too many arguments in build_tx_sender), see
764258d

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.

None yet

2 participants