Skip to content

Commit

Permalink
implement mock MaxPriorityFeePerGas
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed Jul 26, 2024
1 parent 9e91e5c commit ccca7a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions go/host/rpc/clientapi/client_api_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ func (api *EthereumAPI) GetStorageAt(ctx context.Context, encryptedParams common
return *enclaveResponse, nil
}

func (api *EthereumAPI) MaxPriorityFeePerGas(_ context.Context) (*hexutil.Big, error) {
// todo - implement with the gas mechanics
header, err := api.host.Storage().FetchHeadBatchHeader()
if err != nil {
api.logger.Error("Unable to retrieve header for fee history.", log.ErrKey, err)
return nil, fmt.Errorf("unable to retrieve MaxPriorityFeePerGas")
}

// just return the base fee?
return (*hexutil.Big)(header.BaseFee), err
}

// FeeHistory is a placeholder for an RPC method required by MetaMask/Remix.
// rpc.DecimalOrHex -> []byte
func (api *EthereumAPI) FeeHistory(context.Context, string, rpc.BlockNumber, []float64) (*FeeHistoryResult, error) {
Expand Down
1 change: 1 addition & 0 deletions integration/obscurogateway/tengateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func testErrorHandling(t *testing.T, httpURL, wsURL string, w wallet.Wallet) {
`{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xA58C60cc047592DE97BF1E8d2f225Fc5D959De77", "latest"],"id":1,"extra":"extra_field"}`,
`{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[["0xA58C60cc047592DE97BF1E8d2f225Fc5D959De77", "0x1234"]],"id":1}`,
`{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x0000000000000000000000000000000000000000000000000000000000000000"],"id":1}`,
`{"jsonrpc":"2.0","method":"eth_maxPriorityFeePerGas","params":[],"id":1}`,
} {
// ensure the geth request is issued correctly (should return 200 ok with jsonRPCError)
_, response, err := httputil.PostDataJSON(ogClient.HTTP(), []byte(req))
Expand Down

0 comments on commit ccca7a1

Please sign in to comment.