Skip to content

Commit 7976e27

Browse files
committed
Merge branch 'master' into klkvr/internal-fns-in-traces
2 parents 6503571 + 07b0ec3 commit 7976e27

File tree

67 files changed

+1459
-599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1459
-599
lines changed

.github/scripts/prune-prereleases.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = async ({ github, context }) => {
3636

3737
// Pruning rules:
3838
// 1. only keep the earliest (by created_at) release of the month
39-
// 2. to keep the newest 3 nightlies
39+
// 2. to keep the newest 30 nightlies (to make sure nightlies are kept until the next monthly release)
4040
// Notes:
4141
// - This addresses https://github.com/foundry-rs/foundry/issues/6732
4242
// - Name of the release may deviate from created_at due to the usage of different timezones.
@@ -47,7 +47,7 @@ module.exports = async ({ github, context }) => {
4747
const groups = groupBy(nightlies, i => i.created_at.slice(0, 7));
4848
const nightliesToPrune = Object.values(groups)
4949
.reduce((acc, cur) => acc.concat(cur.slice(0, -1)), []) // rule 1
50-
.slice(3); // rule 2
50+
.slice(30); // rule 2
5151

5252
for (const nightly of nightliesToPrune) {
5353
console.log(`Deleting nightly: ${nightly.tag_name}`);

.github/workflows/nextest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
python-version: 3.11
7474
- name: Install Vyper
7575
if: contains(matrix.name, 'external')
76-
run: pip install vyper~=0.3.10
76+
run: pip install vyper~=0.4.0
7777

7878
- name: Forge RPC cache
7979
uses: actions/cache@v3

Cargo.lock

Lines changed: 14 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ foundry-wallets = { path = "crates/wallets" }
147147
foundry-linking = { path = "crates/linking" }
148148

149149
# solc & compilation utilities
150-
foundry-block-explorers = { version = "0.4.1", default-features = false }
151-
foundry-compilers = { version = "0.8.0", default-features = false }
150+
foundry-block-explorers = { version = "0.5.0", default-features = false }
151+
foundry-compilers = { version = "0.9.0", default-features = false }
152152
solang-parser = "=0.3.3"
153153

154154
## revm

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 100 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ use crate::eth::transaction::optimism::{DepositTransaction, DepositTransactionRe
44
use alloy_consensus::{
55
transaction::eip4844::{TxEip4844, TxEip4844Variant, TxEip4844WithSidecar},
66
AnyReceiptEnvelope, Receipt, ReceiptEnvelope, ReceiptWithBloom, Signed, TxEip1559, TxEip2930,
7-
TxEnvelope, TxLegacy, TxReceipt,
7+
TxEnvelope, TxLegacy, TxReceipt, TxType,
88
};
99
use alloy_eips::eip2718::{Decodable2718, Eip2718Error, Encodable2718};
1010
use alloy_primitives::{Address, Bloom, Bytes, Log, Signature, TxHash, TxKind, B256, U256, U64};
1111
use alloy_rlp::{length_of_length, Decodable, Encodable, Header};
1212
use alloy_rpc_types::{
13-
request::TransactionRequest, AccessList, AnyTransactionReceipt, Signature as RpcSignature,
14-
Transaction as RpcTransaction, TransactionReceipt,
13+
request::TransactionRequest, AccessList, AnyTransactionReceipt, ConversionError,
14+
Signature as RpcSignature, Transaction as RpcTransaction, TransactionReceipt,
1515
};
1616
use alloy_serde::{OtherFields, WithOtherFields};
1717
use bytes::BufMut;
@@ -893,6 +893,103 @@ impl TypedTransaction {
893893
}
894894
}
895895

896+
impl TryFrom<RpcTransaction> for TypedTransaction {
897+
type Error = ConversionError;
898+
899+
fn try_from(tx: RpcTransaction) -> Result<Self, Self::Error> {
900+
// TODO(sergerad): Handle Arbitrum system transactions?
901+
match tx.transaction_type.unwrap_or_default().try_into()? {
902+
TxType::Legacy => {
903+
let legacy = TxLegacy {
904+
chain_id: tx.chain_id,
905+
nonce: tx.nonce,
906+
gas_price: tx.gas_price.ok_or(ConversionError::MissingGasPrice)?,
907+
gas_limit: tx.gas,
908+
value: tx.value,
909+
input: tx.input,
910+
to: tx.to.map_or(TxKind::Create, TxKind::Call),
911+
};
912+
let signature = tx
913+
.signature
914+
.ok_or(ConversionError::MissingSignature)?
915+
.try_into()
916+
.map_err(ConversionError::SignatureError)?;
917+
Ok(Self::Legacy(Signed::new_unchecked(legacy, signature, tx.hash)))
918+
}
919+
TxType::Eip1559 => {
920+
let eip1559 = TxEip1559 {
921+
chain_id: tx.chain_id.ok_or(ConversionError::MissingChainId)?,
922+
nonce: tx.nonce,
923+
max_fee_per_gas: tx
924+
.max_fee_per_gas
925+
.ok_or(ConversionError::MissingMaxFeePerGas)?,
926+
max_priority_fee_per_gas: tx
927+
.max_priority_fee_per_gas
928+
.ok_or(ConversionError::MissingMaxPriorityFeePerGas)?,
929+
gas_limit: tx.gas,
930+
value: tx.value,
931+
input: tx.input,
932+
to: tx.to.map_or(TxKind::Create, TxKind::Call),
933+
access_list: tx.access_list.ok_or(ConversionError::MissingAccessList)?,
934+
};
935+
let signature = tx
936+
.signature
937+
.ok_or(ConversionError::MissingSignature)?
938+
.try_into()
939+
.map_err(ConversionError::SignatureError)?;
940+
Ok(Self::EIP1559(Signed::new_unchecked(eip1559, signature, tx.hash)))
941+
}
942+
TxType::Eip2930 => {
943+
let eip2930 = TxEip2930 {
944+
chain_id: tx.chain_id.ok_or(ConversionError::MissingChainId)?,
945+
nonce: tx.nonce,
946+
gas_price: tx.gas_price.ok_or(ConversionError::MissingGasPrice)?,
947+
gas_limit: tx.gas,
948+
value: tx.value,
949+
input: tx.input,
950+
to: tx.to.map_or(TxKind::Create, TxKind::Call),
951+
access_list: tx.access_list.ok_or(ConversionError::MissingAccessList)?,
952+
};
953+
let signature = tx
954+
.signature
955+
.ok_or(ConversionError::MissingSignature)?
956+
.try_into()
957+
.map_err(ConversionError::SignatureError)?;
958+
Ok(Self::EIP2930(Signed::new_unchecked(eip2930, signature, tx.hash)))
959+
}
960+
TxType::Eip4844 => {
961+
let eip4844 = TxEip4844 {
962+
chain_id: tx.chain_id.ok_or(ConversionError::MissingChainId)?,
963+
nonce: tx.nonce,
964+
gas_limit: tx.gas,
965+
max_fee_per_gas: tx.gas_price.ok_or(ConversionError::MissingGasPrice)?,
966+
max_priority_fee_per_gas: tx
967+
.max_priority_fee_per_gas
968+
.ok_or(ConversionError::MissingMaxPriorityFeePerGas)?,
969+
max_fee_per_blob_gas: tx
970+
.max_fee_per_blob_gas
971+
.ok_or(ConversionError::MissingMaxFeePerBlobGas)?,
972+
to: tx.to.ok_or(ConversionError::MissingTo)?,
973+
value: tx.value,
974+
access_list: tx.access_list.ok_or(ConversionError::MissingAccessList)?,
975+
blob_versioned_hashes: tx
976+
.blob_versioned_hashes
977+
.ok_or(ConversionError::MissingBlobVersionedHashes)?,
978+
input: tx.input,
979+
};
980+
Ok(Self::EIP4844(Signed::new_unchecked(
981+
TxEip4844Variant::TxEip4844(eip4844),
982+
tx.signature
983+
.ok_or(ConversionError::MissingSignature)?
984+
.try_into()
985+
.map_err(ConversionError::SignatureError)?,
986+
tx.hash,
987+
)))
988+
}
989+
}
990+
}
991+
}
992+
896993
impl Encodable for TypedTransaction {
897994
fn encode(&self, out: &mut dyn bytes::BufMut) {
898995
match self {

crates/anvil/src/cmd.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::{
2-
config::DEFAULT_MNEMONIC,
2+
config::{ForkChoice, DEFAULT_MNEMONIC},
33
eth::{backend::db::SerializableState, pool::transactions::TransactionOrder, EthApi},
44
AccountGenerator, Hardfork, NodeConfig, CHAIN_ID,
55
};
66
use alloy_genesis::Genesis;
7-
use alloy_primitives::{utils::Unit, U256};
7+
use alloy_primitives::{utils::Unit, B256, U256};
88
use alloy_signer_local::coins_bip39::{English, Mnemonic};
99
use anvil_server::ServerConfig;
1010
use clap::Parser;
@@ -204,10 +204,14 @@ impl NodeArgs {
204204
.with_genesis_balance(genesis_balance)
205205
.with_genesis_timestamp(self.timestamp)
206206
.with_port(self.port)
207-
.with_fork_block_number(
208-
self.evm_opts
209-
.fork_block_number
210-
.or_else(|| self.evm_opts.fork_url.as_ref().and_then(|f| f.block)),
207+
.with_fork_choice(
208+
match (self.evm_opts.fork_block_number, self.evm_opts.fork_transaction_hash) {
209+
(Some(block), None) => Some(ForkChoice::Block(block)),
210+
(None, Some(hash)) => Some(ForkChoice::Transaction(hash)),
211+
_ => {
212+
self.evm_opts.fork_url.as_ref().and_then(|f| f.block).map(ForkChoice::Block)
213+
}
214+
},
211215
)
212216
.with_fork_headers(self.evm_opts.fork_headers)
213217
.with_fork_chain_id(self.evm_opts.fork_chain_id.map(u64::from).map(U256::from))
@@ -394,6 +398,18 @@ pub struct AnvilEvmArgs {
394398
#[arg(long, requires = "fork_url", value_name = "BLOCK", help_heading = "Fork config")]
395399
pub fork_block_number: Option<u64>,
396400

401+
/// Fetch state from a specific transaction hash over a remote endpoint.
402+
///
403+
/// See --fork-url.
404+
#[arg(
405+
long,
406+
requires = "fork_url",
407+
value_name = "TRANSACTION",
408+
help_heading = "Fork config",
409+
conflicts_with = "fork_block_number"
410+
)]
411+
pub fork_transaction_hash: Option<B256>,
412+
397413
/// Initial retry backoff on encountering errors.
398414
///
399415
/// See --fork-url.

0 commit comments

Comments
 (0)