🎉 v0.1.0 - minimally feature complete

This commit is contained in:
Netscape Navigator 2020-04-22 08:44:12 -05:00
parent a3c4d86025
commit e087888e94
17 changed files with 160 additions and 138 deletions

4
.gitignore vendored
View File

@ -1,6 +1,6 @@
coverage/ coverage/
.pigeon/ .pgn/
*.pigeon *.pgn
doc/ doc/
*scratchpad* *scratchpad*
pigeon.bundle pigeon.bundle

View File

@ -98,7 +98,7 @@ TODO
# Optimizations # Optimizations
- [ ] add parsers and validators for all CLI inputs - [ ] add parsers and validators for all CLI inputs
- [ ] Make the switch to LevelDB, RocksDB, [UNQLite](https://unqlite.org/features.html) or similar (currently using Ruby PStore). - [ ] Make the switch to LevelDB, RocksDB, [UNQLite](https://unqlite.org/features.html) or similar (currently using Ruby PStore).
- [ ] Convert literals to constants, remove unused locals, reduce duplication. - [ ] Convert literals to constants, remove unused locals, reduce duplication, run linter.
- [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK. - [ ] Reduce whole darn repo into single module to aide portability. `::Helpers` module is OK.
- [ ] Update the bundles.md document once `bundle consume` works. - [ ] Update the bundles.md document once `bundle consume` works.
- [ ] 100% documentation - [ ] 100% documentation

View File

@ -71,9 +71,9 @@ pigeon peer all
# => @m0LEP+0NrGqu1wT8/4a3nOPuRBM+DrMpUahDZ3/cDi8=.ed25519 # => @m0LEP+0NrGqu1wT8/4a3nOPuRBM+DrMpUahDZ3/cDi8=.ed25519
pigeon bundle create pigeon bundle create
# => (creates @GOl+398b2kWeLi6+DCcU0i3AWD6vWmUtocBVYbpkpNk=.ed25519.pigeon) # => (creates @GOl+398b2kWeLi6+DCcU0i3AWD6vWmUtocBVYbpkpNk=.ed25519.pgn)
pigeon bundle consume @GOl+398b2kWeLi6+DCcU0i3AWD6vWmUtocBVYbpkpNk=.ed25519.pigeon pigeon bundle consume @GOl+398b2kWeLi6+DCcU0i3AWD6vWmUtocBVYbpkpNk=.ed25519.pgn
# => # =>
``` ```

View File

@ -29,7 +29,7 @@ module Pigeon
class Identity < ThorBase class Identity < ThorBase
class ConfigAlreadyExists < StandardError; end class ConfigAlreadyExists < StandardError; end
desc "new", "Creates a new identiy in `.pigeon` directory if none exists" desc "new", "Creates a new identiy in `.pgn` directory if none exists"
def new def new
if File.file?(Pigeon::PIGEON_DB_PATH) if File.file?(Pigeon::PIGEON_DB_PATH)
@ -162,7 +162,7 @@ module Pigeon
end end
class CLI < ThorBase class CLI < ThorBase
desc "status", "Show various information about the `.pigeon` directory" desc "status", "Show various information about the `.pgn` directory"
def status def status
me = db.local_identity.multihash me = db.local_identity.multihash
@ -189,7 +189,7 @@ module Pigeon
desc "draft SUBCOMMAND ...ARGS", "Manage drafts" desc "draft SUBCOMMAND ...ARGS", "Manage drafts"
subcommand "draft", PigeonDraft subcommand "draft", PigeonDraft
desc "identity SUBCOMMAND ...ARGS", "Manage `.pigeon` identity" desc "identity SUBCOMMAND ...ARGS", "Manage `.pgn` identity"
subcommand "identity", Identity subcommand "identity", Identity
desc "message SUBCOMMAND ...ARGS", "Manage blob storage" desc "message SUBCOMMAND ...ARGS", "Manage blob storage"

BIN
db.pigeon Normal file

Binary file not shown.

129
gossip.pigeon Normal file
View File

@ -0,0 +1,129 @@
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind &ET9C7B9N82XR0F021CXEWSPDH23H4CHMX866WWA3R2PXEFZM67PG.sha256
prev NONE
depth 0
lipmaa 0
a:"b"
signature XV7SCMN45EKYFQFZ4W5V3KCHN1B05DGQ3M9EJPBDTKMJHQ8ZG8133YXYRZD8AX29Q4JGQ0THXGJSRGQ5GQJZ7H69Z0Y608QKMF9E218.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind a
prev %A15N6NKZ3ACBA2RW2082G8XMCHTF35E45CHD2X8S4KNR8V8CGG20.sha256
depth 1
lipmaa 0
&7Z2CSZKMB1RE5G6SKXRZ63ZGCNP8VVEM3K0XFMYKETRDQSM5WBSG.sha256:"b"
signature 0RR1YFS0F1KYE0H304GZZJ4N0KY536N2GA5BFZCM4D4ZPJP48ACG16KXAK1357C52EY28KZ7T6NCQV9JWSGGV5BJ8191K9W7DNPWR28.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind a
prev %XQPBM2Z4JSJMGHXN1AJE3PCZ7TT9SD9Z2FYFJYJDFKXV3XET5ZAG.sha256
depth 2
lipmaa 1
b:&HDDSVC617PS44NP856N3CJN91HPJXEHHHE93595BJC9VJN6KANFG.sha256
signature K52Y7ZT5VGPWNNXMYPBZE6BEZQYHHTQ50Z77JEMKESXX1VGDQKQ6ZG4W2EXGN3WXNHG652HXETKEBCM9ZZK0M6VG8Q08MQZK18K1J0G.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 4436caaa-b2a0-43a4-84a9-9b19397abd06
prev %K7DF2RMFFYJ89HWWF2VGK7GXQ7D7THJSGXB0F6NMT5C6NPANQ3TG.sha256
depth 3
lipmaa 2
foo:"69675bb4-8c81-471e-b362-4aec2435e8b3"
signature K3BRR2XPB16CQD79W72NRBQTA14YH14N6K1KDKP9BDW5V7C9RBZG2Z3HHA10BG16QW6GZ0N8K07XD1KP1KZMJEJRTYWSC2M3BN42P10.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind ac549d0a-e636-46df-9499-7a618e695b40
prev %NYGBV7HKXDV00EHHSRGNZRRWABERR6CJA2HD137DBXQBMN5ANZ70.sha256
depth 4
lipmaa 1
foo:"540a0b80-0f0e-4aaf-8983-7a866fce5092"
signature M5P65CDBK6DWYDZTBXFEA6N982J0WZ9F8JN9SRE805B301K6VSB762MVTVKHBQGC022S5WCT4P0M251X9NCE1R1CJB35HD1G8XMS40R.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 5d33b10c-f084-44b4-9a00-7a9bc09761a4
prev %6PAQD2Q4FRYCJWEAPQG3V3BW9S5WW7JDMRTJ085WK556JZGAX7M0.sha256
depth 5
lipmaa 4
foo:"bar"
signature FF0DNPEXQP2A2BRJCQ5W1GQZ15YZ4H9A3Y6DGDR3APZ8CQWYSH4DJDA8EAT18V0BVQTE4WSB8HYE4QJ8WHCV7Y12X4ZQRQFB6VZ5630.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 264dbd6b-512f-44da-b7b5-8be2db432ceb
prev %93Y67BNW183KB2VAXXSC079NFME2Y2935AZGYSWA1QVSMPSWQSB0.sha256
depth 6
lipmaa 5
foo:"6c8024f8-92e4-4b71-81c1-f0105e0666f1"
signature X39FH5B2HBRJ24CVRJJEV0WP2ZWGXDY9SSQZMNHTB6AEY5Q6NKZZ7HJ65WX9HBFMBGHDEXF6XC8G9A79VQM8QJ2E0HA4YPB3QPS5Y38.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 1c43d605-0c12-4d6e-b209-1a7514561787
prev %Q84SMB8F5QHYMV7SCT5ZRQSJNMC81FJ6737T6T5ACK6FEZCN7TFG.sha256
depth 7
lipmaa 6
foo:"bar"
signature 2Y3S6F7723V60CKNBRM95M30ZVNCYA5F675TTKMWKKQ2DVMAA204HKDJ5TDY9FDPR644GXJR48N04M96G7CHWXV4WHRP2HBN2V6XW20.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 3965b309-c3d4-4c3f-b71f-6f630b399b11
prev %2RP9T2XWQ9KH40ZXVQF6XSAQ7JCBWN2VB5CN8850YHWW8GAX6N80.sha256
depth 8
lipmaa 4
foo:"123"
signature 08EA0WNEEGJK7HRCZNHMAJJ501PE9N62JTTDYDFRHVHBGW3AEWNJT2J739HBWTRGBSJ3MZ8A4CPHCBXSM62DAZVBBMXHT3VCT6EY630.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind a93e41cc-0cfc-4dec-a4d1-504156c4d739
prev %TNP0G3EPEQNF2W050HKB7YS7XX3RHRSDBA61XFNFHYQCZDRH1D1G.sha256
depth 9
lipmaa 8
foo:"123"
signature TQP1CHM8P79VE4S27J7C1XCDD2MJ0NNJ4SXK1PAW9AB52REQN9P9142HN0GC5CKV7V2ND5R8F9TE9NCCAEQYS4WEQGJBAWZ7YGSCY20.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 2b338d7f-a2d9-48ad-8455-ad8783621596
prev %EQW115BK88001JTTWPFH8CWTYEWDYDAHDKXZAZXKGFKAB9SBH0XG.sha256
depth 10
lipmaa 9
foo:"bar"
signature ZPF3H3VHWW4SR1K1AT4ZYBQ6A0SQEB9FGQEWSJ0DK2P0MFQEQHNNN5YH0CWZWF30HQ8ZZ7JW1C8A40RT9ZTDGJGVVDNDD0P16E4C80R.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind cb448a72-0d4e-4a3f-bf88-e71c0938fe7e
prev %C4NNY31164R873NMKPTXK5QT22YAD8V921M7SMRKMDXDJJF45RM0.sha256
depth 11
lipmaa 10
foo:"bar"
signature JQQH930EECHYKG4SNKDQ4RZAK9GXMAFP6FFNNZTMATH6CF7QJ9A1N83EWK0P6B31B9FQ520DXHSFTKEN22WCHD1KVGWWCV3Q52Z2M00.sig.ed25519
author @3J01H00Z72F2HVCQK3AD1FY0VQY7VSWHP7BDKMDQ84YK6QC2DWWG.ed25519
kind 5e160f6d-c3cf-4132-9336-59c979b38428
prev %E73R2HZ69F50WNMQWX8T3GB1XGHNHTP5N0BVVN042QP2KBV1PNNG.sha256
depth 12
lipmaa 8
foo:"123"
signature SQ3PCJ1AZAK7X65FCRS9HX3B9N6ZZW0PTARTEP885KZTCM1N6YP8PTY62DCY5WC9W8J606VXQD6D40TP9V0QYQ5SM7PYFR9R2WEGM2R.sig.ed25519

View File

@ -5,8 +5,8 @@
# for quick QA. # for quick QA.
echo "Deleting old pigeon configs" echo "Deleting old pigeon configs"
rm -f db.pigeon rm -f pigeon.db
rm -f pigeon.bundle rm -rf bundle
echo "OK" echo "OK"
echo "Creating new config:" echo "Creating new config:"
@ -80,9 +80,9 @@ echo "=== Sign draft #2"
echo "=== Dump the bundle" echo "=== Dump the bundle"
./bin/pigeon-cli bundle create ./bin/pigeon-cli bundle create
cat pigeon.bundle cat bundle/gossip.pgn
echo "=== end bundle dump. Ingesting bundle..." echo "=== end bundle dump. Ingesting bundle..."
./bin/pigeon-cli bundle ingest pigeon.bundle ./bin/pigeon-cli bundle ingest bundle/gossip.pgn
echo "=== find a message" echo "=== find a message"
./bin/pigeon-cli message find $(./bin/pigeon-cli message last) ./bin/pigeon-cli message find $(./bin/pigeon-cli message last)

View File

@ -7,8 +7,8 @@ module Pigeon
SEED_CONFIG_KEY = "SEED" SEED_CONFIG_KEY = "SEED"
TPL_DIR = File.join(".", "lib", "views") TPL_DIR = File.join(".", "lib", "views")
PIGEON_DB_PATH = File.join("db.pigeon") PIGEON_DB_PATH = File.join("pigeon.db")
DEFAULT_BUNDLE_PATH = File.join(Dir.home, "pigeon.bundle") DEFAULT_BUNDLE_PATH = File.join(Dir.pwd, "bundle")
PIGEON_BLOB_PATH = File.join(Dir.home, "pigeon_sha256") PIGEON_BLOB_PATH = File.join(Dir.home, "pigeon_sha256")
# MESSAGE TEMPLATE CONSTANTS: # MESSAGE TEMPLATE CONSTANTS:
HEADER_TPL = "author <%= author %>\nkind <%= kind %>\nprev <%= prev %>\ndepth <%= depth %>\nlipmaa <%= lipmaa %>\n\n" HEADER_TPL = "author <%= author %>\nkind <%= kind %>\nprev <%= prev %>\ndepth <%= depth %>\nlipmaa <%= lipmaa %>\n\n"
@ -17,14 +17,14 @@ module Pigeon
COMPLETE_TPL = [HEADER_TPL, BODY_TPL, FOOTER_TPL].join("") COMPLETE_TPL = [HEADER_TPL, BODY_TPL, FOOTER_TPL].join("")
CURRENT_DRAFT = "HEAD.draft" CURRENT_DRAFT = "HEAD.draft"
NOTHING = "NONE" NOTHING = "NONE"
OUTBOX_PATH = File.join(".pigeon", "user") OUTBOX_PATH = File.join(".pgn", "user")
DRAFT_PLACEHOLDER = "DRAFT" DRAFT_PLACEHOLDER = "DRAFT"
CR = "\n" CR = "\n"
BUNDLE_MESSAGE_SEPARATOR = CR * 2 BUNDLE_MESSAGE_SEPARATOR = CR * 2
# /MESSAGE TEMPLATE CONSTANTS # /MESSAGE TEMPLATE CONSTANTS
# Internal namespaces for PStore keys: # Internal namespaces for PStore keys:
ROOT_NS = ".pigeon" ROOT_NS = ".pgn"
CONF_NS = "conf" CONF_NS = "conf"
PEER_NS = "peers" PEER_NS = "peers"
USER_NS = "user" USER_NS = "user"

View File

@ -102,22 +102,23 @@ module Pigeon
.sort_by(&:depth) .sort_by(&:depth)
end.flatten end.flatten
# Render messages for all peers. # Attach blobs for all messages in bundle.
content = messages
.map { |message| message.render }
.join(BUNDLE_MESSAGE_SEPARATOR)
File.write(file_path, content + CR)
messages messages
.map(&:collect_blobs) .map(&:collect_blobs)
.flatten .flatten
.uniq .uniq
.map { |mhash| ["bundle", mhash, get_blob(mhash)] } .map { |mhash| ["bundle", mhash, get_blob(mhash)] }
.map { |arg| Helpers.write_to_disk(*arg) } .map { |arg| Helpers.write_to_disk(*arg) }
# Render messages for all peers.
content = messages
.map { |message| message.render }
.join(BUNDLE_MESSAGE_SEPARATOR)
File.write(File.join(file_path, "gossip.pgn"), content + CR)
end end
def ingest_bundle(file_path = DEFAULT_BUNDLE_PATH) def ingest_bundle(file_path = DEFAULT_BUNDLE_PATH)
bundle = File.read(file_path) bundle = File.read(File.join(file_path, "gossip.pgn"))
tokens = Pigeon::Lexer.tokenize(bundle) tokens = Pigeon::Lexer.tokenize(bundle)
Pigeon::Parser.parse(self, tokens) Pigeon::Parser.parse(self, tokens)
end end

View File

@ -1,3 +1,3 @@
module Pigeon module Pigeon
VERSION = "0.0.7" VERSION = "0.1.0"
end end

BIN
pigeon.db Normal file

Binary file not shown.

View File

@ -1,99 +0,0 @@
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind b049f082-861f-43f0-bc10-ca97b2b91b2e
prev NONE
depth 0
lipmaa 0
foo:"123"
signature X4KF6YM3YMR457VTJ7HGY92F6W65YQBEG3WS5QDFNSAF45KHMDZZZRWK710F04Y6TPM2AJ3W135RSF42V8DAE7MJSSTCHYP7JQG7E10.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind bbbae2a3-024b-472d-96b3-8dcc80fcef9e
prev %4YDSWA2SWPH28AA1AH40VJBJ1RT8KKXWJFVSZ3FTYW3S2JG7R2EG.sha256
depth 1
lipmaa 0
foo:"123"
signature 4NACJ81VJTC57W8DBR2JAAEYNGPZ1D08CFXTS66ZF89W5GJHHHH0PMYAQBPWWSMZQWN68XASHAG76605Q0DVWKDW53VYNSQVD05RE38.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind 031a91fd-4c47-41a2-b56a-e6e99bfb4e86
prev %510TYAE8EJPWG9JQXGGVBBB8PG2N3BG728R6KZ97Y8YG7K8RGEQG.sha256
depth 2
lipmaa 1
foo:"bar"
signature C2PE2DSJVM8NEKSYAN3BZZ4EPM3BYCAX0NHAD2NWS31C2TBAGSJPV1GZXRWKQCP9VV3NAJK0N6F7ZMDC1YPKTEJXKQD57EN61ZVYY08.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind f4716a10-bb95-4919-8866-fd19188f3457
prev %YNKM86MYJC3VN8X6YQV0F7XXX9RTZEEFX5T3KJZ97093GJTWDPQG.sha256
depth 3
lipmaa 2
foo:"2ab907c7-9a5d-42f1-9ca9-5ac0853daad0"
signature VXEZG4PWY6DBNMY0A5B8R3FFATN6XFG812V1ZRSZ5VSJ99EKFS7NQN689SP7P4KT8KFM7NQEV3DRDB3XNZ10SZN25ZRPCD14ECFXM1R.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind 617b7d9a-dd39-44a7-afaf-0d5b3651091c
prev %X67GBXJ0216VM2AF580T0B6EAMJTQPSYXPYDAKNQTDC7QSG32ZR0.sha256
depth 4
lipmaa 1
foo:"123"
signature RX5CPHS5J9BABRKYXCHK59WF9S87SFCVWD2644KYB5BEXX0TAQWT9ZS2MKDW62KRZRX34PRE7NNHB9KHGPFHWDBCB9E2MWNVD5HBG1R.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind 066a62ea-eae0-47ae-8013-401665109dbf
prev %F5T6F8K3PFDA2E4QDYP3M5CWF98Y1B46FSVY64BP6YVSNT0AZPV0.sha256
depth 5
lipmaa 4
foo:"123"
signature JCPE2X5MPTVR6KKPYYBY9E8MNEG85P2FNMZA342W6HMNAWJ8AQXJF5QX0H6XP3ATR9TBJN4HG7XKFT5W2DZXRW6KZNSG4NV18QT180R.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind ba16b9f6-a0bc-44e4-b873-da52308186e8
prev %KDKK65CX8GMV7EFCJ4K3J77T38SNDE6DX1TE7AKKGW7X74Z63WKG.sha256
depth 6
lipmaa 5
foo:"bar"
signature JSSFBAZ58Y73NPWZ912KYS0EZ1WA3V3FAG9VW2TF99B3Z0RH06Q52DS2AEBRPEZJFZWBA1Q4WYR7N19VVGRZ9KDFYAX64PCTA9BEW3G.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind 541368e0-3bbc-4408-a743-c649d88e2547
prev %9TVN1WPETZFEDJ49V2B2KFQ7VC58ERWYSJ0SWCFM1A7KBCTYP0X0.sha256
depth 7
lipmaa 6
foo:"fb97ba07-d037-4550-a5ca-ec63ad91109c"
signature BFVWMHGZ2Z8GDWGRVJP989DGCR3B4TFNSW6T5VVNS5P0EMFCTXYB583A5V4AVD4DGTWHSGA67N52VP2AS3MEBYM7BQXH4YYAMAK2W1R.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind c8f2c09f-91f2-48db-b02d-8d9503a7fcd8
prev %XFS3B295588XMP91TM50TPGK78WP8KXESSWAG2BHTSZAFCRDDXFG.sha256
depth 8
lipmaa 4
foo:"a511ac1e-089f-4876-8493-d0d827760515"
signature YRCG26YGM4TB89K96H6HXZNH0ZXHQB2R8P5FSZ8EHG4GDK1X80BV3GN6S7PW4XNWZPFVDQES4TC5AVRB7D17MF21H86QB58DAKHX210.sig.ed25519
author @78V80T9Q7862GW5KTNGSDBKMSA53WE98G8TGFDS6HC9HEABFD64G.ed25519
kind 51c783e4-8729-4e73-9d31-e16db8605004
prev %4PE7S4XCCAYPQ42S98K730CEW6ME5HRWJKHHEGYVYPFHSJWXEY1G.sha256
depth 9
lipmaa 8
foo:"bar"
signature BBE732XXZ33XTCW1CRA9RG13FQ0FVMR61SAHD621VH8C64B4WA8C86JSTTAHG4CSGNBJJ7YSAVRF3YEBX6GTEB6RRWGDA84VJZPMR3R.sig.ed25519

View File

@ -1,9 +0,0 @@
author @PPJQ3Q36W258VQ1NKYY2G7VW24J8NMAACHXCD83GCQ3K8F4C9X2G.ed25519
kind theSlowestWayToSendAMessageEver
prev %K2EKKRFA5F34VG9JSW17SS5HNQAKZTTNP6A9DVR2ZBPG8GME3QVG.sha256
depth 2
lipmaa 1
yo_dawg:"i heard you like gossip protocols"
signature QM8ERCNP4NM4Y3PY09EWVCWJ6MJKPRN67EX4P8MN6DE47BZSG4M3XXCT3JWVRR7D0232Z5HYCQ5J8744JNFBYXFN8JGXM0R0ZESSR2R.sig.ed25519

View File

@ -27,7 +27,7 @@ RSpec.describe Pigeon::Message do
it "creates a bundle" do it "creates a bundle" do
expected_bundle = create_fake_messages.map(&:render).join("\n\n") + "\n" expected_bundle = create_fake_messages.map(&:render).join("\n\n") + "\n"
db.create_bundle db.create_bundle
actual_bundle = File.read(Pigeon::DEFAULT_BUNDLE_PATH) actual_bundle = File.read(File.join(Pigeon::DEFAULT_BUNDLE_PATH, "gossip.pgn"))
expect(expected_bundle).to eq(actual_bundle) expect(expected_bundle).to eq(actual_bundle)
end end
@ -41,7 +41,7 @@ RSpec.describe Pigeon::Message do
db.reset_database db.reset_database
antagonist = "@PPJQ3Q36W258VQ1NKYY2G7VW24J8NMAACHXCD83GCQ3K8F4C9X2G.ed25519" antagonist = "@PPJQ3Q36W258VQ1NKYY2G7VW24J8NMAACHXCD83GCQ3K8F4C9X2G.ed25519"
db.block_peer(antagonist) db.block_peer(antagonist)
db.ingest_bundle("./spec/fixtures/x.bundle") db.ingest_bundle("./spec/fixtures/x")
expect(db.find_all_messages.count).to eq(0) expect(db.find_all_messages.count).to eq(0)
end end
end end

View File

@ -129,7 +129,7 @@ RSpec.describe Pigeon::Lexer do
end end
it "tokenizes a bundle" do it "tokenizes a bundle" do
bundle = File.read("./spec/fixtures/normal.bundle") bundle = File.read("./spec/fixtures/normal/gossip.pgn")
tokens = Pigeon::Lexer.tokenize(bundle) tokens = Pigeon::Lexer.tokenize(bundle)
EXPECTED_TOKENS1.each_with_index do |item, i| EXPECTED_TOKENS1.each_with_index do |item, i|
expect(tokens[i]).to eq(EXPECTED_TOKENS1[i]) expect(tokens[i]).to eq(EXPECTED_TOKENS1[i])

View File

@ -6,7 +6,7 @@ RSpec.describe Pigeon::Lexer do
db.reset_database db.reset_database
db db
end end
let(:example_bundle) { File.read("./spec/fixtures/normal.bundle") } let(:example_bundle) { File.read("./spec/fixtures/normal/gossip.pgn") }
let(:tokens) { Pigeon::Lexer.tokenize(example_bundle) } let(:tokens) { Pigeon::Lexer.tokenize(example_bundle) }
BAD_TOKENS = [ BAD_TOKENS = [
@ -30,7 +30,7 @@ RSpec.describe Pigeon::Lexer do
end end
it "ingests and reconstructs a bundle" do it "ingests and reconstructs a bundle" do
messages = db.ingest_bundle("./spec/fixtures/normal.bundle") messages = db.ingest_bundle("./spec/fixtures/normal")
expect(messages.length).to eq(10) expect(messages.length).to eq(10)
expect(messages.map(&:class).uniq).to eq([Pigeon::Message]) expect(messages.map(&:class).uniq).to eq([Pigeon::Message])
re_bundled = messages.map(&:render).join("\n\n") + "\n" re_bundled = messages.map(&:render).join("\n\n") + "\n"

View File

@ -48,7 +48,7 @@ RSpec.describe Pigeon::Storage do
end end
it "finds all authored by a particular feed" do it "finds all authored by a particular feed" do
ingested_messages = db.ingest_bundle("./spec/fixtures/normal.bundle") ingested_messages = db.ingest_bundle("./spec/fixtures/normal")
author = ingested_messages.first.author.multihash author = ingested_messages.first.author.multihash
actual_messages = db.find_all_messages(author) actual_messages = db.find_all_messages(author)
search_results = db.find_all_messages(author) search_results = db.find_all_messages(author)