-
Notifications
You must be signed in to change notification settings - Fork 116
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
[dot/state] implement state_subscribeStorage #1290
Conversation
Added test for encoding balances genesis parameters.
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.
LGTM, nice example btw
Edward Mack: [dot/state] implement state_subscribeStorage (#1290) * added system accounts to gensis configs Added test for encoding balances genesis parameters. * add to full account object to raw genesis * fix tests * enable rpc module by defualt * update gssmr genesis to use palletBalances key * update genesis-raw * use subscribe for db listener * testing db storage subscribe * lint * add test for db subscribe * add Example db.Subscribe code * update go.mod to use updated chaindb * implement subscribe storage, move filters * remove unused code * lint * remove redundant test * modify tests to increase coverage
ent := s.tries[root].Entries() | ||
for k, v := range ent { | ||
if k != ":code" { | ||
// todo, currently we're ignoring :code since this is a lot of data | ||
kv := &KeyValue{ | ||
Key: common.MustHexToBytes(fmt.Sprintf("0x%x", k)), | ||
Value: v, | ||
} | ||
subRes.Changes = append(subRes.Changes, *kv) | ||
} | ||
} | ||
|
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.
this seems to send all the entries in the trie, not just the ones that are changed? am I mistaken?
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.
Right, I wasn't sure about this, however when I was testing with Substrate node, using key 0x26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850 (System EventCount) I saw that it was responding with a value every block, even though the value remained the same (1). So I figured that I should replicate the same behavior.
Changes
Tests
Make websocket call:
and enjoy the results.
Checklist
Issues