-
Notifications
You must be signed in to change notification settings - Fork 30
[DO NOT MERGE] Tempo support #143
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
base: upstream
Are you sure you want to change the base?
Conversation
* remove redundant ci workflows * do not compile anvil, port additional files * remove anvil tests * start porting cast * continue porting * add evm, evm core * add templates * continue with forge * this should be all * bump Tempo version * fixes * nit * clean up * use new storage provider closure * re-apply skip test of those who were tagged to be skipped * fix formatting * bump alloy-chains * fix flaky test, unsure why this was test before
disable dependabot on fork, use upstream instead
| let sender = SenderKind::from_wallet_opts(wallet).await?; | ||
|
|
||
| let (tx, _) = CastTxBuilder::new(&provider, tx, &config) | ||
| let (tx, _) = CastTxBuilder::<_, _, TransactionRequest>::new(&provider, tx, &config) |
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.
we can likely upstream the cast builder changes somewhat soon. some care should be taken on what we do wrt flags (e.g. do we namespace them? such as --tempo.nonce-seq for the sequence key, or do we just throw it all in global)
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.
crates/cast/src/cmd/erc20.rs
Outdated
| let mut tx = IERC20::new(token.resolve(&provider).await?, &provider) | ||
| .approve(spender.resolve(&provider).await?, U256::from_str(&amount)?) | ||
| .into_transaction_request(); | ||
| tx.fee_token = send_tx.fee_token; |
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.
this we might also be able to upstream but i do wonder if there is a better way to just have this "automatically" happen if a user supplies --fee-token (and again, maybe it should be --tempo.fee-token)
| requires = "blob", | ||
| help_heading = "Transaction options" | ||
| )] | ||
| path: Option<PathBuf>, |
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.
not sure why we removed this?
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.
Tempo does not support blobs but we should leave it for Ethereum, can be restored I think to make diff smaller
crates/cast/src/cmd/run.rs
Outdated
| if is_known_system_sender(tx.from()) | ||
| || tx.transaction_type() == Some(SYSTEM_TRANSACTION_TYPE) | ||
| { | ||
| return Err(eyre::eyre!( | ||
| "{:?} is a system transaction.\nReplaying system transactions is currently not supported.", | ||
| tx.tx_hash() | ||
| )); | ||
| } |
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.
we need to be careful w this given this also affects optimism. we added this check specifically for optimism & prob some other chains (e.g. arb), so maybe we should re-add this check but make it network specific.
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.
added option upstream to replay with system txes, default to false to keep current behavior
| env.evm_env.block_env.timestamp = U256::from(block.header.timestamp()); | ||
| env.evm_env.block_env.beneficiary = block.header.beneficiary(); | ||
| env.evm_env.block_env.difficulty = block.header.difficulty(); | ||
| env.evm_env.block_env.prevrandao = Some(block.header.mix_hash().unwrap_or_default()); | ||
| env.evm_env.block_env.basefee = block.header.base_fee_per_gas().unwrap_or_default(); | ||
| env.evm_env.block_env.gas_limit = block.header.gas_limit(); |
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.
this im unsure how to upstream given the evmenv will change from chain to chain :p
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.
these labels and such we can prob just do somewhere else and make them network specific. e.g. NetworkConfig/NetworkArgs
* fix: properly configure txenv for cast run * fix test --------- Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
Instructions to sync upstream: Once, add `upstream` remote target ``` git remote add upstream git@github.com:foundry-rs/foundry.git ``` First, sync `upstream` branch ``` git fetch upstream git switch upstream git reset --hard upstream/master git push --force-with-lease origin upstream ``` Next, sync `tempo` branch by PR ``` SYNC_BRANCH="sync-$(date -u +%Y%m%d-%H%M%S)" git fetch origin upstream git switch -c "$SYNC_BRANCH" origin/tempo git merge upstream/master git push -u origin "$SYNC_BRANCH" ``` :warning: This should NOT be merged with a squash commit to preserve commit history
Sync's Tempo and Foundry to latest commits
chore: cleanup mktx and run
<!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Bug fixes and new features should include tests. Contributors guide: https://github.com/foundry-rs/foundry/blob/HEAD/CONTRIBUTING.md The contributors guide includes instructions for running rustfmt and building the documentation. --> <!-- ** Please select "Allow edits from maintainers" in the PR Options ** --> ## Motivation add possibility to specify which network to run CI check on - testnet - devnet - all <!-- Explain the context and why you're making that change. What is the problem you're trying to solve? In some cases there is not a problem and this can be thought of as being the motivation for your change. --> ## Solution <!-- Summarize the solution and provide any necessary context needed to understand the code change. --> ## PR Checklist - [ ] Added Tests - [ ] Added Documentation - [ ] Breaking changes
* ci: add check to set user token back to pathusd * add liquidity checks * Apply suggestions from code review --------- Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Sync's Foundry & Tempo
…ithSigner` (#163) Should resolve build failure: https://github.com/tempoxyz/tempo/actions/runs/20437525410/job/58722393899
## Summary Addresses the review comments from [PR #209](#209): ### 1. Pass hardfork to Tempo precompile initialization ([r2762739206](#209 (comment))) Previously, `initialize_tempo_precompiles` always used `TempoHardfork::default()`. Now it accepts the hardfork as a parameter and uses `Backend::hardfork()`, matching how forge handles hardfork configuration. ### 2. Restore OP-stack deposit transaction handling with `is_tempo()` guard ([r2762755804](#209 (comment))) The deposit transaction handling was commented out with a TODO. This PR: - Restores the `get_deposit_tx_parts` call with a `!self.is_tempo()` guard - Adds `deposit: DepositTransactionParts` field to `FoundryTempoTxEnv` - Propagates the deposit field through `IntoTxEnv` and `FromRecoveredTx` conversions This ensures OP-stack deposit transactions work correctly in non-Tempo mode while being properly skipped in Tempo mode. ## Changes - `crates/anvil/src/eth/backend/tempo.rs`: Accept `hardfork` parameter - `crates/anvil/src/eth/backend/mem/mod.rs`: Pass hardfork, restore deposit handling - `crates/primitives/src/tx_env.rs`: Add `deposit` field to `FoundryTempoTxEnv`
Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c2872-e3af-72b9-9b38-daa43f24844f
Amp-Thread-ID: https://ampcode.com/threads/T-019c2872-e3af-72b9-9b38-daa43f24844f Co-authored-by: Amp <amp@ampcode.com>
…er field in tests Amp-Thread-ID: https://ampcode.com/threads/T-019c2872-e3af-72b9-9b38-daa43f24844f Co-authored-by: Amp <amp@ampcode.com>
…empo. (#234) * refactor: prefix WalletOpts access_key and root_account args with --tempo. Updates CLI arg names for consistency with other Tempo-specific flags: - --access-key -> --tempo.access-key - --root-account -> --tempo.root-account Updated: - crates/wallets/src/opts.rs: CLI arg definitions and doc comments - crates/cast/tests/cli/tempo.rs: Test cases - .github/scripts/tempo-check.sh: CI integration test script Amp-Thread-ID: https://ampcode.com/threads/T-019c28b2-4247-7184-a024-a300a39f6541 Co-authored-by: Amp <amp@ampcode.com> * fix(ci): pin alloy-signer-aws to 1.4.x to fix clippy overflow error The alloy-signer-aws 1.5.x triggers a Rust compiler bug 'queries overflow the depth limit!' when running clippy with nightly. Pin to 1.4.x until the upstream issue is resolved. Amp-Thread-ID: https://ampcode.com/threads/T-019c28b8-b808-773f-96bb-d7a5ab95e84a Co-authored-by: Amp <amp@ampcode.com> * Revert "fix(ci): pin alloy-signer-aws to 1.4.x to fix clippy overflow error" This reverts commit d3e8b01. * Reapply "fix(ci): pin alloy-signer-aws to 1.4.x to fix clippy overflow error" This reverts commit da83567. * Revert "Reapply "fix(ci): pin alloy-signer-aws to 1.4.x to fix clippy overflow error"" This reverts commit 110fada. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
… update CI to test / release all binaries (#233) Adds multi-network hardfork support to Chisel (Ethereum, Optimism, Tempo). Enables attestations for releases Enables distribution and testing of all binaries ## Changes - Add `--hardfork` CLI flag via Provider trait - Initialize Tempo precompiles when `--hardfork tempo:T0/T1` (non-fork mode only) - Add integration tests for hardfork modes - Add Chisel fork tests to `tempo-check.sh` - Update CI workflows for Chisel support ## Design Note Added `--hardfork` directly to Chisel opts rather than `EvmArgs` because: - Chisel is a REPL that may run without `foundry.toml` - `EvmArgs` defers hardfork to Config; `evm_version` in `CompilerOpts` is for solc, not runtime - Adding to `EvmArgs` globally would affect forge/cast ## Usage ```bash chisel --hardfork tempo:T0 chisel --hardfork cancun chisel --hardfork optimism:ecotone ```
Add a GitHub workflow that runs daily to check for updates to tempoxyz/tempo dependencies. When updates are found, it: - Updates all tempo* dependency revisions in Cargo.toml - Regenerates Cargo.lock - Generates a changelog from commit messages - Opens a PR with the changes
* fix: add Tempo testnet chain ID for T1 gas estimation After T1 hardfork, Tempo testnet (chain ID 42431) requires RPC gas estimation instead of local simulation due to significantly different gas costs. This fixes CI failures when running forge script against testnet. Amp-Thread-ID: https://ampcode.com/threads/T-019c2d68-54fe-74b1-ac28-1b2aa5bc805c Co-authored-by: Amp <amp@ampcode.com> * Bump tempo rev to v1.1.0 --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
* fix: detect Tempo mode from anvil for gas re-estimation Fixes transaction dropping in Anvil Tempo mode caused by gas estimation mismatch. Tempo mode has higher intrinsic gas costs (~46k vs ~21k), but forge script wasn't detecting this for local anvil instances. Changes: - Add `isTempo` field to `anvil_nodeInfo` response via new `TempoNodeInfo` struct - Add `detect_tempo_mode()` in forge-script to query `anvil_nodeInfo` - Trigger gas re-estimation via RPC when connected to a Tempo-mode anvil This ensures transactions are broadcast with correct gas limits when running `forge script` against `anvil --tempo`. Amp-Thread-ID: https://ampcode.com/threads/T-019c2ed4-f85a-7124-8652-1df09a02d2f8 Co-authored-by: Amp <amp@ampcode.com> * fix build, expand tests * refactor: rename is_tempo to network for upstreaming Address review feedback: use 'network: Option<String>' instead of 'is_tempo: bool' to make this change more generic and easier to upstream. The field now contains the network type (e.g., 'tempo') or None for standard Ethereum. Amp-Thread-ID: https://ampcode.com/threads/T-019c2efb-a1bc-75c2-8e2a-6fd4839b8dd8 Co-authored-by: Amp <amp@ampcode.com> * reduce flakiness re gas limit * enhance w/ local anvil tests & broadcast on anvil fork & local --------- Co-authored-by: Amp <amp@ampcode.com>
* fix(ci): use fresh wallet for anvil fork tests The anvil fork tests reused the same wallet ($PK) that was drained by prior devnet tests (liquidity, swaps, sponsors, batches). By the time the fork tests ran, the account had insufficient fee token balance, causing flaky 'Insufficient funds' / 'Out of gas' errors. Generate a new wallet and fund it via tempo_fundAddress before forking, so the fork snapshot always has a fully-funded account. Amp-Thread-ID: https://ampcode.com/threads/T-019c40f9-c790-771a-a1d5-5524db9edb2d Co-authored-by: Amp <amp@ampcode.com> * fix: wait for fee token balance before forking The sleep 5 was not reliable — funding txs could still be pending when anvil forked. Poll the fee token balance instead to confirm the funding is actually mined before taking the fork snapshot. Amp-Thread-ID: https://ampcode.com/threads/T-019c40f9-c790-771a-a1d5-5524db9edb2d Co-authored-by: Amp <amp@ampcode.com> * fix: replace all sleep-after-fund with balance polling Extract fund_and_wait() helper that calls tempo_fundAddress then polls the fee token balanceOf until non-zero. Replaces unreliable sleep 3/5 after funding the main wallet, access key, sponsor, and fork wallet. All four funding sites had the same race: the funding txs could still be pending when the next step ran, causing 'insufficient funds' errors. Amp-Thread-ID: https://ampcode.com/threads/T-019c40f9-c790-771a-a1d5-5524db9edb2d Co-authored-by: Amp <amp@ampcode.com> * fix: set fee token on devnet before forking The fresh fork wallet had fee token balance but never had setUserToken() called, so the fee controller didn't know which token to charge for gas. The first broadcast tx (setUserToken itself) failed because gas allowance was 0 — a chicken-and-egg problem. Call setUserToken on the devnet before starting the fork so the snapshot includes the fee token configuration. Amp-Thread-ID: https://ampcode.com/threads/T-019c40f9-c790-771a-a1d5-5524db9edb2d Co-authored-by: Amp <amp@ampcode.com> * fix: always pass --tempo.fee-token for fork script commands The fork wallet has no native ETH balance — only fee tokens from tempo_fundAddress. When FEE_TOKEN_ARG is empty (default PathUSD), forge script doesn't include feeToken in eth_estimateGas requests, causing anvil to check ETH balance instead of fee token balance. Gas allowance computes to 0 and the tx is rejected. Always pass --tempo.fee-token explicitly for fork forge script commands so anvil knows to check fee token balance. Amp-Thread-ID: https://ampcode.com/threads/T-019c40f9-c790-771a-a1d5-5524db9edb2d Co-authored-by: Amp <amp@ampcode.com> --------- Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ream-foundry Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # .github/workflows/docker-publish.yml # .github/workflows/test-flaky.yml # .github/workflows/test-isolate.yml # flake.lock
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Add missing tempo-alloy dep to crates/primitives/Cargo.toml - Wrap backend in Arc::new() in executor new() - Add HashSet import in anvil mem backend - Fix env.tx.base -> env.tx.inner for chain_id access - Use TempoBlockEnv wrapper for block_env in trace replay Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com>
- FoundryTxReceipt::with_timestamp was missing feePayer in other fields, causing deserialization failures when TempoTransactionReceipt tried to parse receipts from anvil - Remove useless .into() conversion in cast send (clippy) Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com>
- Add FoundryTxType::Tempo to the match arm that fills max_fee_per_gas and max_priority_fee_per_gas in anvil's build_tx_request, fixing 'missing keys' errors for unlocked account / ethsign transactions - Fix rustfmt: inline feePayer insert in receipt with_timestamp Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com>
- mktx_ethsign: relax snapshot to match any Tempo tx (0x76 prefix) since gas fields are now auto-filled with different values - adheres_to_json_flag: contract_address now populated for call to address(0), use wildcard pattern Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c474f-6c39-751e-a3d1-24b335ebc389 Co-authored-by: Amp <amp@ampcode.com>
## Summary Sync tempo branch with upstream `foundry-rs/foundry` master (47 commits). ## Conflict Resolution Content conflicts were auto-resolved favoring our (tempo) side via `-X ours`. The following files had conflicts that were resolved by keeping our version — **please review these carefully** to incorporate any needed upstream changes: - `Cargo.toml` — upstream changed tempo dep pins from `rev` to `tag: v1.0.0` and removed some deps - `Cargo.lock` — version differences - `crates/anvil/src/config.rs` — upstream changes to config - `crates/anvil/src/eth/backend/mem/mod.rs` — import differences (`address` vs `HashSet`) - `crates/cast/src/cmd/erc20.rs` — upstream refactoring - `crates/cast/src/cmd/mktx.rs` — tx construction changes - `crates/cast/src/cmd/send.rs` — tx sending changes - `crates/evm/evm/src/executors/mod.rs` — executor changes - `crates/primitives/Cargo.toml` — `tempo-revm` vs `tempo-alloy` dep - `deny.toml` — license exception formatting + `tiny-keccak` entry ### Deleted files (kept our deletion) - `.github/workflows/docker-publish.yml` - `.github/workflows/test-flaky.yml` - `.github/workflows/test-isolate.yml` - `flake.lock` Thread: https://tempoxyz.slack.com/archives/C0A87C21805/p1770722908997809
Contains all changes applied to make Foundry work with Tempo
Instructions to sync upstream:
Once, add
upstreamremote targetFirst, sync
upstreambranchNext, sync
tempobranch by PR