-
Notifications
You must be signed in to change notification settings - Fork 14
Fix SVR forwarder #236
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
Merged
Merged
Fix SVR forwarder #236
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,7 +136,7 @@ type MetaClient struct { | |
|
|
||
| func NewMetaClient(lggr logger.Logger, c MetaClientRPC, ks MetaClientKeystore, customURL *url.URL, chainID *big.Int) *MetaClient { | ||
| return &MetaClient{ | ||
| lggr: logger.Sugared(logger.Named(lggr, "MetaClient")), | ||
| lggr: logger.Sugared(logger.Named(lggr, "Txm.Txm.MetaClient")), | ||
| c: c, | ||
| ks: ks, | ||
| customURL: customURL, | ||
|
|
@@ -159,7 +159,7 @@ func (a *MetaClient) SendTransaction(ctx context.Context, tx *types.Transaction, | |
| } | ||
|
|
||
| if meta != nil && meta.DualBroadcast != nil && *meta.DualBroadcast && !tx.IsPurgeable && meta.DualBroadcastParams != nil && meta.FwdrDestAddress != nil { | ||
| meta, err := a.SendRequest(ctx, tx, attempt, *meta.DualBroadcastParams, *meta.FwdrDestAddress) | ||
| meta, err := a.SendRequest(ctx, tx, attempt, *meta.DualBroadcastParams, tx.ToAddress) | ||
| if err != nil { | ||
| return fmt.Errorf("error sending request for transactionID(%d): %w", tx.ID, err) | ||
| } | ||
|
|
@@ -172,6 +172,7 @@ func (a *MetaClient) SendTransaction(ctx context.Context, tx *types.Transaction, | |
| a.lggr.Info("No bids for transactionID(%d): ", tx.ID) | ||
| return nil | ||
| } | ||
| a.lggr.Infow("Broadcasting attempt to public mempool", "tx", tx) | ||
| return a.c.SendTransaction(ctx, attempt.SignedTransaction) | ||
| } | ||
|
|
||
|
|
@@ -193,6 +194,9 @@ type RequestResponse struct { | |
| } | ||
|
|
||
| type ResponseResult struct { | ||
| UO *UORaw `json:"userOperation"` | ||
| SOS []*SO `json:"solverOperations"` | ||
| DO *DO `json:"dAppOperation"` | ||
cl-efornaciari marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| MetacalldataResponse | ||
| } | ||
|
|
||
|
|
@@ -211,15 +215,49 @@ type UO struct { | |
| Data []byte | ||
| } | ||
|
|
||
| type UORaw struct { | ||
| From common.Address `json:"from"` | ||
| To common.Address `json:"to"` | ||
| Value *hexutil.Big `json:"value"` | ||
| Gas *hexutil.Big `json:"gas"` | ||
| MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` | ||
| Nonce *hexutil.Big `json:"nonce"` | ||
| Deadline *hexutil.Big `json:"deadline"` | ||
| Dapp common.Address `json:"dapp"` | ||
| Control common.Address `json:"control"` | ||
| CallConfig *hexutil.Big `json:"callConfig"` | ||
| DappGasLimit *hexutil.Big `json:"dappGasLimit,omitempty"` | ||
| SessionKey common.Address `json:"sessionKey"` | ||
| Data hexutil.Bytes `json:"data"` | ||
| Signature hexutil.Bytes `json:"signature"` | ||
| } | ||
|
|
||
| type SO struct { | ||
| To common.Address | ||
| Control common.Address | ||
| From common.Address `json:"from"` | ||
| To common.Address `json:"to"` | ||
| Value *hexutil.Big `json:"value"` | ||
| Gas *hexutil.Big `json:"gas"` | ||
| MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` | ||
| Deadline *hexutil.Big `json:"deadline"` | ||
| Solver common.Address `json:"solver"` | ||
| Control common.Address `json:"control"` | ||
| UserOpHash common.Hash `json:"userOpHash"` | ||
| BidToken common.Address `json:"bidToken"` | ||
| BidAmount *hexutil.Big `json:"bidAmount"` | ||
| Data hexutil.Bytes `json:"data"` | ||
| Signature hexutil.Bytes `json:"signature"` | ||
| } | ||
|
|
||
| type DO struct { | ||
| To common.Address | ||
| Control common.Address | ||
| Bundler common.Address | ||
| From common.Address `json:"from"` | ||
| To common.Address `json:"to"` | ||
| Nonce *hexutil.Big `json:"nonce"` | ||
| Deadline *hexutil.Big `json:"deadline"` | ||
| Control common.Address `json:"control"` | ||
| Bundler common.Address `json:"bundler"` | ||
| UserOpHash common.Hash `json:"userOpHash"` | ||
| CallChainHash common.Hash `json:"callChainHash"` | ||
| Signature hexutil.Bytes `json:"signature"` | ||
| } | ||
|
|
||
| type Metacalldata struct { | ||
|
|
@@ -309,6 +347,12 @@ func (a *MetaClient) SendRequest(parentCtx context.Context, tx *types.Transactio | |
| return nil, nil | ||
| } | ||
|
|
||
| r, err := json.MarshalIndent(response.Result, "", " ") | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| a.lggr.Info("Response: ", string(r)) | ||
|
|
||
|
||
| return VerifyResponse(response.Result.MetacalldataResponse, dualBroadcastParams, tx.Data, tx.FromAddress, fwdrDestAddress) | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.