Skip to content

Commit

Permalink
Fix eth_watcher index out of range for EOA-controlled upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va committed Nov 11, 2023
1 parent 039cef8 commit 2c6821d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/lib/types/src/protocol_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,18 +274,19 @@ impl TryFrom<Log> for ProtocolUpgrade {
ParamType::Uint(256), // version id
ParamType::Address, // allow list address
])],
&init_calldata[4..],
init_calldata
.get(4..)
.ok_or(crate::ethabi::Error::InvalidData)?,
)?;

let mut decoded = match decoded.remove(0) {
Token::Tuple(x) => x,
_ => unreachable!(),
let Token::Tuple(mut decoded) = decoded.remove(0) else {
unreachable!();
};

let mut transaction = match decoded.remove(0) {
Token::Tuple(x) => x,
_ => unreachable!(),
let Token::Tuple(mut transaction) = decoded.remove(0) else {
unreachable!()
};

let factory_deps = decoded.remove(0).into_array().unwrap();

let tx = {
Expand Down Expand Up @@ -399,9 +400,8 @@ impl TryFrom<Log> for ProtocolUpgrade {
let default_account_code_hash =
H256::from_slice(&decoded.remove(0).into_fixed_bytes().unwrap());
let verifier_address = decoded.remove(0).into_address().unwrap();
let mut verifier_params = match decoded.remove(0) {
Token::Tuple(tx) => tx,
_ => unreachable!(),
let Token::Tuple(mut verifier_params) = decoded.remove(0) else {
unreachable!()
};
let recursion_node_level_vk_hash =
H256::from_slice(&verifier_params.remove(0).into_fixed_bytes().unwrap());
Expand Down

0 comments on commit 2c6821d

Please sign in to comment.