Skip to content
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

[DO NOT MERGE] Enabling V2 scripts #151

Closed
wants to merge 8 commits into from
Closed

[DO NOT MERGE] Enabling V2 scripts #151

wants to merge 8 commits into from

Conversation

bladyjoker
Copy link
Contributor

@bladyjoker bladyjoker commented Sep 12, 2022

DONE

  • Switched to using V2 scripts
  • All hashing uses Plutus.Script.Utils.V2 module functions (and not Ledger.Scripts)
  • Expose a configuration option to specify script versions to use (cc @mikekeke )

Notes

  • It doesn't seem straightforward to support both V1 and V2 scripts
  • After chatting with @mikekeke we settled on having a configuration option to specify script versions to use. Not ideal but anything else requires a larger effort.

@bladyjoker bladyjoker changed the title Enabling V2 scripts [DO NOT MERGE] Enabling V2 scripts Sep 12, 2022
@bladyjoker
Copy link
Contributor Author

bladyjoker commented Sep 13, 2022

Issues

Failed to make collateral: Failed to create collateral UTxO: Couldn't find collateral UTxO

STATUS: SOLVED my fraking collateral setting was too large and the collateral value created wouldn't match what was expected 🤷
After the balancing loop was done...

[BPI] [DEBUG [ TxBalancing ]] UnbalancedTx TxInputs:  0 UnbalancedTx TxOutputs:  1 TxInputs:  1 TxOutputs:  2
CallCommand: (Local,cardano-cli transaction build-raw --babbage-era --tx-in 1630da09a0f9e96d12e024559aaa177d52b8682eb7f81b3b88bb3744729bba11#1 --tx-out addr1vxn2an74ul08e7uyj7cp5gmcdj2sagaeh734nxfdk0vau0gls9qny+857690 --tx-out addr1vxn2an74ul08e7uyj7cp5gmcdj2sagaeh734nxfdk0vau0gls9qny+7375820 --required-signer .wallets/signing-key-a6aecfd5e7de7cfb8497b01a23786c950ea3b9bfa359992db3d9de3d.skey --fee 146400 --protocol-params-file ./protocol.json --out-file .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.raw)
CallCommand: (Local,cardano-cli transaction build-raw --babbage-era --tx-in 1630da09a0f9e96d12e024559aaa177d52b8682eb7f81b3b88bb3744729bba11#1 --tx-out addr1vxn2an74ul08e7uyj7cp5gmcdj2sagaeh734nxfdk0vau0gls9qny+857690 --tx-out addr1vxn2an74ul08e7uyj7cp5gmcdj2sagaeh734nxfdk0vau0gls9qny+7375820 --required-signer .wallets/signing-key-a6aecfd5e7de7cfb8497b01a23786c950ea3b9bfa359992db3d9de3d.skey --fee 146400 --protocol-params-file ./protocol.json --out-file .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.raw)
CallCommand: (Local,cardano-cli transaction sign --tx-body-file .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.raw --signing-key-file .wallets/signing-key-a6aecfd5e7de7cfb8497b01a23786c950ea3b9bfa359992db3d9de3d.skey --out-file .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.signed)
CallCommand: (Local,cardano-cli transaction submit --tx-file .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.signed --mainnet)
CallCommand: (Local,mv .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.raw .work-dir/txs/tx-7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3.raw)
CallCommand: (Local,mv .work-dir/txs/tx-765598e661964a43581f2c14639ffb2a1d9164044d24c0468323cc9db9fa7958.signed .work-dir/txs/tx-7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3.signed)
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [ PABLog ]] Awaiting status change for 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [PABLog]] Current block: 3889, current slot: Slot {getSlot = 7802}
[BPI] [DEBUG [ PABLog ]] TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 not found in index
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [PABLog]] Current block: 3890, current slot: Slot {getSlot = 7804}
[BPI] [DEBUG [ PABLog ]] TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 not found in index
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [PABLog]] Current block: 3891, current slot: Slot {getSlot = 7807}
[BPI] [DEBUG [ PABLog ]] TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 not found in index
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [PABLog]] Current block: 3894, current slot: Slot {getSlot = 7810}
[BPI] [DEBUG [ PABLog ]] TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 not found in index
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [PABLog]] Current block: 3895, current slot: Slot {getSlot = 7813}
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [ PABLog ]] TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 found in index, checking status
CallCommand: (Local,cardano-cli query tip --mainnet)
[BPI] [DEBUG [ PABLog ]] Status for TxId 7df255b21ed9279bb5247eacd9e0409fc9333f06a9fbf3edef916c83e9dbdea3 is TentativelyConfirmed (Depth {unDepth = 0}) TxValid ()
[BPI] [NOTICE [ Collateral ]] Collateral Tx Status: TentativelyConfirmed (Depth {unDepth = 0}) TxValid ()
[BPI] [DEBUG [ Collateral ]] Failed to create collateral UTxO: Couldn't find collateral UTxO
[BPI] [DEBUG [ PABLog ]] Balance tx: BalanceTxFailed: Other error: Failed to make collateral: Failed to create collateral UTxO: Couldn't find collateral UTxO
coop-pab-cli: user error ("WalletContractError (OtherError \"Failed to make collateral: Failed to create collateral UTxO: Couldn't find collateral UTxO\")")

