Skip to content

shrink txmgr seam, delete SignerFactoryFromConfig and test file - #520

Merged
ezdac merged 4 commits into
espresso/batcherfrom
espresso/shrink-txmgr-seam
Sep 16, 2026
Merged

ezdac merged 4 commits into
espresso/batcherfrom
espresso/shrink-txmgr-seam

Conversation

@jjeangal

@jjeangal jjeangal commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #505.

The batcher now builds its Espresso ChainSigner itself, so txmgr no longer carries any Espresso-specific signing API. This keeps op-service/txmgr's public surface identical to upstream, which matters for our rebases.


Comment thread op-service/crypto/signature_test.go
Comment thread op-batcher/batcher/espresso_service.go Outdated
return fmt.Errorf("tx manager does not implement ChainSigner")
tcfg := cfg.TxMgrConfig

// Mirror the txmgr's backwards-compatible HD-path resolution.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As we are using the KMS to sign payloads sent to the BatchAuthenticator contract do we need this?

@jjeangal jjeangal Sep 8, 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.

We use it only for the mnemonic/private-key fallback paths. When the KMS signer is enabled the hdPath is ignored. But the factory still needs it for the other two branches, and it must resolve the path identically to txmgr or a mnemonic would derive a different key.

@philippecamacho

Copy link
Copy Markdown
Collaborator

@jjeangal LGTM. Let us wait for @palango approval.

ezdac and others added 3 commits September 16, 2026 13:47
SignerFactoryFromConfig had no callers because NewConfig had been moved
onto the fork's ChainSignerFactoryFromConfig to populate
Config.ChainSigner.
Not only don't we want to delete upstream functions, we also want to
remove the modification of the upstream NewConfig in a later commit.
NewConfig was switched onto the fork's ChainSignerFactoryFromConfig so that
Config.ChainSigner could be populated for SimpleTxManager.Sign. Both of those are
gone now, and txmgr only ever uses SignTransaction, which upstream's SignerFactory
already provides.

Switching back makes op-service/txmgr free of Espresso entirely, and gives
SignerFactoryFromConfig its caller back - it only looked like a redundant copy of
ChainSignerFactoryFromConfig because txmgr had been moved off it.

ChainSignerFactoryFromConfig stays: the batcher needs Sign over an arbitrary hash
for the Espresso transaction envelope, which a SignerFn cannot provide.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
initChainSigner derives its own signer from cfg.TxMgrConfig, mirroring the HD-path
resolution in txmgr.NewConfig. Nothing checked that the two agreed. If they ever
diverged, Espresso batches would be signed by a key that is not the registered
batcher, the streamer would drop all of them, and L1 submission would carry on.

Check that both derivations resolve to the same address and fail startup if not.

Move the call from initTxManager to initEspresso, next to initKeyPair, so
initTxManager carries no Espresso logic and both signing identities are set up in
one place.

Also note on ChainSignerFactoryFromConfig that upstream's SignerFactoryFromConfig
is not redundant with it: SignerFactory yields a SignerFn, which cannot sign an
arbitrary hash.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ezdac

ezdac commented Sep 16, 2026

Copy link
Copy Markdown

@jjeangal - Instead of commenting I directly pushed three commits. Please let me know if you prefer collaborating differently generally.

The Related: note that prompted this PR said ChainSignerFactoryFromConfig is a near-verbatim copy of SignerFactoryFromConfig, "which now has no production callers — we should keep exactly one factory."

That was a symptom, not redundancy. NewConfig had been moved onto the fork's ChainSignerFactoryFromConfig to populate Config.ChainSigner for SimpleTxManager.Sign — which orphaned the upstream one. So the fix was restoring its caller, not deleting it.

Unfortunately "Exactly one factory" also isn't reachable: SignerFactory returns a SignerFn, which can't sign an arbitrary hash, and that's precisely what Espresso needs for the transaction envelope. So the PR generally was the correct call, and we have to keep the near verbatim copy ChainSignerFactoryFromConfig around, in order to change the underlying sign function.

@jjeangal jjeangal left a comment

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.

I agree with this new approach being the best way to go about. Thanks @ezdac

@ezdac
ezdac merged commit 7548cc7 into espresso/batcher Sep 16, 2026
40 checks passed
@ezdac
ezdac deleted the espresso/shrink-txmgr-seam branch September 16, 2026 14:21
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.

3 participants