semiotic-ai / timeline-aggregation-protocol

A fast, efficient and trust-minimized unidirectional micro-payments system.
Apache License 2.0
14 stars 3 forks source link

105 tap manager always requesting rav using all receipts even when some receipts included in previous rav #109

Closed ColePBryan closed 1 year ago

github-actions[bot] commented 1 year ago

Coverage after merging 105-tap_manager-always-requesting-rav-using-all-receipts-even-when-some-receipts-included-in-previous-rav into main will be

80.78%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
tap_aggregator/src
   aggregator.rs92.45%100%100%90.70%40–43, 53–56
   api_versioning.rs86.21%100%76.47%90.24%15–16
   error_codes.rs0%100%0%0%13, 27
   jsonrpsee_helpers.rs43.90%100%33.33%48.28%44, 51–57, 9
   main.rs3.70%100%6.67%2.56%17, 21–22, 26, 30–31, 35–36, 40–41, 45–46, 49–51, 54–61, 64–69, 72–76, 78
   server.rs86.09%100%100%82.22%101, 113–117, 137, 69–77
tap_core/src
   eip_712_signed_message.rs83.78%100%80%85.19%58
   error.rs50%100%50%50%13
   lib.rs83.33%100%87.50%81.25%26
   receipt_aggregate_voucher.rs92.50%100%87.50%93.75%23
tap_core/src/adapters/test
   collateral_adapter_mock.rs88.33%100%75%90.38%18, 44–45, 64
   collateral_adapter_test.rs100%100%100%100%
   rav_storage_adapter_mock.rs92%100%71.43%95.35%30
   rav_storage_adapter_test.rs100%100%100%100%
   receipt_checks_adapter_mock.rs97.83%100%100%97.50%61
   receipt_checks_adapter_test.rs95.83%100%100%95%59
   receipt_storage_adapter_mock.rs85%100%80%85.83%104–106, 128–137, 29
   receipt_storage_adapter_test.rs100%100%100%100%
tap_core/src/tap_manager
   manager.rs82.35%100%61.54%84.29%107, 126–129, 136, 183, 200, 211–212, 223, 95
   rav_request.rs0%100%0%0%9
tap_core/src/tap_manager/test
   manager_test.rs100%100%100%100%
tap_core/src/tap_receipt
   mod.rs41.46%100%36.36%43.33%16, 49–59
   receipt.rs88.46%100%87.50%88.89%19
   receipt_auditor.rs80%100%83.33%79.70%103–105, 115, 121–126, 139, 146, 161–163, 65, 78–80, 87–90
   received_receipt.rs83.06%100%78.05%83.83%119–121, 131, 215–217, 230–232, 238–240, 247–249, 251–253, 282–284, 308, 319, 326, 333–335, 340, 345, 349–350, 359–360, 382, 396–398
github-actions[bot] commented 1 year ago

🤖 Cargo Audit Report 🤖`

Show Report *** Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Loaded 550 security advisories (from /usr/local/cargo/advisory-db) Updating crates.io index Scanning Cargo.lock for vulnerabilities (419 crate dependencies) Crate: atty Version: 0.2.14 Warning: unsound Title: Potential unaligned read Date: 2021-07-04 ID: RUSTSEC-2021-0145 URL: https://rustsec.org/advisories/RUSTSEC-2021-0145 Dependency tree: atty 0.2.14 └── criterion 0.4.0 └── tap_core 0.1.0 └── tap_aggregator 0.1.0 warning: 1 allowed warning found ```

Pusher: @ColePBryan, Action: pull_request, Working Directory: `, Workflow:tests`

ColePBryan commented 1 year ago

LGTM, just a few comments.

Also, wouldn't it be good to be able to mess around with the receipts timestamps in tests? Shouldn't that be achievable using mocking? (future task perhaps) I'm particularly interested in testing in the case there is a RAV in the middle of a train of receipts with consecutive/repeating timestamps, and making sure that there is no gap/double inclusion in the final RAV.

