-
Notifications
You must be signed in to change notification settings - Fork 21.5k
node: refactor package node #21105
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
node: refactor package node #21105
Conversation
582c0aa to
124539d
Compare
9359c43 to
c471809
Compare
|
Notes from review:
func (n *Node) RegisterHTTP(path string, h http.Handler) error
|
| // Start auxiliary services if enabled | ||
| if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) { | ||
| // Mining only makes sense if a full Ethereum node is running | ||
| if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think everything in this block is code that only works for full nodes.
We should create an auxiliary function for setting up *eth.Ethereum specifically
and then put a type assertion for *eth.Ethereum here.
|
HTTP Rule: flags:
console:
|
|
TODO:
extra:
|
badcdba to
a49a20b
Compare
a26f56a to
cf15c83
Compare
I'm not happy with 'path' for this because we also have ResolvePath to find file paths in the datadir.
This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775. There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL. There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the ./geth --http --graphql flag combination. The --graphql.port and --graphql.addr flags are no longer available.
Merge from upstream, go-ethereum v 1.9.19 (https://github.com/ethereum/go-ethereum/releases/tag/v1.9.19) Geth v1.9.19 is our regular maintenance release Note, if you were using GraphQL previously, it was moved to the HTTP RPC endpoint. The old --graphql.host and --graphql.port flags will not work any more. You might need to adjust your TOML config files accordingly too. 1.9.19 Notes: Deprecated flags: GraphQLListenAddrFlag GraphQLPortFlag Added flags: CacheTrieJournalFlag CacheTrieRejournalFlag 28c5a8a fetcher.go/mainLoop check ancestor, otherwise the lightest sync could panic fetcher.go/newLightFetcher Add downloader.SyncMode as parameter c0c0161 (ethereum/go-ethereum#21105) node.go: startNetworking should server stop if proxyServer failed main.go startNode runnerFactory replaced 90dedea this commit tried to fusion the consensus/istanbul/core/event.go file with an erased tests (signed_data_internal_test.go) Restored that test, and add the changes from the signer/core/signed_data.go, to the shared/signer/signed_data.go c28fd9c make Berlin a copy of Istanbul instead of YoloV1 Backwards compatibility The commit c0c0161 (ethereum/go-ethereum#21105) "changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible" (following this proposal https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775)
This PR significantly changes the APIs for instantiating Ethereum nodes in a Go program. The new APIs are not backwards-compatible, but we feel that this is made up for by the much simpler way of registering services on node.Node. You can find more information and rationale in the design document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775.
There is also a new feature in Node's Go API: it is now possible to register arbitrary handlers on the user-facing HTTP server. In geth, this facility is used to enable GraphQL.
There is a single minor change relevant for geth users in this PR: The GraphQL API is no longer available separately from the JSON-RPC HTTP server. If you want GraphQL, you need to enable it using the
--http --graphqlflag combination. The--graphql.portand--graphql.addrflags are no longer available.[ + ] Introduces
Lifecycleinterface[ + ] Introduces
RegisterAPIs()method[ + ] Introduces
RegisterLifecycle()method[ + ] Introduces
RegisterHTTP()method[ + ] Introduces
RegisterProtocols()method[<>] Changes the way information about node's HTTP servers is stored
[<>] Separates
LES servermanagement frometh.Ethereum, now managed bynode[<>] GraphQL can only be started on the node's canonical HTTP server (to enable graphql
--graphql, the user must also enable http with the--httpflag)[ - ] Removes
Serviceinterface[ - ] Removes
ServiceContext[ - ] Removes the responsibility of service construction
TODO
RegisterHTTPmethodscmd/geth/main.go