Skip to content

Refactor ContractWriter.SubmitTransaction to single request struct#1895

Open
Fletch153 wants to merge 1 commit intomainfrom
submit-tx-request-struct
Open

Refactor ContractWriter.SubmitTransaction to single request struct#1895
Fletch153 wants to merge 1 commit intomainfrom
submit-tx-request-struct

Conversation

@Fletch153
Copy link

Summary

  • Replace 8 positional parameters on ContractWriter.SubmitTransaction with a single SubmitTransactionRequest struct
  • Adding a field to a struct is backwards-compatible; adding a parameter to a function signature is not
  • Prepares for SimulationOptions PR (PLEX-2604) which will add SimulationOptions as a struct field

Changes (4 files)

  • pkg/types/contract_writer.go — Add SubmitTransactionRequest struct, update interface signature
  • pkg/loop/internal/relayer/pluginprovider/contractwriter/contract_writer.go — Update gRPC Client and Server
  • pkg/types/interfacetests/utils.go — Update test helper call sites
  • pkg/loop/internal/relayer/pluginprovider/contractreader/contract_reader_test.go — Update fakeContractWriter

What's NOT changed

  • Proto files — wire format unchanged
  • Chain-specific interfaces (EVM, Solana, Aptos) — separate SubmitTransaction on different types
  • GetEstimateFee — separate concern, separate PR
  • No mock regeneration needed — .mockery.yaml doesn't include ContractWriter

Breaking Change

ContractWriter.SubmitTransaction signature changed. All downstream implementors (chainlink-evm, chainlink-solana, chainlink-aptos, etc.) will need corresponding updates when bumping this dependency.

Test plan

  • go build ./... — clean
  • go test ./pkg/types/... — pass
  • go test ./pkg/loop/internal/relayer/pluginprovider/... — pass
  • Grep confirms no remaining callers use old positional signature

Replace 8 positional parameters with SubmitTransactionRequest struct
to make future field additions backwards-compatible.

BREAKING CHANGE: ContractWriter.SubmitTransaction signature changed
from (ctx, contractName, method, args, transactionID, toAddress, meta, value)
to (ctx, SubmitTransactionRequest). All implementors must update.
@Fletch153 Fletch153 requested review from a team as code owners March 13, 2026 13:42
@github-actions
Copy link

👋 Fletch153, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link

⚠️ API Diff Results - github.com/smartcontractkit/chainlink-common

⚠️ Breaking Changes (1)

pkg/types.ContractWriter (1)
  • SubmitTransaction — Type changed:
func(
  context.Context, 
  - string, 
  - string, 
  - any, 
  - IdempotencyKey, 
  - string, 
  - *TxMeta, 
  - *math/big.Int
  + SubmitTransactionRequest
)
error

✅ Compatible Changes (1)

pkg/types (1)
  • SubmitTransactionRequest — ➕ Added

📄 View full apidiff report

@Fletch153
Copy link
Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

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