-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ethereum Settlement Engine improvements (#150)
* fix(store): only save the Ethereum block number in the recently observed data We cannot assume that the operator's balance will keep increasing, since they may transfer funds to another address * refactor(eth-se): Improve notifier readability and robustness - use join_all to avoid callback hell - avoid using spawn's - mark a transaction as credited only after the call to the connector was successful - save the last observed block only after all calls in that block range has been successfully credited * Use pending in eth_TransactionCount call to take into account transactions which are already in the mempool Allows the removal of the nonce middleware * improvement(eth-se): Estimate gas and gas price before sending transaction * improve redis keys naming * feat(eth-se): Add filter for ERC20 transactions * fix(eth-se): Sign the address along with the challenge Otherwise we would be signing any message that gets sent to us and that is insecure * (api ) FixedInterval retry when creating new account Otherwise it may take too long for the connector to ping its engine to get the address from its peer * improvement(eth-se): Use tx hash as an idempotency key This ensures the same transaction is never processed twice by the connector (also minor improvements in variable/function naming * remove apply_outgoing_settlement function Adding it resulted in incorerct behavior the balance is already lowered in the PROCESS_FULFILL script. With it, the balance was lowered by 2x the amount it should. Note that the reason the balance is lowered first is because we don't want two packets fulfilled simultaneously to trigger settlements for the same amount_to_settle. By reducing the balance by the amount_to_settle before making the settlement client send the request to the settlement engine, this ensures that the settlement will only happen once. The refund_settlement is there in case that call to the SE fails and we need to revert the change to the balance.
- Loading branch information
Showing
9 changed files
with
527 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
483 changes: 292 additions & 191 deletions
483
crates/interledger-settlement-engines/src/engines/ethereum_ledger/eth_engine.rs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.