Documentation ¶
Overview ¶
OFAC banned addresses
Request represents an incoming client request ¶
Whitelist for smart contract functions that never need protection.
Index ¶
- Variables
- func AddressPtrToStr(a *common.Address) string
- func BigIntPtrToStr(i *big.Int) string
- func GetIP(r *http.Request) string
- func GetIPHash(r *http.Request) string
- func GetSenderFromRawTx(tx *ethtypes.Transaction) (string, error)
- func GetSenderFromTx(tx *ethtypes.Transaction) (string, error)
- func GetTx(rawTxHex string) (*ethtypes.Transaction, error)
- func GetTxStatus(txHash string) (*types.PrivateTxApiResponse, error)
- func IsBlacklisted(ip string) bool
- func IsMetamask(r *http.Request) bool
- func IsMetamaskMoz(r *http.Request) bool
- func Max(a uint64, b uint64) uint64
- func Min(a uint64, b uint64) uint64
- func NewRequestRecord(db database.Store) *requestRecord
- func ParseJsonRPCResponse(resp *http.Response) (*types.JsonRpcResponse, error)
- func RedisKeyBlockedTxHash(txHash string) string
- func RedisKeyNonceFixForAccount(txFrom string) string
- func RedisKeySenderMaxNonce(txFrom string) string
- func RedisKeySenderOfTxHash(txHash string) string
- func RedisKeyTxHashForSenderAndNonce(txFrom string, nonce uint64) string
- func RedisKeyTxSentToRelay(txHash string) string
- func RedisKeyWhitehatBundleTransactions(bundleId string) string
- type RPCProxyClient
- type RedisState
- func (s *RedisState) AddTxToWhitehatBundle(bundleId string, signedTx string) error
- func (s *RedisState) DelNonceFixForAccount(txFrom string) error
- func (s *RedisState) DelWhitehatBundleTx(bundleId string) error
- func (s *RedisState) GetBlockedTxHash(txHash string) (returnValue string, found bool, err error)
- func (s *RedisState) GetNonceFixForAccount(txFrom string) (numTimesSent uint64, found bool, err error)
- func (s *RedisState) GetSenderMaxNonce(txFrom string) (senderMaxNonce uint64, found bool, err error)
- func (s *RedisState) GetSenderOfTxHash(txHash string) (txSender string, found bool, err error)
- func (s *RedisState) GetTxHashForSenderAndNonce(txFrom string, nonce uint64) (txHash string, found bool, err error)
- func (s *RedisState) GetTxSentToRelay(txHash string) (timeSent time.Time, found bool, err error)
- func (s *RedisState) GetWhitehatBundleTx(bundleId string) ([]string, error)
- func (s *RedisState) SetBlockedTxHash(txHash string, returnValue string) error
- func (s *RedisState) SetNonceFixForAccount(txFrom string, numTimesSent uint64) error
- func (s *RedisState) SetSenderMaxNonce(txFrom string, nonce uint64) error
- func (s *RedisState) SetSenderOfTxHash(txHash string, txFrom string) error
- func (s *RedisState) SetTxHashForSenderAndNonce(txFrom string, nonce uint64, txHash string) error
- func (s *RedisState) SetTxSentToRelay(txHash string) error
- type RpcEndPointServer
- type RpcRequest
- type RpcRequestHandler
Constants ¶
This section is empty.
Variables ¶
var DebugDontSendTx = os.Getenv("DEBUG_DONT_SEND_RAWTX") != ""
var FlashbotsRPC *flashbotsrpc.FlashbotsRPC
var Now = time.Now // used to mock time in tests
var ProtectTxApiHost = "https://protect.flashbots.net"
var RedisExpiryBlockedTxHash = 24 * time.Hour // 1 day
var RedisExpiryNonceFixForAccount = 24 * time.Hour // 1 day
var RedisExpirySenderMaxNonce = 2 * time.Hour
var RedisExpirySenderOfTxHash = 24 * time.Hour // 1 day
var RedisExpiryTxHashForSenderAndNonce = 24 * time.Hour // 1 day
var RedisExpiryTxSentToRelay = 24 * time.Hour // 1 day
var RedisExpiryWhitehatBundleTransactions = 24 * time.Hour // 1 day
var RedisPrefix = "rpc-endpoint:"
var RedisPrefixBlockedTxHash = RedisPrefix + "blocked-tx-hash:"
Enable lookup of bundle txs by bundleId
var RedisPrefixNonceFixForAccount = RedisPrefix + "txsender-with-nonce-fix:"
nonce-fix of an account (with number of times sent)
var RedisPrefixSenderMaxNonce = RedisPrefix + "txsender-pending-max-nonce:"
Remember nonce of pending user tx
var RedisPrefixSenderOfTxHash = RedisPrefix + "txsender-of-txhash:"
Enable lookup of txFrom by txHash
var RedisPrefixTxHashForSenderAndNonce = RedisPrefix + "txsender-and-nonce-to-txhash:"
Enable lookup of txHash by txFrom+nonce (only if sent to relay)
var RedisPrefixTxSentToRelay = RedisPrefix + "tx-sent-to-relay:"
Enable lookup of timeSentToRelay by txHash
var RedisPrefixWhitehatBundleTransactions = RedisPrefix + "tx-for-whitehat-bundle:"
Enable lookup of bundle txs by bundleId
Functions ¶
func AddressPtrToStr ¶ added in v1.4.4
func BigIntPtrToStr ¶ added in v1.4.4
func GetSenderFromRawTx ¶
func GetSenderFromRawTx(tx *ethtypes.Transaction) (string, error)
func GetSenderFromTx ¶
func GetSenderFromTx(tx *ethtypes.Transaction) (string, error)
func GetTxStatus ¶ added in v1.3.0
func GetTxStatus(txHash string) (*types.PrivateTxApiResponse, error)
func IsBlacklisted ¶
func NewRequestRecord ¶ added in v1.5.0
func ParseJsonRPCResponse ¶ added in v1.4.4
func ParseJsonRPCResponse(resp *http.Response) (*types.JsonRpcResponse, error)
func RedisKeyBlockedTxHash ¶ added in v1.5.1
func RedisKeyNonceFixForAccount ¶ added in v1.4.2
func RedisKeySenderMaxNonce ¶ added in v1.4.2
func RedisKeySenderOfTxHash ¶ added in v1.4.2
func RedisKeyTxHashForSenderAndNonce ¶ added in v1.4.2
func RedisKeyTxSentToRelay ¶ added in v1.4.2
func RedisKeyWhitehatBundleTransactions ¶ added in v1.4.3
Types ¶
type RPCProxyClient ¶ added in v1.4.4
func NewRPCProxyClient ¶ added in v1.4.4
func NewRPCProxyClient(proxyURL string) RPCProxyClient
type RedisState ¶ added in v1.4.2
type RedisState struct {
RedisClient *redis.Client
}
var RState *RedisState
Metamask fix helper
func NewRedisState ¶ added in v1.4.2
func NewRedisState(redisUrl string) (*RedisState, error)
func (*RedisState) AddTxToWhitehatBundle ¶ added in v1.4.3
func (s *RedisState) AddTxToWhitehatBundle(bundleId string, signedTx string) error
Enable lookup of tx bundles by bundle ID
func (*RedisState) DelNonceFixForAccount ¶ added in v1.4.2
func (s *RedisState) DelNonceFixForAccount(txFrom string) error
func (*RedisState) DelWhitehatBundleTx ¶ added in v1.4.3
func (s *RedisState) DelWhitehatBundleTx(bundleId string) error
func (*RedisState) GetBlockedTxHash ¶ added in v1.5.1
func (s *RedisState) GetBlockedTxHash(txHash string) (returnValue string, found bool, err error)
func (*RedisState) GetNonceFixForAccount ¶ added in v1.4.2
func (s *RedisState) GetNonceFixForAccount(txFrom string) (numTimesSent uint64, found bool, err error)
func (*RedisState) GetSenderMaxNonce ¶ added in v1.4.2
func (s *RedisState) GetSenderMaxNonce(txFrom string) (senderMaxNonce uint64, found bool, err error)
func (*RedisState) GetSenderOfTxHash ¶ added in v1.4.2
func (s *RedisState) GetSenderOfTxHash(txHash string) (txSender string, found bool, err error)
func (*RedisState) GetTxHashForSenderAndNonce ¶ added in v1.4.2
func (*RedisState) GetTxSentToRelay ¶ added in v1.4.2
func (*RedisState) GetWhitehatBundleTx ¶ added in v1.4.3
func (s *RedisState) GetWhitehatBundleTx(bundleId string) ([]string, error)
func (*RedisState) SetBlockedTxHash ¶ added in v1.5.1
func (s *RedisState) SetBlockedTxHash(txHash string, returnValue string) error
Block transactions, with a specific return value (eg. "nonce too low")
func (*RedisState) SetNonceFixForAccount ¶ added in v1.4.2
func (s *RedisState) SetNonceFixForAccount(txFrom string, numTimesSent uint64) error
nonce-fix per account
func (*RedisState) SetSenderMaxNonce ¶ added in v1.4.2
func (s *RedisState) SetSenderMaxNonce(txFrom string, nonce uint64) error
func (*RedisState) SetSenderOfTxHash ¶ added in v1.4.2
func (s *RedisState) SetSenderOfTxHash(txHash string, txFrom string) error
Enable lookup of txFrom by txHash
func (*RedisState) SetTxHashForSenderAndNonce ¶ added in v1.4.2
func (s *RedisState) SetTxHashForSenderAndNonce(txFrom string, nonce uint64, txHash string) error
Enable lookup of txHash by txFrom+nonce
func (*RedisState) SetTxSentToRelay ¶ added in v1.4.2
func (s *RedisState) SetTxSentToRelay(txHash string) error
Enable lookup of timeSentToRelay by txHash
type RpcEndPointServer ¶
type RpcEndPointServer struct {
// contains filtered or unexported fields
}
func NewRpcEndPointServer ¶
func NewRpcEndPointServer(version, listenAddress, proxyUrl, relayUrl string, relaySigningKey *ecdsa.PrivateKey, redisUrl string, db database.Store) (*RpcEndPointServer, error)
func (*RpcEndPointServer) HandleBundleRequest ¶ added in v1.4.3
func (s *RpcEndPointServer) HandleBundleRequest(respw http.ResponseWriter, req *http.Request)
func (*RpcEndPointServer) HandleHttpRequest ¶
func (s *RpcEndPointServer) HandleHttpRequest(respw http.ResponseWriter, req *http.Request)
func (*RpcEndPointServer) Start ¶
func (s *RpcEndPointServer) Start()
type RpcRequest ¶
type RpcRequest struct {
// contains filtered or unexported fields
}
func NewRpcRequest ¶
func NewRpcRequest(logger log.Logger, client RPCProxyClient, jsonReq *types.JsonRpcRequest, relaySigningKey *ecdsa.PrivateKey, ip, origin string, isWhitehatBundleCollection bool, whitehatBundleId string, ethSendRawTxEntry *database.EthSendRawTxEntry, preferences *types.PrivateTxPreferences) *RpcRequest
func (*RpcRequest) GetAddressNonceRange ¶ added in v1.4.2
func (r *RpcRequest) GetAddressNonceRange(address string) (minNonce, maxNonce uint64, err error)
func (*RpcRequest) ProcessRequest ¶ added in v1.4.3
func (r *RpcRequest) ProcessRequest() *types.JsonRpcResponse
func (*RpcRequest) WhitehatBalanceCheckerRewrite ¶ added in v1.4.3
func (r *RpcRequest) WhitehatBalanceCheckerRewrite()
type RpcRequestHandler ¶ added in v1.4.3
type RpcRequestHandler struct {
// contains filtered or unexported fields
}
RPC request handler for a single/ batch JSON-RPC request
func NewRpcRequestHandler ¶ added in v1.4.3
func NewRpcRequestHandler(respw *http.ResponseWriter, req *http.Request, proxyUrl string, relaySigningKey *ecdsa.PrivateKey, db database.Store) *RpcRequestHandler