We can try a mock crate like this https://github.com/museun/mock_instant . Alternatively since the receipt struct is public we can just change the timestamp before signing.

aasseman commented 1 year ago

LGTM, just a few comments. Also, wouldn't it be good to be able to mess around with the receipts timestamps in tests? Shouldn't that be achievable using mocking? (future task perhaps) I'm particularly interested in testing in the case there is a RAV in the middle of a train of receipts with consecutive/repeating timestamps, and making sure that there is no gap/double inclusion in the final RAV.

We can try a mock crate like this https://github.com/museun/mock_instant . Alternatively since the receipt struct is public we can just change the timestamp before signing.

Playing with the struct will do then. I'll open an issue.

aasseman commented 1 year ago

@ColePBryan could you rebase on latest main for the CI to run?

github-actions[bot] commented 1 year ago

🤖 Cargo Audit Report 🤖`

Show Report *** Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Loaded 550 security advisories (from /usr/local/cargo/advisory-db) Updating crates.io index Scanning Cargo.lock for vulnerabilities (419 crate dependencies) Crate: atty Version: 0.2.14 Warning: unsound Title: Potential unaligned read Date: 2021-07-04 ID: RUSTSEC-2021-0145 URL: https://rustsec.org/advisories/RUSTSEC-2021-0145 Dependency tree: atty 0.2.14 └── criterion 0.4.0 └── tap_core 0.1.0 └── tap_aggregator 0.1.0 warning: 1 allowed warning found ```

Pusher: @ColePBryan, Action: pull_request, Working Directory: `, Workflow:tests`

github-actions[bot] commented 1 year ago

Coverage after merging 105-tap_manager-always-requesting-rav-using-all-receipts-even-when-some-receipts-included-in-previous-rav into main will be

80.03%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
tap_aggregator/src
   aggregator.rs92.45%100%100%90.70%40–43, 53–56
   api_versioning.rs86.21%100%76.47%90.24%15–16
   error_codes.rs0%100%0%0%13, 27
   jsonrpsee_helpers.rs43.90%100%33.33%48.28%44, 51–57, 9
   main.rs3.70%100%6.67%2.56%17, 21–22, 26, 30–31, 35–36, 40–41, 45–46, 49–51, 54–61, 64–69, 72–76, 78
   server.rs86.09%100%100%82.22%101, 113–117, 137, 69–77
tap_core/src
   eip_712_signed_message.rs83.78%100%80%85.19%58
   error.rs50%100%50%50%13
   lib.rs83.33%100%87.50%81.25%26
   receipt_aggregate_voucher.rs92.50%100%87.50%93.75%23
tap_core/src/adapters/test
   collateral_adapter_mock.rs88.33%100%75%90.38%18, 44–45, 64
   collateral_adapter_test.rs100%100%100%100%
   rav_storage_adapter_mock.rs92%100%71.43%95.35%30
   rav_storage_adapter_test.rs100%100%100%100%
   receipt_checks_adapter_mock.rs97.83%100%100%97.50%61
   receipt_checks_adapter_test.rs95.83%100%100%95%59
   receipt_storage_adapter_mock.rs75.97%100%57.14%80.16%104–106, 128–137, 29
   receipt_storage_adapter_test.rs100%100%100%100%
tap_core/src/tap_manager
   manager.rs80.63%100%61.54%82.31%107, 126–129, 136, 185, 200–203, 209, 220–221, 232, 95
   rav_request.rs0%100%0%0%9
tap_core/src/tap_manager/test
   manager_test.rs100%100%100%100%
tap_core/src/tap_receipt
   mod.rs41.46%100%36.36%43.33%16, 49–59
   receipt.rs88.46%100%87.50%88.89%19
   receipt_auditor.rs80%100%83.33%79.70%103–105, 115, 121–126, 139, 146, 161–163, 65, 78–80, 87–90
   received_receipt.rs83.06%100%78.05%83.83%119–121, 131, 215–217, 230–232, 238–240, 247–249, 251–253, 282–284, 308, 319, 326, 333–335, 340, 345, 349–350, 359–360, 382, 396–398
