Skip to content

Commit

Permalink
rename: odyssey_sendTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdud007 committed Oct 19, 2024
1 parent 345e87e commit 03cd13f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ Consult the [Kurtosis OP package](https://github.com/ethpandaops/optimism-packag

Odyssey has a custom `wallet_` namespace, that allows users to delegate their EOAs to a contract using EIP-7702, and perform transactions on those accounts, all funded by the sequencer.

To enable this namespace, set the environment variable `EXP1_SK` to a private key that will sign the transactions, and `EXP1_WHITELIST` to a comma-delimited list of checksummed addresses accounts are allowed to delegate to. The new RPC method, `wallet_odyssey_sendTransaction`, will only sign transactions that either:
To enable this namespace, set the environment variable `EXP1_SK` to a private key that will sign the transactions, and `EXP1_WHITELIST` to a comma-delimited list of checksummed addresses accounts are allowed to delegate to. The new RPC method, `odyssey_sendTransaction`, will only sign transactions that either:

1. Delegate accounts to one of the whitelisted addresses using EIP-7702, or
1. Send transactions to an EIP-7702 EOA that is already delegated to a whitelisted address

The `wallet_odyssey_sendTransaction` endpoint accepts the same fields as `eth_sendTransaction`, with these notable exceptions:
The `odyssey_sendTransaction` endpoint accepts the same fields as `eth_sendTransaction`, with these notable exceptions:

1. `nonce` must not be set, as this is managed by the node
1. `value` must be unset or 0
Expand All @@ -150,7 +150,7 @@ The following fields are ignored, as they are overwritten internally:
1. `gasLimit`
1. `chainId`

To get the list of contracts that are whitelisted for `wallet_odyssey_sendTransaction`, you can query `wallet_getCapabilities`.
To get the list of contracts that are whitelisted for `odyssey_sendTransaction`, you can query `wallet_getCapabilities`.

### Security

Expand Down
3 changes: 1 addition & 2 deletions crates/e2e-tests/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ async fn test_wallet_api() -> Result<(), Box<dyn std::error::Error>> {
let tx =
TransactionRequest::default().with_authorization_list(vec![auth]).with_to(signer.address());

let tx_hash: B256 =
provider.client().request("wallet_odyssey_sendTransaction", vec![tx]).await?;
let tx_hash: B256 = provider.client().request("odyssey_sendTransaction", vec![tx]).await?;

let receipt = PendingTransactionBuilder::new(&provider, tx_hash).get_receipt().await?;

Expand Down
12 changes: 6 additions & 6 deletions crates/wallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
//!
//! - `wallet_getCapabilities` based on [EIP-5792][eip-5792], with the only capability being
//! `delegation`.
//! - `wallet_odyssey_sendTransaction` that can perform sequencer-sponsored [EIP-7702][eip-7702]
//! - `odyssey_sendTransaction` that can perform sequencer-sponsored [EIP-7702][eip-7702]
//! delegations and send other sequencer-sponsored transactions on behalf of EOAs with delegated
//! code.
//!
//! # Restrictions
//!
//! `wallet_odyssey_sendTransaction` has additional verifications in place to prevent some
//! `odyssey_sendTransaction` has additional verifications in place to prevent some
//! rudimentary abuse of the sequencer's funds. For example, transactions cannot contain any
//! `value`.
//!
Expand Down Expand Up @@ -100,7 +100,7 @@ pub trait OdysseyWalletApi {
///
/// [eip-7702]: https://eips.ethereum.org/EIPS/eip-7702
/// [eip-1559]: https://eips.ethereum.org/EIPS/eip-1559
#[method(name = "odyssey_sendTransaction")]
#[method(name = "sendTransaction", aliases = ["odyssey_sendTransaction"])]
async fn send_transaction(&self, request: TransactionRequest) -> RpcResult<TxHash>;
}

Expand Down Expand Up @@ -213,7 +213,7 @@ where
}

async fn send_transaction(&self, mut request: TransactionRequest) -> RpcResult<TxHash> {
trace!(target: "rpc::wallet", ?request, "Serving wallet_odyssey_sendTransaction");
trace!(target: "rpc::wallet", ?request, "Serving odyssey_sendTransaction");

// validate fields common to eip-7702 and eip-1559
if let Err(err) = validate_tx_request(&request) {
Expand Down Expand Up @@ -382,9 +382,9 @@ fn validate_tx_request(request: &TransactionRequest) -> Result<(), OdysseyWallet
#[derive(Metrics)]
#[metrics(scope = "wallet")]
struct WalletMetrics {
/// Number of invalid calls to `wallet_odyssey_sendTransaction`
/// Number of invalid calls to `odyssey_sendTransaction`
invalid_send_transaction_calls: Counter,
/// Number of valid calls to `wallet_odyssey_sendTransaction`
/// Number of valid calls to `odyssey_sendTransaction`
valid_send_transaction_calls: Counter,
}

Expand Down

0 comments on commit 03cd13f

Please sign in to comment.