{"id":17041913,"url":"https://github.com/cloudhead/iohk-challenge","last_synced_at":"2025-06-28T18:07:53.494Z","repository":{"id":66106817,"uuid":"90486792","full_name":"cloudhead/iohk-challenge","owner":"cloudhead","description":"IOHK Haskell test","archived":false,"fork":false,"pushed_at":"2017-05-08T10:55:00.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T01:29:48.710Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudhead.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-06T19:38:52.000Z","updated_at":"2018-01-11T01:53:19.000Z","dependencies_parsed_at":"2023-04-04T17:30:47.568Z","dependency_job_id":null,"html_url":"https://github.com/cloudhead/iohk-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloudhead/iohk-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudhead%2Fiohk-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudhead%2Fiohk-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudhead%2Fiohk-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudhead%2Fiohk-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudhead","download_url":"https://codeload.github.com/cloudhead/iohk-challenge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudhead%2Fiohk-challenge/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262473969,"owners_count":23316902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:14:09.880Z","updated_at":"2025-06-28T18:07:53.470Z","avatar_url":"https://github.com/cloudhead.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iohk-challenge\n\nThe approach taken here is to broadcast messages between nodes without expecting a reply.\nEach node has a receiving process and a broadcasting process which work independently, to\nexploit parallelism, and avoid blocking while waiting for messages. We use a \"fire and forget\" model because nodes cannot rely on each other to be online beyond the initial\ndiscovery phase.\n\nTo maintain total ordering by *time sent*, we have to buffer. The size of that buffer is specified with the `--buffer` flag, which defaults to 10'000 messages. Without the buffer, ordering is only on a per-node basis, since we already receive messages in sending order, but not accross nodes. If a message arrives too late to be processed in order, it is dropped. If nodes have even connectivity, a smaller buffer size should do. In the case of discrepancies between nodes, the node with the highest ping will have its messages dropped the most, since the buffer will fill with \"faster\" nodes.\n\nIf we wanted to maintain complete ordering with no dropped messages, we would have to store every single message. This is of course not practical, hence the buffer size parameter.\n\nWith more time, we could have run a profiler to find out if there are any hotspots, or try out different methods of maintaining ordering.\n\n## Assumptions\n\n* The nodes need to be started together, and available in the initial startup phase, as they will wait for each of their remotes to be online before starting to broadcast. However, if one node dies, the rest will keep going.\n\n* Nodes are well-behaved and run in a trusted network.\n\n## Building\n\n    stack build\n\nTested on GHC 8.0.2.\n\n## Running\n\nThe executable takes a list of space-delimited hosts to connect to. For example,\nif we had three machines, it could look something like this:\n\n    user@10.0.0.1 $ stack exec iohk-node -- --port 9000 10.0.0.2:9000 10.0.0.3:9000\n    user@10.0.0.2 $ stack exec iohk-node -- --port 9000 10.0.0.1:9000 10.0.0.3:9000\n    user@10.0.0.3 $ stack exec iohk-node -- --port 9000 10.0.0.1:9000 10.0.0.2:9000\n\nTo specify sending time and grace period, pass `--send-for N` and `--wait-for N`,\nwhere N is in seconds.\n\nTo specify a random seed, pass `--with-seed N`. To see all options, run the command with\nno arguments.\n\n## Output\n\nAt the end of the grace period, the program outputs two values, delimited with a space, to stdout. The first is the number of messages received and the second is the final computed value. Note that dropped messages are not included in either of these.\n\nDebug information is output to stderr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudhead%2Fiohk-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudhead%2Fiohk-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudhead%2Fiohk-challenge/lists"}