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

handle case when contract creation was reverted #482

Merged
merged 5 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions .github/workflows/jerigon-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
branches:
- "**"


env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
Expand All @@ -26,24 +25,24 @@ jobs:
uses: actions/checkout@v4

- name: Checkout test-jerigon-network sources
uses: actions/checkout@v4
uses: actions/checkout@v4
with:
repository: 0xPolygonZero/jerigon-test-network
ref: 'feat/kurtosis-network'
ref: "feat/kurtosis-network"
path: jerigon-test-network

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up rust cache
uses: Swatinem/rust-cache@v2
Expand All @@ -58,41 +57,37 @@ jobs:

#It is much easier to use cast tool in scripts so install foundry
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
uses: foundry-rs/foundry-toolchain@v1

- name: Run cancun test network
run: |
docker pull ghcr.io/0xpolygonzero/erigon:feat-zero
temaniarpit27 marked this conversation as resolved.
Show resolved Hide resolved
kurtosis run --enclave cancun-testnet github.com/ethpandaops/[email protected] --args-file jerigon-test-network/network_params.yml
kurtosis run --enclave cancun-testnet github.com/ethpandaops/[email protected] --args-file jerigon-test-network/network_params.yml

- name: Generate blocks with transactions
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cast rpc eth_blockNumber --rpc-url $ETH_RPC_URL
cd jerigon-test-network && set -a && source .env && set +a
bash ./tests/generate_transactions.sh
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
atanmarko marked this conversation as resolved.
Show resolved Hide resolved
cast rpc eth_blockNumber --rpc-url $ETH_RPC_URL
cd jerigon-test-network && set -a && source .env && set +a
bash ./tests/generate_transactions.sh

- name: Run prove blocks with native tracer in test_only mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cd zero_bin/tools
ulimit -n 8192
OUTPUT_TO_TERMINAL=true ./prove_rpc.sh 0x5 0xf $ETH_RPC_URL native true 3000 100 test_only
OUTPUT_TO_TERMINAL=true ./prove_rpc.sh 0x1 0xf $ETH_RPC_URL native true 3000 100 test_only
temaniarpit27 marked this conversation as resolved.
Show resolved Hide resolved
echo "Proving blocks in test_only mode finished"


- name: Run prove blocks with native tracer in real mode
run: |
ETH_RPC_URL="$(kurtosis port print cancun-testnet el-2-erigon-lighthouse ws-rpc)"
cd zero_bin/tools
rm -rf proofs/* circuits/* ./proofs.json test.out verify.out leader.out
OUTPUT_TO_TERMINAL=true RUN_VERIFICATION=true ./prove_rpc.sh 0x5 0x7 $ETH_RPC_URL native true 3000 100
OUTPUT_TO_TERMINAL=true RUN_VERIFICATION=true ./prove_rpc.sh 0x4 0x7 $ETH_RPC_URL native true 3000 100
echo "Proving blocks in real mode finished"

- name: Shut down network
run: |
kurtosis enclave rm -f cancun-testnet
kurtosis engine stop



17 changes: 16 additions & 1 deletion zero_bin/rpc/src/native/txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ where
TransportT: Transport + Clone,
{
let (tx_receipt, pre_trace, diff_trace) = fetch_tx_data(provider, &tx.hash).await?;
let tx_status = tx_receipt.status();
let tx_receipt = tx_receipt.map_inner(rlp::map_receipt_envelope);
let access_list = parse_access_list(tx.access_list.as_ref());

Expand All @@ -74,14 +75,28 @@ where
gas_used: tx_receipt.gas_used as u64,
};

let (code_db, tx_traces) = match (pre_trace, diff_trace) {
let (code_db, mut tx_traces) = match (pre_trace, diff_trace) {
(
GethTrace::PreStateTracer(PreStateFrame::Default(read)),
GethTrace::PreStateTracer(PreStateFrame::Diff(diff)),
) => process_tx_traces(access_list, read, diff).await?,
_ => unreachable!(),
};

// Handle case when transaction failed and a contract creation was reverted
if !tx_status && tx_receipt.contract_address.is_some() {
tx_traces.insert(
tx_receipt.contract_address.unwrap(),
TxnTrace {
balance: None,
nonce: None,
storage_read: None,
storage_written: None,
code_usage: None,
},
temaniarpit27 marked this conversation as resolved.
Show resolved Hide resolved
);
}

Ok((
code_db,
TxnInfo {
Expand Down
Loading