From f48d1e6a0c0345c1186633c17757c3f885285869 Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Wed, 30 May 2018 15:10:39 -0500 Subject: [PATCH 01/36] Added test for rejected duplicate transfer and negative transfer. GH #3608 --- tests/nodeos_run_test.py | 105 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/tests/nodeos_run_test.py b/tests/nodeos_run_test.py index f492bc98f5a..5c4a90f04ac 100755 --- a/tests/nodeos_run_test.py +++ b/tests/nodeos_run_test.py @@ -157,6 +157,8 @@ def cmdError(name, cmdCode=0, exitNow=False): cmdError("eos wallet create") errorExit("Failed to create wallet %s." % (defproduceraWalletName)) + Print("Wallet \"%s\" password=%s." % (defproduceraWalletName, defproduceraWallet.password.encode("utf-8"))) + defproduceraAccount=cluster.defproduceraAccount defproducerbAccount=cluster.defproducerbAccount @@ -503,6 +505,16 @@ def cmdError(name, cmdCode=0, exitNow=False): errorExit("Failed to push message to currency1111 contract") transId=testUtils.Node.getTransId(trans[1]) + Print("push duplicate transfer action to currency1111 contract") + transDuplicate=node.pushMessage(contract, action, data, opts, True) + if transDuplicate is not None and transDuplicate[0]: + transDuplicateId=testUtils.Node.getTransId(transDuplicate[1]) + if transId == transDuplicateId: + cmdError("%s push message currency1111 duplicate transfer accepted but with different transaction ids, it is likely a timing issue, report if problem persists, \norig: %s \ndup: %s" % (ClientName, trans, transDuplicate)) + else: + cmdError("%s push message currency1111 transfer, \norig: %s \ndup: %s" % (ClientName, trans, transDuplicate)) + errorExit("Failed to reject duplicate message for currency1111 contract") + Print("verify transaction exists") if not node.waitForTransIdOnNode(transId): cmdError("%s get transaction trans_id" % (ClientName)) @@ -573,6 +585,99 @@ def cmdError(name, cmdCode=0, exitNow=False): Print("FAILURE - Failed to parse block transaction. %s" % (myTrans)) raise + Print("Unlocking wallet \"%s\"." % (defproduceraWallet.name)) + if not walletMgr.unlockWallet(defproduceraWallet): + cmdError("%s wallet unlock" % (ClientName)) + errorExit("Failed to unlock wallet %s" % (defproduceraWallet.name)) + + Print("push transfer action to currency1111 contract that would go negative") + contract="currency1111" + action="transfer" + data="{\"from\":\"defproducera\",\"to\":\"currency1111\",\"quantity\":" + data +="\"00.0051 CUR\",\"memo\":\"test\"}" + opts="--permission defproducera@active" + trans=node.pushMessage(contract, action, data, opts, True) + if trans is None or trans[0]: + cmdError("%s push message currency1111 transfer should have failed" % (ClientName)) + errorExit("Failed to reject invalid transfer message to currency1111 contract") + + Print("read current contract balance") + amountStr=node.getTableAccountBalance("currency1111", defproduceraAccount.name) + + expected="0.0050 CUR" + actual=amountStr + if actual != expected: + errorExit("FAILURE - Wrong currency1111 balance (expected=%s, actual=%s)" % (str(expected), str(actual)), raw=True) + + amountStr=node.getTableAccountBalance("currency1111", currencyAccount.name) + + expected="99999.9950 CUR" + actual=amountStr + if actual != expected: + errorExit("FAILURE - Wrong currency1111 balance (expected=%s, actual=%s)" % (str(expected), str(actual)), raw=True) + + Print("push another transfer action to currency1111 contract") + contract="currency1111" + action="transfer" + data="{\"from\":\"defproducera\",\"to\":\"currency1111\",\"quantity\":" + data +="\"00.0050 CUR\",\"memo\":\"test\"}" + opts="--permission defproducera@active" + trans=node.pushMessage(contract, action, data, opts) + if trans is None or not trans[0]: + cmdError("%s push message currency1111 transfer" % (ClientName)) + errorExit("Failed to push message to currency1111 contract") + transId=testUtils.Node.getTransId(trans[1]) + + Print("read current contract balance") + amountStr=node.getCurrencyBalance("currency1111", defproduceraAccount.name, "CUR") + expected="0.0000 CUR" + try: + actual=amountStr.strip() + assert(expected == actual or not actual) + except (AssertionError, KeyError) as _: + Print("ERROR: Failed get currecy balance assertion. (expected=<%s>, actual=<%s>)" % (str(expected), str(actual))) + raise + + amountStr=node.getTableAccountBalance("currency1111", currencyAccount.name) + + expected="100000.0000 CUR" + actual=amountStr + if actual != expected: + errorExit("FAILURE - Wrong currency1111 balance (expected=%s, actual=%s)" % (str(expected), str(actual)), raw=True) + + Print("push transfer action to currency1111 contract that would go negative") + contract="currency1111" + action="transfer" + data="{\"from\":\"defproducera\",\"to\":\"currency1111\",\"quantity\":" + data +="\"00.0025 CUR\",\"memo\":\"test\"}" + opts="--permission defproducera@active" + trans=node.pushMessage(contract, action, data, opts, True) + if trans is None or trans[0]: + cmdError("%s push message currency1111 transfer should have failed" % (ClientName)) + errorExit("Failed to reject invalid transfer message to currency1111 contract") + + Print("read current contract balance") + amountStr=node.getCurrencyBalance("currency1111", defproduceraAccount.name, "CUR") + expected="0.0000 CUR" + try: + actual=amountStr.strip() + assert(expected == actual or not actual) + except (AssertionError, KeyError) as _: + Print("ERROR: Failed get currecy balance assertion. (expected=<%s>, actual=<%s>)" % (str(expected), str(actual))) + raise + + amountStr=node.getTableAccountBalance("currency1111", currencyAccount.name) + + expected="100000.0000 CUR" + actual=amountStr + if actual != expected: + errorExit("FAILURE - Wrong currency1111 balance (expected=%s, actual=%s)" % (str(expected), str(actual)), raw=True) + + Print("Locking wallet \"%s\"." % (defproduceraWallet.name)) + if not walletMgr.lockWallet(defproduceraWallet): + cmdError("%s wallet lock" % (ClientName)) + errorExit("Failed to lock wallet %s" % (defproduceraWallet.name)) + Print("Exchange Contract Tests") Print("upload exchange contract") From 6e350e89a09e291eb72a207aa8a7fc556d88142b Mon Sep 17 00:00:00 2001 From: Brian Johnson Date: Wed, 30 May 2018 16:26:23 -0500 Subject: [PATCH 02/36] Fixed logic for identifying why duplicate transaction didn't get rejected. GH #3608 --- tests/nodeos_run_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nodeos_run_test.py b/tests/nodeos_run_test.py index 5c4a90f04ac..1fc8ba00647 100755 --- a/tests/nodeos_run_test.py +++ b/tests/nodeos_run_test.py @@ -509,8 +509,8 @@ def cmdError(name, cmdCode=0, exitNow=False): transDuplicate=node.pushMessage(contract, action, data, opts, True) if transDuplicate is not None and transDuplicate[0]: transDuplicateId=testUtils.Node.getTransId(transDuplicate[1]) - if transId == transDuplicateId: - cmdError("%s push message currency1111 duplicate transfer accepted but with different transaction ids, it is likely a timing issue, report if problem persists, \norig: %s \ndup: %s" % (ClientName, trans, transDuplicate)) + if transId != transDuplicateId: + cmdError("%s push message currency1111 duplicate transfer incorrectly accepted, but they were generated with different transaction ids, it is likely a timing issue, report if problem persists, \norig: %s \ndup: %s" % (ClientName, trans, transDuplicate)) else: cmdError("%s push message currency1111 transfer, \norig: %s \ndup: %s" % (ClientName, trans, transDuplicate)) errorExit("Failed to reject duplicate message for currency1111 contract") From 1fe61186a38a0cf368ec9fe07638d56027030432 Mon Sep 17 00:00:00 2001 From: Bill Hamilton Date: Thu, 31 May 2018 01:39:38 +0000 Subject: [PATCH 03/36] Centos: moved directory opt/boost_1_67_0 to opt/boost --- eosio_build.sh | 2 +- scripts/eosio_build_centos.sh | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/eosio_build.sh b/eosio_build.sh index 67f7e939f3c..9d339a05241 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -153,7 +153,7 @@ export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm export CMAKE=${HOME}/opt/cmake/bin/cmake export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost" ;; "elementary OS") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 5766548a053..9d4a38f6aba 100644 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -298,6 +298,23 @@ printf "\\tCMAKE found @ %s.\\n" "${CMAKE}" fi + if [ -d "${HOME}/opt/boost_1_67_0" ]; then + if ! mv "${HOME}/opt/boost_1_67_0" "${BOOST_ROOT}" + then + printf "\\n\\tUnable to move directory %s/opt/boost_1_67_0 to %s.\\n" "${HOME}" "${BOOST_ROOT}" + printf "\\n\\tExiting now.\\n" + exit 1 + fi + if [ -d "$BUILD_DIR" ]; then + if ! rm -rf "$BUILD_DIR" + then + printf "\\tUnable to remove directory %s. Please remove this directory and run this script %s again. 0\\n" "$BUILD_DIR" "${BASH_SOURCE[0]}" + printf "\\tExiting now.\\n\\n" + exit 1; + fi + fi + fi + printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "#define BOOST_VERSION" "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3) @@ -366,9 +383,9 @@ exit 1; fi fi - printf "\\tBoost 1.67.0 successfully installed @ %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\tBoost successfully installed @ %s.\\n" "${BOOST_ROOT}" else - printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\tBoost 1.67.0 found at %s.\\n\\n" "${BOOST_ROOT}" fi printf "\\n\\tChecking MongoDB installation.\\n" From 035e1eda5ef23733cf30173eff00c484577c3588 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:30:50 -0400 Subject: [PATCH 04/36] Update eosio.system-buyram-rc.md updated based on the pattern shown in buyrambytes --- .../eosio.system/eosio.system-buyram-rc.md | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/contracts/eosio.system/eosio.system-buyram-rc.md b/contracts/eosio.system/eosio.system-buyram-rc.md index d6ff406d865..6d95fcebcab 100644 --- a/contracts/eosio.system/eosio.system-buyram-rc.md +++ b/contracts/eosio.system/eosio.system-buyram-rc.md @@ -1,19 +1,16 @@ # Action - `{{ buyram }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description -The `{{ buyram }}` action... - -### Inputs and Input Types - -The `{{ buyram }}` action requires the following `inputs` and `input types`: +This action will attempt to reserve about {{quant}} SYS tokens worth of RAM on behalf of {{receiver}}. -| Action | Input | Input Type | -|:--|:--|:--| -| `{{ buyram }}` | `{{ payerVar }}`
`{{ receiverVar }}`
`{{ quantVar }}` | `{{ account_name }}`
`{{ account_name }}`
`{{ asset }}` | +{{buyer}} authorizes this contract to transfer {{quant}} SYS tokens to buy RAM based upon the current price as determined by the market maker algorithm. -As an authorized party I {{ signer }} wish to buy {{ quantVar }} worth of RAM using the funds of {{ payerVar }} with the RAM to be owned by and be the property of {{ receiverVar }}. +{{buyer}} accepts that a 0.5% fee will be charged on the SYS spent and that the actual RAM received may be slightly less than expected due to the approximations necessary to enable this service. +{{buyer}} accepts that a 0.5% fee will be charged if and when they sell the RAM received. +{{buyer}} accepts that rounding errors resulting from limits of computational precision may result in less RAM being allocated. +{{buyer}} acknowledges that the supply of RAM may be increased at any time up to the limits of off-the-shelf computer equipment and that this may result in RAM selling for less than purchase price. +{{buyer}} acknowledges that the price of RAM may increase or decrease over time according to supply and demand. +{{buyer}} acknowledges that RAM is non-transferrable. +{{buyer}} acknowledges RAM currently in use by their account cannot be sold until it is freed and that freeing RAM may be subject to terms of other contracts. -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 3ac56c748a1cd01bc654c075059ee19a35bb2d62 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:33:35 -0400 Subject: [PATCH 05/36] Update eosio.system-unregprod-rc.md remove deprecated arbitration clause --- contracts/eosio.system/eosio.system-unregprod-rc.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contracts/eosio.system/eosio.system-unregprod-rc.md b/contracts/eosio.system/eosio.system-unregprod-rc.md index 1d21b022c59..de3dad69963 100644 --- a/contracts/eosio.system/eosio.system-unregprod-rc.md +++ b/contracts/eosio.system/eosio.system-unregprod-rc.md @@ -2,7 +2,7 @@ ### Description -The `{{ unregprod }}` action... +The `{{ unregprod }}` action unregisters a previously registered block producer candidate. ### Input and Input Type @@ -13,5 +13,3 @@ The `{{ unregprod }}` action requires the following `input` and `input type`: | `{{ unregprod }}` | `{{ producerVar }}` | `{{ account_name }}` | As an authorized party I {{ signer }} wish to unregister the block producer candidate {{ producerVar }}, rendering that candidate no longer able to receive votes. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 2f5db2e5f95f35cfa90e7c27e1d6f864cd4db065 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:35:12 -0400 Subject: [PATCH 06/36] Rename eosio.system.voteproducer-rc.md to eosio.system-voteproducer-rc.md renamed file to match others in naming convention --- ....system.voteproducer-rc.md => eosio.system-voteproducer-rc.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename contracts/eosio.system/{eosio.system.voteproducer-rc.md => eosio.system-voteproducer-rc.md} (100%) diff --git a/contracts/eosio.system/eosio.system.voteproducer-rc.md b/contracts/eosio.system/eosio.system-voteproducer-rc.md similarity index 100% rename from contracts/eosio.system/eosio.system.voteproducer-rc.md rename to contracts/eosio.system/eosio.system-voteproducer-rc.md From ccc7b64514f18b7d09bd8ad4a5883a1f4de9ecf4 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:36:44 -0400 Subject: [PATCH 07/36] Update eosio.system-bidname-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-bidname-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-bidname-rc.md b/contracts/eosio.system/eosio.system-bidname-rc.md index 87b11b131b8..e71f2fa4d30 100644 --- a/contracts/eosio.system/eosio.system-bidname-rc.md +++ b/contracts/eosio.system/eosio.system-bidname-rc.md @@ -1,7 +1,5 @@ # Action - `{{ bidname }}` -This Contract is legally binding and can be used in the event of a dispute. Disputes shall be settled through the standard arbitration process established by EOS.IO. - ### Description The `{{ bidname }}` action places a bid on a premium account name, in the knowledge that the high bid will purchase the name. @@ -15,5 +13,3 @@ The `{{ bidname }}` action requires the following `inputs` and `input types`: | `{{ bidname }}` | `{{ bidderVar }}`
`{{ newnameVar }}`
`{{ bidVar }}` | `{{ account_name }}`
`{{ account_name }}`
`{{ asset }}` | As an authorized party I {{ signer }} wish to bid on behalf of {{ bidderVar }} the amount of {{ bidVar }} toward purchase of the account name {{ newnameVar }}. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From e4c3982d4cf72011c8426f6a2cdc0c1af9307593 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:37:08 -0400 Subject: [PATCH 08/36] Update eosio.system-canceldelay-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-canceldelay-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-canceldelay-rc.md b/contracts/eosio.system/eosio.system-canceldelay-rc.md index db68ca85066..8c7c0a387b9 100644 --- a/contracts/eosio.system/eosio.system-canceldelay-rc.md +++ b/contracts/eosio.system/eosio.system-canceldelay-rc.md @@ -1,7 +1,5 @@ # Action - `{{ canceldelay }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ canceldelay }}` action cancels an existing delayed transaction. @@ -15,5 +13,3 @@ The `{{ canceldelay }}` action requires the following `inputs` and `input types` | `{{ canceldelay }}` | `{{ canceling_authVar }}`
`{{ trx_idVar }}` | `{{ permission_level }}`
`{{ transaction_id_type }}` | As an authorized party I {{ signer }} wish to invoke the authority of {{ canceling_authVar }} to cancel the transaction with ID {{ trx_idVar }}. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From ec005f127465966bc723e3370fb4a8abeafb7ed2 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:37:29 -0400 Subject: [PATCH 09/36] Update eosio.system-claimrewards-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-claimrewards-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-claimrewards-rc.md b/contracts/eosio.system/eosio.system-claimrewards-rc.md index 8470bcb2c18..47362044499 100644 --- a/contracts/eosio.system/eosio.system-claimrewards-rc.md +++ b/contracts/eosio.system/eosio.system-claimrewards-rc.md @@ -1,7 +1,5 @@ # Action - `{{ claimrewards }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ claimrewards }}` action allows a block producer (active or standby) to claim the system rewards due them for producing blocks and receiving votes. @@ -15,5 +13,3 @@ The `{{ claimrewards }}` action requires the following `input` and `input type`: | `{{ claimrewards }}` | `{{ ownerVar }}` | `{{ account_name }}` | As an authorized party I {{ signer }} wish to have the rewards earned by {{ ownerVar }} deposited into their (my) account. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 5fb54ee32edb261af5b96d29a19c7b514b893919 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:38:14 -0400 Subject: [PATCH 10/36] Update eosio.system-delegatebw-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-delegatebw-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-delegatebw-rc.md b/contracts/eosio.system/eosio.system-delegatebw-rc.md index 904d43db957..5db46687683 100644 --- a/contracts/eosio.system/eosio.system-delegatebw-rc.md +++ b/contracts/eosio.system/eosio.system-delegatebw-rc.md @@ -1,7 +1,5 @@ # eosio.system delegatebw -This Ricardian contract for the system action *delegatebw* is legally binding and can be used in the event of a dispute. - ## delegatebw (account_name-from; account_name-to; @@ -20,5 +18,3 @@ It is {{ bool:transfer }} that I wish these tokens to become immediately owned b {{/if}} As signer I stipulate that, if I am not the beneficial owner of these tokens, I have proof that I’ve been authorized to take this action by their beneficial owner(s). - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 43e97a6f978828142102b40ff33689030eb82208 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:38:33 -0400 Subject: [PATCH 11/36] Update eosio.system-deleteauth-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-deleteauth-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-deleteauth-rc.md b/contracts/eosio.system/eosio.system-deleteauth-rc.md index fc1db915e9b..c447bbe380b 100644 --- a/contracts/eosio.system/eosio.system-deleteauth-rc.md +++ b/contracts/eosio.system/eosio.system-deleteauth-rc.md @@ -1,7 +1,5 @@ # Action - `{{ deleteauth }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ deleteauth }}` action... @@ -15,5 +13,3 @@ The `{{ deleteauth }}` action requires the following `inputs` and `input types`: | `{{ deleteauth }}` | `{{ accountVar }}`
`{{ permissionVar }}` | `{{ account_name }}`
`{{ permission_name }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 9467ac52d5953cecd157f9e044c3247868b9b3e4 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:38:50 -0400 Subject: [PATCH 12/36] Update eosio.system-linkauth-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-linkauth-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-linkauth-rc.md b/contracts/eosio.system/eosio.system-linkauth-rc.md index 9ba584cf60b..f3e4b7266d2 100644 --- a/contracts/eosio.system/eosio.system-linkauth-rc.md +++ b/contracts/eosio.system/eosio.system-linkauth-rc.md @@ -1,7 +1,5 @@ # Action - `{{ linkauth }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ linkauth }}` action... @@ -15,5 +13,3 @@ The `{{ linkauth }}` action requires the following `inputs` and `input types`: | `{{ linkauth }}` | `{{ accountVar }}`
`{{ codeVar }}`
`{{ typeVar }}`
`{{ requirementVar }}` | `{{ account_name }}`
`{{ account_name }}`
`{{ action_name }}`
`{{ permission_name }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From a2962477ece48e5dab99840dc847c62e3a7a7678 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:39:07 -0400 Subject: [PATCH 13/36] Update eosio.system-newaccount-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-newaccount-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-newaccount-rc.md b/contracts/eosio.system/eosio.system-newaccount-rc.md index 1392f41a727..70e9b47386d 100644 --- a/contracts/eosio.system/eosio.system-newaccount-rc.md +++ b/contracts/eosio.system/eosio.system-newaccount-rc.md @@ -1,7 +1,5 @@ # Action - `{{ newaccount }}` -This Contract is legally binding and can be used in the event of a dispute. Disputes shall be settled through the standard arbitration process established by EOS.IO. - ### Description The `{{ newaccount }}` action creates a new account. @@ -15,5 +13,3 @@ The `{{ newaccount }}` action requires the following `inputs` and `input types`: | `{{ newaccount }}` | `{{ creatorVar }}`
`{{ nameVar }}`
`{{ ownerVar }}`
`{{ activeVar }}` | `{{ account_name }}`
`{{ account_name }}`
`{{ authority }}`
`{{ authority }}` | As an authorized party I {{ signer }} wish to exercise the authority of {{ creatorVar }} to create a new account on this system named {{ nameVar }} such that the new account's owner public key shall be {{ ownerVar }} and the active public key shall be {{ activeVar }}. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 1efcc877b0401a129c9f6d9c42603a3444ddd972 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:39:23 -0400 Subject: [PATCH 14/36] Update eosio.system-onerror-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-onerror-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-onerror-rc.md b/contracts/eosio.system/eosio.system-onerror-rc.md index 7b8755ec676..925abf77090 100644 --- a/contracts/eosio.system/eosio.system-onerror-rc.md +++ b/contracts/eosio.system/eosio.system-onerror-rc.md @@ -1,7 +1,5 @@ # Action - `{{ onerror }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ onerror }}` action... @@ -15,5 +13,3 @@ The `{{ onerror }}` action requires the following `inputs` and `input types`: | `{{ onerror }}` | `{{ sender_idVar }}`
`{{ sent_trxVar }}` | `{{ uint128 }}`
`{{ bytes }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 1acee545cb7789c1fffd8db89f2ec96e9e6ddebb Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:39:46 -0400 Subject: [PATCH 15/36] Update eosio.system-refund-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-refund-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-refund-rc.md b/contracts/eosio.system/eosio.system-refund-rc.md index 7e2af0284d8..04dac54afe0 100644 --- a/contracts/eosio.system/eosio.system-refund-rc.md +++ b/contracts/eosio.system/eosio.system-refund-rc.md @@ -1,7 +1,5 @@ # Action - `{{ refund }}` -This Contract is legally binding and can be used in the event of a dispute. Disputes shall be settled through the standard arbitration process established by EOS.IO. - ### Description The intent of the `{{ refund }}` action is to return previously unstaked tokens to an account after the unstaking period has elapsed. @@ -16,5 +14,3 @@ The `{{ refund }}` action requires the following `input` and `input type`: As an authorized party I {{ signer }} wish to have the unstaked tokens of {{ ownerVar }} returned. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 159d2e217c75f55bb6e5bc38c227add3b651dc58 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:40:00 -0400 Subject: [PATCH 16/36] Update eosio.system-regproxy-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-regproxy-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-regproxy-rc.md b/contracts/eosio.system/eosio.system-regproxy-rc.md index 3c78aa692b8..8e96159b7a8 100644 --- a/contracts/eosio.system/eosio.system-regproxy-rc.md +++ b/contracts/eosio.system/eosio.system-regproxy-rc.md @@ -1,7 +1,5 @@ # Action - `{{ regproxy }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ regproxy }}` action... @@ -15,5 +13,3 @@ The `{{ regproxy }}` action requires the following `inputs` and `input types`: | `{{ regproxy }}` | `{{ proxyVar }}`
`{{ isproxyVar }}` | `{{ account_name }}`
`{{ bool }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From b0a4779f6d77d52f11abcd323e41c6a6e406f074 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:40:15 -0400 Subject: [PATCH 17/36] Update eosio.system-reqauth-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-reqauth-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-reqauth-rc.md b/contracts/eosio.system/eosio.system-reqauth-rc.md index c347e5b044f..a95b8cb25dd 100644 --- a/contracts/eosio.system/eosio.system-reqauth-rc.md +++ b/contracts/eosio.system/eosio.system-reqauth-rc.md @@ -1,7 +1,5 @@ # Action - `{{ reqauth }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ reqauth }}` action... @@ -15,5 +13,3 @@ The `{{ reqauth }}` action requires the following `input` and `input type`: | `{{ reqauth }}` | `{{ fromVar }}` | `{{ account_name }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 6284656bf58491e994e2c2972c8305662c937e6f Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:40:52 -0400 Subject: [PATCH 18/36] Update eosio.system-sellram-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-sellram-rc.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/contracts/eosio.system/eosio.system-sellram-rc.md b/contracts/eosio.system/eosio.system-sellram-rc.md index b10dfb04ced..ad4f616f03f 100644 --- a/contracts/eosio.system/eosio.system-sellram-rc.md +++ b/contracts/eosio.system/eosio.system-sellram-rc.md @@ -1,10 +1,8 @@ # Action - `{{ sellram }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description -The `{{ sellram }}` action... +The `{{ sellram }}` action sells unused RAM for SYS tokens. ### Inputs and Input Types @@ -15,5 +13,3 @@ The `{{ sellram }}` action requires the following `inputs` and `input types`: | `{{ sellram }}` | `{{ accountVar }}`
`{{ bytesVar }}` | `{{ account_name }}`
`{{ uint64 }}` | As an authorized party I {{ signer }} wish to sell {{ bytesVar }} of RAM from account {{ accountVar }}. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From af8e3297ad55d9c14e79f33ba788d0cd733fdad8 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:41:12 -0400 Subject: [PATCH 19/36] Update eosio.system-setabi-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-setabi-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-setabi-rc.md b/contracts/eosio.system/eosio.system-setabi-rc.md index 6167d2a8b14..21417856e10 100644 --- a/contracts/eosio.system/eosio.system-setabi-rc.md +++ b/contracts/eosio.system/eosio.system-setabi-rc.md @@ -1,7 +1,5 @@ # Action - `{{ setabi }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The intention of the `{{ setabi }}` action is to... @@ -15,5 +13,3 @@ The `{{ setabi }}` action requires the following `inputs` and `input types`: | `{{ setabi }}` | `{{ accountVar }}`
`{{ abiVar }}` | `{{ account_name }}`
`{{ bytes }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 67fd1eb0213aca36bf3db2ef6c79a1bf5e6e9dcf Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:41:29 -0400 Subject: [PATCH 20/36] Update eosio.system-setalimits-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-setalimits-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-setalimits-rc.md b/contracts/eosio.system/eosio.system-setalimits-rc.md index 70b210ffcad..f03fbee1f67 100644 --- a/contracts/eosio.system/eosio.system-setalimits-rc.md +++ b/contracts/eosio.system/eosio.system-setalimits-rc.md @@ -1,7 +1,5 @@ # Action - `{{ setalimits }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ setalimits }}` action... @@ -16,5 +14,3 @@ The `{{ setalimits }}` action requires the following `inputs` and `input types`: As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 31b9392fed75eb94e59df203879897cb717f1375 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:41:45 -0400 Subject: [PATCH 21/36] Update eosio.system-setglimits-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-setglimits-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-setglimits-rc.md b/contracts/eosio.system/eosio.system-setglimits-rc.md index fa8405a45e3..0c168662df1 100644 --- a/contracts/eosio.system/eosio.system-setglimits-rc.md +++ b/contracts/eosio.system/eosio.system-setglimits-rc.md @@ -1,7 +1,5 @@ # Action - `{{ setglimits }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The intention of the `{{ setglimits }}` action is to ... @@ -15,5 +13,3 @@ The `{{ setglimits }}` action requires the following `input` and `input type`: | `{{ setglimits }}` | `{{ cpu_usec_per_periodVar }}` | `{{ int64 }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 7989c668f4e2959927ffa3a3c0f90fa0bb119fc1 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:41:59 -0400 Subject: [PATCH 22/36] Update eosio.system-setpriv-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-setpriv-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-setpriv-rc.md b/contracts/eosio.system/eosio.system-setpriv-rc.md index 9425fbedba3..0875c30d1e2 100644 --- a/contracts/eosio.system/eosio.system-setpriv-rc.md +++ b/contracts/eosio.system/eosio.system-setpriv-rc.md @@ -1,7 +1,5 @@ # Action - `{{ setpriv }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The intention of the `{{ setpriv }}` action is to ... @@ -15,5 +13,3 @@ The `{{ setpriv }}` action requires the following `inputs` and `input types`: | `{{ setpriv }}` | `{{ accountVar }}`
`{{ is_privVar }}` | `{{ account_name }}`
`{{ int8 }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From c9bdcc87ecefa548567a266b467f0d87a55061c0 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:42:16 -0400 Subject: [PATCH 23/36] Update eosio.system-setprods-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-setprods-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-setprods-rc.md b/contracts/eosio.system/eosio.system-setprods-rc.md index fd4f8d67fc5..8b6ef8ca062 100644 --- a/contracts/eosio.system/eosio.system-setprods-rc.md +++ b/contracts/eosio.system/eosio.system-setprods-rc.md @@ -1,7 +1,5 @@ # Action - `{{ setprods }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ setprods }}` action creates a new schedule of active producers, who will produce blocks in the order given. @@ -18,5 +16,3 @@ THIS IS A SYSTEM COMMAND NOT AVAILABLE FOR DIRECT ACCESS BY USERS. As an authorized party I {{ signer }} wish to set the rotation of producers to be {{ scheduleVar }}. - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From ef71510fdb05aa1ef710cc576a95f4d514898aaa Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:42:38 -0400 Subject: [PATCH 24/36] Update eosio.system-undelegatebw-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-undelegatebw-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-undelegatebw-rc.md b/contracts/eosio.system/eosio.system-undelegatebw-rc.md index f0290732736..e7a1fcf3929 100644 --- a/contracts/eosio.system/eosio.system-undelegatebw-rc.md +++ b/contracts/eosio.system/eosio.system-undelegatebw-rc.md @@ -1,7 +1,5 @@ # eosio.system undelegatebw -This Ricardian contract for the system action *undelegatebw* is legally binding and can be used in the event of a dispute. - ## undelegatebw (account_name-from; account_name-to; @@ -13,5 +11,3 @@ _Intent: unstake tokens from bandwidth_ As an authorized party I {{ signer }} wish to unstake {{ asset-unstake_cpu_quantity }} from CPU and {{ asset-unstake_net_quantity }} from bandwidth from the tokens owned by {{ account_name-from }} previously delegated for the use of delegatee {{ account_name-to }}. If I as signer am not the beneficial owner of these tokens I stipulate I have proof that I’ve been authorized to take this action by their beneficial owner(s). - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 6a15693bd52b31e99b5e65150cd4ca80003fa2d0 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:42:55 -0400 Subject: [PATCH 25/36] Update eosio.system-unlinkauth-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-unlinkauth-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-unlinkauth-rc.md b/contracts/eosio.system/eosio.system-unlinkauth-rc.md index 0e6034f8a6a..b93928f8c34 100644 --- a/contracts/eosio.system/eosio.system-unlinkauth-rc.md +++ b/contracts/eosio.system/eosio.system-unlinkauth-rc.md @@ -1,7 +1,5 @@ # Action - `{{ unlinkauth }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ unlinkauth }}` action... @@ -16,5 +14,3 @@ The `{{ unlinkauth }}` action requires the following `inputs` and `input types`: As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 1c97dad376dbdda8b714569515034c1925dfe1f5 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Wed, 30 May 2018 23:43:09 -0400 Subject: [PATCH 26/36] Update eosio.system-updateauth-rc.md removed deprecated arbitration clauses --- contracts/eosio.system/eosio.system-updateauth-rc.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contracts/eosio.system/eosio.system-updateauth-rc.md b/contracts/eosio.system/eosio.system-updateauth-rc.md index fe5d639a2b5..0e6144586d7 100644 --- a/contracts/eosio.system/eosio.system-updateauth-rc.md +++ b/contracts/eosio.system/eosio.system-updateauth-rc.md @@ -1,7 +1,5 @@ # Action - `{{ updateauth }}` -This Contract is legally binding and can be used in the event of a dispute. - ### Description The `{{ updateauth }}` action... @@ -15,5 +13,3 @@ The `{{ updateauth }}` action requires the following `inputs` and `input types`: | `{{ updateauth }}` | `{{ accountVar }}`
`{{ permissionVar }}`
`{{ parentVar }}`
`{{ authVar }}` | `{{ account_name }}`
`{{ permission_name }}`
`{{ permission_name }}`
`{{ authority }}` | As an authorized party I {{ signer }} wish to UNKNOWN - -All disputes arising from this contract shall be resolved in the EOS Core Arbitration Forum. From 82248197d2dd7ffa8655a862bb5dc77e4d78a15b Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Wed, 30 May 2018 22:55:08 -0500 Subject: [PATCH 27/36] Add test for nested recursive array type --- unittests/abi_tests.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index bbfaa15072a..e4c7b5ea5c2 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -3297,6 +3297,31 @@ BOOST_AUTO_TEST_CASE(abi_type_redefine_to_name) } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE(abi_type_nested_in_vector) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [], + "structs": [{ + "name": "store_t", + "base": "", + "fields": [{ + "name": "id", + "type": "uint64" + },{ + "name": "childs", + "type": "store_t[]" + }], + "actions": [], + "tables": [] + } + )====="; + + BOOST_CHECK_THROW( abi_serializer abis(fc::json::from_string(repeat_abi).as()), fc::exception ); + +} FC_LOG_AND_RETHROW() } + BOOST_AUTO_TEST_CASE(abi_account_name_in_eosio_abi) { try { // inifinite loop in types From 87f75030f23ad7a8d1b63a5994f85856f12345b9 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Wed, 30 May 2018 22:56:37 -0500 Subject: [PATCH 28/36] Guard against infinite recursion --- libraries/abi_generator/abi_generator.cpp | 44 ++++++++++++------- .../eosio/abi_generator/abi_generator.hpp | 15 ++++--- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/libraries/abi_generator/abi_generator.cpp b/libraries/abi_generator/abi_generator.cpp index c6a084007c9..44a0a6f5216 100644 --- a/libraries/abi_generator/abi_generator.cpp +++ b/libraries/abi_generator/abi_generator.cpp @@ -124,7 +124,7 @@ bool abi_generator::inspect_type_methods_for_actions(const Decl* decl) { try { qt.setLocalFastQualifiers(0); string field_name = p->getNameAsString(); - string field_type_name = add_type(qt); + string field_type_name = add_type(qt, 0); field_def struct_field{field_name, field_type_name}; ABI_ASSERT(is_builtin_type(get_vector_element_type(struct_field.type)) @@ -236,7 +236,7 @@ void abi_generator::handle_decl(const Decl* decl) { try { auto qt = action_decl->getTypeForDecl()->getCanonicalTypeInternal(); - auto type_name = add_struct(qt); + auto type_name = add_struct(qt, "", 0); ABI_ASSERT(!is_builtin_type(type_name), "A built-in type with the same name exists, try using another name: ${type_name}", ("type_name",type_name)); @@ -259,7 +259,7 @@ void abi_generator::handle_decl(const Decl* decl) { try { ABI_ASSERT(table_decl != nullptr); auto qt = table_decl->getTypeForDecl()->getCanonicalTypeInternal(); - auto type_name = add_struct(qt); + auto type_name = add_struct(qt, "", 0); ABI_ASSERT(!is_builtin_type(type_name), "A built-in type with the same name exists, try using another name: ${type_name}", ("type_name",type_name)); @@ -433,7 +433,11 @@ const struct_def* abi_generator::find_struct(const type_name& name) { type_name abi_generator::resolve_type(const type_name& type){ const auto* td = find_type(type); if( td ) { - return resolve_type(td->type); + for( auto i = output->types.size(); i > 0; --i ) { // avoid infinite recursion + const type_name& t = td->type; + td = find_type(t); + if( td == nullptr ) return t; + } } return type; } @@ -505,7 +509,9 @@ string abi_generator::get_type_name(const clang::QualType& qt, bool with_namespa return name; } -clang::QualType abi_generator::add_typedef(const clang::QualType& tqt) { +clang::QualType abi_generator::add_typedef(const clang::QualType& tqt, size_t recursion_depth) { + + ABI_ASSERT( ++recursion_depth < max_recursion_depth, "recursive definition, max_recursion_depth" ); clang::QualType qt(get_named_type_if_elaborated(tqt)); @@ -516,7 +522,7 @@ clang::QualType abi_generator::add_typedef(const clang::QualType& tqt) { auto underlying_type_name = get_type_name(underlying_type); if ( is_vector(underlying_type) ) { - underlying_type_name = add_vector(underlying_type); + underlying_type_name = add_vector(underlying_type, recursion_depth); } type_def abi_typedef; @@ -531,7 +537,7 @@ clang::QualType abi_generator::add_typedef(const clang::QualType& tqt) { } if( is_typedef(underlying_type) && !is_builtin_type(get_type_name(underlying_type)) ) - return add_typedef(underlying_type); + return add_typedef(underlying_type, recursion_depth); return underlying_type; } @@ -568,14 +574,16 @@ const clang::RecordDecl::field_range abi_generator::get_struct_fields(const clan return record_type->getDecl()->fields(); } -string abi_generator::add_vector(const clang::QualType& vqt) { +string abi_generator::add_vector(const clang::QualType& vqt, size_t recursion_depth) { + + ABI_ASSERT( ++recursion_depth < max_recursion_depth, "recursive definition, max_recursion_depth" ); clang::QualType qt(get_named_type_if_elaborated(vqt)); auto vector_element_type = get_vector_element_type(qt); ABI_ASSERT(!is_vector(vector_element_type), "Only one-dimensional arrays are supported"); - add_type(vector_element_type); + add_type(vector_element_type, recursion_depth); auto vector_element_type_str = translate_type(get_type_name(vector_element_type)); vector_element_type_str += "[]"; @@ -583,7 +591,9 @@ string abi_generator::add_vector(const clang::QualType& vqt) { return vector_element_type_str; } -string abi_generator::add_type(const clang::QualType& tqt) { +string abi_generator::add_type(const clang::QualType& tqt, size_t recursion_depth) { + + ABI_ASSERT( ++recursion_depth < max_recursion_depth, "recursive definition, max_recursion_depth" ); clang::QualType qt(get_named_type_if_elaborated(tqt)); @@ -596,7 +606,7 @@ string abi_generator::add_type(const clang::QualType& tqt) { } if( is_typedef(qt) ) { - qt = add_typedef(qt); + qt = add_typedef(qt, recursion_depth); if( is_builtin_type(translate_type(get_type_name(qt))) ) { return type_name; } @@ -604,12 +614,12 @@ string abi_generator::add_type(const clang::QualType& tqt) { } if( is_vector(qt) ) { - auto vector_type_name = add_vector(qt); + auto vector_type_name = add_vector(qt, recursion_depth); return is_type_def ? type_name : vector_type_name; } if( is_struct(qt) ) { - return add_struct(qt, full_type_name); + return add_struct(qt, full_type_name, recursion_depth); } ABI_ASSERT(false, "types can only be: vector, struct, class or a built-in type. (${type}) ", ("type",get_type_name(qt))); @@ -623,7 +633,9 @@ clang::QualType abi_generator::get_named_type_if_elaborated(const clang::QualTyp return qt; } -string abi_generator::add_struct(const clang::QualType& sqt, string full_name) { +string abi_generator::add_struct(const clang::QualType& sqt, string full_name, size_t recursion_depth) { + + ABI_ASSERT( ++recursion_depth < max_recursion_depth, "recursive definition, max_recursion_depth" ); clang::QualType qt(get_named_type_if_elaborated(sqt)); @@ -653,7 +665,7 @@ string abi_generator::add_struct(const clang::QualType& sqt, string full_name) { const auto* record_type = base_qt->getAs(); if( record_type && is_struct(base_qt) && !record_type->getDecl()->field_empty() ) { ABI_ASSERT(total_bases == 0, "Multiple inheritance not supported - ${type}", ("type",full_name)); - base_name = add_type(base_qt); + base_name = add_type(base_qt, recursion_depth); ++total_bases; } ++bitr; @@ -664,7 +676,7 @@ string abi_generator::add_struct(const clang::QualType& sqt, string full_name) { clang::QualType qt = field->getType(); string field_name = field->getNameAsString(); - string field_type_name = add_type(qt); + string field_type_name = add_type(qt, recursion_depth); field_def struct_field{field_name, field_type_name}; ABI_ASSERT(is_builtin_type(get_vector_element_type(struct_field.type)) diff --git a/libraries/abi_generator/include/eosio/abi_generator/abi_generator.hpp b/libraries/abi_generator/include/eosio/abi_generator/abi_generator.hpp index 093409d22ba..cdb5d0ffe3e 100644 --- a/libraries/abi_generator/include/eosio/abi_generator/abi_generator.hpp +++ b/libraries/abi_generator/include/eosio/abi_generator/abi_generator.hpp @@ -159,7 +159,8 @@ namespace eosio { * @brief Generates eosio::abi_def struct handling events from ASTConsumer */ class abi_generator { - private: + private: + static constexpr size_t max_recursion_depth = 25; // arbitrary depth to prevent infinite recursion bool verbose; int optimizations; abi_def* output; @@ -171,6 +172,7 @@ namespace eosio { string target_contract; vector target_actions; ricardian_contracts rc; + public: enum optimization { @@ -178,7 +180,8 @@ namespace eosio { }; abi_generator() - :optimizations(0) + : verbose(false) + , optimizations(0) , output(nullptr) , compiler_instance(nullptr) , ast_context(nullptr) @@ -283,17 +286,17 @@ namespace eosio { string decl_to_string(clang::Decl* d); bool is_typedef(const clang::QualType& qt); - QualType add_typedef(const clang::QualType& qt); + QualType add_typedef(const clang::QualType& qt, size_t recursion_depth); bool is_vector(const clang::QualType& qt); bool is_vector(const string& type_name); - string add_vector(const clang::QualType& qt); + string add_vector(const clang::QualType& qt, size_t recursion_depth); bool is_struct(const clang::QualType& qt); - string add_struct(const clang::QualType& qt, string full_type_name=""); + string add_struct(const clang::QualType& qt, string full_type_name, size_t recursion_depth); string get_type_name(const clang::QualType& qt, bool no_namespace); - string add_type(const clang::QualType& tqt); + string add_type(const clang::QualType& tqt, size_t recursion_depth); bool is_elaborated(const clang::QualType& qt); bool is_struct_specialization(const clang::QualType& qt); From f14ee7229f533b712171cd2cfe5835087abd9d82 Mon Sep 17 00:00:00 2001 From: Spartucus Date: Thu, 31 May 2018 15:16:17 +0800 Subject: [PATCH 29/36] Remove unused local variable It seems like that `ps` is unused, `fc::datastream` has neither lock nor mutex. --- libraries/chain/fork_database.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index 34a77030e43..560221afde0 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -79,8 +79,6 @@ namespace eosio { namespace chain { void fork_database::close() { if( my->index.size() == 0 ) return; - fc::datastream ps; - auto fork_db_dat = my->datadir / config::forkdb_filename; std::ofstream out( fork_db_dat.generic_string().c_str(), std::ios::out | std::ios::binary | std::ofstream::trunc ); uint32_t num_blocks_in_fork_db = my->index.size(); From 38587d0ee53fb5fadbdb06201dc64f3c50501902 Mon Sep 17 00:00:00 2001 From: Spartucus Date: Thu, 31 May 2018 15:37:19 +0800 Subject: [PATCH 30/36] Remove unused local variable --- libraries/chain/resource_limits.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libraries/chain/resource_limits.cpp b/libraries/chain/resource_limits.cpp index 482d45119aa..a3fe393f6b7 100644 --- a/libraries/chain/resource_limits.cpp +++ b/libraries/chain/resource_limits.cpp @@ -93,7 +93,6 @@ void resource_limits_manager::update_account_usage(const flat_set& void resource_limits_manager::add_transaction_usage(const flat_set& accounts, uint64_t cpu_usage, uint64_t net_usage, uint32_t time_slot ) { const auto& state = _db.get(); const auto& config = _db.get(); - set> authorizing_accounts; for( const auto& a : accounts ) { @@ -232,7 +231,6 @@ bool resource_limits_manager::set_account_limits( const account_name& account, i */ } - auto old_ram_bytes = limits.ram_bytes; _db.modify( limits, [&]( resource_limits_object& pending_limits ){ pending_limits.ram_bytes = ram_bytes; pending_limits.net_weight = net_weight; From 77ac40e2b2a60d99589687d757ca5f2e95dd3e6b Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 31 May 2018 09:30:51 -0400 Subject: [PATCH 31/36] Set default HTTP port for user specified http:// urls in cleos to :80 Change the default HTTP port used by cleos for http:// URLs to port 80. This doesn't change the default URL of http://localhost:8888, just the port number if someone were to use http://foo.bar/ for example --- programs/cleos/httpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cleos/httpc.cpp b/programs/cleos/httpc.cpp index 33a03b55b1b..e67c02d22bb 100644 --- a/programs/cleos/httpc.cpp +++ b/programs/cleos/httpc.cpp @@ -95,7 +95,7 @@ namespace eosio { namespace client { namespace http { if(res.server.empty()) FC_THROW("No server parsed from URL \"${u}\"", ("u", server_url)); if(res.port.empty()) - res.port = res.scheme == "http" ? "8888" : "443"; + res.port = res.scheme == "http" ? "80" : "443"; boost::trim_right_if(res.path_prefix, boost::is_any_of("/")); return res; } From a89398d3c34ead1f0eec845b3565641d8c707b32 Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Thu, 31 May 2018 09:57:15 -0400 Subject: [PATCH 32/36] Update eosio.system-buyram-rc.md --- contracts/eosio.system/eosio.system-buyram-rc.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/eosio.system/eosio.system-buyram-rc.md b/contracts/eosio.system/eosio.system-buyram-rc.md index 6d95fcebcab..98c775d794a 100644 --- a/contracts/eosio.system/eosio.system-buyram-rc.md +++ b/contracts/eosio.system/eosio.system-buyram-rc.md @@ -2,11 +2,11 @@ ### Description -This action will attempt to reserve about {{quant}} SYS tokens worth of RAM on behalf of {{receiver}}. +This action will attempt to reserve about {{quant}} worth of RAM on behalf of {{receiver}}. -{{buyer}} authorizes this contract to transfer {{quant}} SYS tokens to buy RAM based upon the current price as determined by the market maker algorithm. +{{buyer}} authorizes this contract to transfer {{quant}} to buy RAM based upon the current price as determined by the market maker algorithm. -{{buyer}} accepts that a 0.5% fee will be charged on the SYS spent and that the actual RAM received may be slightly less than expected due to the approximations necessary to enable this service. +{{buyer}} accepts that a 0.5% fee will be charged on the amount spent and that the actual RAM received may be slightly less than expected due to the approximations necessary to enable this service. {{buyer}} accepts that a 0.5% fee will be charged if and when they sell the RAM received. {{buyer}} accepts that rounding errors resulting from limits of computational precision may result in less RAM being allocated. {{buyer}} acknowledges that the supply of RAM may be increased at any time up to the limits of off-the-shelf computer equipment and that this may result in RAM selling for less than purchase price. From 6dc27f63f7f03d2e5ef0b03b1a1378d518dfad1f Mon Sep 17 00:00:00 2001 From: Thomas Cox Date: Thu, 31 May 2018 09:59:06 -0400 Subject: [PATCH 33/36] Update eosio.system-sellram-rc.md removed 'SYS' --- contracts/eosio.system/eosio.system-sellram-rc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/eosio.system/eosio.system-sellram-rc.md b/contracts/eosio.system/eosio.system-sellram-rc.md index ad4f616f03f..316c7deca3f 100644 --- a/contracts/eosio.system/eosio.system-sellram-rc.md +++ b/contracts/eosio.system/eosio.system-sellram-rc.md @@ -2,7 +2,7 @@ ### Description -The `{{ sellram }}` action sells unused RAM for SYS tokens. +The `{{ sellram }}` action sells unused RAM for tokens. ### Inputs and Input Types From 704d01f3c9b83c6a642993d40e21a5cf23fc9836 Mon Sep 17 00:00:00 2001 From: Anton Perkov Date: Thu, 31 May 2018 10:21:45 -0400 Subject: [PATCH 34/36] fixes for json parsing for from bitshares #3539 --- libraries/fc/include/fc/io/json.hpp | 20 ++-- libraries/fc/include/fc/io/json_relaxed.hpp | 18 ++-- libraries/fc/src/io/json.cpp | 112 ++++++++------------ 3 files changed, 67 insertions(+), 83 deletions(-) diff --git a/libraries/fc/include/fc/io/json.hpp b/libraries/fc/include/fc/io/json.hpp index e35517a9a63..1395cf75b32 100644 --- a/libraries/fc/include/fc/io/json.hpp +++ b/libraries/fc/include/fc/io/json.hpp @@ -2,6 +2,8 @@ #include #include +#define DEFAULT_MAX_RECURSION_DEPTH 200 + namespace fc { using std::ostream; @@ -32,12 +34,12 @@ namespace fc static ostream& to_stream( ostream& out, const variants& v, output_formatting format = stringify_large_ints_and_doubles ); static ostream& to_stream( ostream& out, const variant_object& v, output_formatting format = stringify_large_ints_and_doubles ); - static variant from_string( const string& utf8_str, parse_type ptype = legacy_parser ); - static variants variants_from_string( const string& utf8_str, parse_type ptype = legacy_parser ); + static variant from_string( const string& utf8_str, parse_type ptype = legacy_parser, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH ); + static variants variants_from_string( const string& utf8_str, parse_type ptype = legacy_parser, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH ); static string to_string( const variant& v, output_formatting format = stringify_large_ints_and_doubles ); static string to_pretty_string( const variant& v, output_formatting format = stringify_large_ints_and_doubles ); - static bool is_valid( const std::string& json_str, parse_type ptype = legacy_parser ); + static bool is_valid( const std::string& json_str, parse_type ptype = legacy_parser, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH ); template static void save_to_file( const T& v, const fc::path& fi, bool pretty = true, output_formatting format = stringify_large_ints_and_doubles ) @@ -46,16 +48,16 @@ namespace fc } static void save_to_file( const variant& v, const fc::path& fi, bool pretty = true, output_formatting format = stringify_large_ints_and_doubles ); - static variant from_file( const fc::path& p, parse_type ptype = legacy_parser ); + static variant from_file( const fc::path& p, parse_type ptype = legacy_parser, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH ); template - static T from_file( const fc::path& p, parse_type ptype = legacy_parser ) + static T from_file( const fc::path& p, parse_type ptype = legacy_parser, uint32_t max_depth = DEFAULT_MAX_RECURSION_DEPTH ) { - return json::from_file(p, ptype).as(); + return json::from_file(p, ptype, max_depth).as(); } template - static string to_string( const T& v, output_formatting format = stringify_large_ints_and_doubles ) + static string to_string( const T& v, output_formatting format = stringify_large_ints_and_doubles ) { return to_string( variant(v), format ); } @@ -69,8 +71,10 @@ namespace fc template static void save_to_file( const T& v, const std::string& p, bool pretty = true, output_formatting format = stringify_large_ints_and_doubles ) { - save_to_file( variant(v), fc::path(p), pretty ); + save_to_file( variant(v), fc::path(p), pretty, format ); } }; } // fc + +#undef DEFAULT_MAX_RECURSION_DEPTH diff --git a/libraries/fc/include/fc/io/json_relaxed.hpp b/libraries/fc/include/fc/io/json_relaxed.hpp index 3ddf0ae894f..c2691d44bec 100644 --- a/libraries/fc/include/fc/io/json_relaxed.hpp +++ b/libraries/fc/include/fc/io/json_relaxed.hpp @@ -21,7 +21,7 @@ namespace fc { namespace json_relaxed { template - variant variant_from_stream( T& in ); + variant variant_from_stream( T& in, uint32_t max_depth ); template std::string tokenFromStream( T& in ) @@ -562,7 +562,7 @@ namespace fc { namespace json_relaxed } FC_CAPTURE_AND_RETHROW( (token) ) } template - variant_object objectFromStream( T& in ) + variant_object objectFromStream( T& in, uint32_t max_depth ) { mutable_variant_object obj; try @@ -590,7 +590,7 @@ namespace fc { namespace json_relaxed ("key", key) ); } in.get(); - auto val = json_relaxed::variant_from_stream( in ); + auto val = json_relaxed::variant_from_stream( in, max_depth - 1 ); obj(std::move(key),std::move(val)); skip_white_space(in); @@ -613,7 +613,7 @@ namespace fc { namespace json_relaxed } template - variants arrayFromStream( T& in ) + variants arrayFromStream( T& in, uint32_t max_depth ) { variants ar; try @@ -631,7 +631,7 @@ namespace fc { namespace json_relaxed continue; } if( skip_white_space(in) ) continue; - ar.push_back( json_relaxed::variant_from_stream(in) ); + ar.push_back( json_relaxed::variant_from_stream(in, max_depth - 1) ); skip_white_space(in); } if( in.peek() != ']' ) @@ -686,7 +686,7 @@ namespace fc { namespace json_relaxed } template - variant variant_from_stream( T& in ) + variant variant_from_stream( T& in, uint32_t max_depth ) { skip_white_space(in); variant var; @@ -701,11 +701,11 @@ namespace fc { namespace json_relaxed in.get(); continue; case '"': - return json_relaxed::stringFromStream( in ); + return json_relaxed::stringFromStream( in ); case '{': - return json_relaxed::objectFromStream( in ); + return json_relaxed::objectFromStream( in, max_depth - 1 ); case '[': - return json_relaxed::arrayFromStream( in ); + return json_relaxed::arrayFromStream( in, max_depth - 1 ); case '-': case '+': case '.': diff --git a/libraries/fc/src/io/json.cpp b/libraries/fc/src/io/json.cpp index 281634c3853..57c6462aa0c 100644 --- a/libraries/fc/src/io/json.cpp +++ b/libraries/fc/src/io/json.cpp @@ -13,13 +13,13 @@ namespace fc { // forward declarations of provided functions - template variant variant_from_stream( T& in ); + template variant variant_from_stream( T& in, uint32_t max_depth ); template char parseEscape( T& in ); template std::string stringFromStream( T& in ); template bool skip_white_space( T& in ); template std::string stringFromToken( T& in ); - template variant_object objectFromStream( T& in ); - template variants arrayFromStream( T& in ); + template variant_object objectFromStream( T& in, uint32_t max_depth ); + template variants arrayFromStream( T& in, uint32_t max_depth ); template variant number_from_stream( T& in ); template variant token_from_stream( T& in ); void escape_string( const std::string& str, std::ostream& os ); @@ -169,7 +169,7 @@ namespace fc } template - variant_object objectFromStream( T& in ) + variant_object objectFromStream( T& in, uint32_t max_depth ) { mutable_variant_object obj; try @@ -180,7 +180,6 @@ namespace fc "Expected '{', but read '${char}'", ("char",string(&c, &c + 1)) ); in.get(); - skip_white_space(in); while( in.peek() != '}' ) { if( in.peek() == ',' ) @@ -197,10 +196,10 @@ namespace fc ("key", key) ); } in.get(); - auto val = variant_from_stream( in ); + auto val = variant_from_stream( in, max_depth - 1 ); obj(std::move(key),std::move(val)); - skip_white_space(in); + //skip_white_space(in); } if( in.peek() == '}' ) { @@ -220,7 +219,7 @@ namespace fc } template - variants arrayFromStream( T& in ) + variants arrayFromStream( T& in, uint32_t max_depth ) { variants ar; try @@ -238,7 +237,7 @@ namespace fc continue; } if( skip_white_space(in) ) continue; - ar.push_back( variant_from_stream(in) ); + ar.push_back( variant_from_stream( in, max_depth - 1) ); skip_white_space(in); } if( in.peek() != ']' ) @@ -307,7 +306,7 @@ namespace fc { } std::string str = ss.str(); - if (str == "-." || str == ".") // check the obviously wrong things we could have encountered + if (str == "-." || str == "." || str == "-") // check the obviously wrong things we could have encountered FC_THROW_EXCEPTION(parse_error_exception, "Can't parse token \"${token}\" as a JSON numeric constant", ("token", str)); if( dot ) return parser_type == json::legacy_parser_with_string_doubles ? variant(str) : variant(to_double(str)); @@ -388,8 +387,10 @@ namespace fc template - variant variant_from_stream( T& in ) + variant variant_from_stream( T& in, uint32_t max_depth ) { + if( max_depth == 0 ) + FC_THROW_EXCEPTION( parse_error_exception, "Too many nested items in JSON input!" ); skip_white_space(in); variant var; while( 1 ) @@ -406,9 +407,9 @@ namespace fc case '"': return stringFromStream( in ); case '{': - return objectFromStream( in ); + return objectFromStream( in, max_depth - 1 ); case '[': - return arrayFromStream( in ); + return arrayFromStream( in, max_depth - 1 ); case '-': case '.': case '0': @@ -439,50 +440,27 @@ namespace fc return variant(); } - - /** the purpose of this check is to verify that we will not get a stack overflow in the recursive descent parser */ - void check_string_depth( const string& utf8_str ) - { - int32_t open_object = 0; - int32_t open_array = 0; - for( auto c : utf8_str ) - { - switch( c ) - { - case '{': open_object++; break; - case '}': open_object--; break; - case '[': open_array++; break; - case ']': open_array--; break; - default: break; - } - FC_ASSERT( open_object < 100 && open_array < 100, "object graph too deep", ("object depth",open_object)("array depth", open_array) ); - } - } - - variant json::from_string( const std::string& utf8_str, parse_type ptype ) + variant json::from_string( const std::string& utf8_str, parse_type ptype, uint32_t max_depth ) { try { - check_string_depth( utf8_str ); - std::stringstream in( utf8_str ); //in.exceptions( std::ifstream::eofbit ); switch( ptype ) { case legacy_parser: - return variant_from_stream( in ); + return variant_from_stream( in, max_depth ); case legacy_parser_with_string_doubles: - return variant_from_stream( in ); + return variant_from_stream( in, max_depth ); case strict_parser: - return json_relaxed::variant_from_stream( in ); + return json_relaxed::variant_from_stream( in, max_depth ); case relaxed_parser: - return json_relaxed::variant_from_stream( in ); + return json_relaxed::variant_from_stream( in, max_depth ); default: FC_ASSERT( false, "Unknown JSON parser type {ptype}", ("ptype", ptype) ); } } FC_RETHROW_EXCEPTIONS( warn, "", ("str",utf8_str) ) } - variants json::variants_from_string( const std::string& utf8_str, parse_type ptype ) + variants json::variants_from_string( const std::string& utf8_str, parse_type ptype, uint32_t max_depth ) { try { - check_string_depth( utf8_str ); variants result; std::stringstream in( utf8_str ); //in.exceptions( std::ifstream::eofbit ); @@ -490,7 +468,7 @@ namespace fc while( true ) { // result.push_back( variant_from_stream( in )); - result.push_back(json_relaxed::variant_from_stream( in )); + result.push_back(json_relaxed::variant_from_stream( in, max_depth )); } } catch ( const fc::eof_exception& ){} return result; @@ -678,10 +656,12 @@ namespace fc to_stream(os, o, format ); return; } + default: + FC_THROW_EXCEPTION( fc::invalid_arg_exception, "Unsupported variant type: " + v.get_type() ); } } - std::string json::to_string( const variant& v, output_formatting format /* = stringify_large_ints_and_doubles */ ) + std::string json::to_string( const variant& v, output_formatting format ) { std::stringstream ss; fc::to_stream( ss, v, format ); @@ -779,16 +759,16 @@ namespace fc - std::string json::to_pretty_string( const variant& v, output_formatting format /* = stringify_large_ints_and_doubles */ ) + std::string json::to_pretty_string( const variant& v, output_formatting format ) { - return pretty_print(to_string(v, format), 2); + return pretty_print(to_string(v, format), 2); } - void json::save_to_file( const variant& v, const fc::path& fi, bool pretty, output_formatting format /* = stringify_large_ints_and_doubles */ ) + void json::save_to_file( const variant& v, const fc::path& fi, bool pretty, output_formatting format ) { if( pretty ) { - auto str = json::to_pretty_string( v, format ); + auto str = json::to_pretty_string( v, format ); std::ofstream o(fi.generic_string().c_str()); o.write( str.c_str(), str.size() ); } @@ -798,7 +778,7 @@ namespace fc fc::to_stream( o, v, format ); } } - variant json::from_file( const fc::path& p, parse_type ptype ) + variant json::from_file( const fc::path& p, parse_type ptype, uint32_t max_depth ) { //auto tmp = std::make_shared( p, ifstream::binary ); //auto tmp = std::make_shared( p.generic_string().c_str(), std::ios::binary ); @@ -807,69 +787,69 @@ namespace fc switch( ptype ) { case legacy_parser: - return variant_from_stream( bi ); + return variant_from_stream( bi, max_depth ); case legacy_parser_with_string_doubles: - return variant_from_stream( bi ); + return variant_from_stream( bi, max_depth ); case strict_parser: - return json_relaxed::variant_from_stream( bi ); + return json_relaxed::variant_from_stream( bi, max_depth ); case relaxed_parser: - return json_relaxed::variant_from_stream( bi ); + return json_relaxed::variant_from_stream( bi, max_depth ); default: FC_ASSERT( false, "Unknown JSON parser type {ptype}", ("ptype", ptype) ); } } /* - variant json::from_stream( buffered_istream& in, parse_type ptype ) + variant json::from_stream( buffered_istream& in, parse_type ptype, uint32_t max_depth ) { switch( ptype ) { case legacy_parser: - return variant_from_stream( in ); + return variant_from_stream( in, max_depth ); case legacy_parser_with_string_doubles: - return variant_from_stream( in ); + return variant_from_stream( in, max_depth ); case strict_parser: - return json_relaxed::variant_from_stream( in ); + return json_relaxed::variant_from_stream( in, max_depth ); case relaxed_parser: - return json_relaxed::variant_from_stream( in ); + return json_relaxed::variant_from_stream( in, max_depth ); default: FC_ASSERT( false, "Unknown JSON parser type {ptype}", ("ptype", ptype) ); } } */ - std::ostream& json::to_stream( std::ostream& out, const variant& v, output_formatting format /* = stringify_large_ints_and_doubles */ ) + std::ostream& json::to_stream( std::ostream& out, const variant& v, output_formatting format ) { fc::to_stream( out, v, format ); return out; } - std::ostream& json::to_stream( std::ostream& out, const variants& v, output_formatting format /* = stringify_large_ints_and_doubles */ ) + std::ostream& json::to_stream( std::ostream& out, const variants& v, output_formatting format ) { fc::to_stream( out, v, format ); return out; } - std::ostream& json::to_stream( std::ostream& out, const variant_object& v, output_formatting format /* = stringify_large_ints_and_doubles */ ) + std::ostream& json::to_stream( std::ostream& out, const variant_object& v, output_formatting format ) { fc::to_stream( out, v, format ); return out; } - bool json::is_valid( const std::string& utf8_str, parse_type ptype ) + bool json::is_valid( const std::string& utf8_str, parse_type ptype, uint32_t max_depth ) { if( utf8_str.size() == 0 ) return false; std::stringstream in( utf8_str ); switch( ptype ) { case legacy_parser: - variant_from_stream( in ); + variant_from_stream( in, max_depth ); break; case legacy_parser_with_string_doubles: - variant_from_stream( in ); + variant_from_stream( in, max_depth ); break; case strict_parser: - json_relaxed::variant_from_stream( in ); + json_relaxed::variant_from_stream( in, max_depth ); break; case relaxed_parser: - json_relaxed::variant_from_stream( in ); + json_relaxed::variant_from_stream( in, max_depth ); break; default: FC_ASSERT( false, "Unknown JSON parser type {ptype}", ("ptype", ptype) ); From 34f39cb3f78461c4f24c73336e4f2ed177808022 Mon Sep 17 00:00:00 2001 From: Bill Hamilton Date: Thu, 31 May 2018 14:27:21 +0000 Subject: [PATCH 35/36] Ubuntu: moved opt/boost_1_67_0 to opt/boost --- eosio_build.sh | 6 +++--- scripts/eosio_build_amazon.sh | 4 ++-- scripts/eosio_build_ubuntu.sh | 21 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/eosio_build.sh b/eosio_build.sh index 67f7e939f3c..1c9e89b68e9 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -161,7 +161,7 @@ C_COMPILER=clang-4.0 MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost" ;; "Fedora") FILE="${PWD}/scripts/eosio_build_fedora.sh" @@ -177,7 +177,7 @@ C_COMPILER=clang-4.0 MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost" ;; "Ubuntu") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" @@ -185,7 +185,7 @@ C_COMPILER=clang-4.0 MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost" ;; *) printf "\\n\\tUnsupported Linux Distribution. Exiting now.\\n\\n" diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index 285c3fad0de..5e31d0cfc52 100644 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -214,7 +214,7 @@ if [ -d "${HOME}/opt/boost_1_67_0" ]; then if ! mv "${HOME}/opt/boost_1_67_0" "$BOOST_ROOT" then - printf "\\n\\tUnable to move directory ${HOME}/opt/boost_1_67_0 to ${BOOST_ROOT}.\\n" + printf "\\n\\tUnable to move directory %s/opt/boost_1_67_0 to %s.\\n" "${HOME}" "${BOOST_ROOT}" printf "\\n\\tExiting now.\\n" exit 1 fi @@ -299,7 +299,7 @@ fi printf "\\tBoost successfully installed @ %s.\\n" "${BOOST_ROOT}" else - printf "\\tBoost 1.67.0 found at %s.\\n" "${BOOST_ROOT}" + printf "\\tBoost found at %s.\\n" "${BOOST_ROOT}" fi printf "\\n\\tChecking MongoDB installation.\\n" diff --git a/scripts/eosio_build_ubuntu.sh b/scripts/eosio_build_ubuntu.sh index c75fa2ea228..e27372b72a2 100644 --- a/scripts/eosio_build_ubuntu.sh +++ b/scripts/eosio_build_ubuntu.sh @@ -106,6 +106,23 @@ printf "\\n\\tNo required dpkg dependencies to install.\\n" fi + if [ -d "${HOME}/opt/boost_1_67_0" ]; then + if ! mv "${HOME}/opt/boost_1_67_0" "$BOOST_ROOT" + then + printf "\\n\\tUnable to move directory %s/opt/boost_1_67_0 to %s.\\n" "${HOME}" "${BOOST_ROOT}" + printf "\\n\\tExiting now.\\n" + exit 1 + fi + if [ -d "$BUILD_DIR" ]; then + if ! rm -rf "$BUILD_DIR" + then + printf "\\tUnable to remove directory %s. Please remove this directory and run this script %s again. 0\\n" "$BUILD_DIR" "${BASH_SOURCE[0]}" + printf "\\tExiting now.\\n\\n" + exit 1; + fi + fi + fi + printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep BOOST_LIB_VERSION "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3 | sed 's/[^0-9\._]//gI') @@ -174,9 +191,9 @@ exit 1; fi fi - printf "\\tBoost 1.67.0 successfully installed @ %s/opt/boost_1_67_0.\\n" "${HOME}" + printf "\\tBoost successfully installed @ %s.\\n" "${BOOST_ROOT}" else - printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\tBoost found at %s.\\n" "${BOOST_ROOT}" fi printf "\\n\\tChecking MongoDB installation.\\n" From 9dcd921d0355dac11b5b2231993abd87076fe61a Mon Sep 17 00:00:00 2001 From: arhag Date: Thu, 31 May 2018 11:04:49 -0400 Subject: [PATCH 36/36] change default max-irreversible-block-age to unlimited #3663 --- plugins/producer_plugin/producer_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 464e112e271..c252e7d7ee9 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -412,8 +412,8 @@ void producer_plugin::set_program_options( ("pause-on-startup,x", boost::program_options::bool_switch()->notifier([this](bool p){my->_pause_production = p;}), "Start this node in a state where production is paused") ("max-transaction-time", bpo::value()->default_value(30), "Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute before being considered invalid") - ("max-irreversible-block-age", bpo::value()->default_value( 30 * 60 ), - "Limits the maximum age (in seconds) of the DPOS Irreversible Block for a chain this node will produce blocks on") + ("max-irreversible-block-age", bpo::value()->default_value( -1 ), + "Limits the maximum age (in seconds) of the DPOS Irreversible Block for a chain this node will produce blocks on (use negative value to indicate unlimited)") ("producer-name,p", boost::program_options::value>()->composing()->multitoken(), "ID of producer controlled by this node (e.g. inita; may specify multiple times)") ("private-key", boost::program_options::value>()->composing()->multitoken()->default_value({fc::json::to_string(private_key_default)},