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

Authenticated Blob Dispersal #311

Closed

Conversation

gianbelinche
Copy link

@gianbelinche gianbelinche commented Oct 21, 2024

What ❔

This PR implements put_blob_authenticated method for EigenDAClient

It does so by creating a channel were the first element of the stream is sent

let (sender, receiver) = tokio::sync::mpsc::unbounded_channel::<AuthenticatedRequest>();

Then that channel is transformed into a stream and sent to disperse_blob_authenticated, which returns another stream used for getting the responses.

let receiver_stream = tokio_stream::wrappers::UnboundedReceiverStream::new(receiver);
let mut stream = self
.disperser
.lock()
.await
.disperse_blob_authenticated(receiver_stream)
.await
.map_err(|e| EigenDAError::PutError(e.to_string()))?;

Then the first request is processed, and its returned value is used for computing the signature needed for the second request.

let result = stream
.get_mut()
.message()
.await
.map_err(|e| EigenDAError::PutError(e.to_string()))?;

let challenge = header.challenge_parameter;
let new_request = AuthenticatedRequest {
payload: Some(
disperser::authenticated_request::Payload::AuthenticationData(
AuthenticationData {
authentication_data: sign(challenge, private_key),
},
),
),
};

Then that request is added to the sender stream, and its result is processed, completing the dispersal.

sender
.send(new_request)
.map_err(|e| EigenDAError::PutError(e.to_string()))?;
let result = stream
.get_mut()
.message()
.await
.map_err(|e| EigenDAError::PutError(e.to_string()))?;

Why ❔

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted via zk_supervisor fmt and zk_supervisor lint.

Copy link

github-actions bot commented Oct 21, 2024

Hey there! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.
Examples of valid PR titles:

  • feat(eth_sender): Support new transaction type
  • fix(state_keeper): Correctly handle edge case
  • ci: Add new workflow for linting

Details:

No release type found in pull request title "Authenticated Blob Dispersal". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

@gianbelinche gianbelinche changed the title Implement first authenticated call Authenticated Blob Dispersal Oct 21, 2024
@gianbelinche gianbelinche marked this pull request as ready for review October 22, 2024 20:28
Base automatically changed from eigenda-disperser-client to da-eigen-implementation-m0 October 24, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant