From 045d936369d60ca747079f299fd345c6ac81f346 Mon Sep 17 00:00:00 2001 From: vsmk98 Date: Wed, 15 May 2019 17:12:11 +0800 Subject: [PATCH] permission: Code and documentation clean up --- cmd/geth/main.go | 4 ++-- core/quorum/api.go | 4 ++-- core/tx_pool.go | 2 +- docs/Permissioning/Permissioning apis.md | 8 ++++---- eth/downloader/downloader.go | 1 - mkdocs.yml | 4 +++- permission/permission.go | 10 +++++----- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 1c19e6149..bb9dcf037 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -345,7 +345,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { } }() - //START - QUORUM Permissioning + //START - QUORUM permission service go startQuorumPermissionService(ctx, stack) // Start auxiliary services if enabled @@ -376,7 +376,7 @@ func startNode(ctx *cli.Context, stack *node.Node) { } -// Starts the permissioning services. services will come up only when +// Starts the permission services. services will come up only when // geth is brought up in --permissioned mode and permission-config.json is present func startQuorumPermissionService(ctx *cli.Context, stack *node.Node) { diff --git a/core/quorum/api.go b/core/quorum/api.go index 0a038ca65..7171be67e 100644 --- a/core/quorum/api.go +++ b/core/quorum/api.go @@ -420,11 +420,11 @@ func (s *QuorumControlsAPI) valSubOrgBreadthDepth(porgId string) (ExecStatus, er org := types.OrgInfoMap.GetOrg(porgId) if s.permConfig.SubOrgDepth.Cmp(org.Level) == 0 { - return ErrMaxDepth, errors.New("max depth for suborgs reached") + return ErrMaxDepth, errors.New("max depth for sub orgs reached") } if s.permConfig.SubOrgBreadth.Cmp(big.NewInt(int64(len(org.SubOrgList)))) == 0 { - return ErrMaxBreadth, errors.New("max breadth for suborgs reached") + return ErrMaxBreadth, errors.New("max breadth for sub orgs reached") } return ExecSuccess, nil diff --git a/core/tx_pool.go b/core/tx_pool.go index c0cbcd721..4c3d87d0e 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1318,7 +1318,7 @@ func (t *txLookup) Remove(hash common.Hash) { delete(t.all, hash) } -// checks if the account is permissioned for transaction +// checks if the account is has the necessary access for the transaction func checkAccount(fromAcct common.Address, toAcct *common.Address) error { access := types.GetAcctAccess(fromAcct) diff --git a/docs/Permissioning/Permissioning apis.md b/docs/Permissioning/Permissioning apis.md index 808ed6e5d..f650b4c97 100644 --- a/docs/Permissioning/Permissioning apis.md +++ b/docs/Permissioning/Permissioning apis.md @@ -130,8 +130,8 @@ This returns the list of accounts, nodes, roles, and sub organizations linked to } ``` #### quorumPermission.addOrg -This api can be executed by a network admin account only for proposing a new organization into the network -* Input: Unique alphanumeric organization id, enode id, account id +This api can be executed by a network admin account (`from:` in transactions args) only for proposing a new organization into the network +* Input: Unique alphanumeric organization id, enode id, account id (org admin account) * Output: Status of the operation * Example: ``` @@ -162,8 +162,8 @@ If there are any pending items for approval, proposal of any new organization wi ``` #### quorumPermission.approveOrg -This api can be executed by a network admin account only for approving a proposed organization into the network. -* Input: Unique organization id, enode id, account id +This api can be executed by a network admin account (`from:` in transactions args) only for approving a proposed organization into the network. +* Input: Unique organization id, enode id, account id (org admin account) * Output: Status of the operation * Example: ``` diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index e658c0dd6..f3f046f32 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -347,7 +347,6 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode if d.synchroniseMock != nil { return d.synchroniseMock(id, hash) } - // Make sure only one goroutine is ever allowed past this point at once if !atomic.CompareAndSwapInt32(&d.synchronising, 0, 1) { return errBusy diff --git a/mkdocs.yml b/mkdocs.yml index dd086df38..31a69b4b5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,11 +23,13 @@ nav: - Raft: Consensus/raft.md - Istanbul: Consensus/istanbul-rpc-api.md - Transaction Processing: Transaction Processing/Transaction Processing.md + - Security: + - Security & Permissioning: Security/Security & Permissioning.md - Permissioning: - Overview: Permissioning/Overview.md - Design: Permissioning/Contract Design.md - Setup: Permissioning/setup.md - - API: Permissioning/Permissioning apis.md + - API: Permissioning/Permissioning apis.md - Usage: Permissioning/Usage.md - Privacy: - Tessera: diff --git a/permission/permission.go b/permission/permission.go index 921084f7c..3d2ae8c43 100644 --- a/permission/permission.go +++ b/permission/permission.go @@ -99,7 +99,7 @@ func populateConfig(config PermissionLocalConfig) types.PermissionConfig { } // function reads the permissions config file passed and populates the -// config structure accrodingly +// config structure accordingly func ParsePermissionConifg(dir string) (types.PermissionConfig, error) { fileName := "permission-config.json" fullPath := filepath.Join(dir, fileName) @@ -133,8 +133,8 @@ func ParsePermissionConifg(dir string) (types.PermissionConfig, error) { return permConfig, nil } -// for cases where the node is joining an existing network, permissioning -// service can be brought up only after block syncing is complete. This function +// for cases where the node is joining an existing network, permission service +// can be brought up only after block syncing is complete. This function // waits for block syncing before the starting permissions func waitForSync(e *eth.Ethereum) { for !types.GetSyncStatus() { @@ -147,7 +147,7 @@ func waitForSync(e *eth.Ethereum) { // Creates the controls structure for permissions func NewQuorumPermissionCtrl(stack *node.Node, permissionedMode, isRaft bool, pconfig *types.PermissionConfig) (*PermissionCtrl, error) { - // Create a new ethclient to for interfacing with the contract + // Create a new eth client to for interfacing with the contract stateReader, e, err := CreateEthClient(stack) waitForSync(e) if err != nil { @@ -526,7 +526,7 @@ func (p *PermissionCtrl) disconnectNode(enodeId string) { } // Thus function checks if the initial network boot up status and if no -// populates permissioning model with details from permission-config.json +// populates permissions model with details from permission-config.json func (p *PermissionCtrl) populateInitPermissions() error { auth := bind.NewKeyedTransactor(p.key) permInterfSession := &pbind.PermInterfaceSession{