Failed to create collateral UTxO: Insufficient Funds

STATUS: SOLVED!!! The network ID must be Mainnet, not Testnet
Contract run with BPI directly

[BPI] [DEBUG [ PABLog ]] Chain index query: requesting unspent utxos located at addresses with the credential PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c
[BPI] [DEBUG [ PABLog ]] Chain index datums from address response: ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!0
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!1
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!2
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!3
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!4
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!5
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!6
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!7
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!8
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) ) ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!9
, - Value (Map [(,Map [("",100000000000)])]) addressed to
    PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) )
    
...
Requires signatures:
Utxo index:
  ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!0
  , - Value (Map [(,Map [("",100000000000)])]) addressed to
      PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) )
  ( f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf!1
  , - Value (Map [(,Map [("",100000000000)])]) addressed to
      PubKeyCredential: fbc60c1ef1a9ae0cf6d04b89bd6d08eeb66d1a8928efc0b10201714c (no staking credential) )
Validity range:
  (-∞ , +∞)
[BPI] [DEBUG [Collateral]] Collateral UTxO not found in contract env.
[BPI] [DEBUG [ Collateral ]] Collateral UTxO not found or failed to be found in wallet: Couldn't find collateral UTxO
[BPI] [DEBUG [Collateral]] Creating collateral UTxO.
[BPI] [NOTICE [Collateral]] Making collateral
[BPI] [DEBUG [TxBalancing]] fromList []
[BPI] [DEBUG [CoinSelection]] Remaining UTxOs:  []
[BPI] [DEBUG [CoinSelection]] Selecting UTxOs via greedy approx search
[BPI] [DEBUG [ CoinSelection ]] Greedy Pruning: The list of remaining UTxO vectors in null.
[BPI] [DEBUG [CoinSelection]]  Selected UTxOs Index:  []
[BPI] [DEBUG [Collateral]] Failed to create collateral UTxO: Insufficient Funds
[BPI] [DEBUG [ PABLog ]] Balance tx: BalanceTxFailed: Other error: Failed to make collateral: Failed to create collateral UTxO: Insufficient Funds
coop-pab-cli: user error ("WalletContractError (OtherError \"Failed to make collateral: Failed to create collateral UTxO: Insufficient Funds\")")

Can't find the utxos but there's 10 of them...

cardano-cli query utxo --cardano-mode --address addr1v8auvrq77x56ur8k6p9cn0tdprhtvmg63y5wls93qgqhznqnuclxm --testnet-magic 764824073
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     0        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     1        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     2        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     3        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     4        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     5        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     6        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     7        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     8        100000000000 lovelace + TxOutDatumNone
f082f8e93a7191cbf974f45196b11a97f5ae89ec3f620a10c86bf2b056c6ffdf     9        100000000000 lovelace + TxOutDatumNone

