You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added a test case in trade_simulator to verify the transaction input data parsing: #[test] fn test_wrangle_tx() { let mut trade_simulator = TradeSimulator::new(); let buf = hex!("ac9650d8...[truncated for brevity]...0000000000000042"); let tx = TransactionInfo{ to: e_Address::from_str("0xE592427A0AEce92De3Edee1F18E0157C05861564").unwrap(), value: U256::zero(), input: &buf }; trade_simulator.wrangle_transaction(&tx); }
Upon running this test, I'm trying to match and decode data corresponding to the UNISWAP_V3_V2_EXACT_OUTPUT selector: } else if selector == UNISWAP_V3_V2_EXACT_OUTPUT { println!("🦄2 exact output"); let swap = UniswapV3ExactOutputParamsV2::decode(buf).unwrap(); println!("{:?}",swap.path); println!("{:?}",TradeSimulator::bytes_zcp_to_hex_string(&swap.path)); }
The output I received was: 🦄2 exact output BytesZcp([0, 0, 0, 0,...,0, 0, 66]) "00000000000000000000000022e798f9440f563b92aae24e94c75dfa499e3d3e00000000000000000000000000000000000000000000009110f5cdf1c1500000000000000000000000000000000000000000000000000000000000007741d7a10000000000000000000000000000000000000000000000000000000000000042"
This is incorrect, yielding a length of 128 bytes for the parsed result. The expected correct result should be of 66 bytes: 0c880f6761f1af8d9aa9c466984b80dab9a8c9e8000bb882af49447d8a07e3bd95bd0d56f35241523fbab10001f4ff970a61a04b1ca14834a43f5de4533ebddb5cc8
The text was updated successfully, but these errors were encountered:
Sorry! The parsed content is wrong, the correct one is: fn test_wrangle_tx() { let mut trade_simulator = TradeSimulator::new(); let buf = hex!("09b813460000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000022e798f9440f563b92aae24e94c75dfa499e3d3e00000000000000000000000000000000000000000000009110f5cdf1c1500000000000000000000000000000000000000000000000000000000000007741d7a100000000000000000000000000000000000000000000000000000000000000420c880f6761f1af8d9aa9c466984b80dab9a8c9e8000bb882af49447d8a07e3bd95bd0d56f35241523fbab10001f4ff970a61a04b1ca14834a43f5de4533ebddb5cc8000000000000000000000000000000000000000000000000000000000000"); let tx = TransactionInfo{ to: e_Address::from_str("0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45").unwrap(), value: U256::zero(), input: &buf }; trade_simulator.wrangle_transaction(&tx); }
In addition, the definition of e_Address comes from use ethers::types::Address as e_Address;
I've added a test case in trade_simulator to verify the transaction input data parsing:
#[test] fn test_wrangle_tx() { let mut trade_simulator = TradeSimulator::new(); let buf = hex!("ac9650d8...[truncated for brevity]...0000000000000042"); let tx = TransactionInfo{ to: e_Address::from_str("0xE592427A0AEce92De3Edee1F18E0157C05861564").unwrap(), value: U256::zero(), input: &buf }; trade_simulator.wrangle_transaction(&tx); }
Upon running this test, I'm trying to match and decode data corresponding to the UNISWAP_V3_V2_EXACT_OUTPUT selector:
} else if selector == UNISWAP_V3_V2_EXACT_OUTPUT { println!("🦄2 exact output"); let swap = UniswapV3ExactOutputParamsV2::decode(buf).unwrap(); println!("{:?}",swap.path); println!("{:?}",TradeSimulator::bytes_zcp_to_hex_string(&swap.path)); }
The output I received was:
🦄2 exact output BytesZcp([0, 0, 0, 0,...,0, 0, 66]) "00000000000000000000000022e798f9440f563b92aae24e94c75dfa499e3d3e00000000000000000000000000000000000000000000009110f5cdf1c1500000000000000000000000000000000000000000000000000000000000007741d7a10000000000000000000000000000000000000000000000000000000000000042"
This is incorrect, yielding a length of 128 bytes for the parsed result. The expected correct result should be of 66 bytes:
0c880f6761f1af8d9aa9c466984b80dab9a8c9e8000bb882af49447d8a07e3bd95bd0d56f35241523fbab10001f4ff970a61a04b1ca14834a43f5de4533ebddb5cc8
The text was updated successfully, but these errors were encountered: