Skip to content

Commit

Permalink
feat: Avail gas relay upgrade (#3601)
Browse files Browse the repository at this point in the history
## What ❔

This PR upgrades Avail Turbo DA from v0.1 to v1 with significant API
changes and improvements to the authentication system. The upgrade
includes a complete overhaul of the API endpoints structure,
authentication mechanism (moving from JWT to API keys), and internal
architecture improvements.

## Why ❔

Improve security through better API key management and support for
multiple keys per user
Enhance performance with better latency and higher throughput
capabilities
Create a more maintainable and extensible codebase through modular
design
Establish proper API versioning to better manage future updates and
backwards compatibility
Standardize endpoint structures by removing redundant path segments

## Is this a breaking change?
- [ ] Yes
- [x] No

## Operational changes
<!-- Any config changes? Any new flags? Any changes to any scripts? -->
<!-- Please add anything that non-Matter Labs entities running their own
ZK Chain may need to know -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] 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 `zkstack dev fmt` and `zkstack dev
lint`.
  • Loading branch information
dimazhornyk authored and ischasny committed Feb 23, 2025
1 parent 90de20f commit 36bca56
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/node/da_clients/src/avail/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ impl GasRelayClient {
}

pub(crate) async fn post_data(&self, data: Vec<u8>) -> anyhow::Result<(H256, u64)> {
let submit_url = format!("{}/user/submit_raw_data?token=ethereum", &self.api_url);
let submit_url = format!("{}/v1/submit_raw_data", &self.api_url);
// send the data to the gas relay
let submit_response = self
.api_client
.post(&submit_url)
.body(Bytes::from(data))
.header("Content-Type", "text/plain")
.header("Authorization", format!("Bearer {}", self.api_key))
.header("Content-Type", "application/octet-stream")
.header("x-api-key", &self.api_key)
.send()
.await
.context("Failed to submit data to the gas relay")?;
Expand All @@ -472,15 +472,15 @@ impl GasRelayClient {
};

let status_url = format!(
"{}/user/get_submission_info?submission_id={}",
"{}/v1/get_submission_info?submission_id={}",
self.api_url, submit_response.submission_id
);

tokio::time::sleep(Self::DEFAULT_INCLUSION_DELAY).await;
let status_response = (|| async {
self.api_client
.get(&status_url)
.header("Authorization", format!("Bearer {}", self.api_key))
.header("x-api-key", &self.api_key)
.send()
.await
})
Expand Down

0 comments on commit 36bca56

Please sign in to comment.