RPC method ’encodescript' #14476

pull rodentrabies wants to merge 4 commits into bitcoin:master from rodentrabies:encodescript-rpc changing 4 files +211 −5
  1. rodentrabies commented at 7:38 pm on October 13, 2018: contributor
    Implements proposal in #12948. Fixes the problem with white space delimiters inside single-quoted strings in ParseScript.
  2. rpc: implement 'encodescript' RPC method a534ee15f0
  3. rodentrabies force-pushed on Oct 13, 2018
  4. util: handle spaces/tabs/newlines inside quoted strings in ParseScript 67404434fa
  5. meshcollider added the label RPC/REST/ZMQ on Oct 13, 2018
  6. meshcollider commented at 8:01 am on October 14, 2018: contributor
    Concept ACK
  7. util: replace boost::split with std::regex tokenizer 86315aa485
  8. in src/core_read.cpp:50 in 67404434fa outdated
    45@@ -46,8 +46,24 @@ CScript ParseScript(const std::string& s)
    46         }
    47     }
    48 
    49+    std::vector<std::string> blocks;
    50     std::vector<std::string> words;
    51-    boost::algorithm::split(words, s, boost::algorithm::is_any_of(" \t\n"), boost::algorithm::token_compress_on);
    


    fanquake commented at 11:37 am on October 14, 2018:
    These changes are overlapping with the work in #13751, here: https://github.com/bitcoin/bitcoin/pull/13751/files#diff-846395c972e400d3933d195c29740098R50. It might be worth helping review those changes, and/or considering how to do this without introducing new Boost usage, as the project is trying to reduce it where possible, see https://github.com/bitcoin/bitcoin/projects/3.

    rodentrabies commented at 2:57 pm on October 14, 2018:

    Thanks for pointing that out. Some of the ways to resolve this:

    • function Split implemented in #13751 can be used in place of boost::algorithm::split introduced here as well, so it may be resolved by either amending to this commit, or to the one #13751, depending on what’s first to get to master;
    • since this change is not that important for this PR, so I can just delete the last commit and it push it when boost’s split is eliminated in one way or another;
    • implement small split utility and use it here, but that again overlaps with #13751;
    • use std::regex.

    rodentrabies commented at 5:12 pm on October 14, 2018:
    See 86315aa for std::regex-based tokenizer. Noticed there’s no std::regex usage throughout code base, so let me know if there’s any policy against that.
  9. rodentrabies force-pushed on Oct 15, 2018
  10. test: add functional test for 'encodescript' RPC 2c5f9d5c2f
  11. rodentrabies force-pushed on Oct 15, 2018
  12. rodentrabies closed this on Oct 15, 2018

  13. rodentrabies reopened this on Oct 15, 2018

  14. sipa commented at 7:49 am on October 17, 2018: member
    I’m not convinced we need more pure utility functionality as RPCs. These things can be implemented as a library or whatever.
  15. laanwj commented at 10:21 am on October 18, 2018: member
    I tend to agree with @sipa though also this discussion should probably have been done in #12948, @mrwhythat simply picked an open issue which didn’t seem to have anyone protesting against it, and implemented it
  16. DrahtBot commented at 10:00 am on October 20, 2018: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #13751 (Utils and libraries: Drops the boost/algorithm/string/split.hpp dependency by 251Labs)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  17. Sjors commented at 3:24 pm on November 6, 2018: member
    I created an issue to discuss a tool that could replace pure utility RPC calls: #14671
  18. in src/rpc/rawtransaction.cpp:581 in 2c5f9d5c2f
    573@@ -574,6 +574,40 @@ static UniValue decoderawtransaction(const JSONRPCRequest& request)
    574     return result;
    575 }
    576 
    577+static UniValue encodescript(const JSONRPCRequest& request)
    578+{
    579+    if (request.fHelp || request.params.size() != 1)
    580+        throw std::runtime_error(
    581+            "encodescript \"asm\"\n"
    


    MarcoFalke commented at 11:21 pm on November 13, 2018:
    Needs rebase and be switched to RPCHelpMan{"encodescript", { ...
  19. rodentrabies commented at 5:53 pm on December 12, 2018: contributor
    Closing this because #12984 was rejected.
  20. rodentrabies closed this on Dec 12, 2018

  21. rodentrabies deleted the branch on Mar 15, 2021
  22. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-08 22:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me