-
Notifications
You must be signed in to change notification settings - Fork 95
fix(sequencer)!: use bridge address to determine asset in bridge unlock cost estimation instead of signer #1905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sequencer)!: use bridge address to determine asset in bridge unlock cost estimation instead of signer #1905
Conversation
SuperFluffy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads like the right change to make, but the naming of the containing function, get_total_transaction_cost, is highly confusing to me. This likely played a role in this bug being introduced in the first place.
I remember coming across this function earlier and being caught by this.
I think we should remove this function entirely in favor of two functions, calculate_fees_for_transaction (already exists) and calculate_funds_moved_by_transaction (essentially move the loop over the actions to it). The check for enough funds would then take the result of both methods.
I think that would make the current situation much clearer.
## Summary Refactored calculation of total transfers made in a transaction to helper function for clarity. ## Background See here: #1905 (review) > I think we should remove this function entirely in favor of two functions, `calculate_fees_for_transaction` (already exists) and `calculate_funds_moved_by_transaction` (essentially move the loop over the actions to it). The check for enough funds would then take the result of both methods. ## Changes - Moved calculation of all transfers made in a transaction to helper function, and called this helper function in `get_total_transaction_cost()`. ## Testing Passing all tests, no additional tests needed. ## Changelogs No updates required. ## Related Issues closes #1907
## Summary Refactored calculation of total transfers made in a transaction to helper function for clarity. ## Background See here: astriaorg/astria#1905 (review) > I think we should remove this function entirely in favor of two functions, `calculate_fees_for_transaction` (already exists) and `calculate_funds_moved_by_transaction` (essentially move the loop over the actions to it). The check for enough funds would then take the result of both methods. ## Changes - Moved calculation of all transfers made in a transaction to helper function, and called this helper function in `get_total_transaction_cost()`. ## Testing Passing all tests, no additional tests needed. ## Changelogs No updates required. ## Related Issues closes #1907
## Summary Refactored calculation of total transfers made in a transaction to helper function for clarity. ## Background See here: astriaorg/astria#1905 (review) > I think we should remove this function entirely in favor of two functions, `calculate_fees_for_transaction` (already exists) and `calculate_funds_moved_by_transaction` (essentially move the loop over the actions to it). The check for enough funds would then take the result of both methods. ## Changes - Moved calculation of all transfers made in a transaction to helper function, and called this helper function in `get_total_transaction_cost()`. ## Testing Passing all tests, no additional tests needed. ## Changelogs No updates required. ## Related Issues closes #1907
Summary
Changed bridge unlock cost calculation to use bridge address instead of signer address.
Background
Previously, the
get_total_transaction_costattempted to retrieve the bridge account asset by the tx signer instead of by the bridge address. This works fine if the sender is a bridge account, but if it is the authorized bridge withdrawer, it will fail.Changes
BridgeUnlockcost calculation to retrieve asset based on the action's bridge address instead of the transaction signer.Testing
Added unit test to ensure function works correctly when submitting a
BridgeUnlockfrom the bridge withdrawer address.Synced to mainnet from genesis to ensure this would not be a network breaking change.
Changelogs
Changelog updates.
Breaking Changelist
BridgeUnlocksubmitted from the withdrawer address would fail. This has been synced to mainnet successfully from genesis as of January 13, 2025 at 2:32pm CST.Related Issues
closes #1904