feat: add ExpectedSimulationFailureRule to ContractWriter.SubmitTransaction#1894
feat: add ExpectedSimulationFailureRule to ContractWriter.SubmitTransaction#1894
Conversation
|
👋 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! |
|
| } | ||
|
|
||
| func (c *Client) SubmitTransaction(ctx context.Context, contractName, method string, params any, transactionID, toAddress string, meta *types.TxMeta, value *big.Int) error { | ||
| func (c *Client) SubmitTransaction(ctx context.Context, contractName, method string, params any, transactionID, toAddress string, meta *types.TxMeta, value *big.Int, expectedSimulationFailureRules []types.ExpectedSimulationFailureRule) error { |
There was a problem hiding this comment.
You could avoid future breaking changes by switching to a single struct arg like grpc uses:
| func (c *Client) SubmitTransaction(ctx context.Context, contractName, method string, params any, transactionID, toAddress string, meta *types.TxMeta, value *big.Int, expectedSimulationFailureRules []types.ExpectedSimulationFailureRule) error { | |
| func (c *Client) SubmitTransaction(ctx context.Context, req SubmitTransactionRequest) error { |
There was a problem hiding this comment.
I was thinking of doing this tbh, i've done this for SimulationOptions (in a recent commit) but perhaps it's better we go with a single request argument struct as you suggested
678ec6f to
c5b583c
Compare
c5b583c to
6d243cf
Compare
Replace the trailing expectedSimulationFailureRules parameter with *SimulationOptions, a struct wrapping both SimulateTransaction (bool) and ExpectedSimulationFailureErrors. The pointer type makes it nil-able so existing callers can pass nil to use the implementation's default simulation behavior. Changes: - Add SimulationOptions and ExpectedSimulationFailureError types - Update ContractWriter interface and UnimplementedContractWriter - Update proto schemas (contract_writer.proto, aptos.proto) with SimulationOptions message - Regenerate proto Go files - Update LOOP bridge client/server and converters - Add SimulationOptions to Aptos SubmitTransactionRequest Go type and wire up proto converters - Update all callers and test helpers
6d243cf to
ea5d387
Compare
Summary
ExpectedSimulationFailureRulestruct (ErrorContains string) topkg/types/and a new[]ExpectedSimulationFailureRuleparameter toContractWriter.SubmitTransactioncontract_writer.proto(field 8) andaptos.proto(field 4) with regenerated Go codeFailureRulesToProto/FailureRulesFromProtoconverter functions, following the existingTxMetapatternUnimplementedContractWriterforward-compat base typeBreaking Change
ContractWriter.SubmitTransactionsignature now requires an additional[]ExpectedSimulationFailureRuleparameter. All implementations must update their signatures. Passnilto preserve existing behavior.Context
chainlink-aptos (
NONEVM-2618) addedExpectedSimulationFailureRuleto its TXMEnqueue, butSubmitTransaction(the product-agnostic interface in chainlink-common) didn't carry these rules. This change enables failure rules to flow from callers through the LOOP gRPC boundary to chain-specific implementations.Test plan
go build ./...passesgo test ./...passes (pre-existingotelzapfailure unrelated)