{"action":"created","issue":{"url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/153","repository_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding","labels_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/153/comments","events_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/153/events","html_url":"https://github.com/prysmaticlabs/geth-sharding/issues/153","id":330022274,"node_id":"MDU6SXNzdWUzMzAwMjIyNzQ=","number":153,"title":"Implement a Shard Transaction Generator","user":{"login":"rauljordan","id":5572669,"node_id":"MDQ6VXNlcjU1NzI2Njk=","avatar_url":"https://avatars3.githubusercontent.com/u/5572669?v=4","gravatar_id":"","url":"https://api.github.com/users/rauljordan","html_url":"https://github.com/rauljordan","followers_url":"https://api.github.com/users/rauljordan/followers","following_url":"https://api.github.com/users/rauljordan/following{/other_user}","gists_url":"https://api.github.com/users/rauljordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rauljordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauljordan/subscriptions","organizations_url":"https://api.github.com/users/rauljordan/orgs","repos_url":"https://api.github.com/users/rauljordan/repos","events_url":"https://api.github.com/users/rauljordan/events{/privacy}","received_events_url":"https://api.github.com/users/rauljordan/received_events","type":"User","site_admin":false},"labels":[{"id":953163898,"node_id":"MDU6TGFiZWw5NTMxNjM4OTg=","url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/labels/Beginner","name":"Beginner","color":"fef2c0","default":false},{"id":878285942,"node_id":"MDU6TGFiZWw4NzgyODU5NDI=","url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/labels/Phase%201","name":"Phase 1","color":"31edab","default":false}],"state":"open","locked":false,"assignee":{"login":"rauljordan","id":5572669,"node_id":"MDQ6VXNlcjU1NzI2Njk=","avatar_url":"https://avatars3.githubusercontent.com/u/5572669?v=4","gravatar_id":"","url":"https://api.github.com/users/rauljordan","html_url":"https://github.com/rauljordan","followers_url":"https://api.github.com/users/rauljordan/followers","following_url":"https://api.github.com/users/rauljordan/following{/other_user}","gists_url":"https://api.github.com/users/rauljordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rauljordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauljordan/subscriptions","organizations_url":"https://api.github.com/users/rauljordan/orgs","repos_url":"https://api.github.com/users/rauljordan/repos","events_url":"https://api.github.com/users/rauljordan/events{/privacy}","received_events_url":"https://api.github.com/users/rauljordan/received_events","type":"User","site_admin":false},"assignees":[{"login":"rauljordan","id":5572669,"node_id":"MDQ6VXNlcjU1NzI2Njk=","avatar_url":"https://avatars3.githubusercontent.com/u/5572669?v=4","gravatar_id":"","url":"https://api.github.com/users/rauljordan","html_url":"https://github.com/rauljordan","followers_url":"https://api.github.com/users/rauljordan/followers","following_url":"https://api.github.com/users/rauljordan/following{/other_user}","gists_url":"https://api.github.com/users/rauljordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rauljordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauljordan/subscriptions","organizations_url":"https://api.github.com/users/rauljordan/orgs","repos_url":"https://api.github.com/users/rauljordan/repos","events_url":"https://api.github.com/users/rauljordan/events{/privacy}","received_events_url":"https://api.github.com/users/rauljordan/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/milestones/1","html_url":"https://github.com/prysmaticlabs/geth-sharding/milestone/1","labels_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/milestones/1/labels","id":3141840,"node_id":"MDk6TWlsZXN0b25lMzE0MTg0MA==","number":1,"title":"Ruby","description":"The Ruby Release: Local Alphanet","creator":{"login":"prestonvanloon","id":7246818,"node_id":"MDQ6VXNlcjcyNDY4MTg=","avatar_url":"https://avatars1.githubusercontent.com/u/7246818?v=4","gravatar_id":"","url":"https://api.github.com/users/prestonvanloon","html_url":"https://github.com/prestonvanloon","followers_url":"https://api.github.com/users/prestonvanloon/followers","following_url":"https://api.github.com/users/prestonvanloon/following{/other_user}","gists_url":"https://api.github.com/users/prestonvanloon/gists{/gist_id}","starred_url":"https://api.github.com/users/prestonvanloon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prestonvanloon/subscriptions","organizations_url":"https://api.github.com/users/prestonvanloon/orgs","repos_url":"https://api.github.com/users/prestonvanloon/repos","events_url":"https://api.github.com/users/prestonvanloon/events{/privacy}","received_events_url":"https://api.github.com/users/prestonvanloon/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":66,"state":"open","created_at":"2018-02-25T21:22:44Z","updated_at":"2018-06-07T02:41:31Z","due_on":"2018-08-01T07:00:00Z","closed_at":null},"comments":0,"created_at":"2018-06-06T20:34:23Z","updated_at":"2018-06-07T22:22:04Z","closed_at":null,"author_association":"NONE","body":"Now that #149 is merged, we can create a simple shard tx generator as a service attached to `ShardEthereum` from `sharding/node/backend.go` that publishes `[]*types.Transaction` data to a go channel.\r\n\r\nThe proposer service will need this in order to process these incoming transactions into serialized blobs that will then be packaged into collations.\r\n"},"comment":{"url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/comments/395584343","html_url":"https://github.com/prysmaticlabs/geth-sharding/issues/153#issuecomment-395584343","issue_url":"https://api.github.com/repos/prysmaticlabs/geth-sharding/issues/153","id":395584343,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTU4NDM0Mw==","user":{"login":"rauljordan","id":5572669,"node_id":"MDQ6VXNlcjU1NzI2Njk=","avatar_url":"https://avatars3.githubusercontent.com/u/5572669?v=4","gravatar_id":"","url":"https://api.github.com/users/rauljordan","html_url":"https://github.com/rauljordan","followers_url":"https://api.github.com/users/rauljordan/followers","following_url":"https://api.github.com/users/rauljordan/following{/other_user}","gists_url":"https://api.github.com/users/rauljordan/gists{/gist_id}","starred_url":"https://api.github.com/users/rauljordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rauljordan/subscriptions","organizations_url":"https://api.github.com/users/rauljordan/orgs","repos_url":"https://api.github.com/users/rauljordan/repos","events_url":"https://api.github.com/users/rauljordan/events{/privacy}","received_events_url":"https://api.github.com/users/rauljordan/received_events","type":"User","site_admin":false},"created_at":"2018-06-07T22:22:04Z","updated_at":"2018-06-07T22:22:04Z","author_association":"NONE","body":"Hey @rawfalafel, as I mentioned, I started on this issue but happy for you to take over if you want.\r\n\r\nThe idea was that I added an event feed to the shard txpool as follows:\r\n\r\nin `sharding/txpool/service.go`\r\n```go\r\n// ShardTXPool handles a transaction pool for a sharded system.\r\ntype ShardTXPool struct {\r\n\tp2p              sharding.ShardP2P\r\n\ttransactionsFeed *event.Feed\r\n}\r\n\r\n// NewShardTXPool creates a new observer instance.\r\nfunc NewShardTXPool(p2p sharding.ShardP2P) (*ShardTXPool, error) {\r\n\treturn &ShardTXPool{p2p: p2p, transactionsFeed: new(event.Feed)}, nil\r\n}\r\n\r\n// Start the main routine for a shard transaction pool.\r\nfunc (pool *ShardTXPool) Start() error {\r\n\tlog.Info(\"Starting shard txpool service\")\r\n\tgo pool.generateTestTransactions()\r\n\treturn nil\r\n}\r\n\r\nfunc (pool *ShardTXPool) TransactionsFeed() *event.Feed {\r\n\treturn pool.transactionsFeed\r\n}\r\n\r\nfunc (pool *ShardTXPool) generateTestTransactions() {\r\n\tfor {\r\n\t\tnsent := pool.transactionsFeed.Send(1)\r\n\t\tlog.Info(fmt.Sprintf(\"Sent transaction to %d subscribers\", nsent))\r\n\t\ttime.Sleep(time.Second)\r\n\t}\r\n}\r\n```\r\n\r\nand then in the `proposer` subpackage, I subscribed to this feed via a for, select block:\r\n\r\nin `sharding/proposer/service.go`\r\n```go\r\n// Start the main loop for proposing collations.\r\nfunc (p *Proposer) Start() error {\r\n\tlog.Info(\"Starting proposer service\")\r\n\tgo p.subscribeTransactions()\r\n\treturn nil\r\n}\r\n\r\nfunc (p *Proposer) subscribeTransactions() {\r\n\t// Subscribes to incoming transactions from the txpool via the shardp2p network.\r\n\tfor {\r\n\t\tsubchan := make(chan int)\r\n\t\tsub := p.txpool.TransactionsFeed().Subscribe(subchan)\r\n\t\t// 10 second time out for the subscription.\r\n\t\ttimeout := time.NewTimer(10 * time.Second)\r\n\t\tselect {\r\n\t\tcase v := <-subchan:\r\n\t\t\tlog.Info(fmt.Sprintf(\"Received transaction with id: %d\", v))\r\n\t\tcase <-timeout.C:\r\n\t\t\tlog.Error(\"Receive timeout\")\r\n\t\t}\r\n\r\n\t\tsub.Unsubscribe()\r\n\t\tselect {\r\n\t\tcase _, ok := <-sub.Err():\r\n\t\t\tif ok {\r\n\t\t\t\tlog.Error(\"Channel not closed after unsubscribe\")\r\n\t\t\t}\r\n\t\tcase <-timeout.C:\r\n\t\t\tlog.Error(\"Unsubscribe timeout\")\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nRight now I just used an int for the channel but we can make this system more elaborate by generating a variety of different transactions. The PR should also include tests and a nicer way to generate them at random intervals + handling timeouts. Let me know if you are interested. I started this on my [personal branch](https://github.com/rauljordan/go-ethereum/blob/generator/sharding/txpool/service.go) but happy for you to take the initial code from there and take over."}}
{"actor":{"display_login":"rauljordan"}}