mirror of
https://gitee.com/BTAJL/repchain.git
synced 2024-11-29 18:28:27 +08:00
repchain2.0-update77:不再支持非DID账户管理合约。
This commit is contained in:
parent
5d1e4e61e9
commit
bfd8d8a02c
@ -141,8 +141,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -129,8 +129,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,6 @@ system {
|
||||
account {
|
||||
chain_code_name = "RdidOperateAuthorizeTPL"#账户管理合约的名称,使用did配置:RdidOperateAuthorizeTPL;使用非did配置:ContractCert
|
||||
chain_code_version = 1
|
||||
#证书状态改变函数名
|
||||
cert_status_change_function = "UpdateCertStatus"
|
||||
cache_size = 10000 //账户权限信息缓存大小,默认10000
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -256,10 +256,6 @@ class RepChainConfig {
|
||||
this.sysConf.getInt("system.account.chain_code_version")
|
||||
}
|
||||
|
||||
def getAccountCertChangeMethod:String={
|
||||
this.sysConf.getString("system.account.cert_status_change_function")
|
||||
}
|
||||
|
||||
def getAccountCacheSize:Int={
|
||||
this.sysConf.getInt("system.account.cache_size")
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ import rep.utils._
|
||||
import rep.network.tools.PeerExtension
|
||||
import rep.log.{RepLogger, RepTimeTracer}
|
||||
import rep.proto.rc2.{ActionResult, ChaincodeId, Transaction, TransactionResult}
|
||||
import rep.sc.Sandbox.SandboxException
|
||||
import rep.storage.chain.KeyPrefixManager
|
||||
|
||||
import scala.collection.immutable.HashMap
|
||||
|
||||
|
||||
@ -248,13 +250,14 @@ abstract class Sandbox(cid: ChaincodeId) extends Actor {
|
||||
case Transaction.Type.CHAINCODE_DEPLOY =>
|
||||
dotrans.contractStateType match {
|
||||
case ContractStateType.ContractInLevelDB =>
|
||||
throw new SandboxException(ERR_REPEATED_CID)
|
||||
throw SandboxException(ERR_REPEATED_CID)
|
||||
case _ =>
|
||||
//检查合约部署者以及权限
|
||||
if(IdTool.isDidContract(pe.getRepChainContext.getConfig.getAccountContractName)){
|
||||
permissioncheck.CheckPermissionOfDeployContract(dotrans)
|
||||
}else{
|
||||
IsCurrentSigner(dotrans)
|
||||
throw SandboxException(ERR_NONDID_CONTRACT)
|
||||
//IsCurrentSigner(dotrans)
|
||||
}
|
||||
}
|
||||
case Transaction.Type.CHAINCODE_SET_STATE =>
|
||||
@ -262,7 +265,8 @@ abstract class Sandbox(cid: ChaincodeId) extends Actor {
|
||||
if(IdTool.isDidContract(pe.getRepChainContext.getConfig.getAccountContractName)){
|
||||
permissioncheck.CheckPermissionOfSetStateContract(dotrans)
|
||||
}else{
|
||||
IsCurrentSigner(dotrans)
|
||||
throw SandboxException(ERR_NONDID_CONTRACT)
|
||||
//IsCurrentSigner(dotrans)
|
||||
}
|
||||
|
||||
case Transaction.Type.CHAINCODE_INVOKE =>
|
||||
@ -274,6 +278,8 @@ abstract class Sandbox(cid: ChaincodeId) extends Actor {
|
||||
}else{
|
||||
if(IdTool.isDidContract(pe.getRepChainContext.getConfig.getAccountContractName)) {
|
||||
permissioncheck.CheckPermissionOfInvokeContract(dotrans)
|
||||
}else{
|
||||
throw SandboxException(ERR_NONDID_CONTRACT)
|
||||
}
|
||||
}
|
||||
case _ => throw SandboxException(ERR_UNKNOWN_TRANSACTION_TYPE)
|
||||
|
@ -28,6 +28,7 @@ object SandboxDispatcher {
|
||||
val ERR_REPEATED_CID = "存在重复的合约Id"
|
||||
val ERR_CODER = "合约只能由部署者升级更新"
|
||||
val ERR_DISABLE_CID = "合约处于禁用状态"
|
||||
val ERR_NONDID_CONTRACT = "系统不支持非DID账户管理合约"
|
||||
|
||||
//权限检查异常消息预定义
|
||||
val ERR_NO_PERMISSION_OF_DEPLOY = "没有合约部署的权限"
|
||||
|
@ -69,7 +69,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
//val chainCodeId = IdTool.getCid(t.getCid)
|
||||
//val oid = if(t.oid.isEmpty) "_" else t.oid.toString
|
||||
val accountContractName = ctx.getConfig.getAccountContractName
|
||||
val certMethod = ctx.getConfig.getAccountCertChangeMethod
|
||||
|
||||
val memberContractName = ctx.getConfig.getMemberManagementContractName
|
||||
val memberContractMethod = ctx.getConfig.getMemberManagementContractMethod
|
||||
@ -85,10 +84,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && IdTool.isDidContract(accountContractName)) {
|
||||
//账户修改
|
||||
ctx.getPermissionCacheManager.updateCache(k)
|
||||
} else if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && t.para.ipt.get.function.equalsIgnoreCase(certMethod)) {
|
||||
//证书修改
|
||||
ctx.getPermissionCacheManager.updateCertCache(k)
|
||||
}else if (t.getCid.chaincodeName.equalsIgnoreCase(memberContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && t.para.ipt.get.function.equalsIgnoreCase(memberContractMethod)){
|
||||
if(k.indexOf(ReloadableTrustManager.key_trust_stores) > 0){
|
||||
@ -124,10 +119,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && IdTool.isDidContract(accountContractName)) {
|
||||
//账户修改
|
||||
ctx.getPermissionCacheManager.updateCache(k)
|
||||
} else if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && t.para.ipt.get.function.equalsIgnoreCase(certMethod)) {
|
||||
//证书修改
|
||||
ctx.getPermissionCacheManager.updateCertCache(k)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -302,7 +293,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
val r = result(i)
|
||||
val t = trs(i)
|
||||
val accountContractName = ctx.getConfig.getAccountContractName
|
||||
val certMethod = ctx.getConfig.getAccountCertChangeMethod
|
||||
|
||||
val memberContractName = ctx.getConfig.getMemberManagementContractName
|
||||
val memberContractMethod = ctx.getConfig.getMemberManagementContractMethod
|
||||
@ -321,10 +311,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
}
|
||||
|
||||
if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && t.para.ipt.get.function.equalsIgnoreCase(certMethod)) {
|
||||
//证书修改
|
||||
ctx.getPermissionCacheManager.updateCertCache(k)
|
||||
} else if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE) {
|
||||
//账户修改
|
||||
ctx.getPermissionCacheManager.updateCache(k)
|
||||
@ -368,10 +354,6 @@ class BlockStorager(ctx: RepChainSystemContext, isEncrypt: Boolean = false) exte
|
||||
}
|
||||
|
||||
if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE && t.para.ipt.get.function.equalsIgnoreCase(certMethod)) {
|
||||
//证书修改
|
||||
ctx.getPermissionCacheManager.updateCertCache(k)
|
||||
} else if (t.getCid.chaincodeName.equalsIgnoreCase(accountContractName) &&
|
||||
t.`type` == Transaction.Type.CHAINCODE_INVOKE) {
|
||||
//账户修改
|
||||
ctx.getPermissionCacheManager.updateCache(k)
|
||||
|
Loading…
Reference in New Issue
Block a user