/tmp/test-cluster2239055/bot-plutus-interface/result-scripts/policy-392527e3bd0fd3c6af0164d9ec2d834c7ad0f0cd7473de189fd29562.plutus: openBinaryFile: does not exist (No such file or directory

STATUS: Resolved (not sure how)

FAIL                                                                                                                                                                                                                                          
      But it didn't.                                                                                                                                                                                                                          
      Result: Execution result {                                                                                                                                                                                                              
          outcome: Left (ContractExecutionError "WalletContractError (OtherError \"ExitCode 1: Command failed: transaction build-raw  Error: /tmp/test-cluster2239055/bot-plutus-interface/result-scripts/policy-392527e3bd0fd3c6af0164d9ec2d8
34c7ad0f0cd7473de189fd29562.plutus: /tmp/test-cluster2239055/bot-plutus-interface/result-scripts/policy-392527e3bd0fd3c6af0164d9ec2d834c7ad0f0cd7473de189fd29562.plutus: openBinaryFile: does not exist (No such file or directory)\\n\")")   
          final state:  ""                                                                                                                                                                                                                    
      }                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                              
      Use assertExecutionWith to show contract logs or budgets.                                                                                                                                                                               
      Use -p '/mint-nft/&&/Contract should succeed/' to rerun this test only.                                                                                                                                                                 
    Should yield '1':                  FAIL                                                                                                                                                                                                   
      Contract failed                                                                                                                                                                                                                         
                                                                                                                                                                                                                                              
      Use assertExecutionWith to show contract logs or budgets.                                                                                                                                                                               
      Use -p '/mint-nft/&&/Should yield '\''1'\''/' to rerun this test only.                                                                                                                                                                  
      
      6. [CONTRACT] [DEBUG [ Any ]] { "mkTxLogLookups" : 
                                        { "slMPS" : 
                                            [ [ 73ec1006a1c6e78579d0436c79520724ce25d0e45af05a9e5a5c135f
                                            , { "getMintingPolicy" : 
                                                  59024401000033332323232323232323232322222253300b4901166d6b4f6e6553686f744d696e74696e67506f6c6963790013232323232533300f332300e22533301100114a02a664660260022944c00cc0580044c008c0540048c8cdd79ba7301600a374e602c0026028602a0020062a66601e66e1cc8cccc03000920002333300d00248001d69bab001003375c0126eb402852615330104912e6d6b4f6e6553686f744d696e74696e67506f6c6963793a20496e636f7272656374206d696e7465642076616c7565001615330104912c6d6b4f6e6553686f744d696e74696e67506f6c6963793a20446f65736e277420636f6e73756d65207574786f001632533010490112706f776e43757272656e637953796d626f6c00132323253330123370e900000109bae3016001153301349134706f776e43757272656e637953796d626f6c3a2053637269707420707572706f7365206973206e6f7420274d696e74696e6727210016301700230120013754002602460220086eacc044c8c044c044c044004c040008dd61808000980818078009807800918011ba90012222330052253330080011005153330093375e6016601a00200c26008601e601a002260046018002002464600446600400400246004466004004002aae7d5cd2b9c5573aae895d0918011baa0015573c98010101004c012258206f1f3dc2b9bd207af5c8285d42019378207c257157bbe1ba2b1dea194db4ac1d004c012bd8799fd8799f58202ed0e569ab28cb9ed3242d8fa25851c0a94dba4cd54c9850e29bc9c110f0b800ff00ff0001 } ] ]
                                        , "slOtherData" :  []
                                        , "slOtherScripts" :  []
                                        , "slOwnPaymentPubKeyHash" : 
                                            { "unPaymentPubKeyHash" : 
                                                { "getPubKeyHash" : 
                                                    c9e8c9a95b15892e5b0ca3b341aed59c75b142387c42a4b116907ed3 } }
                                        , "slOwnStakePubKeyHash" :  null
                                        , "slPaymentPubKeyHashes" :  []
                                        , "slTxOutputs" : 
                                            [ [ { "txOutRefId" : 
                                                    { "getTxId" : 
                                                        2ed0e569ab28cb9ed3242d8fa25851c0a94dba4cd54c9850e29bc9c110f0b800 }
                                            , "txOutRefIdx" :  0.0 }
                                            , { "_ciTxOutAddress" : 
                                                  { "addressCredential" : 
                                                      { "contents" : 
                                                          { "getPubKeyHash" : 
                                                              c9e8c9a95b15892e5b0ca3b341aed59c75b142387c42a4b116907ed3 }
                                                      , "tag" :  PubKeyCredential }
                                                  , "addressStakingCredential" : 
                                                      null }
                                            , "_ciTxOutPublicKeyDatum" :  null
                                            , "_ciTxOutReferenceScript" :  null
                                            , "_ciTxOutValue" : 
                                                { "getValue" : 
                                                    [ [ {"unCurrencySymbol" :  }
                                                    , [ [ {"unTokenName" :  }
                                                    , 1.0e7 ] ] ] ] }
                                            , "tag" :  PublicKeyChainIndexTxOut } ] ]
                                        , "slTypedValidator" :  null }

Something is still using the old hashing method it seems...

@samuelWilliams99
Copy link
Contributor

This is superseded by #157

@bladyjoker bladyjoker closed this Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants