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

Merge/main into multichain #684

Merged
merged 49 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
918a5a1
edr-0.4.1
github-actions[bot] Jul 1, 2024
86986aa
chore: run prettier (#535)
fvictorio Jul 2, 2024
dfdd380
test: avoid unconditional reverts in stack traces tests (#537)
fvictorio Jul 2, 2024
b056511
fix: allow missing nonce in remote blocks (#539)
Wodann Jul 3, 2024
57a9a75
ci: upgrade pnpm/action-setup (#541)
fvictorio Jul 3, 2024
22bef83
ci: enable some debug logs for hardhat tests (#538)
fvictorio Jul 3, 2024
048c0c0
Sync with recent Hardhat changes and deduplicate the Hardhat dep (#544)
Xanewok Jul 8, 2024
e650c9e
feat: upgrade revm dependencies (#546)
fvictorio Jul 9, 2024
fe9e3b1
edr-0.4.2 (#540)
github-actions[bot] Jul 11, 2024
83f3325
ci: remove path checks for benchmarks (#550)
agostbiro Jul 11, 2024
caa4ac8
ci: remove path restrictions for EDR jobs (#551)
agostbiro Jul 11, 2024
2d62afd
ci: check that index.d.ts is up to date (#553)
fvictorio Jul 16, 2024
07c7667
feat: add support for RIP-7212 (#552)
Wodann Jul 17, 2024
7aa2f61
edr-0.5.0 (#555)
github-actions[bot] Jul 17, 2024
e02eb22
build: upgrade revm to v12 (#557)
Wodann Jul 18, 2024
0bba027
fix: use remote chain id for pre-fork simulation (#567)
agostbiro Jul 31, 2024
37e2737
chore: Bump hardhat to 2.22.7 (#571)
Xanewok Jul 31, 2024
8ae31b9
fix: prevent crash when returning large JSON responses (#569)
Wodann Aug 1, 2024
c324128
ci: update collaborator check in the benchmarks workflow (#574)
galargh Aug 2, 2024
cf5d7a1
edr-0.5.1 (#559)
github-actions[bot] Aug 5, 2024
66ca796
fix: add json alias property in provider response (#582)
fvictorio Aug 5, 2024
e90a194
edr-0.5.2 (#583)
github-actions[bot] Aug 5, 2024
a417e19
breaking change: rename response.json to response.data (#584)
fvictorio Aug 7, 2024
2f1c189
fix: improve error message and option to skip unsupported transaction…
agostbiro Aug 21, 2024
afb1803
ci: remove review-related slack notifications (#612)
fvictorio Aug 21, 2024
87f2833
chore: js tooling improvements (#609)
fvictorio Aug 21, 2024
36b9637
chore: upgrade hardhat and add patch (#613)
fvictorio Aug 22, 2024
fdf1583
chore: Bump @napi-rs/cli to fix duplicated napi typedefs (#617)
Xanewok Aug 23, 2024
4a39a8d
feat: Port existing stack trace refinement 1:1 from Hardhat (#545)
Xanewok Aug 27, 2024
f3a1766
refactor: Clean up the majority of the stack trace port implementatio…
Xanewok Sep 2, 2024
f6f22d2
chore: Bump hardhat to 2.22.10 (#639)
Xanewok Sep 5, 2024
d57ab75
edr-0.6.0 (#610)
github-actions[bot] Sep 10, 2024
a0601cb
fix: Prevent contiguous blockchain storage from bitrotting (#654)
Xanewok Sep 10, 2024
7080c8d
doc: add style guide (#660)
Wodann Sep 12, 2024
2e5ff9d
ci: add workflow for testing Optimism every night (#649)
Wodann Sep 12, 2024
bb3808b
fix: Correctly handle optional solc output in the tracing engine (#665)
Xanewok Sep 16, 2024
c8fbf3b
fix: Allow block time offset to be negative (#663)
Xanewok Sep 16, 2024
9aa38c4
edr-0.6.1 (#666)
github-actions[bot] Sep 23, 2024
e96b403
fix: Handle nullptr JS TypedArrays by bumping napi to 2.6.11 (#673)
Xanewok Sep 23, 2024
49b7ebe
chore: format with latest nightly version (#675)
fvictorio Sep 23, 2024
1f0ae25
fixup: Re-generate the index.d.ts file and bump @napi-rs/cli to 2.18.…
Xanewok Sep 23, 2024
debac88
fix: Use correct bytecode in proxy error propagation check (#679)
Xanewok Sep 25, 2024
af56289
fix: Only add unmapped instructions at the opcode boundary (#680)
Xanewok Sep 25, 2024
54f1d70
edr-0.6.2 (#681)
github-actions[bot] Sep 25, 2024
2c2c78b
ci: Replace actions-rs actions in GitHub workflows (#678)
Xanewok Sep 25, 2024
723e003
Merge remote-tracking branch 'origin/main' into merge/main-into-multi…
Wodann Sep 25, 2024
bfd3d55
update index.d.ts
Wodann Sep 25, 2024
e8aad72
remove erroneously added files
Wodann Sep 25, 2024
b87054b
fix: ci
Wodann Sep 25, 2024
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
29 changes: 23 additions & 6 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
name: Setup rust
description: Sets up rust
name: Setup Rust
description: Sets up Rust
inputs:
toolchain:
description: The Rust toolchain to use
required: false
components:
description: Comma-separated list of components to install
required: false

runs:
using: composite
steps:
- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
override: true
# Empty string means rust-toolchain if it exists, otherwise stable
toolchain: ${{ inputs.toolchain }}
components: ${{ inputs.components }}
cache: true
# Do not override the RUSTFLAGS by default and instead do that per job,
# if needed. Setting RUSTFLAGS via env var, config, etc. is mutually
# exclusive and often a source of bugs.
# Empty string here means no override.
rustflags: ""
# By default, we do not override the toolchain from rust-toolchain.
# The user needs to explicitly use `<cmd> +<toolchain>` for clarity.
override: false

- uses: Swatinem/rust-cache@v2
63 changes: 12 additions & 51 deletions .github/workflows/edr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ jobs:
# Install pre-built binaries for cargo hack
- uses: taiki-e/install-action@cargo-hack

- name: Cargo hack
uses: actions-rs/cargo@v1
- run: cargo hack check --feature-powerset --no-dev-deps
env:
RUSTFLAGS: -Dwarnings
with:
command: hack
args: check --feature-powerset --no-dev-deps

test-edr-rs:
name: Test EDR (${{ matrix.os }})
Expand All @@ -60,13 +56,10 @@ jobs:
key: edr-rs-rpc-cache-v1

- name: Run cargo tests (with coverage)
uses: actions-rs/cargo@v1
env:
ALCHEMY_URL: ${{ secrets.ALCHEMY_URL }}
INFURA_URL: ${{ secrets.INFURA_URL }}
with:
command: llvm-cov
args: --workspace --all-targets --all-features --codecov --output-path codecov.json
run: cargo llvm-cov --workspace --all-targets --all-features --codecov --output-path codecov.json

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -77,10 +70,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Doctests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --workspace --features tracing
run: cargo test --doc --workspace --features tracing

# disable until:
# 1) https://github.com/napi-rs/napi-rs/issues/1405 is resolved (Windows-only)
Expand All @@ -92,13 +82,10 @@ jobs:
# uses: taiki-e/install-action@nextest

# - name: Test with latest nextest release
# uses: actions-rs/cargo@v1
# env:
# CARGO_INCREMENTAL: ${{ matrix.CARGO_INCREMENTAL }}
# ALCHEMY_URL: ${{ secrets.ALCHEMY_URL }}
# with:
# command: nextest
# args: run --workspace --all-features --all-targets
# run: cargo nextest run --workspace --all-features --all-targets

test-edr-ts:
name: Test EDR TS bindings (${{ matrix.os }})
Expand All @@ -112,23 +99,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Install Node
uses: actions/setup-node@v3
- uses: ./.github/actions/setup-node
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true

- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/setup-rust

- name: Cache EDR RPC cache
uses: actions/cache@v2
Expand All @@ -151,29 +126,18 @@ jobs:
needs: check-edr
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
with:
components: clippy

- name: Install nightly rustfmt
uses: actions-rs/toolchain@v1
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
profile: minimal
components: rustfmt

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: clippy

- uses: Swatinem/rust-cache@v2

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
toolchain: nightly
command: fmt
args: --all --check
run: cargo +nightly fmt --all --check

- name: Run cargo clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
Expand All @@ -187,10 +151,7 @@ jobs:
- uses: ./.github/actions/setup-rust

- name: Cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --no-deps --all-features
run: cargo doc --workspace --no-deps --all-features

lint:
name: Run Prettier
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/test-recent-mainnet-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ jobs:
**/edr-cache
key: test-recent-mainnet-block-rpc-cache-v1

- name: Run test
uses: actions-rs/cargo@v1
with:
command: replay-block
args: -u ${{ secrets.ALCHEMY_URL }} -c l1
- run: cargo replay-block -u ${{ secrets.ALCHEMY_URL }} -c l1

- name: Notify failures
if: failure()
Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/test-recent-optimism-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@ jobs:
with:
ref: feat/multichain

- name: Install Rust (stable)
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true

- uses: Swatinem/rust-cache@v2
- uses: ./.github/actions/setup-rust

- name: Cache EDR RPC cache
uses: actions/cache@v4
Expand All @@ -29,11 +23,7 @@ jobs:
**/edr-cache
key: test-recent-optimism-block-rpc-cache-v1

- name: Run test
uses: actions-rs/cargo@v1
with:
command: replay-block
args: -u ${{ secrets.ALCHEMY_URL }} -c optimism
- run: cargo replay-block -u ${{ secrets.ALCHEMY_URL }} -c optimism

- name: Notify failures
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions crates/edr_napi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @nomicfoundation/edr

## 0.6.2

### Patch Changes

- af56289: fix(tracing): Decode unmapped instructions only at the opcode boundary
- debac88: fix(tracing): Use correct subtrace when detecting error error propagation across delegatecall

## 0.6.1

### Patch Changes

- c8fbf3b: Allow forked block time offset to be negative
- bb3808b: Handle optional solc settings better in the tracing engine

## 0.6.0

### Minor Changes
Expand Down
22 changes: 11 additions & 11 deletions crates/edr_napi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,16 @@ export interface Withdrawal {
/** The value contained in withdrawal */
amount: bigint
}
export class EdrContext {
export declare class EdrContext {
/**Creates a new [`EdrContext`] instance. Should only be called once! */
constructor()
/**Constructs a new provider with the provided configuration. */
createProvider(chainType: string, providerConfig: ProviderConfig, loggerConfig: LoggerConfig, subscriptionConfig: SubscriptionConfig): Promise<Provider>
/**Registers a new provider factory for the provided chain type. */
registerProviderFactory(chainType: string, factory: ProviderFactory): Promise<void>
}
export class ProviderFactory { }
export class Response {
export declare class ProviderFactory { }
export declare class Response {
/**Returns the response data as a JSON string or a JSON object. */
get data(): string | any
/**Returns the Solidity trace of the transaction that failed to execute, if any. */
Expand All @@ -686,7 +686,7 @@ export class Response {
get traces(): Array<RawTrace>
}
/** A JSON-RPC provider for Ethereum. */
export class Provider {
export declare class Provider {
/**Handles a JSON-RPC request and returns a JSON-RPC response. */
handleRequest(request: string): Promise<Response>
setCallOverrideCallback(callOverrideCallback: (contract_address: Buffer, data: Buffer) => Promise<CallOverrideResult | undefined>): Promise<void>
Expand All @@ -702,13 +702,13 @@ export class Provider {
* Opaque handle to the `Bytecode` struct.
* Only used on the JS side by the `VmTraceDecoder` class.
*/
export class BytecodeWrapper { }
export class Exit {
export declare class BytecodeWrapper { }
export declare class Exit {
get kind(): ExitCode
isError(): boolean
getReason(): string
}
export class ReturnData {
export declare class ReturnData {
readonly value: Uint8Array
constructor(value: Uint8Array)
isEmpty(): boolean
Expand All @@ -717,26 +717,26 @@ export class ReturnData {
decodeError(): string
decodePanic(): bigint
}
export class SolidityTracer {
export declare class SolidityTracer {

constructor()
getStackTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): SolidityStackTrace
}
export class VmTraceDecoder {
export declare class VmTraceDecoder {
constructor()
addBytecode(bytecode: BytecodeWrapper): void
tryToDecodeMessageTrace(messageTrace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace
getContractAndFunctionNamesForCall(code: Uint8Array, calldata: Uint8Array | undefined): ContractAndFunctionName
}
export type VMTracer = VmTracer
/** N-API bindings for the Rust port of `VMTracer` from Hardhat. */
export class VmTracer {
export declare class VmTracer {
constructor()
/** Observes a trace, collecting information about the execution of the EVM. */
observe(trace: RawTrace): void
getLastTopLevelMessageTrace(): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace | undefined
getLastError(): Error | undefined
}
export class RawTrace {
export declare class RawTrace {
trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
}
4 changes: 2 additions & 2 deletions crates/edr_napi/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@nomicfoundation/edr",
"version": "0.6.0",
"version": "0.6.2",
"devDependencies": {
"@napi-rs/cli": "^2.18.3",
"@napi-rs/cli": "^2.18.4",
"@nomicfoundation/ethereumjs-util": "^9.0.4",
"@types/chai": "^4.2.0",
"@types/chai-as-promised": "^7.1.8",
Expand Down
26 changes: 1 addition & 25 deletions crates/edr_rpc_eth/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,32 +223,8 @@ impl TransactionWithSignature {

/// Returns whether the transaction is a legacy transaction.
pub fn is_legacy(&self) -> bool {
matches!(self.transaction_type(), RpcTransactionType::Legacy) && matches!(self.v, 27 | 28)
matches!(self.transaction_type, None | Some(0)) && matches!(self.v, 27 | 28)
}

pub fn transaction_type(&self) -> RpcTransactionType {
match self.transaction_type {
Some(0) | None => RpcTransactionType::Legacy,
Some(1) => RpcTransactionType::AccessList,
Some(2) => RpcTransactionType::Eip1559,
Some(3) => RpcTransactionType::Eip4844,
Some(r#type) => RpcTransactionType::Unknown(r#type),
}
}
}

/// The transaction type of the remote transaction.
pub enum RpcTransactionType {
/// Legacy transaction
Legacy,
/// EIP-2930 access list transaction
AccessList,
/// EIP-1559 transaction
Eip1559,
/// EIP-4844 transaction
Eip4844,
/// Unknown transaction type
Unknown(u8),
}

impl From<TransactionWithSignature> for transaction::signed::Legacy {
Expand Down
Loading
Loading