github-actions[bot] commented 1 year ago

🤖 Cargo Audit Report 🤖`

Show Report *** Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Loaded 552 security advisories (from /usr/local/cargo/advisory-db) Updating crates.io index Scanning Cargo.lock for vulnerabilities (420 crate dependencies) Crate: atty Version: 0.2.14 Warning: unsound Title: Potential unaligned read Date: 2021-07-04 ID: RUSTSEC-2021-0145 URL: https://rustsec.org/advisories/RUSTSEC-2021-0145 Dependency tree: atty 0.2.14 └── criterion 0.4.0 └── tap_core 0.1.0 ├── tap_integration_tests 0.1.0 └── tap_aggregator 0.1.0 └── tap_integration_tests 0.1.0 warning: 1 allowed warning found ```

Pusher: @ColePBryan, Action: pull_request, Working Directory: `, Workflow:tests`

github-actions[bot] commented 1 year ago

🤖 Cargo Audit Report 🤖`

Show Report *** Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Loaded 552 security advisories (from /usr/local/cargo/advisory-db) Updating crates.io index Scanning Cargo.lock for vulnerabilities (420 crate dependencies) Crate: atty Version: 0.2.14 Warning: unsound Title: Potential unaligned read Date: 2021-07-04 ID: RUSTSEC-2021-0145 URL: https://rustsec.org/advisories/RUSTSEC-2021-0145 Dependency tree: atty 0.2.14 └── criterion 0.4.0 └── tap_core 0.1.0 ├── tap_integration_tests 0.1.0 └── tap_aggregator 0.1.0 └── tap_integration_tests 0.1.0 warning: 1 allowed warning found ```

Pusher: @ColePBryan, Action: pull_request, Working Directory: `, Workflow:tests`

github-actions[bot] commented 1 year ago

Coverage after merging 105-tap_manager-always-requesting-rav-using-all-receipts-even-when-some-receipts-included-in-previous-rav into main will be

80.24%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
tap_aggregator/src
   aggregator.rs92.45%100%100%90.70%40–43, 53–56
   api_versioning.rs86.21%100%76.47%90.24%15–16
   error_codes.rs0%100%0%0%13, 27
   jsonrpsee_helpers.rs43.90%100%33.33%48.28%44, 51–57, 9
   lib.rs100%100%100%100%
   main.rs3.70%100%6.67%2.56%13, 17–18, 22, 26–27, 31–32, 36–37, 41–42, 45–47, 50–57, 60–65, 68–72, 74
   server.rs86.09%100%100%82.22%101, 113–117, 137, 69–77
tap_core/src
   eip_712_signed_message.rs83.78%100%80%85.19%58
   error.rs50%100%50%50%
   lib.rs83.33%100%87.50%81.25%26
   receipt_aggregate_voucher.rs92.50%100%87.50%93.75%23
tap_core/src/adapters/test
   collateral_adapter_mock.rs88.33%100%75%90.38%18, 44–45
   collateral_adapter_test.rs100%100%100%100%
   rav_storage_adapter_mock.rs92%100%71.43%95.35%30
   rav_storage_adapter_test.rs100%100%100%100%
   receipt_checks_adapter_mock.rs97.83%100%100%97.50%61
   receipt_checks_adapter_test.rs95.83%100%100%95%59
   receipt_storage_adapter_mock.rs71.78%100%57.14%74.14%111, 130, 134–136, 148, 163–177, 29, 43, 57, 75, 93
   receipt_storage_adapter_test.rs100%100%100%100%
tap_core/src/tap_manager
   manager.rs82.50%100%61.54%84.35%107, 126–129, 136, 185, 200–203, 209, 95
   rav_request.rs0%100%0%0%9
tap_core/src/tap_manager/test
   manager_test.rs100%100%100%100%
