Skip to content

Commit 3269b6a

Browse files
authored
feat: remove delegation whitelist (#62)
After discussion w/ @onbjerg – this PR removes the delegation whitelist check – allowing consumers to use their own delegation contracts. Existing checks on gas limits to avoid abuse should be sufficient for now.
1 parent e4c6f53 commit 3269b6a

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ Consult the [Kurtosis OP package](https://github.com/ethpandaops/optimism-packag
122122

123123
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.
124124

125-
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:
125+
To enable this namespace, set the environment variable `EXP1_SK` to a private key that will sign the transactions. The new RPC method, `wallet_sendTransaction`, will only sign transactions that either:
126126

127-
1. Delegate accounts to one of the whitelisted addresses using EIP-7702, or
128-
1. Send transactions to an EIP-7702 EOA that is already delegated to a whitelisted address
127+
1. Designates a contract address to an EOA via EIP-7702, or
128+
1. Send transactions to an EIP-7702 EOA that is already delegated to an address
129129

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

@@ -139,8 +139,6 @@ The following fields are ignored, as they are overwritten internally:
139139
1. `gasLimit`
140140
1. `chainId`
141141

142-
To get the list of contracts that are whitelisted for `odyssey_sendTransaction`, you can query `wallet_getCapabilities`.
143-
144142
### Security
145143

146144
See [SECURITY.md](SECURITY.md).

crates/wallet/src/lib.rs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ pub trait OdysseyWalletApi {
8989
///
9090
/// The transaction will only be processed if:
9191
///
92-
/// - The transaction is an [EIP-7702][eip-7702] transaction that delegates to one of the
93-
/// addresses listed in [`DelegationCapability`] (see [`Self::get_capabilities`])
92+
/// - The transaction is an [EIP-7702][eip-7702] transaction.
9493
/// - The transaction is an [EIP-1559][eip-1559] transaction to an EOA that is currently
9594
/// delegated to one of the addresses above
9695
/// - The value in the transaction is exactly 0.
@@ -123,19 +122,12 @@ pub enum OdysseyWalletError {
123122
/// Requests with the nonce field set are rejected, as this is managed by the sequencer.
124123
#[error("tx nonce is set")]
125124
NonceSet,
126-
/// An authorization item was invalid.
127-
///
128-
/// The item is invalid if it tries to delegate an account to a contract that is not
129-
/// whitelisted.
130-
#[error("invalid authorization address")]
131-
InvalidAuthorization,
132125
/// The to field of the transaction was invalid.
133126
///
134127
/// The destination is invalid if:
135128
///
136129
/// - There is no bytecode at the destination, or
137-
/// - The bytecode is not an EIP-7702 delegation designator, or
138-
/// - The delegation designator points to a contract that is not whitelisted
130+
/// - The bytecode is not an EIP-7702 delegation designator
139131
#[error("the destination of the transaction is not a delegated account")]
140132
IllegalDestination,
141133
/// The transaction request was invalid.
@@ -221,20 +213,6 @@ where
221213
return Err(err.into());
222214
}
223215

224-
let valid_delegations: &[Address] = self
225-
.inner
226-
.capabilities
227-
.get(self.chain_id())
228-
.map(|caps| caps.delegation.addresses.as_ref())
229-
.unwrap_or_default();
230-
if let Some(authorizations) = &request.authorization_list {
231-
// check that all auth items delegate to a valid address
232-
if authorizations.iter().any(|auth| !valid_delegations.contains(&auth.address)) {
233-
self.inner.metrics.invalid_send_transaction_calls.increment(1);
234-
return Err(OdysseyWalletError::InvalidAuthorization.into());
235-
}
236-
}
237-
238216
// validate destination
239217
match (request.authorization_list.is_some(), request.to) {
240218
// if this is an eip-1559 tx, ensure that it is an account that delegates to a
@@ -254,10 +232,8 @@ where
254232
})
255233
.unwrap_or_default();
256234

257-
// not a whitelisted address, or not an eip-7702 bytecode
258-
if delegated_address == Address::ZERO
259-
|| !valid_delegations.contains(&delegated_address)
260-
{
235+
// not eip-7702 bytecode
236+
if delegated_address == Address::ZERO {
261237
self.inner.metrics.invalid_send_transaction_calls.increment(1);
262238
return Err(OdysseyWalletError::IllegalDestination.into());
263239
}

0 commit comments

Comments
 (0)