dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.2k forks source link

feat: make whitelist works with composite commands for platform needs #6100

Closed knst closed 1 month ago

knst commented 2 months ago

Issue being fixed or feature implemented

https://github.com/dashpay/dash-issues/issues/66 https://github.com/dashpay/dash-issues/issues/65

What was done?

Our composite commands such as "quorum list" have been refactored to make them truly compatible with other features, such as whitelist, see https://github.com/dashpay/dash/pull/6052 https://github.com/dashpay/dash/pull/6051 https://github.com/dashpay/dash/pull/6055 and other related PRs

This PR makes whitelist feature to be compatible with composite commands.

Instead implementing additional users such "dapi" better to provide universal way which do not require new build for every new API that has been used by platform, let's simplify things.

Platform at their side can use config such as this one (created based on shumkov's example):

rpc: {
          host: '127.0.0.1',
          port: 9998,
          users: [
            {
              user: 'dashmate',
              password: 'rpcpassword',
              whitelist: null,
              lowPriority: false,
            },
            {
              username: 'platform-dapi',
              password: 'rpcpassword',
              whitelist: [],
              lowPriority: true,
            },
            {
              username: 'platform-drive-consensus',
              password: 'rpcpassword',
              whitelist: [getbestchainlock,getblockchaininfo,getrawtransaction,submitchainlock,verifychainlock,protx_listdiff,quorum_listextended,quorum_info,getassetunlockstatuses,sendrawtransaction,mnsync_status]
              lowPriority: false,
            },
            {
              username: 'platform-drive-other',
              password: 'rpcpassword',
              whitelist: [getbestchainlock,getblockchaininfo,getrawtransaction,submitchainlock,verifychainlock,protx_listdiff,quorum_listextended,quorum_info,getassetunlockstatuses,sendrawtransaction,mnsync_status]
],
              lowPriority: true,
            },
          ],
          allowIps: ['127.0.0.1', '172.16.0.0/12', '192.168.0.0/16'],
        },

How Has This Been Tested?

Updated functional tests, see commits

Breaking Changes

n/a

Checklist:

UdjinM6 commented 1 month ago

We should split this PR in 2 separate ones imo:

github-actions[bot] commented 1 month ago

This pull request has conflicts, please rebase.

knst commented 1 month ago

@knst knst force-pushed the feat-whitelist-composite branch from 2ac4c0e to 85abbb9

resolved conflicts

PastaPastaPasta commented 1 month ago

back ported in #6115