Skip to content

Create and deploy fee collector accounts - #2568

Open
Mirko-von-Leipzig wants to merge 3 commits into
mirko/preserve-user-batch-proofsfrom
mirko/batch-fees-pass-through-tx
Open

Mirko-von-Leipzig wants to merge 3 commits into
mirko/preserve-user-batch-proofsfrom
mirko/batch-fees-pass-through-tx

Conversation

@Mirko-von-Leipzig

@Mirko-von-Leipzig Mirko-von-Leipzig commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Adds miden-node fee-collector commands to create and deploy the fee collector account used by the sequencer to transfer transaction fees to the batch builder wallet.

These need to be run as part of bootstrapping the sequencer node. The existing bootstrap command remains as is, because it is shared by all nodes.

The deploy step appends a single block to the chain which deploys the account. All proving etc is done locally to minimize external interfaces, though they could be added easily enough. This only occurs (hopefully) once per chain, so its not a big deal imo.

Part of #2501.

Changelog

[[entry]]
scope       = "node"
impact      = "added"
description = "Create and deploy a fee collector account `miden-node fee-collector` commands."

@Mirko-von-Leipzig Mirko-von-Leipzig changed the title feat(batch-builder): append fee collection transaction feat(batch-builder): collect batch fees into a single P2ID note Sep 16, 2026
@Mirko-von-Leipzig Mirko-von-Leipzig changed the title feat(batch-builder): collect batch fees into a single P2ID note Collect batch fees into a single P2ID note Sep 16, 2026
@Mirko-von-Leipzig
Mirko-von-Leipzig marked this pull request as ready for review September 16, 2026 13:54
@Mirko-von-Leipzig
Mirko-von-Leipzig removed this pull request from stack #2569 September 17, 2026 11:59
@Mirko-von-Leipzig
Mirko-von-Leipzig added this pull request to stack #2641 September 17, 2026 12:01
@Mirko-von-Leipzig
Mirko-von-Leipzig marked this pull request as draft September 17, 2026 14:27
@Mirko-von-Leipzig
Mirko-von-Leipzig force-pushed the mirko/batch-fees-pass-through-tx branch from 30737c0 to 4c39055 Compare September 18, 2026 07:31
@Mirko-von-Leipzig Mirko-von-Leipzig changed the title Collect batch fees into a single P2ID note Create and deploy fee collector accounts Sep 18, 2026
@Mirko-von-Leipzig
Mirko-von-Leipzig marked this pull request as ready for review September 18, 2026 09:19
@PhilippGackstatter

PhilippGackstatter commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Question: Why do we need commands for deploying the fee collector account? Is this done manually or by some script? I expected the deployment to be handled automatically as part of batch building, as part of the first batch. So the first batch would contain the deploy + fee collection tx (could be the same tx, simpler for the tx creators) and after that only one fee collection tx per batch.

@Mirko-von-Leipzig
Mirko-von-Leipzig removed this pull request from stack #2641 September 18, 2026 09:45
@Mirko-von-Leipzig
Mirko-von-Leipzig force-pushed the mirko/batch-fees-pass-through-tx branch from 4c39055 to 7bedab6 Compare September 18, 2026 09:47
@Mirko-von-Leipzig
Mirko-von-Leipzig changed the base branch from mirko/batch-fees to mirko/preserve-user-batch-proofs September 18, 2026 09:47
@Mirko-von-Leipzig
Mirko-von-Leipzig added this pull request to stack #2649 September 18, 2026 09:47
@Mirko-von-Leipzig

Mirko-von-Leipzig commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

Question: Why do we need commands for deploying the fee collector account? Is this done manually or by some script? I expected the deployment to be handled automatically as part of batch building, as part of the first batch. So the first batch would contain the deploy + fee collection tx (could be the same tx, simpler for the tx creators) and after that only one fee collection tx per batch.

Because the first transaction changes the accounts state by deploying it. So there is no way to spin up multiple concurrent batch building threads without racing them. You first need a sequentially ordered batch. I opted to implement that as a separate step completely because otherwise its too much effort to handle failures, rollbacks etc.

Really we should just deploy this in genesis, but whatever :)

This would be done by whoever is operating the sequencer, so however they wish to do it. The same way they first need to bootstrap the node.

@PhilippGackstatter PhilippGackstatter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Partial review.

Comment on lines +145 to +146
let mast_store = TransactionMastStore::new();
mast_store.load_account_code(account.code());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will also eventually need to load the native fee asset account's account code (USDCx faucet) since transferring USDCx makes a callback (blocklist check) so the foreign account is required, and this DataStore does not support get_foreign_account_inputs.

So, I think we need to pass in the native faucet state at the reference block to this data store.

@Mirko-von-Leipzig Mirko-von-Leipzig Sep 18, 2026

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.

Faucet handling is now separated into draft PR #2650 for further design review. This PR returns todo in followup: support native faucet callbacks from the unsupported foreign-account and storage-map methods. ECDSA and the other deployment review fixes remain here.

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.

Actually no, I'll handle this in a dedicated PR. This might warrant some discussion.

Comment thread bin/node/src/commands/fee_collector.rs Outdated
Comment thread crates/block-producer/src/fee_collector/transaction.rs Outdated
Comment thread crates/block-producer/src/fee_collector/transaction.rs
@Mirko-von-Leipzig
Mirko-von-Leipzig force-pushed the mirko/batch-fees-pass-through-tx branch from 7bedab6 to cfcccb5 Compare September 18, 2026 10:12
@Mirko-von-Leipzig
Mirko-von-Leipzig force-pushed the mirko/batch-fees-pass-through-tx branch from cfcccb5 to ecc8ccb Compare September 18, 2026 10:37

@PhilippGackstatter PhilippGackstatter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

Comment thread crates/block-producer/src/fee_collector.rs
@Mirko-von-Leipzig
Mirko-von-Leipzig force-pushed the mirko/batch-fees-pass-through-tx branch from 1c97b1e to abea398 Compare September 18, 2026 12:24
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