-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add ecdsa subquery * fix: update axiom-components rep * chore: add axiom-eth deploy key to workflow * chore: fix cargo git * fix: ethers version --------- Co-authored-by: Jonathan Wang <[email protected]>
- Loading branch information
1 parent
6ae55b0
commit 5cf0711
Showing
11 changed files
with
103 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,15 @@ on: | |
jobs: | ||
axiom-sdk-rust-client: | ||
runs-on: ubuntu-latest-64core-256ram | ||
env: | ||
CARGO_NET_GIT_FETCH_WITH_CLI: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Give GitHub Actions access to axiom-crypto/axiom-eth-working | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: | | ||
${{ secrets.AXIOM_ETH_DEPLOY_PRIVATE_KEY }} | ||
- name: Build rust client | ||
run: | | ||
cargo build --verbose | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ license.workspace = true | |
[dependencies] | ||
axiom-codec = { git = "ssh://[email protected]/axiom-crypto/axiom-eth-working.git", branch = "develop" } | ||
axiom-query = { git = "ssh://[email protected]/axiom-crypto/axiom-eth-working.git", branch = "develop" } | ||
axiom-components = { git = "ssh://[email protected]/axiom-crypto/axiom-eth-working.git", branch = "develop" } | ||
ethers = { version = "2.0", features = ["optimism"] } | ||
anyhow = "1.0.75" | ||
tokio = "1.34.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use anyhow::Result; | ||
use axiom_codec::types::native::AnySubquery; | ||
use axiom_components::{ | ||
ecdsa::{utils::verify_signature, ECDSAComponentInput, ECDSAComponentNativeInput}, | ||
utils::flatten::InputFlatten, | ||
}; | ||
use axiom_query::axiom_eth::{halo2_base::AssignedValue, Field}; | ||
use ethers::{ | ||
providers::{JsonRpcClient, Provider}, | ||
types::H256, | ||
}; | ||
|
||
use super::caller::FetchSubquery; | ||
|
||
impl<F: Field> FetchSubquery<F> for ECDSAComponentInput<AssignedValue<F>> { | ||
fn fetch<P: JsonRpcClient>(&self, _: &Provider<P>) -> Result<H256> { | ||
let flattened_subquery = self.flatten(); | ||
let subquery_value: Vec<F> = flattened_subquery.iter().map(|v| *v.value()).collect(); | ||
let unflattened_subquery = ECDSAComponentInput::unflatten(subquery_value).unwrap(); | ||
let native_input: ECDSAComponentNativeInput = unflattened_subquery.into(); | ||
let res = verify_signature(native_input)?; | ||
Ok(H256::from_low_u64_be(res as u64)) | ||
} | ||
|
||
fn any_subquery(&self) -> AnySubquery { | ||
let flattened_subquery = self.flatten(); | ||
let subquery_value: Vec<F> = flattened_subquery.iter().map(|v| *v.value()).collect(); | ||
let unflattened_subquery = ECDSAComponentInput::unflatten(subquery_value).unwrap(); | ||
let native_input: ECDSAComponentNativeInput = unflattened_subquery.into(); | ||
AnySubquery::ECDSA(native_input) | ||
} | ||
|
||
fn flatten(&self) -> Vec<AssignedValue<F>> { | ||
self.flatten_vec() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters