Rpc statediffing #10

Merged
telackey merged 14 commits from rpc_statediffing into statediffing 2019-07-31 17:52:06 +00:00
Member
  • Statediffing service API to relay payloads over an rpc subscription over websocket or idc
  • Adjusting statediffs to be closer to the form needed for converting to and publishing as IPLDs
  • Flattening out the statediff directory to try to closer match the organization of Geth
  • Option to include intermediate nodes
  • Option for state and storage leafs to carry their proofs and paths out with them
  • Option to associate block data with statediff payloads
  • Option to restrict statediff processing to specific addresses

This is the branch that the seed node needs to work with.

Don't mind Travis...

* Statediffing service API to relay payloads over an rpc subscription over websocket or idc * Adjusting statediffs to be closer to the form needed for converting to and publishing as IPLDs * Flattening out the statediff directory to try to closer match the organization of Geth * Option to include intermediate nodes * Option for state and storage leafs to carry their proofs and paths out with them * Option to associate block data with statediff payloads * Option to restrict statediff processing to specific addresses This is the branch that the [seed node](https://github.com/vulcanize/vulcanizedb/pull/114) needs to work with. Don't mind Travis...
rmulhol (Migrated from github.com) reviewed 2019-04-26 16:48:56 +00:00
m0ar (Migrated from github.com) reviewed 2019-04-26 16:48:56 +00:00
elizabethengelman (Migrated from github.com) reviewed 2019-05-16 21:31:07 +00:00
elizabethengelman (Migrated from github.com) commented 2019-05-16 19:24:45 +00:00

does utils.StateDiffWatchedAddresses need to be in here too?

does `utils.StateDiffWatchedAddresses` need to be in here too?
elizabethengelman (Migrated from github.com) commented 2019-05-16 21:31:04 +00:00

is the idea that the StateDiffWatchedAddresses.Name should be a slice of all the addressed to be watched? Has this been implemented yet - I couldn't quite figure out where this watching was being done.

is the idea that the `StateDiffWatchedAddresses.Name` should be a slice of all the addressed to be watched? Has this been implemented yet - I couldn't quite figure out where this watching was being done.
elizabethengelman (Migrated from github.com) commented 2019-05-16 20:54:43 +00:00

could you remind me what this config does? is this where we're determining if the the trie should be pruned?

could you remind me what this config does? is this where we're determining if the the trie should be pruned?
elizabethengelman (Migrated from github.com) commented 2019-05-16 21:00:00 +00:00

:%s/then/the?

`:%s/then/the`?
elizabethengelman (Migrated from github.com) commented 2019-05-16 21:25:28 +00:00

where is lastUsed used?

where is `lastUsed` used?
elizabethengelman (Migrated from github.com) commented 2019-05-16 21:12:06 +00:00

I wonder if we can extract each of these branches in the if/else block into it's own method: collectPathAndProofs, collectOnlyLeaves, etc.

I wonder if we can extract each of these branches in the `if/else` block into it's own method: `collectPathAndProofs`, `collectOnlyLeaves`, etc.
elizabethengelman (Migrated from github.com) commented 2019-05-16 21:18:13 +00:00

also wondering if each of these if/else branches could be pulled out into their own methods, so that buildStorageDiffsFromTrie is a bit easier to read from a high level.

also wondering if each of these `if/else` branches could be pulled out into their own methods, so that `buildStorageDiffsFromTrie` is a bit easier to read from a high level.
Author
Member

Hey @elizabethengelman thank you for the review!! Been rushing to get this demo working so I haven't had time to look over everything here yet. I'm fairly certain I touched on a number of these issues in my latest commits but I will revisit this after the demo.

Hey @elizabethengelman thank you for the review!! Been rushing to get this demo working so I haven't had time to look over everything here yet. I'm fairly certain I touched on a number of these issues in my latest commits but I will revisit this after the demo.
i-norden reviewed 2019-05-20 19:47:30 +00:00
Author
Member

Sure does, added it!

Sure does, added it!
i-norden reviewed 2019-05-20 19:50:39 +00:00
Author
Member

I've refactored this quite a bit, it's still one method but much more concise. Might still be best to extract into separate methods but I think we would need 4 different methods to cover the different combinations of processing (leafs only, leafs with their proofs and paths, all nodes, all nodes + leaf proof and paths)

I've refactored this quite a bit, it's still one method but much more concise. Might still be best to extract into separate methods but I think we would need 4 different methods to cover the different combinations of processing (leafs only, leafs with their proofs and paths, all nodes, all nodes + leaf proof and paths)
i-norden reviewed 2019-05-20 19:51:37 +00:00
Author
Member

Did similar refactoring as above, let me know what you think! Separate methods might still be the best option.

Did similar refactoring as above, let me know what you think! Separate methods might still be the best option.
i-norden reviewed 2019-05-20 19:51:57 +00:00
Author
Member

It isn't, neither is the mutex 🙃 got rid of them both.

It isn't, neither is the mutex 🙃 got rid of them both.
i-norden reviewed 2019-05-20 19:57:13 +00:00
Author
Member

I don't think it had been implemented yet at the time of this comment, but yes the StateDiffWatchedAddresses.Name is used to load this StringSliceFlag which is a slice of addresses to watch e.g. ./geth --statediff --statediff.streamblock --ws --syncmode "full" --statediff.watchedaddresses 0xfakeaddr1,0xfakeaddr2,0xfakeaddr3

I don't think it had been implemented yet at the time of this comment, but yes the `StateDiffWatchedAddresses.Name` is used to load this [StringSliceFlag](https://github.com/vulcanize/go-ethereum/blob/rpc_statediffing/cmd/utils/flags.go#L725) which is a slice of addresses to watch e.g. `./geth --statediff --statediff.streamblock --ws --syncmode "full" --statediff.watchedaddresses 0xfakeaddr1,0xfakeaddr2,0xfakeaddr3`
i-norden reviewed 2019-05-20 20:10:26 +00:00
Author
Member

Yeah this is where GC/pruning can be turned completely off- setting to true = archival node.

Yeah this is where GC/pruning can be turned completely off- setting to true = archival node.
elizabethengelman (Migrated from github.com) reviewed 2019-05-21 18:06:27 +00:00
elizabethengelman (Migrated from github.com) left a comment

Overall this is looking really good!

I wonder if it would be helpful to include some additional documentation at some point, because I'm a bit unclear on how one is able to watch the RPC connection to get the statediffs off of it.

Overall this is looking really good! I wonder if it would be helpful to include some additional documentation at some point, because I'm a bit unclear on how one is able to watch the RPC connection to get the statediffs off of it.
elizabethengelman (Migrated from github.com) commented 2019-05-21 15:38:20 +00:00

super nitpicky, but can we put these in the same order as they're listed in main?

super nitpicky, but can we put these in the same order as they're listed in `main`?
elizabethengelman (Migrated from github.com) commented 2019-05-21 15:46:38 +00:00

same here, with regards to the ordering of the config

same here, with regards to the ordering of the config
elizabethengelman (Migrated from github.com) commented 2019-05-21 15:49:02 +00:00

I wonder if the config field AllNodes and the CLI flag name StateDiffIntermediateNodes should be more similar, to reduce confusion. I slightly prefer using IntermediateNodes here, to be clear that they will be included as opposed to having to decipher what AllNodes implies.

I wonder if the config field `AllNodes` and the CLI flag name `StateDiffIntermediateNodes` should be more similar, to reduce confusion. I slightly prefer using `IntermediateNodes` here, to be clear that they will be included as opposed to having to decipher what `AllNodes` implies.
elizabethengelman (Migrated from github.com) commented 2019-05-21 16:00:51 +00:00

👍

👍
elizabethengelman (Migrated from github.com) commented 2019-05-21 16:02:06 +00:00

cool, thanks!

cool, thanks!
elizabethengelman (Migrated from github.com) commented 2019-05-21 16:25:21 +00:00

do we want to check these print statements in, in addition to the error logging?

do we want to check these print statements in, in addition to the error logging?
@ -0,0 +182,4 @@
}
// Subscribe is used by the API to subscribe to the StateDiffingService loop
func (sds *Service) Subscribe(id rpc.ID, sub chan<- Payload, quitChan chan<- bool) {
elizabethengelman (Migrated from github.com) commented 2019-05-21 16:37:15 +00:00

For some reason, I've had a tough time creating and keeping a mental model in my head, so I sketched it out. Does this seem about right to you?
statediff subscription

For some reason, I've had a tough time creating and keeping a mental model in my head, so I sketched it out. Does this seem about right to you? ![statediff subscription](https://user-images.githubusercontent.com/4752801/58119653-13107780-7bc9-11e9-8d1e-2bb8fbf23a14.png)
@ -0,0 +214,4 @@
}
// Start is used to begin the StateDiffingService
func (sds *Service) Start(*p2p.Server) error {
elizabethengelman (Migrated from github.com) commented 2019-05-21 16:53:53 +00:00

I haven't looked at the geth startup process in awhile, but when starting services, is there anything that makes sure that the subscribers have called Subscribe first, before Start is called?

I haven't looked at the geth startup process in awhile, but when starting services, is there anything that makes sure that the subscribers have called `Subscribe` first, before `Start` is called?
elizabethengelman (Migrated from github.com) commented 2019-05-21 17:42:36 +00:00

I think this file may be able to be deleted, since statediff/publisher/publisher.go was removed.

I think this file may be able to be deleted, since `statediff/publisher/publisher.go` was removed.
elizabethengelman (Migrated from github.com) commented 2019-05-21 17:58:29 +00:00

I may be missing something, but I only see this MockStateDiffService is statediff/testhelpers/mocks/service_test.go which seems to be testing the mock. Is the intention that this mock can also be used to test the API portion or something?

I may be missing something, but I only see this `MockStateDiffService` is `statediff/testhelpers/mocks/service_test.go` which seems to be testing the mock. Is the intention that this mock can also be used to test the API portion or something?
elizabethengelman (Migrated from github.com) commented 2019-05-21 17:59:27 +00:00

is this file testing the Mock service? or the API? I wonder if the file should be renamed?

is this file testing the Mock service? or the API? I wonder if the file should be renamed?
i-norden reviewed 2019-06-03 16:18:26 +00:00
Author
Member

Yes, definitely!

Yes, definitely!
i-norden reviewed 2019-06-03 16:18:51 +00:00
Author
Member

No, good catch. Will remove these!

No, good catch. Will remove these!
i-norden reviewed 2019-06-03 16:21:07 +00:00
@ -0,0 +182,4 @@
}
// Subscribe is used by the API to subscribe to the StateDiffingService loop
func (sds *Service) Subscribe(id rpc.ID, sub chan<- Payload, quitChan chan<- bool) {
Author
Member

Yeah this looks awesome! Thanks for putting this together. The only thing I catch that is different is that the call to Start actually happens when the node and its services are first spun up. I think this should probably be changed, since there is no point in performing the state diff processing if nobody is listening for them yet (previously since it was writing to CSVs this start up mode made more sense).

Yeah this looks awesome! Thanks for putting this together. The only thing I catch that is different is that the call to Start actually happens when the node and its services are first spun up. I think this should probably be changed, since there is no point in performing the state diff processing if nobody is listening for them yet (previously since it was writing to CSVs this start up mode made more sense).
i-norden reviewed 2019-06-03 16:24:16 +00:00
@ -0,0 +214,4 @@
}
// Start is used to begin the StateDiffingService
func (sds *Service) Start(*p2p.Server) error {
Author
Member

Nope, the service currently starts up whether or not there are subscribers. This is a bit of an artifact from the old mode of operation when writing to CSVs, should adjust it to wait for a subscription to start the processing.

Nope, the service currently starts up whether or not there are subscribers. This is a bit of an artifact from the old mode of operation when writing to CSVs, should adjust it to wait for a subscription to start the processing.
i-norden reviewed 2019-06-03 16:31:16 +00:00
Author
Member

This mock is used to test the API and service together, the service_test that uses it has to be moved in here to prevent a disallowed import cycle (a disadvantage to the really flat package organization that geth uses). The service_test in the top level statediff package uses the real service which has been configured with all mocks, the service_test in statediff/testhelpers/mocks/service_test.go uses this MockStateDiffService which allows us to pass in current and parent blocks by its channels.

We are reusing the same patterns as the rest of the services and apis in Geth so we shouldn't need to write tests for everything, so this test might be superfluous (when comparing the test we have to the test coverage in other service packages).

This mock is used to test the API and service together, the service_test that uses it has to be moved in here to prevent a disallowed import cycle (a disadvantage to the really flat package organization that geth uses). The service_test in the top level statediff package uses the real service which has been configured with all mocks, the service_test in `statediff/testhelpers/mocks/service_test.go` uses this `MockStateDiffService` which allows us to pass in current and parent blocks by its channels. We are reusing the same patterns as the rest of the services and apis in Geth so we shouldn't need to write tests for everything, so this test might be superfluous (when comparing the test we have to the test coverage in other service packages).
i-norden reviewed 2019-06-03 16:33:26 +00:00
Author
Member

Sorry, see above, this is confusing and sloppy and only organized like this because of a disallowed import cycle if this test is moved up to the statediff package into the other service_test file.

Sorry, see above, this is confusing and sloppy and only organized like this because of a disallowed import cycle if this test is moved up to the `statediff` package into the other service_test file.
Author
Member

Hey @elizabethengelman thanks again for the review! I can provide some additional docs. I'm not entirely sure where they are appropriate because the rpc patterns we are using are the same throughout geth and the general documentation for that is here. That doc is severely lacking though.

Hey @elizabethengelman thanks again for the review! I can provide some additional docs. I'm not entirely sure where they are appropriate because the rpc patterns we are using are the same throughout geth and the general documentation for that is [here](https://github.com/ethereum/go-ethereum/blob/master/rpc/doc.go). That doc is severely lacking though.
i-norden reviewed 2019-06-05 18:24:51 +00:00
@ -0,0 +182,4 @@
}
// Subscribe is used by the API to subscribe to the StateDiffingService loop
func (sds *Service) Subscribe(id rpc.ID, sub chan<- Payload, quitChan chan<- bool) {
Author
Member

So Start is still called at startup, as is normal for these services, but I've adjusted the processing loop so that it only performs the state diff processing if there is at least one subscriber listening.

So `Start` is still called at startup, as is normal for these services, but I've adjusted the processing loop so that it only performs the state diff processing [if there is at least one subscriber listening](https://github.com/vulcanize/go-ethereum/blob/rpc_statediffing/statediff/service.go#L116).
Author
Member

For some reason I can't see the conversation here anymore (it says there are 34 comments)... I'm going to clean this up and reopen it, and prepare a PR to master Geth.

For some reason I can't see the conversation here anymore (it says there are 34 comments)... I'm going to clean this up and reopen it, and prepare a PR to master Geth.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 13:38:18 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 13:38:18 +00:00

Super small thing, but I wonder if this method could be renamed rootAllowedToBeDereferenced. For some reason, that seems to make more sense in my head. Also, I realize that I maybe wrote this method 😆, so I'd be happy to change it myself as well.

Super small thing, but I wonder if this method could be renamed `rootAllowedToBeDereferenced`. For some reason, that seems to make more sense in my head. Also, I realize that I maybe wrote this method 😆, so I'd be happy to change it myself as well.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 13:59:33 +00:00
@ -0,0 +65,4 @@
case packet := <-payloadChannel:
if notifyErr := notifier.Notify(rpcSub.ID, packet); notifyErr != nil {
log.Error("Failed to send state diff packet; error: " + notifyErr.Error())
unSubErr := api.sds.Unsubscribe(rpcSub.ID)
elizabethengelman (Migrated from github.com) commented 2019-07-22 13:59:33 +00:00

I'm not sure exactly how Notify could potentially fail, but I wonder if we want to wait to unsubscribe until there are multiple failures? I haven't thought this through all the way yet, and would totally be cool with punting on this question for now, but wanted to bring it up so that we can think on it.

I'm not sure exactly how `Notify` could potentially fail, but I wonder if we want to wait to unsubscribe until there are multiple failures? I haven't thought this through all the way yet, and would totally be cool with punting on this question for now, but wanted to bring it up so that we can think on it.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:14:52 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:14:52 +00:00

If subscribing over RPC, I think we need to pass the --rpc flag when starting geth up, right? Maybe we can include that here too.

If subscribing over `RPC`, I think we need to pass the `--rpc` flag when starting geth up, right? Maybe we can include that here too.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:15:58 +00:00
@ -0,0 +43,4 @@
e.g.
cli, _ := rpc.Dial("ipcPathOrWsURL")
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:15:58 +00:00

🎉 thanks for including this here, it's super helpful!

🎉 thanks for including this here, it's super helpful!
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:17:24 +00:00
@ -0,0 +87,4 @@
}
// Find all the diffed keys
createKeys := sortKeys(creations)
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:17:23 +00:00

Could you remind me why we need to sort the keys?

Could you remind me why we need to sort the keys?
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:21:27 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:21:26 +00:00

is iOfA short for indexOfA?

is `iOfA` short for `indexOfA`?
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:26:43 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:26:43 +00:00

Are these comments just explaining what the different results from strings.Compare mean? If so, that's super helpful! I wonder if we could format them differently, or add some additional text to the comments - it took me a minute to realize that these were indeed comments, and not just commented out dead code.

Are these comments just explaining what the different results from `strings.Compare` mean? If so, that's super helpful! I wonder if we could format them differently, or add some additional text to the comments - it took me a minute to realize that these were indeed comments, and not just commented out dead code.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 14:28:06 +00:00
@ -0,0 +34,4 @@
"github.com/ethereum/go-ethereum/rpc"
)
const chainEventChanSize = 20000
elizabethengelman (Migrated from github.com) commented 2019-07-22 14:28:05 +00:00

