Skip to content

Commit

Permalink
adds a readme
Browse files Browse the repository at this point in the history
  • Loading branch information
montekki committed Oct 18, 2023
1 parent c645642 commit 22412ad
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions bin/prepare-calldata-for-withdrawal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
This is a utility that prepares a calldata for `finalizeWithdrawals` call for a single
withdrawal with a known withdrawal id. Typically you use this calldata when tracing
unsuccessful withdrawals on a service such as `tenderly`.

Suppose you have a case of a single withdrawal being predicted as unfinalizable by
the contract:

```
message: "predicting results for withdrawals: [2069871]"
message: "predicted results for withdrawals: [Result { l_2_block_number: 271910, l_2_message_index: 1, gas: 0, success: false }]"
```

What you want to do is take the same calldata and trace it on `tenderly` to figure
out what is going on.

This utility allows you to connect to your database and by providing the withdrawal
id in question it constructs hax-encoded calldata for you as such (note that you need to
set the relevant gas limit for this withdrawal yourself):

```
cargo run -- -d $DATABASE_URL -w 2069871 -g 300000
building finalization calldata for withdrawal with id 2069871
hex payload is
32bfc64d0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000042626000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001fb00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000493e000000000000000000000000000000000000000000000000000000000000000386c0960f932400084c286cf3e17e7b677ea9583e60a000324000000000000000000000000000000000000000000000000000000174876e80000000000000000000000000000000000000000000000000000000000000000000000000000000009e2b46711cae1b8f60bae9d46df7ce9c8c39ffeccd452182854eef12bba7499377e158aaa61feffd84335d7677ffdaaee40d59453ac23068aa929ccc1c6afce16e3697c7f33c31a9b0f0aeb8542287d0d21e8c4cf82163d0c44c7a98aa11aa111199cc5812543ddceeddd0fc82807646a4899444240db2c0d2f20c3cceb5f51fae4733f281f18ba3ea8775dd62d2fcd84011c8c938f16ea5790fd29a03bf8db891798a1fd9c8fbb818c98cff190daa7cc10b6e5ac9716b4a2649f7c2ebcef227266d7c5983afe44cf15ea8cf565b34c6c31ff0cb4dd744524f7842b942d08770db04e5ee349086985f74b73971ce9dfe76bbed95c84906c5dffd96504e1e5396cac506ecb5465659b3a927143f6d724f91d8d9c4bdb2463aee111d9aa869874db
```

You can then take this calldata and perform tracing on `tenderly`.

0 comments on commit 22412ad

Please sign in to comment.