tap_core/src/tap_receipt
   mod.rs46.34%100%45.45%46.67%49–59
   receipt.rs88.46%100%87.50%88.89%19
   receipt_auditor.rs84.83%100%83.33%84.96%103–105, 115, 139, 161–163, 65, 78–80, 87–90
   received_receipt.rs83.71%100%78.05%84.59%119–121, 131, 215–217, 230–232, 238–240, 247–249, 251–253, 282–284, 319, 333–335, 340, 349–350, 359–360, 382, 396–398
github-actions[bot] commented 1 year ago

🤖 Cargo Audit Report 🤖`

Show Report *** Fetching advisory database from `https://github.com/RustSec/advisory-db.git` Loaded 552 security advisories (from /usr/local/cargo/advisory-db) Updating crates.io index Scanning Cargo.lock for vulnerabilities (420 crate dependencies) Crate: atty Version: 0.2.14 Warning: unsound Title: Potential unaligned read Date: 2021-07-04 ID: RUSTSEC-2021-0145 URL: https://rustsec.org/advisories/RUSTSEC-2021-0145 Dependency tree: atty 0.2.14 └── criterion 0.4.0 └── tap_core 0.1.0 ├── tap_integration_tests 0.1.0 └── tap_aggregator 0.1.0 └── tap_integration_tests 0.1.0 warning: 1 allowed warning found ```

Pusher: @ColePBryan, Action: pull_request, Working Directory: `, Workflow:tests`

github-actions[bot] commented 1 year ago

Coverage after merging 105-tap_manager-always-requesting-rav-using-all-receipts-even-when-some-receipts-included-in-previous-rav into main will be

80.24%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
tap_aggregator/src
   aggregator.rs92.45%100%100%90.70%40–43, 53–56
   api_versioning.rs86.21%100%76.47%90.24%15–16
   error_codes.rs0%100%0%0%13, 27
   jsonrpsee_helpers.rs43.90%100%33.33%48.28%44, 51–57, 9
   lib.rs100%100%100%100%
   main.rs3.70%100%6.67%2.56%13, 17–18, 22, 26–27, 31–32, 36–37, 41–42, 45–47, 50–57, 60–65, 68–72, 74
   server.rs86.09%100%100%82.22%101, 113–117, 137, 69–77
tap_core/src
   eip_712_signed_message.rs83.78%100%80%85.19%58
   error.rs50%100%50%50%
   lib.rs83.33%100%87.50%81.25%26
   receipt_aggregate_voucher.rs92.50%100%87.50%93.75%23
tap_core/src/adapters/test
   collateral_adapter_mock.rs88.33%100%75%90.38%18, 44–45
   collateral_adapter_test.rs100%100%100%100%
   rav_storage_adapter_mock.rs92%100%71.43%95.35%30
   rav_storage_adapter_test.rs100%100%100%100%
   receipt_checks_adapter_mock.rs97.83%100%100%97.50%61
   receipt_checks_adapter_test.rs95.83%100%100%95%59
   receipt_storage_adapter_mock.rs71.78%100%57.14%74.14%111, 130, 134–136, 148, 163–177, 29, 43, 57, 75, 93
   receipt_storage_adapter_test.rs100%100%100%100%
tap_core/src/tap_manager
   manager.rs82.50%100%61.54%84.35%107, 126–129, 136, 185, 200–203, 209, 95
   rav_request.rs0%100%0%0%9
tap_core/src/tap_manager/test
   manager_test.rs100%100%100%100%
tap_core/src/tap_receipt
   mod.rs46.34%100%45.45%46.67%49–59
   receipt.rs88.46%100%87.50%88.89%19
   receipt_auditor.rs84.83%100%83.33%84.96%103–105, 115, 139, 161–163, 65, 78–80, 87–90
   received_receipt.rs83.71%100%78.05%84.59%119–121, 131, 215–217, 230–232, 238–240, 247–249, 251–253, 282–284, 319, 333–335, 340, 349–350, 359–360, 382, 396–398