Conversation
components/brave_wallet/browser/cardano/cardano_transaction_serializer.cc
Outdated
Show resolved
Hide resolved
components/brave_wallet/browser/cardano/cardano_transaction_serializer.cc
Show resolved
Hide resolved
components/brave_wallet/browser/cardano/cardano_transaction_serializer.cc
Outdated
Show resolved
Hide resolved
components/brave_wallet/browser/cardano/cardano_knapsack_solver.cc
Outdated
Show resolved
Hide resolved
0c0306d to
88451a3
Compare
components/brave_wallet/browser/cardano/cardano_max_send_solver.cc
Outdated
Show resolved
Hide resolved
components/brave_wallet/browser/cardano/cardano_transaction_serializer_unittest.cc
Show resolved
Hide resolved
|
[puLL-Merge] - brave/brave-core@32579 DescriptionThis PR refactors the Cardano transaction fee and amount validation logic. The main changes include:
Possible Issues
Security Hotspots
Privacy Hotspots
ChangesChangescomponents/brave_wallet/browser/cardano/cardano_transaction_serializer.cc/h
components/brave_wallet/browser/cardano/cardano_transaction.cc/h
components/brave_wallet/browser/cardano/cardano_create_transaction_task.cc
components/brave_wallet/browser/cardano/cardano_knapsack_solver.cc
components/brave_wallet/browser/cardano/cardano_max_send_solver.cc
Test Files
sequenceDiagram
participant Task as CardanoCreateTransactionTask
participant Solver as CardanoKnapsackSolver/MaxSendSolver
participant Serializer as CardanoTransactionSerializer
participant Tx as CardanoTransaction
Task->>Solver: Create with base tx + inputs
Note over Solver: Validate target output min value
Solver->>Solver: RunSolver iteration loop
loop For each input combination
Solver->>Serializer: AdjustFeeAndOutputsForTx(tx, params)
Serializer->>Serializer: Calculate initial fee
loop Max 10 iterations
Serializer->>Tx: Adjust output amounts based on fee
Serializer->>Serializer: CalcMinTransactionFee(tx)
alt Fee converged
Serializer->>Serializer: ValidateAmounts(tx)
Serializer-->>Solver: Return valid tx
else Need larger fee
Note over Serializer: Increase fee, retry
end
end
end
Solver-->>Task: Return best solution
Task->>Serializer: CHECK ValidateAmounts(tx)
Task->>Task: Store transaction
|
kdenhartog
left a comment
There was a problem hiding this comment.
Are we changing how the fee structure works for smart contract execution transactions?
From what I can see, the calculation here operates a bit differently and I don't see anything about the way that Collateral requirements work or execution budget aspects.
The concern here would be that the fee structure isn't correct and lead to a phase 2 failure where a small fee (the collateral) is still collected even though the transaction didn't execute properly. Here's some docs I found that highlight how this works: https://www.essentialcardano.io/article/no-surprises-transaction-validation-part-2
Does that have an impact on this PR at all?
components/brave_wallet/browser/cardano/cardano_knapsack_solver_unittest.cc
Show resolved
Hide resolved
Phase 2 failure fee is burned from collateral inputs which we don't(and didn't) add to transactions. |
kdenhartog
left a comment
There was a problem hiding this comment.
My question seems unrelated to the focus of this PR so we can address it in a follow up.
We discussed over DMs and it seems this is not an area we have implemented yet. I'm going to do some testing today and determine the best path forward to avoid the issue I highlighted above around smart contract execution fees and will open a follow up issue for it.
|
Released in v1.87.47 |
Resolves brave/brave-browser#51121