Skip to content

Conversation

@onbjerg
Copy link
Member

@onbjerg onbjerg commented Jan 12, 2026

Add Solidity libraries for building and RLP-encoding transactions:

  • LegacyTransactionLib - Legacy transactions (no type prefix)
  • Eip1559TransactionLib - EIP-1559 transactions (type 0x02)
  • Eip7702TransactionLib - EIP-7702 transactions (type 0x04)
  • TempoTransactionLib - Tempo transactions (type 0x76)

Also adds VmRlp and VmExecuteTransaction interfaces for the vm.toRlp() and vm.executeTransaction() cheatcodes.

Usage

using LegacyTransactionLib for LegacyTransaction;

VmRlp rlp = VmRlp(address(vm));
VmExecuteTransaction txVm = VmExecuteTransaction(address(vm));

bytes memory rawTx = LegacyTransactionLib.create()
    .withNonce(0)
    .withGasPrice(100)
    .withGasLimit(100000)
    .withTo(target)
    .withData(calldata)
    .encodeWithSignature(rlp, v, r, s);

bytes memory result = txVm.executeTransaction(rawTx);

Add Solidity libraries for building and RLP-encoding transactions:

- `LegacyTransactionLib` - Legacy transactions (no type prefix)
- `Eip1559TransactionLib` - EIP-1559 transactions (type 0x02)
- `Eip7702TransactionLib` - EIP-7702 transactions (type 0x04)
- `TempoTransactionLib` - Tempo transactions (type 0x76)

Also adds `VmRlp` and `VmExecuteTransaction` interfaces for the
`vm.toRlp()` and `vm.executeTransaction()` cheatcodes.

## Usage

```solidity
using LegacyTransactionLib for LegacyTransaction;

VmRlp rlp = VmRlp(address(vm));
VmExecuteTransaction txVm = VmExecuteTransaction(address(vm));

bytes memory rawTx = LegacyTransactionLib.create()
    .withNonce(0)
    .withGasPrice(100)
    .withGasLimit(100000)
    .withTo(target)
    .withData(calldata)
    .encodeWithSignature(rlp, v, r, s);

bytes memory result = txVm.executeTransaction(rawTx);
```
@onbjerg onbjerg force-pushed the onbjerg/push-qmqxovnlmvyu branch from 722521d to aadacce Compare January 12, 2026 17:12
@zerosnacks
Copy link
Collaborator

zerosnacks commented Jan 13, 2026

Approach lgtm here but current vm.executeTransaction zero's out gas price which is not in line with the expectation; my suggestion is to not zero out (we rely on gas paid for some types of assertions).

See: https://github.com/tempoxyz/tempo-foundry/pull/183/changes#r2685929170

@onbjerg
Copy link
Member Author

onbjerg commented Jan 13, 2026

Replied here https://github.com/tempoxyz/tempo-foundry/pull/183/changes#r2685995988

@onbjerg onbjerg enabled auto-merge (squash) January 16, 2026 16:13
@onbjerg onbjerg merged commit 2fc19c7 into master Jan 16, 2026
13 checks passed
@onbjerg onbjerg deleted the onbjerg/push-qmqxovnlmvyu branch January 16, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants