Commit 7da8a8e
fix: replace sender to timelock address during error decoding (#775)
Timelock execution failures through a CallProxy were decoded with the
wrong underlying revert. CI reported `OnlyCallableByOwner()` on
WorkflowRegistry, but the real failure was
`NodeDoesNotSupportCapability(...)`.
#### Root cause
When `mcms.WithCallProxy` is used, the EVM executor sends the tx to the
`CallProxy,` not the `RBACTimelock`. On failure, `BuildExecutionError`
replayed the inner timelock call with `From` set to that execution
address (the proxy). That synthetic path is not what happens on chain:
CallProxy forwards to the timelock, and the target sees `msg.sender` as
the timelock. Replaying from the proxy made Ownable targets revert with
`OnlyCallableByOwner()` even when the real execution had already passed
ownership and failed for a different reason.
#### Fix
EVM-only change in `sdk/evm/execution_error.go`: before underlying-call
replay, resolve the real sender. If the execution address is a generated
CallProxy (runtime bytecode fingerprint from bindings.CallProxy),
extract the embedded timelock target and use it as From for eth_call
replay. Otherwise behavior is unchanged.
### AI Summary
This pull request enhances the handling of execution errors for EVM
timelock transactions, especially when transactions are routed through a
CallProxy contract. The main improvement is the ability to correctly
identify and replay the underlying call from the true sender (the
embedded timelock) even when a proxy is involved, providing more
accurate revert reasons. The changes also add robust testing for
CallProxy bytecode fingerprinting and sender resolution logic.
**Enhancements to CallProxy handling and error replay:**
* Added logic to detect when an address is a CallProxy contract by
matching its runtime bytecode against known prefix/suffix fingerprints,
and to extract the embedded target (timelock) address from the bytecode.
This allows the system to replay the underlying transaction as the
correct sender, improving error diagnosis.
(`sdk/evm/execution_error.go`)
[[1]](diffhunk://#diff-9877f8386f0be068752fac0fe1b707306afd2dca253b8b10b494f145c3b08131R35-R40)
[[2]](diffhunk://#diff-9877f8386f0be068752fac0fe1b707306afd2dca253b8b10b494f145c3b08131L298-R351)
* Introduced the `resolveUnderlyingCallSender` function, which
determines the true sender for replaying failed calls, handling both
proxy and non-proxy cases. (`sdk/evm/execution_error.go`)
**Testing and validation improvements:**
* Added comprehensive unit tests for CallProxy bytecode detection,
target extraction, and sender resolution, including edge cases for
incorrect bytecode and error fallbacks.
(`sdk/evm/execution_error_test.go`)
* Added integration-style tests to ensure that when a timelock operation
fails through a CallProxy, the error replay uses the correct sender and
the underlying revert reason is surfaced accurately.
(`sdk/evm/timelock_executor_test.go`)
[[1]](diffhunk://#diff-2f3502ced6798d1ac2675c1ae7d2e1beae121201c834d810ca2b00dbf6ab6accR102-R135)
[[2]](diffhunk://#diff-2f3502ced6798d1ac2675c1ae7d2e1beae121201c834d810ca2b00dbf6ab6accR78)
[[3]](diffhunk://#diff-2f3502ced6798d1ac2675c1ae7d2e1beae121201c834d810ca2b00dbf6ab6accR175-R178)
**Other changes:**
* Updated imports to support new logic and tests.
(`sdk/evm/execution_error.go`, `sdk/evm/execution_error_test.go`,
`sdk/evm/timelock_executor_test.go`)
[[1]](diffhunk://#diff-9877f8386f0be068752fac0fe1b707306afd2dca253b8b10b494f145c3b08131R4)
[[2]](diffhunk://#diff-809122f496465d2c75e2526e781484db6146c7e09f05750872260c7a19a8a0e0R4-R16)
[[3]](diffhunk://#diff-2f3502ced6798d1ac2675c1ae7d2e1beae121201c834d810ca2b00dbf6ab6accR10)
These changes significantly improve the reliability and transparency of
error handling for timelock operations, especially in the presence of
proxy contracts.
---------
Signed-off-by: Pablo <pablo.estrada@smartcontract.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent d1e8d62 commit 7da8a8e
3 files changed
Lines changed: 323 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
296 | 303 | | |
297 | 304 | | |
298 | 305 | | |
299 | | - | |
| 306 | + | |
| 307 | + | |
300 | 308 | | |
301 | 309 | | |
302 | 310 | | |
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
306 | 314 | | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
307 | 345 | | |
308 | 346 | | |
309 | 347 | | |
| |||
449 | 487 | | |
450 | 488 | | |
451 | 489 | | |
452 | | - | |
| 490 | + | |
453 | 491 | | |
454 | 492 | | |
455 | | - | |
| 493 | + | |
456 | 494 | | |
457 | 495 | | |
458 | 496 | | |
459 | | - | |
| 497 | + | |
460 | 498 | | |
461 | 499 | | |
462 | 500 | | |
| |||
627 | 665 | | |
628 | 666 | | |
629 | 667 | | |
630 | | - | |
631 | | - | |
| 668 | + | |
| 669 | + | |
632 | 670 | | |
633 | 671 | | |
634 | 672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
1423 | 1426 | | |
1424 | 1427 | | |
1425 | 1428 | | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
1426 | 1665 | | |
1427 | 1666 | | |
1428 | 1667 | | |
| |||
0 commit comments