Closed themighty1 closed 10 years ago
fellowtraveler 11:54 dansmith_btc: I've figured out the problem you were having 11:55 basically we have recently ported the Chaiscript OT API to C++ 11:55 the section of the script that crashes for you is complaining about a missing function 11:55 The function is actually still there in the chai, but it's missing because OT is now using the C++ version 11:56 the C++ version is actually also here in the code, but it's not exposed to the scripts fellowtraveler 11:56 Here's an example: https://github.com/Open-Transactions/Open-Transactions/blob/master/src/otapi/OT_ME.cpp#L1718 fellowtraveler 11:57 Notice how a shit-ton of OT API functions, at the URL I just pasted, are exposed to the scripts? 11:57 Basically the smart contract functions you need, whichever ones are missing, need to be added there at that URL 11:57 Cory left the room (quit: Ping timeout: 240 seconds). fellowtraveler 11:57 one line for each function, just like you see there. 11:57 The functions that are missing for you, never needed to be there before because they were implemented directly in script form 11:58 but now that they are in C++, the scripts can't see those functions unless they are explicitly exposed 11:58 So FYI I'm going to get them all added there, which will fix your problem dansmith_btc. 11:58 ucerr left the room (quit: Ping timeout: 246 seconds). fellowtraveler 11:58 In the meantime you can also just add them there yourself and rebuild, and it will fix your problem immeidately 11:58 otherwise I'll have the fix in quite soon. 11:59 Also dansmith_btc here is where in the smartcontract.ot script it is going down: 11:59 . 11:59 var bStatAgents = stat_partyagents(strSmartContract, strPartyName, int32_t(nDepth-1)) var bStatAccounts = stat_partyaccounts(strSmartContract, strPartyName, int32_t(nDepth-1)) 11:59 . 12:00 Friday, June 20, 2014 fellowtraveler 12:00 Basically it's complaining that the stat_partyagents function doesn't exist fellowtraveler 12:00 So I know if I go here: https://github.com/Open-Transactions/Open-Transactions/blob/master/src/otapi/OT_ME.cpp#L1718 fellowtraveler 12:00 and add a line there for stat_partyagents, the problem will go away 12:00 But then it will hit a similar problem on the very next line, with stat_partyaccounts 12:01 So then I can add that function too, and then it will hit the problem again on some other related function 12:01 and basically go through that process until they're all added to OT_ME.cpp 12:01 Might be quicker for you to just do that and send a pull request, but otherwise like I said, I will get those calls added. 12:01
What I did is I took the whole public block from https://github.com/Open-Transactions/Open-Transactions/blob/master/include/otapi/ot_commands_ot.hpp#L24 EXPORT OT_COMMANDS_OT static int32_t accept_from_paymentbox(const string & strMyAcctID, const string & strIndices, const string & strPaymentType); .... and stuck it to the bottom of OTAPI.hpp as part of the OTAPI_Wrap class EXPORT static int32_t accept_from_paymentbox(const std::string & strMyAcctID, const std::string & strIndices, const std::string & strPaymentType); .... then added all these commands to OT_ME.cpp theScript.chai->add(fun(&OTAPI_Wrap::accept_from_paymentbox), "OT_API_accept_from_paymentbox"); ... make gives me this for each command otapi/.libs/libotapi.so: undefined reference to `OTAPI_Wrap::accept_from_paymentbox(std::string const&, std::string const&, std::string const&)' .... advise on how to proceed is appreciated.
What I did is I took the whole public block from (URL) and stuck it to the bottom of OTAPI.hpp as part of the OTAPI_Wrap class
This part is unnecessary because that URL proves that all those functions are ALREADY part of the OT_Command class. See for yourself:
Therefore there's no need adding those functions to OTAPI_Wrap because they already exist in OT_Command.
then added all these commands to OT_ME.cpp theScript.chai->add(fun(&OTAPI_Wrap::accept_from_paymentbox), "OT_API_accept_from_paymentbox");
This part is mostly correct, except probably should be more like this:
theScript.chai->add(fun(&OT_Command::accept_from_paymentbox), "OT_COM_accept_from_paymentbox");
Also you probably don't need to do it for the "whole block" of functions, but just for a few functions like stat_partyaccounts and stat_partyagents (the functions specifically used by smartcontract.ot.)
I would do it one function at a time, since it will probably only be a few functions. When it complains about the next function, just add it.
If OT_ME.cpp is unable to see the functions, BTW, see if "ot_commands_ot.hpp" is #included at the top of OT_ME.cpp. If not, adding the include there will fix that.
ALas, the same issue as in OP triggered again after making changes as suggested and doing sudo make uninstall make sudo make install sudo ldconfig
I just realized the function shouldn't be exposed as OT_COM_accept_from_paymentbox, but rather, as accept_from_paymentbox, since that is the function name that would be expected. (There are places that would already be calling that function and would expect a certain name already.)
Yes, that fixed it. thanks
Trying to create a new smart contract by adding a new party "buyer" produces a crash. TLDR: Error: "Can not find object: stat_partyagents" during evaluation at (369, 29) Full console log:
Welcome to Open Transactions -- version 0.92.d
Using as server: r1fUoHwJOWCuK3WBAAySjmKYqsG6G2TYIxdqY6YNuuG Using as mynym: DYEB6U7dcpbwdGrftPnslNKz76BDuBTFAjiAgKaiY2n Using as myacct: yQGh0vgm9YiqYOh6bfLDxyAA7Nnh2NmturCQmOt4LTo Using as mypurse: JY7kEFnm2c50CGNphdpgnlVo2hOZuLrBua5cFqWWR9Q
Please paste a smart contract you would like to edit, followed by a ~ on a line by itself. (Just leave it blank if you want to start fresh.) ~ Creating a new smart contract!
To get started, we'll need a NymID to act as the 'Lawyer'. (Private key must be available) I say 'Lawyer' meaning, he doesn't have to actually be one of the PARTIES to the agreement, he is just here to sign it during construction (since OT constructs the text itself during the signing process.) Once the actual parties have signed on to the agreement later on, the 'Lawyer' signature will have been dropped from the text. It's for editing only.
Acting as 'Lawyer': FT's Test Nym ( DYEB6U7dcpbwdGrftPnslNKz76BDuBTFAjiAgKaiY2n )
Created new smart contract:
-----BEGIN SIGNED SMARTCONTRACT----- Hash: SAMY
<smartContract version="2.0" serverID="" activatorUserID="" activatorAcctID="" lastSenderUserID="" lastSenderAcctID="" lastRecipientUserID="" lastRecipientAcctID="" canceled="false" cancelerUserID="" transactionNum="0" creationDate="1403010736" validFrom="1403010736" validTo="0" nextProcessDate="0" >
-----BEGIN SMARTCONTRACT SIGNATURE----- Version: Open Transactions 0.92.d Comment: http://github.com/FellowTraveler/Open-Transactions/wiki Meta: SDT9
CoABCzxQm72xDjALFE+vJvQoJNV2Sac0kOSEpKHLhToYDEdfoQRDAi0vl2TcCQUM Pwwye83rrU/hu90KoJPH9p6luWWYOs0DFX+taCoy0RXexgDdNsnU6kMue411yX8l Fy+L6LEB+yVzQqHXt1cwDdzhoLrglCiKHmGWbq37JDkQ7cc= -----END SMARTCONTRACT SIGNATURE-----
This contract has NOT yet been confirmed by all of its parties. (FYI.)
===> Smart contract has 0 bylaws. <===
===> Smart contract has 0 parties. <===
Commands:
v : verbose (shows smart contract in greater detail.) r : raw (prints raw smart contract to the screen.) p : Edit parties b : Edit bylaws q : quit (it will also output the actual smart contract to the screen.)
You must choose, but choose wisely: p
===> Smart contract has 0 parties. <===
Edit Parties:
a : Add a party q : return to the previous menu.
Your choice: a
Enter a name for the new party (party_ will be prepended): buyer -----BEGIN SIGNED SMARTCONTRACT----- Hash: SAMY
<smartContract version="2.0" serverID="" activatorUserID="" activatorAcctID="" lastSenderUserID="" lastSenderAcctID="" lastRecipientUserID="" lastRecipientAcctID="" canceled="false" cancelerUserID="" transactionNum="0" creationDate="1403010736" validFrom="1403010736" validTo="0" nextProcessDate="0" >
<scriptableContract specifyAssetID="false" specifyParties="false" numParties="1" numBylaws="0" >
<party name="party_buyer" ownerType="nym" ownerID="" openingTransNo="0" signedCopyProvided="false" authorizingAgent="agent_buyer" numAgents="1" numAccounts="0" >
<agent name="agent_buyer" doesAgentRepresentHimself="true" isAgentAnIndividual="true" nymID="" roleID="" groupName="" />
-----BEGIN SMARTCONTRACT SIGNATURE----- Version: Open Transactions 0.92.d Comment: http://github.com/FellowTraveler/Open-Transactions/wiki Meta: SDT9
CoABGgSn8E6F+smFOpUWSKNRzHZw3eYicQ6l6l2SDxQSVF7HauRzsg3iOQbmEvZ7 wokEIAhp2r9OPFw+L5UG8utpQsdp6xF7rtB0x3MNsYD/LXzz8sf+M7LePIo6xJMM YwtM5LF8WnBjJIXZIxJM/6DBoAtaZ8UaOU6bst0rSDea6qc= -----END SMARTCONTRACT SIGNATURE----- New party added: party_buyer
===> Smart contract has 1 party. <===
Party 'party_buyer' is merely a template, waiting for a real Nym to come along and play its role. OTScriptChai::ExecuteScript: Caught chaiscript::exception::eval_error: Can not find object: stat_partyagents. File: Start position, line: 0 column: 0 End position, line: 0 column: 0
Error: "Can not find object: stat_partyagents" during evaluation at (369, 29)
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (369, 29) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (369, 13) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (365, 9) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (387, 12) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (387, 12) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (400, 18) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (400, 17) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (400, 17) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (398, 18) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (396, 9) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1054, 9) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1052, 12) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1277, 30) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1277, 29) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1277, 29) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1275, 25) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1273, 21) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1256, 17) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1250, 13) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1183, 12) :
from ./dev/Open-Transactions/scripts/smartcontracts/smartcontract.ot (1867, 5) :