forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 1
sending a Tempo transaction via cast send #395
Copy link
Copy link
Open
Description
Reviewer's Guide
Implements full support for Tempo transactions across Foundry (building, signing, and sending), refines Optimism base-fee handling using network-specific parameters, adjusts artifact lookup and documentation output behavior, introduces CLI options and workflows, and updates dependency and CI configurations.
Sequence diagram for sending a Tempo transaction via cast send
sequenceDiagram
actor User
participant CastSend as Cast_send
participant CastTxBuilder
participant WalletSigner
participant FoundryTxReq as FoundryTransactionRequest
participant FoundryTypedTx
participant NetworkWallet as NetworkWallet_FoundryNetwork
participant CastTxSender
participant ProviderNode as Ethereum_Node
User->>CastSend: cast send --tempo.fee-token ...
CastSend->>CastTxBuilder: new(provider, tx_opts)
CastTxBuilder->>CastTxBuilder: is_tempo() // checks other[feeToken]
CastSend->>CastTxBuilder: build(&WalletSigner)
CastTxBuilder->>CastTxBuilder: _build(sender, fill_defaults=true, for_signing=false)
CastTxBuilder-->>CastSend: (WithOtherFields<TransactionRequest>, fn)
CastSend->>FoundryTxReq: FoundryTransactionRequest::new(tx)
Note over CastSend,WalletSigner: Tempo path selected (is_tempo == true)
CastSend->>WalletSigner: sign_request(FoundryTransactionRequest)
WalletSigner->>WalletSigner: default_signer_address()
WalletSigner->>FoundryTxReq: build_typed_tx()
FoundryTxReq->>FoundryTxReq: is_tempo(), complete_tempo()
FoundryTxReq-->>WalletSigner: FoundryTypedTx::Tempo
WalletSigner->>NetworkWallet: sign_transaction_from(sender, FoundryTypedTx::Tempo)
NetworkWallet->>WalletSigner: validate sender == default_signer_address
NetworkWallet->>FoundryTypedTx: sign_transaction(self, &mut TempoTx)
FoundryTypedTx-->>NetworkWallet: Signature
NetworkWallet->>FoundryTypedTx: into_signed(TempoSignature)
NetworkWallet-->>WalletSigner: FoundryTxEnvelope::Tempo
WalletSigner-->>CastSend: FoundryTxEnvelope::Tempo
CastSend->>CastSend: encode_2718_len(), encode_2718(raw_tx)
CastSend->>CastTxSender: new(provider)
CastSend->>CastTxSender: send_raw(raw_tx)
CastTxSender->>ProviderNode: eth_sendRawTransaction(raw_tx)
ProviderNode-->>CastTxSender: PendingTransaction
CastTxSender-->>CastSend: PendingTransactionBuilder
CastSend-->>User: tx_hash / receipt
Updated class diagram for Tempo transaction support and signing
classDiagram
class FoundryTransactionRequest {
- inner : WithOtherFields_TransactionRequest
+ new(inner : WithOtherFields_TransactionRequest) FoundryTransactionRequest
+ into_inner() WithOtherFields_TransactionRequest
+ is_deposit() bool
+ is_tempo() bool
+ get_tempo_fee_token() Option_Address
+ complete_tempo() Result_void_vec_str
+ preferred_type() FoundryTxType
+ try_build() Option_FoundryTypedTx
+ build_typed_tx() Result_FoundryTypedTx_vec_str
+ build_unsigned() Result_FoundryTypedTx_vec_str
}
class FoundryTxType {
<<enum>>
Legacy
Eip2930
Eip1559
Eip4844
Eip7702
Deposit
Tempo
}
class FoundryTypedTx {
<<enum>>
Legacy
Eip2930
Eip1559
Eip4844
Eip7702
Deposit
Tempo
}
class TempoTransaction {
+ chain_id : u64
+ fee_token : Option_Address
+ max_fee_per_gas : u128
+ max_priority_fee_per_gas : u128
+ gas_limit : u128
+ nonce_key : U256
+ nonce : u64
+ calls : Vec_Call
+ access_list : AccessList
+ encoded_for_signing() Vec_u8
+ into_signed(sig : TempoSignature) Self
}
class Call {
+ to : Address
+ value : U256
+ input : Bytes
}
class FoundryTxEnvelope {
<<enum>>
Legacy
Eip2930
Eip1559
Eip4844
Eip7702
Deposit
Tempo
+ encode_2718_len() usize
+ encode_2718(buf : Vec_u8) void
}
class TempoSignature {
}
class WalletSigner {
+ default_signer_address() Address
+ has_signer_for(address : Address) bool
+ signer_addresses() Iterator_Address
+ sign_transaction_from(sender : Address, tx : FoundryTypedTx) Result_FoundryTxEnvelope
+ sign_request(request : FoundryTransactionRequest) Result_FoundryTxEnvelope
}
class TxSigner_Signature {
<<trait>>
+ sign_transaction(self, tx : T) Future_Result_Signature
}
class NetworkWallet_FoundryNetwork {
<<trait>>
+ default_signer_address() Address
+ has_signer_for(address : Address) bool
+ signer_addresses() Iterator_Address
+ sign_transaction_from(sender : Address, tx : FoundryTypedTx) Result_FoundryTxEnvelope
+ sign_request(request : FoundryTransactionRequest) Result_FoundryTxEnvelope
}
class DevSigner {
+ sign_transaction(tx : FoundryTypedTx) Result_Signature
}
class CastTxBuilder_P_InputState {
+ tx : WithOtherFields_TransactionRequest
+ build(sender : SenderKind) Result_FoundryTransactionRequest_Option_Function
+ build_unsigned_raw(from : Address) Result_String
+ is_tempo() bool
+ _build(sender : SenderKind, fill_defaults : bool, for_signing : bool) Result_WithOtherFields_TransactionRequest_Option_Function
}
class CastTxBuilder_P_InitState {
}
class CastTxBuilder_P_ToState {
}
class CastTxSender_P {
+ provider : Provider_AnyNetwork
+ new(provider : Provider_AnyNetwork) Self
+ send(tx_request : WithOtherFields_TransactionRequest) Result_PendingTransactionBuilder_AnyNetwork
+ send_raw(raw_tx : Vec_u8) Result_PendingTransactionBuilder_AnyNetwork
+ receipt(hash : String, block : Option_u64, confirmations : Option_u64, timeout : Option_Duration, cast_async : bool) Result_TransactionReceipt
}
FoundryTransactionRequest --> FoundryTypedTx : builds
FoundryTypedTx o-- TempoTransaction : contains
TempoTransaction o-- Call : contains
FoundryTypedTx --> FoundryTxEnvelope : wrapped as
FoundryTxEnvelope --> TempoSignature : uses
WalletSigner ..|> TxSigner_Signature
WalletSigner ..|> NetworkWallet_FoundryNetwork
DevSigner ..> FoundryTypedTx : signs
DevSigner ..> TempoSignature : converts Signature to TempoSignature
CastTxBuilder_P_InputState --> FoundryTransactionRequest : build()
CastTxBuilder_P_InputState --> WithOtherFields_TransactionRequest : internal tx
CastTxSender_P --> Provider_AnyNetwork : uses
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Add end-to-end support for Tempo (type 0x76) transactions in transaction building, signing, and Cast/CLI flows. |
|
crates/primitives/src/transaction/request.rscrates/wallets/src/signer.rscrates/cast/src/cmd/send.rscrates/cast/src/tx.rscrates/cast/src/cmd/mktx.rscrates/cli/src/opts/tempo.rscrates/cli/src/opts/transaction.rscrates/wallets/Cargo.tomlcrates/anvil/src/eth/sign.rscrates/anvil/Cargo.tomlCargo.toml |
| Use network-specific base-fee parameters (especially Optimism Canyon) in Anvil and add a regression test. |
|
crates/evm/networks/src/lib.rscrates/anvil/src/config.rscrates/anvil/src/eth/fees.rscrates/anvil/src/eth/backend/mem/mod.rscrates/anvil/tests/it/optimism.rscrates/evm/networks/Cargo.tomlcrates/anvil/Cargo.toml |
| Improve artifact lookup and error behavior for cheatcodes fs and strengthen docs generation semantics. |
|
crates/cheatcodes/src/fs.rscrates/doc/src/writer/as_doc.rscrates/doc/src/writer/buf_writer.rscrates/doc/src/parser/comment.rs |
| Adjust CLI, scripting, and simulation UX and robustness (transaction options, suggestions, script-sequence, gas reporting, error messaging). |
|
crates/cli/src/opts/mod.rscrates/cli/src/opts/transaction.rscrates/cast/src/cmd/send.rscrates/cast/src/tx.rscrates/cast/src/cmd/mktx.rscrates/script/src/simulate.rscrates/cli/src/utils/suggestions.rscrates/common/src/contracts.rscrates/config/src/compilation.rs.config/nextest.tomlcrates/script-sequence/src/sequence.rsflake.nix |
| Update dependency management, CI workflows, and add example Solidity counter project and assorted templates. |
|
.github/workflows/dependencies.ymlCargo.tomlcrates/anvil/Cargo.tomlcrates/wallets/Cargo.toml.github/workflows/google.yml.github/workflows/docker.yml.github/workflows/codeql.yml.github/workflows/snyk-container.yml.github/workflows/apisec-scan.yml.github/workflows/deploy.yml.github/workflows/docker-image.yml.circleci/config.yml.circleci/cargo.yml.circleci/ci-web3-gamefi.ymlcounter/README.mdcounter/foundry.tomlcounter/src/Counter.solcounter/script/Counter.s.solcounter/test/Counter.t.solcounter/.github/workflows/test.yml.deps/remix-tests/remix_tests.sol.deps/remix-tests/remix_accounts.sol.github/ISSUE_TEMPLATE/bug_report.md.github/ISSUE_TEMPLATE/feature_request.md.github/ISSUE_TEMPLATE/custom.md.codesandbox/tasks.json.gitmodules.gitignoreCargo.lockcounter/.gitignorecounter/lib/forge-stdcounter/lib/openzeppelin-contracts |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull
request title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment@sourcery-ai summaryon the pull request to
(re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull
request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request
summary, the reviewer's guide, and others. - Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Originally posted by @sourcery-ai[bot] in #303 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Todo