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

Add config to toggle the TXM #15714

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

amit-momin
Copy link
Contributor

@amit-momin amit-momin commented Dec 16, 2024

MERC-6516

Added the TXMEnabled config to enable or disable the TXM. This toggle was added so a product that only needs read-only access (i.e client, head tracker, log poller) can disable the unused component.

Copy link
Contributor

github-actions bot commented Dec 16, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@amit-momin amit-momin force-pushed the MERC-6516-Allow-disabling-TXM-completely-substitute-null-txm-for-mercury-where-it-isn-t-needed branch from 3b65ac2 to e29572f Compare December 16, 2024 20:29
@smartcontractkit smartcontractkit deleted a comment from github-actions bot Dec 16, 2024
@amit-momin amit-momin marked this pull request as ready for review December 16, 2024 21:42
@amit-momin amit-momin requested review from a team as code owners December 16, 2024 21:42
@@ -49,6 +49,7 @@ type EVM interface {
NodeNoNewHeadsThreshold() time.Duration
FinalizedBlockOffset() uint32
NoNewFinalizedHeadsThreshold() time.Duration
TXMEnabled() bool
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have EVM.Transactions. Would EVM.Transactions.XYZ make sense? Rather than EVM.TXMEnabled?

  • EVM.Transactions.Enabled
  • EVM.Transactions.ManagerEnabled
  • ??

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 considered adding it there but since this also affects the gas estimator I thought it was better to keep the config at the EVM level like LogBroadcasterEnabled. I'm not steadfast on that though so not against moving this under EVM.Transactions. That does remind me that I should update the config description to mention the gas estimator though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the gas estimator change things? Does that suggest that we might have wanted it nested as Transactions.GasEstimator?

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 think it still makes sense to have gas estimator configs outside of EVM.Transactions since that component could still be referenced separately. But in the case for chain initialization, the gas estimator depends on the TXM to start its lifecycle which is why they go hand in hand.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, but I am still not seeing how this new field is relevant to the gas estimator. The TXMEnabled() method is only called from one place currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only relevance is that the new field is also responsible for enabling/disabling gas estimators along with the TXM. Maybe the config name is misleading since it only refers to the TXM.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should at least be expanded for clarity, but if there is a more general name that would be good.

Suggested change
TXMEnabled() bool
TransactionManagerEnabled() bool

return nil, fmt.Errorf("failed to instantiate EvmTxm for chain with ID %s: %w", chainID.String(), err)
var txm txmgr.TxManager
var gasEstimator gas.EvmFeeEstimator
//nolint:gocritic // ignoring styling issue
Copy link
Contributor

Choose a reason for hiding this comment

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

What rule is being suppressed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wanted me to covert this if-else to a switch statement which I thought wouldn't be as clear to read

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you reference that in the description?

var err error
txm, gasEstimator, err = newEvmTxm(opts.DS, cfg.EVM(), opts.AppConfig.Database(), opts.AppConfig.Database().Listener(), client, l, logPoller, opts, headTracker, clientsByChainID)
if err != nil {
return nil, fmt.Errorf("failed to instantiate EvmTxm for chain with ID %s: %w", chainID.String(), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return nil, fmt.Errorf("failed to instantiate EvmTxm for chain with ID %s: %w", chainID.String(), err)
return nil, fmt.Errorf("failed to instantiate EvmTxm for chain with ID %s: %w", chainID, err)

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