filecoin-project / oni

👹 (DEPRECATED; see README) Project Oni | Network Validation
https://docs.google.com/document/d/16jYL--EWYpJhxT9bakYq7ZBGLQ9SB940Wd1lTDOAbNE
7 stars 5 forks source link

generator; single main() entrypoint for each suite. #232

Closed raulk closed 4 years ago

raulk commented 4 years ago

This introduces a new organisation for test vector scripts.

Each suite now lives in a package (directory), with a single main entrypoint.

I have introduced a Generator that the main method can delegate to to have it handle the generation and writing of test vectors into properly named files. I have also taken the opportunity to make things DRYer; scripts no longer have to instantiate the Builder manually, or call v.Finish(): the Generator takes care of that.

See godocs of the Generator struct for more info on the layout.

I have migrated the message_application suite to use this style. paych suite pending.


This fixes https://github.com/filecoin-project/oni/issues/189 via an alternative approach that is less hacky and a lot more declarative, and DRY.


Try it out:

$ cd tvx
$ go run ./scripts/msg_application -o ./foo
generating test vector: msg-apply-fail-actor-execution-illegal-arg
generating test vector: msg-apply-fail-unknown-receiver
generating test vector: msg-apply-fail-unknown-receiver
generating test vector: msg-apply-fail-invalid-receiver-method
generating test vector: msg-apply-fail-invalid-receiver-method
generating test vector: msg-apply-fail-onchainsize-gas
generating test vector: msg-apply-fail-transfer-accountcreation-gas
generating test vector: msg-apply-fail-transfer-accountcreation-gas
$ ls -lrt foo
total 208
-rw-r--r--  1 raul  staff   2720 Aug 14 15:59 invalid_msgs-0.json
-rw-r--r--  1 raul  staff   2720 Aug 14 15:59 invalid_msgs-1.json
-rw-r--r--  1 raul  staff   3142 Aug 14 15:59 unknown_actors-1.json
-rw-r--r--  1 raul  staff   3142 Aug 14 15:59 unknown_actors-0.json
-rw-r--r--  1 raul  staff   4045 Aug 14 15:59 actor_exec-0.json
-rw-r--r--  1 raul  staff  26436 Aug 14 15:59 gas_cost-2.json
-rw-r--r--  1 raul  staff  26436 Aug 14 15:59 gas_cost-1.json
-rw-r--r--  1 raul  staff  26436 Aug 14 15:59 gas_cost-0.json