Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arweave Integration Milestone 1: Publish using transaction ID #485

Merged
merged 96 commits into from Sep 16, 2022

Conversation

MantisClone
Copy link
Contributor

@MantisClone MantisClone commented Jun 13, 2022

Towards oceanprotocol/pm#151

Changes proposed in this PR:

  • Add new arweave files structure
"files": [
  {
    "type": "arweave",
    "transactionId": "a4qJoQZa1poIv5guEzkfgZYSAD0uYm7Vw4zm_tCswVQ",
  }
]
  • Update fileinfo and download endpoints to support files stored in Arweave.

  • Add ARWEAVE_GATEWAY envvar for resolving Arweave transaction ids

  • Add test_download_arweave to show that downloading an asset stored in Arweave works.

  • Add test_compute_arweave to show that a compute job that uses a dataset stored in Arweave works.

  • Add test_check_arweave_good and test_check_arweave_bad to show that fileinfo endpoint works with arweave transaction ids.

  • Fix bug in the download endpoint where the Arweave transaction ID or IPFS CID are leaked in the "Content-Disposition" response header.

  • Discard MismatchedABI warnings that occur when processing event logs - these are expected because a given transaction receipt will likely have many different Events, not just ones that match the Event ABI of interest.

  • Add ARWEAVE_TRANSACTION_ID constant that points to branin.arff stored permanently on Arweave.

Note
This does not include the ability to upload to Arweave. That is left for a future PR.

Changes that were implemented but then reverted:

@alexcos20 alexcos20 self-assigned this Jun 14, 2022
@MantisClone
Copy link
Contributor Author

MantisClone commented Jun 14, 2022

The CI checks for this PR is failing due to a strange error: https://github.com/oceanprotocol/provider/runs/6887646381?check_suite_focus=true#step:10:8

Does anyone know what might be going wrong?

Run docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1
docker logs ocean_aquarius_1 && docker logs ocean_provider_1 && docker logs ocean_provider2_1 && docker logs ocean_computetodata_1
shell: /usr/bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.8.12/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.12/x64/lib
Error: No such container: ocean_aquarius_1
Error: Process completed with exit code 1.

MantisClone and others added 5 commits June 15, 2022 11:39
  * When calling download, `is_safe_url()` is called earlier by
    `check_url_details()` so calling again in `build_download_response`
    is redunant.
  * When calling computeResult, `validate_url=False` so `is_safe_url()`
    check is skipped anyway.
@MantisClone MantisClone marked this pull request as ready for review June 16, 2022 22:41
@MantisClone MantisClone marked this pull request as draft June 17, 2022 21:19
@MantisClone
Copy link
Contributor Author

Lol, I just realized while testing with ocean.py that when downloading an arweave file, the filename is the transaction id 🤦

So this PR is not ready. I converted it back to draft. Definitely have to fix it so that the downloaded filename doesn't leak the transaction id.

  - Trying to fix error in test_compute (the following test):
    ```
	>       assert response.status == "200 OK", f"start compute job failed: {response.data}"
	E       AssertionError: start compute job failed: b'{"error": "`agreementId` already in use for other job."}'
	E       assert '400 BAD REQUEST' == '200 OK'
	E         - 200 OK
	E         + 400 BAD REQUEST
	```
@MantisClone
Copy link
Contributor Author

@calina-c I have re-requested a review despite test_compute failing. I believe it is failing for reasons outside of this PR. This can be seen in PR #534. It is "empty", identical to main, but test_compute is failing in the same way.

@calina-c
Copy link
Contributor

calina-c commented Sep 2, 2022

You can probably fix the failing tests by cherry picking #533 (comment)

@MantisClone
Copy link
Contributor Author

Thanks, @calina-c You were right, cherry-picking 6d22a6d fixed the failing test.

I believe this PR is now ready for review.

@MantisClone
Copy link
Contributor Author

@calina-c I have reverted the is_safe_url removal and I believe this is ready for your review again.

@alexcos20
Copy link
Member

Please merge main branch, a new type was added

  - Fix error message:
  >       fee_token.functions.transfer(consumer_wallet.address, to_wei(80)).transact(
            {"from": deployer_wallet.address}
        )
E           web3.exceptions.ContractLogicError: execution reverted: VM Exception while processing transaction: revert ERC20: transfer amount exceeds balance
@MantisClone
Copy link
Contributor Author

Hello @calina-c @alexcos20 I believe this PR is ready for review.

P.S. It seems I am unable to request additional reviewers, perhaps because I am an external contributor.

@alexcos20 alexcos20 self-requested a review September 16, 2022 08:34
Copy link
Member

@alexcos20 alexcos20 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@alexcos20 alexcos20 merged commit e023e7c into oceanprotocol:main Sep 16, 2022
2 checks passed
@MantisClone MantisClone deleted the arweave-integration branch September 16, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants