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

feat : added aws s3 adapter and data storage trait #27

Merged
merged 16 commits into from
Jun 27, 2024

Conversation

ocdbytes
Copy link
Member

S3 Implementation

  • Added data storage crate for getting and storing data on cloud
  • Added AWS S3 trait and added .env values

Issue : #24

Arun Jangra and others added 3 commits June 25, 2024 18:49
This commit fixes the style issues introduced in 7e65299 according to the output
from Rustfmt.

Details: #27
Copy link
Contributor

deepsource-io bot commented Jun 25, 2024

Here's the code health analysis summary for commits a342034..cc54f2b. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Rust LogoRust✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@ocdbytes ocdbytes requested a review from apoorvsadana June 25, 2024 13:24
Copy link
Contributor

Choose a reason for hiding this comment

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

we're using - instead of _ in file and crate names as a convention

Comment on lines 11 to 12
const SNOS_OUTPUT_FILE_NAME: &str = "snos_output.json";
const KZG_FILE_NAME: &str = "kzg.txt";
Copy link
Contributor

Choose a reason for hiding this comment

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

s3 shouldn't be aware of this, these details can be in the snos job. also, do we need to store kzg now? i was thinking we can calculate the proof when we calculate state diffs in update state only


#[async_trait]
impl DataStorage for AWSS3 {
async fn get_snos_data_for_block(&self, block_number: u128) -> Result<StarknetOsOutput, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above, S3 should have no idea on what snos is. s3 should only have get and put functions.

Arun Jangra and others added 4 commits June 25, 2024 19:40
.env.example Outdated
Comment on lines 19 to 20
AWS_S3_KEY_SECRET=
Copy link
Contributor

Choose a reason for hiding this comment

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

so, I think, as long as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are in the env variables, aws sdk automatically fetches the config. like, we never initialise the SQS config in the orchestrator, it just works. although we do use a wrapper library as well so maybe that handles it automatically but i mostly think its the aws sdk itself. and in that case, i think we can just have one aws access key and secret for all AWS services


#[async_trait]
impl DataStorage for AWSS3 {
async fn get_data_for_block(&self, key: &str) -> Result<StarknetOsOutput, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

it should be just get_data and it should return just bytes. if we hardcode StarknetOsOutput, I can't use S3 later on with the DA layer for example in case I want to store it in s3

Ok(json)
}

async fn put_data_for_block(&self, data: StarknetOsOutput, key: &str) -> Result<usize, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

//
// #[rstest]
// #[tokio::test]
// async fn test_put_data_in_bucket() {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this pending?

@ocdbytes ocdbytes merged commit a4e6cba into main Jun 27, 2024
7 checks passed
Tranduy1dol pushed a commit to sota-zk-labs/madara-orchestrator that referenced this pull request Jul 9, 2024
* feat : added aws s3 adapter and data storage trait

* updated .env

* style: format code with Rustfmt

This commit fixes the style issues introduced in 7e65299 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : removed redundant functions

* style: format code with Rustfmt

This commit fixes the style issues introduced in 59ce0a9 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : added bucket tests for local testing

* feat : renamed funcs and cleanup

* style: format code with Rustfmt

This commit fixes the style issues introduced in c47e330 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : removed deepsource.toml file

* feat : lint fix

* feat : added comments for functions and impls as suggested by deepsource

* fix : deepsource doc recommendation fix

* refactor

---------

Co-authored-by: Arun Jangra <[email protected]>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Tranduy1dol pushed a commit to sota-zk-labs/madara-orchestrator that referenced this pull request Jul 9, 2024
* feat : added aws s3 adapter and data storage trait

* updated .env

* style: format code with Rustfmt

This commit fixes the style issues introduced in 7e65299 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : removed redundant functions

* style: format code with Rustfmt

This commit fixes the style issues introduced in 59ce0a9 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : added bucket tests for local testing

* feat : renamed funcs and cleanup

* style: format code with Rustfmt

This commit fixes the style issues introduced in c47e330 according to the output
from Rustfmt.

Details: madara-alliance#27

* feat : removed deepsource.toml file

* feat : lint fix

* feat : added comments for functions and impls as suggested by deepsource

* fix : deepsource doc recommendation fix

* refactor

---------

Co-authored-by: Arun Jangra <[email protected]>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
ocdbytes added a commit that referenced this pull request Oct 16, 2024
* feat : added aws s3 adapter and data storage trait

* updated .env

* style: format code with Rustfmt

This commit fixes the style issues introduced in 7e65299 according to the output
from Rustfmt.

Details: #27

* feat : removed redundant functions

* style: format code with Rustfmt

This commit fixes the style issues introduced in 59ce0a9 according to the output
from Rustfmt.

Details: #27

* feat : added bucket tests for local testing

* feat : renamed funcs and cleanup

* style: format code with Rustfmt

This commit fixes the style issues introduced in c47e330 according to the output
from Rustfmt.

Details: #27

* feat : removed deepsource.toml file

* feat : lint fix

* feat : added comments for functions and impls as suggested by deepsource

* fix : deepsource doc recommendation fix

* refactor

---------

Co-authored-by: Arun Jangra <[email protected]>
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
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.

2 participants