@@ -40,6 +40,7 @@ import (
4040type APIBackend interface {
4141 ethapi.Backend
4242 tracers.Backend
43+ filters.Backend
4344 filters.BloomOverrider
4445}
4546
@@ -85,45 +86,65 @@ func (vm *VM) ethRPCServer() (*rpc.Server, error) {
8586 // - eth_syncing
8687 {"eth" , ethapi .NewEthereumAPI (b )},
8788 // Standard Ethereum node APIs:
89+ // - eth_gasPrice
90+ // - eth_syncing
91+ //
92+ // Undocumented APIs:
93+ // - eth_feeHistory
94+ // - eth_maxPriorityFeePerGas
95+ {"eth" , ethapi .NewEthereumAPI (b )},
96+ // Standard Ethereum node APIs:
8897 // - eth_blockNumber
98+ // - eth_call
8999 // - eth_chainId
100+ // - eth_estimateGas
101+ // - eth_getBalance
90102 // - eth_getBlockByHash
91103 // - eth_getBlockByNumber
92- // - eth_getBlockReceipts
104+ // - eth_getCode
105+ // - eth_getStorageAt
93106 // - eth_getUncleByBlockHashAndIndex
94107 // - eth_getUncleByBlockNumberAndIndex
95108 // - eth_getUncleCountByBlockHash
96109 // - eth_getUncleCountByBlockNumber
97110 //
98111 // Geth-specific APIs:
112+ // - eth_createAccessList
99113 // - eth_getHeaderByHash
100114 // - eth_getHeaderByNumber
115+ //
116+ // Undocumented APIs:
117+ // - eth_getBlockReceipts
118+ // - eth_getProof
101119 {"eth" , & blockChainAPI {ethapi .NewBlockChainAPI (b ), b }},
102120 // Standard Ethereum node APIs:
103121 // - eth_getBlockTransactionCountByHash
104122 // - eth_getBlockTransactionCountByNumber
105123 // - eth_getTransactionByBlockHashAndIndex
106124 // - eth_getTransactionByBlockNumberAndIndex
107125 // - eth_getTransactionByHash
126+ // - eth_getTransactionCount
108127 // - eth_getTransactionReceipt
109128 // - eth_sendRawTransaction
110129 // - eth_sendTransaction
111130 // - eth_sign
112131 // - eth_signTransaction
113132 //
114133 // Undocumented APIs:
134+ // - eth_fillTransaction
115135 // - eth_getRawTransactionByBlockHashAndIndex
116136 // - eth_getRawTransactionByBlockNumberAndIndex
117137 // - eth_getRawTransactionByHash
118138 // - eth_pendingTransactions
139+ // - eth_resend
119140 {
120141 "eth" ,
121142 immediateReceipts {
122143 vm .exec ,
123144 ethapi .NewTransactionAPI (b , new (ethapi.AddrLocker )),
124145 },
125146 },
126- // Standard Ethereum node APIS :
147+ // Standard Ethereum node APIs :
127148 // - eth_getFilterChanges
128149 // - eth_getFilterLogs
129150 // - eth_getLogs
@@ -139,7 +160,6 @@ func (vm *VM) ethRPCServer() (*rpc.Server, error) {
139160 // - logs
140161 {"eth" , filterAPI },
141162 }
142-
143163 if vm .config .RPCConfig .EnableDBInspecting {
144164 apis = append (apis , api {
145165 // Geth-specific APIs:
@@ -148,18 +168,15 @@ func (vm *VM) ethRPCServer() (*rpc.Server, error) {
148168 // - debug_dbAncient
149169 // - debug_dbAncients
150170 // - debug_dbGet
151- // - debug_getRawTransaction
152- // - debug_printBlock
153- // - debug_setHead (no-op, logs info)
154- //
155- // TODO: implement once BlockByNumberOrHash and GetReceipts exist:
156171 // - debug_getRawBlock
157172 // - debug_getRawHeader
158173 // - debug_getRawReceipts
174+ // - debug_getRawTransaction
175+ // - debug_printBlock
176+ // - debug_setHead
159177 "debug" , ethapi .NewDebugAPI (b ),
160178 })
161179 }
162-
163180 if vm .config .RPCConfig .EnableProfiling {
164181 apis = append (apis , api {
165182 // Geth-specific APIs:
@@ -186,14 +203,51 @@ func (vm *VM) ethRPCServer() (*rpc.Server, error) {
186203 "debug" , debug .Handler ,
187204 })
188205 }
189-
190206 if ! vm .config .RPCConfig .DisableTracing {
191207 apis = append (apis , api {
192208 // Geth-specific APIs:
209+ // - debug_intermediateRoots
210+ // - debug_standardTraceBadBlockToFile
211+ // - debug_standardTraceBlockToFile
212+ // - debug_traceBadBlock
213+ // - debug_traceBlock
214+ // - debug_traceBlockByHash
215+ // - debug_traceBlockByNumber
216+ // - debug_traceBlockFromFile
217+ // - debug_traceCall
218+ // - debug_traceChain
219+ // - debug_traceTransaction
193220 "debug" , tracers .NewAPI (b ),
194221 })
195222 }
196-
223+ // Unsupported APIs:
224+ //
225+ // Standard Ethereum node APIs:
226+ // - eth_protocolVersion
227+ // - eth_coinbase
228+ // - eth_mining
229+ // - eth_hashrate
230+ // - eth_accounts
231+ //
232+ // Block and state inspection APIs:
233+ // - debug_accountRange
234+ // - debug_dumpBlock
235+ // - debug_getAccessibleState
236+ // - debug_getBadBlocks
237+ // - debug_getModifiedAccountsByHash
238+ // - debug_getModifiedAccountsByNumber
239+ // - debug_getTrieFlushInterval
240+ // - debug_preimage
241+ // - debug_setTrieFlushInterval
242+ // - debug_storageRangeAt
243+ //
244+ // The admin namespace.
245+ // The clique namespace.
246+ // The les namespace.
247+ // The miner namespace.
248+ // The personal namespace.
249+ //
250+ // The graphql service.
197251 s := rpc .NewServer ()
198252 for _ , api := range apis {
199253 if err := s .RegisterName (api .namespace , api .api ); err != nil {
@@ -312,6 +366,7 @@ func (b bloomOverrider) OverrideHeaderBloom(header *types.Header) types.Bloom {
312366 ))
313367}
314368
369+ // TODO: Rename to apiBackend
315370type ethAPIBackend struct {
316371 vm * VM
317372 accountManager * accounts.Manager
@@ -337,7 +392,8 @@ func (b *ethAPIBackend) RPCTxFeeCap() float64 {
337392}
338393
339394func (b * ethAPIBackend ) UnprotectedAllowed () bool {
340- return false
395+ // TODO(StephenButtolph) Expose this as a config and default to false.
396+ return true
341397}
342398
343399// ExtRPCEnabled reports that external RPC access is enabled. This adds an
@@ -599,7 +655,7 @@ func (b *ethAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Sub
599655 return b .vm .exec .SubscribeChainEvent (ch )
600656}
601657
602- func (b * ethAPIBackend ) SubscribeChainSideEvent (chan <- core.ChainSideEvent ) event.Subscription {
658+ func (* ethAPIBackend ) SubscribeChainSideEvent (chan <- core.ChainSideEvent ) event.Subscription {
603659 // SAE never reorgs, so there are no side events.
604660 return newNoopSubscription ()
605661}
@@ -608,7 +664,7 @@ func (b *ethAPIBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.S
608664 return b .Set .Pool .SubscribeTransactions (ch , true )
609665}
610666
611- func (b * ethAPIBackend ) SubscribeRemovedLogsEvent (chan <- core.RemovedLogsEvent ) event.Subscription {
667+ func (* ethAPIBackend ) SubscribeRemovedLogsEvent (chan <- core.RemovedLogsEvent ) event.Subscription {
612668 // SAE never reorgs, so no logs are ever removed.
613669 return newNoopSubscription ()
614670}
@@ -617,7 +673,7 @@ func (b *ethAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscri
617673 return b .vm .exec .SubscribeLogsEvent (ch )
618674}
619675
620- func (b * ethAPIBackend ) SubscribePendingLogsEvent (chan <- []* types.Log ) event.Subscription {
676+ func (* ethAPIBackend ) SubscribePendingLogsEvent (chan <- []* types.Log ) event.Subscription {
621677 // In SAE, "pending" refers to the execution status. There are no logs known
622678 // for transactions pending execution.
623679 return newNoopSubscription ()
0 commit comments