Where does 20000 come from?

Where does `20000` come from?
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 15:29:05 +00:00
@ -0,0 +122,4 @@
currentBlock := chainEvent.Block
parentHash := currentBlock.ParentHash()
var parentBlock *types.Block
if sds.lastBlock != nil && bytes.Equal(sds.lastBlock.Hash().Bytes(), currentBlock.ParentHash().Bytes()) {
elizabethengelman (Migrated from github.com) commented 2019-07-22 15:29:05 +00:00

i like this validation that the last block is in fact the parent block! are we doing this first, instead of going straight to GetBlockByHash to potentially avoid doing another RPC call if possible?

i like this validation that the last block is in fact the parent block! are we doing this first, instead of going straight to `GetBlockByHash` to potentially avoid doing another RPC call if possible?
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 15:31:20 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 15:31:19 +00:00

isn't this send method sending data to the rpc subscriptions as well?

isn't this `send` method sending data to the rpc subscriptions as well?
elizabethengelman (Migrated from github.com) approved these changes 2019-07-22 16:17:27 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 16:15:23 +00:00

%s/reeipt/receipt

%s/reeipt/receipt
@ -0,0 +44,4 @@
// StateDiff is the final output structure from the builder
type StateDiff struct {
BlockNumber *big.Int `json:"blockNumber" gencodec:"required"`
elizabethengelman (Migrated from github.com) commented 2019-07-22 16:17:07 +00:00

there are some small spacing issues here and with AccountDiff and StorageDiff structs

there are some small spacing issues here and with `AccountDiff` and `StorageDiff` structs
elizabethengelman commented 2019-07-22 16:19:06 +00:00 (Migrated from github.com)

Looks good to me! :shipit: Just a few small comments and questions, but I'd be comfortable with merging this into the statediffing branch whenever you're ready.

Looks good to me! :shipit: Just a few small comments and questions, but I'd be comfortable with merging this into the `statediffing` branch whenever you're ready.
elizabethengelman (Migrated from github.com) reviewed 2019-07-22 16:29:49 +00:00
elizabethengelman (Migrated from github.com) commented 2019-07-22 16:29:49 +00:00

This method isn't being used anymore, and can probably be deleted.

I think this was being used previously to get the contract's address. But from what I remember the sdb.chainDB.Get call will only return the address with an archive node, which is partially why we're currently not able to get the address,

This method isn't being used anymore, and can probably be deleted. I think this was being used previously to get the contract's address. But from what I remember the `sdb.chainDB.Get` call will only return the address with an archive node, which is partially why we're currently not able to get the address,
i-norden reviewed 2019-07-23 17:39:57 +00:00
Author
Member

I believe so! I didn't write this method, or at least I don't remember writing them 🙃

I believe so! I didn't write this method, or at least I don't remember writing them 🙃
i-norden reviewed 2019-07-23 17:40:58 +00:00
Author
Member

I agree! Looking through this method it definitely needs some cleaning up, I think this is left over from the quorum code we copied over. The comments are explaining the different results from strings.Compare, but it still isn't super clear how/why we are doing the things we do.

I agree! Looking through this method it definitely needs some cleaning up, I think this is left over from the quorum code we copied over. The comments are explaining the different results from `strings.Compare`, but it still isn't super clear how/why we are doing the things we do.
i-norden reviewed 2019-07-23 17:46:06 +00:00
@ -0,0 +34,4 @@
"github.com/ethereum/go-ethereum/rpc"
)
const chainEventChanSize = 20000
Author
Member

I'm getting that number from here and here

I'm getting that number from [here](https://github.com/vulcanize/go-ethereum/blob/rpc_statediffing/rpc/client.go#L60) and [here](https://github.com/vulcanize/go-ethereum/blob/rpc_statediffing/rpc/client.go#L415)
i-norden reviewed 2019-07-23 17:49:26 +00:00
@ -0,0 +122,4 @@
currentBlock := chainEvent.Block
parentHash := currentBlock.ParentHash()
var parentBlock *types.Block
if sds.lastBlock != nil && bytes.Equal(sds.lastBlock.Hash().Bytes(), currentBlock.ParentHash().Bytes()) {
Author
Member

Yeah that's the idea! I'm not sure this is really necessary, now that I think about it more we don't do an rpc call to do GetBlockByHash since the blockchain is an internal component... but I still think this quick check against the cached block is faster than reaching down and doing a lookup in the blockchain.

Yeah that's the idea! I'm not sure this is really necessary, now that I think about it more we don't do an rpc call to do `GetBlockByHash` since the blockchain is an internal component... but I still think this quick check against the cached block is faster than reaching down and doing a lookup in the blockchain.
i-norden reviewed 2019-07-23 17:50:28 +00:00
Author
Member

Yes, thank you! That is poor wording on my part. It sends to rpc subscriptions- whether or not those subscriptions are over websocket or ipc.

Yes, thank you! That is poor wording on my part. It sends to rpc subscriptions- whether or not those subscriptions are over websocket or ipc.
i-norden reviewed 2019-07-23 17:51:49 +00:00
@ -0,0 +87,4 @@
}
// Find all the diffed keys
createKeys := sortKeys(creations)
Author
Member

As I understand it we need to sort the keys before doing findIntersection on them, so that the findIntersection method is comparing equivalent keys (since it is using the iOfA and iOfB to iterate through and compare, the keys need to be sorted by index).

As I understand it we need to sort the keys before doing `findIntersection` on them, so that the `findIntersection` method is comparing equivalent keys (since it is using the `iOfA` and `iOfB` to iterate through and compare, the keys need to be sorted by index).
i-norden reviewed 2019-07-23 17:54:57 +00:00
Author
Member

I seem to be able to get away with ./geth --statediff --statediff.streamblock --ws --syncmode "full" I think the --rpc flag turns on the HTTP-RPC server, which we don't use here (we either need to use the IPC-RPC server which is on by default or the WS-RPC server which we turn on with the --ws flag).

I seem to be able to get away with `./geth --statediff --statediff.streamblock --ws --syncmode "full"` I think the `--rpc` flag turns on the HTTP-RPC server, which we don't use here (we either need to use the IPC-RPC server which is on by default or the WS-RPC server which we turn on with the `--ws` flag).
i-norden reviewed 2019-07-23 17:57:15 +00:00
@ -0,0 +65,4 @@
case packet := <-payloadChannel:
if notifyErr := notifier.Notify(rpcSub.ID, packet); notifyErr != nil {
log.Error("Failed to send state diff packet; error: " + notifyErr.Error())
unSubErr := api.sds.Unsubscribe(rpcSub.ID)
Author
Member

That's a really good point! I will need to think about this more, and take a closer look at the notifier, but my gut tells me you are right and that there are failures we will want to ignore.

That's a really good point! I will need to think about this more, and take a closer look at the notifier, but my gut tells me you are right and that there are failures we will want to ignore.
i-norden reviewed 2019-07-23 17:57:48 +00:00
Author
Member

Definitely, will update! That makes more sense to me too.

Definitely, will update! That makes more sense to me too.
i-norden reviewed 2019-07-23 17:59:10 +00:00
Author
Member

Thank you for bringing this up! I'll get rid of this, and take a closer look to see if we can do something similar with a full node...

Thank you for bringing this up! I'll get rid of this, and take a closer look to see if we can do something similar with a full node...
Author
Member

Thanks for all the helpful reviews @elizabethengelman!! I'm going to make the changes you mention, and then I'll merge into statediffing. After that I'll begin the official PR to geth:master. I will definitely want your input on how to best structure/frame/word that PR- what's the best way to correspond on that (since we won't want to open the PR til we have it ready)? I'll throw together a draft and send it to you over slack/discord? I'm on vacation in the boonies this week so I won't get around to that until at least tomorrow afternoon when I have internet access again.

Thanks for all the helpful reviews @elizabethengelman!! I'm going to make the changes you mention, and then I'll merge into `statediffing`. After that I'll begin the official PR to geth:master. I will definitely want your input on how to best structure/frame/word that PR- what's the best way to correspond on that (since we won't want to open the PR til we have it ready)? I'll throw together a draft and send it to you over slack/discord? I'm on vacation in the boonies this week so I won't get around to that until at least tomorrow afternoon when I have internet access again.
i-norden reviewed 2019-07-29 19:01:19 +00:00
@ -0,0 +65,4 @@
case packet := <-payloadChannel:
if notifyErr := notifier.Notify(rpcSub.ID, packet); notifyErr != nil {
log.Error("Failed to send state diff packet; error: " + notifyErr.Error())
unSubErr := api.sds.Unsubscribe(rpcSub.ID)
Author
Member

This makes it sound like we should unsubscribe because the rpc connection is closed when an error occurs. But that's actually only true if the error occurs here, if the error is from here then the connection isn't closed so we could wait for more failures.

[This](https://github.com/ethereum/go-ethereum/blob/master/rpc/subscription.go#L119) makes it sound like we should unsubscribe because the rpc connection is closed when an error occurs. But that's actually only true if the error occurs [here](https://github.com/ethereum/go-ethereum/blob/master/rpc/subscription.go#L135), if the error is from [here](https://github.com/ethereum/go-ethereum/blob/master/rpc/subscription.go#L123) then the connection isn't closed so we could wait for more failures.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/go-ethereum#10
No description provided.