Validates a signed batch's `changes`: the slice is bounded by [`Eip8130Constants::MAX_ACTOR_CHANGES_PER_CONFIG`], plus the reserved-window authenticator bound for the *new* actor of each `AuthorizeActor` op. Repeated `actorId` targets are *not* rejected here: unlike `Create.initial_actors`, the contract and the enshrined apply path process a batch's ops sequentially (authorize upserts, revoke clea
(changes: &[SignedChange])
| 2101 | /// - `Lock` / `Unlock`: their apply handlers are not yet enshrined, so a batch |
| 2102 | /// carrying one is rejected here rather than admitted and failed later. |
| 2103 | fn validate_actor_changes(changes: &[SignedChange]) -> Result<(), InvalidPoolTransactionError> { |
| 2104 | if changes.len() > Eip8130Constants::MAX_ACTOR_CHANGES_PER_CONFIG { |
| 2105 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2106 | } |
| 2107 | for change in changes { |
| 2108 | // Per-op structural well-formedness only. Repeated `actorId` targets |
| 2109 | // are intentionally NOT rejected: Keystore and the enshrined apply |
| 2110 | // path process a batch's ops in order (`AuthorizeActor` is an upsert, |
| 2111 | // `RevokeActor` clears), so a repeated target is valid on-chain (the |
| 2112 | // last write wins). Rejecting it here would drop a protocol-valid |
| 2113 | // batch, so the pool matches consensus and admits it. |
| 2114 | match change.change_type { |
| 2115 | ChangeType::AuthorizeActor => { |
| 2116 | // `payload` = `abi.encode(bytes32 actorId, ActorConfig, bytes)`; |
| 2117 | // the new actor's authenticator is the right-aligned address |
| 2118 | // in the second word. |
| 2119 | if change.payload.len() < 64 { |
| 2120 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2121 | } |
| 2122 | // The target `actorId` is `payload[0..32]`. `bytes32(0)` is the |
| 2123 | // reserved "no actor" sentinel and can never be authorized; |
| 2124 | // reject it up front to match `_authorizeActor`'s |
| 2125 | // `InvalidActorId` (the enshrined apply path rejects it too). |
| 2126 | if change.payload[..32].iter().all(|&b| b == 0) { |
| 2127 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2128 | } |
| 2129 | // The authenticator word is an ABI-encoded `address`: its |
| 2130 | // leading 12 bytes are zero padding. Reject dirty upper bits so |
| 2131 | // the gate and a strict ABI decoder downstream agree. |
| 2132 | if change.payload[32..44].iter().any(|&b| b != 0) { |
| 2133 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2134 | } |
| 2135 | let authenticator = Address::from_slice(&change.payload[44..64]); |
| 2136 | if Self::authenticator_out_of_range(&authenticator) { |
| 2137 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2138 | } |
| 2139 | } |
| 2140 | ChangeType::RevokeActor => { |
| 2141 | if change.payload.len() != 32 { |
| 2142 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2143 | } |
| 2144 | } |
| 2145 | ChangeType::IncrementLocalEpoch => { |
| 2146 | if !change.payload.is_empty() { |
| 2147 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2148 | } |
| 2149 | // Names no actor; skip the target-dedup. |
| 2150 | continue; |
| 2151 | } |
| 2152 | ChangeType::Lock | ChangeType::Unlock => { |
| 2153 | return Err(InvalidTransactionError::TxTypeNotSupported.into()); |
| 2154 | } |
| 2155 | } |
| 2156 | } |
| 2157 | Ok(()) |
| 2158 | } |
| 2159 | |
| 2160 | /// Performs the necessary Base-specific checks based on top of the regular eth outcome. |