Comments (6)
After discussion session current plan is to enable bpi
to use separate constant utxo as collateral in automatic manner, such that:
at startbpi
should create separate collateral utxo containing Ada only from UTXOs available at user wallet address (address that refers to "own PubKeyHash")- at start
bpi
should try to find suitable utxo for collateral containing Ada only from UTXOs available at user wallet address (address that refers to "own PubKeyHash"), if there is none - create separate collateral UTXO- default amount of Ada for such UTXO will be 10 Ada, but can also be specified via
bpi
config
- default amount of Ada for such UTXO will be 10 Ada, but can also be specified via
bpi
tracks this collateral UTXO in memory excluding it from queries performed by contracts and balancing (if possible)- collateral UTXO should not be returned in Contract queries like
utxosAt
- collateral UTXO should not be used as input (unless there is no other choice)
- collateral UTXO should not be returned in Contract queries like
- if there is no way to secure collateral UTXO from being consumed (e.g. no more UTXO left for balancing)
bpi
should create new UTXO that could be used as collateral while balancing transaction; in this case some warning log message could be handy to make user aware of situation
from bot-plutus-interface.
I strongly prefer Solution 2.
from bot-plutus-interface.
There are two problems with this approach
There is one more issue found - case when Ada value of picked collateral is not enough for calculated fee:
Result: ExecutionResult {outcome = Left (ContractExecutionError "WalletContractError (OtherError \"ExitCode 1: Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (InsufficientCollateral (Coin 2000000) (Coin 5460195))))])\\n\")")
Link to source for InsufficientCollateral
from bot-plutus-interface.
So, balancing requires collateral to be selected, because balancing involves calculating the tx fee and thus the change output?
If that's the case, then I would suggest the following silly workaround:
- Select the largest utxo available and set it as the collateral input, for the purposes of balancing. (This minimizes the chance that balancing will fail due to insufficient collateral during fee calculation -- if that's possible)
- After balancing, replace the collateral input in the balanced transaction with the smallest utxo that is larger than the required collateral amount.
Assuming that replacing one collateral input for another in the transaction balanced transaction does not affect fees (I don't think it should), this should give you what you want, improving upon the "random collateral" selection rule.
--
Alternatively, if fee calculation during balancing does not check for collateral sufficiency/existence, then don't set collateral before balancing --- do balancing first and then set collateral to the smallest sufficient utxo.
from bot-plutus-interface.
Some more thoughts:-
I was looking into some plutip transactions case by case in an interactive environment and it dawned on me that the "No collateral" issue pops up primarily after a minting transaction where the minted token is paid to your wallet. The new tokens must be put within some ada utxo, but it looks like the balancing algo BPI uses is very eager to jumble up a lot of your existing "small ada change" utxos into one and then put the new tokens inside it.
So even if you start with a lot of small ada utxos in change, if your mint + pay to self transactions don't explicitly distribute ada, it might be jumbled up after a few transactions.
This can be solved by putting an explicit constraint that says "create this much ada only utxos as outputs" but the crux of the issue really seems like it lies on the balancing algo IMO. The contract endpoint needs to know how much ada a particular user has to do a "distribute ada" in a UX friendly manner, but that's not the contract's job! It should be the balancer's job.
from bot-plutus-interface.
from bot-plutus-interface.
Related Issues (20)
- Query local node to convert between `POSIXTime` and `SlotNo` HOT 1
- Use cardano-api instead of cli calls
- Threat of plutus-apps getting obsolete HOT 1
- Introduce QueryNode effect for interactions with node
- awaitTxStatusChange hides rollbacks as `Unknown` HOT 1
- Improve protocol params handling HOT 2
- Balancing does not preserve output order HOT 1
- Switch CI to Hydra
- Transaction change should not be added to UTxOs with Datums HOT 1
- Handle new PAB requests (Vasil update branch)
- Contract submission error in vasil HOT 1
- Add inline Datum support for `utxosAt` node query.
- Building fully balanced transactions for users HOT 1
- Vasil compatibility HOT 1
- Remove dependency on Ouroboros. HOT 1
- Implement DatumsAtAddress effect
- Implement minting with reference script
- Direct connection
- Plutus V2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bot-plutus-interface.