-
Notifications
You must be signed in to change notification settings - Fork 38
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
add zeth support in rpc type #803
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
# Zeth Integration | ||
|
||
name: Zeth Integration | ||
|
||
on: | ||
push: | ||
branches: [develop, main] | ||
pull_request: | ||
branches: | ||
- "**" | ||
workflow_dispatch: | ||
branches: | ||
- "**" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
zeth_integration: | ||
name: Zeth Integration | ||
runs-on: zero-ci | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
|
||
- name: Clone Repositories | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 0xPolygonZero/zeth | ||
ref: "arpit/1" | ||
path: zeth | ||
|
||
- name: Run zeth network | ||
run: | | ||
cd zeth | ||
touch polygon-zero.db | ||
cargo run -- node --dev --http.api all & | ||
# TODO - @temaniarpit27 - This is a hack to wait for the network to start | ||
echo "Zeth network started, Sleeping for sometime to let the network start" | ||
sleep 120 | ||
|
||
- name: Generate txn | ||
run: | | ||
cast send --async --legacy \ | ||
--from "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" \ | ||
--private-key "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" \ | ||
--rpc-url http://localhost:8545 --gas-limit 100000 --value 1 "0x852DA15b70a3e197d1D668a9a481B1F4c2168a5D" | ||
Comment on lines
+44
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could probably use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a demo integration to kick things off. Issue for improvement: |
||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: zk_evm | ||
|
||
- name: Run prove blocks with zero tracer in test_only mode | ||
run: | | ||
cd zk_evm | ||
OUTPUT_TO_TERMINAL=true ./scripts/prove_rpc.sh 1 1 http://localhost:8545 zeth 0 3000 100 test_only | ||
echo "Proving blocks in test_only mode finished" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use alloy::{providers::Provider, rpc::types::eth::BlockId, transports::Transport}; | ||
use trace_decoder::BlockTrace; | ||
|
||
use super::fetch_other_block_data; | ||
use crate::prover::BlockProverInput; | ||
use crate::provider::CachedProvider; | ||
|
||
pub async fn block_prover_input<ProviderT, TransportT>( | ||
cached_provider: std::sync::Arc<CachedProvider<ProviderT, TransportT>>, | ||
target_block_id: BlockId, | ||
checkpoint_block_number: u64, | ||
) -> anyhow::Result<BlockProverInput> | ||
where | ||
ProviderT: Provider<TransportT>, | ||
TransportT: Transport + Clone, | ||
{ | ||
let block_number = match target_block_id { | ||
BlockId::Number(block_number) => block_number, | ||
_ => return Err(anyhow::anyhow!("block number expected")), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We handle case where block hash is provided in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}; | ||
|
||
let block_trace = cached_provider | ||
.get_provider() | ||
.await? | ||
.raw_request::<_, BlockTrace>("zero_getBlockTraceByNumber".into(), vec![block_number]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't there a same standard API in https://github.com/paradigmxyz/reth/blob/main/crates/rpc/rpc-api/src/debug.rs#L73 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zeth is a wrapper over reth. This was done by Francesco earlier. We can name this API whatever we want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should stick with the standard API. It is not about renaming, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya cool. Created task above to handle this in future |
||
.await?; | ||
|
||
let other_data = | ||
fetch_other_block_data(cached_provider, target_block_id, checkpoint_block_number).await?; | ||
|
||
Ok(BlockProverInput { | ||
block_trace, | ||
other_data, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When do we plan to merge your work to the main branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR - 0xPolygonZero/zeth#5
Whenever this is merged