repchain2.0-update64:修改创世块里面的授权,改为每个授权只包含一个操作和一个被授权人。

This commit is contained in:
jiangbuyun 2022-06-15 11:37:07 +08:00
parent d396d6b642
commit 728680fa8c
4 changed files with 250 additions and 216 deletions

File diff suppressed because one or more lines are too long

View File

@ -131,6 +131,13 @@ object KeyPrefixManager {
getIdentityNetId(config)+"_"+chainCodeName+"_"+oid
}
def getCustomNetKeyPrefix(networkId:String,chainCodeName:String,oid:String="_"):String={
if(oid==null || oid.equalsIgnoreCase(""))
networkId+"_"+chainCodeName+"_"+"_"
else
networkId+"_"+chainCodeName+"_"+oid
}
/*def getContractStateKey(systemName:String,key:String):String={
getChainId(systemName)+"_"+this.ContractDeployKeyByCIdPrefix+"_"+key
}*/

View File

@ -158,12 +158,27 @@ object CreateGenesisInfo {
opids += opsOfAPI(i)._1
}
val tmpmillis = System.currentTimeMillis()
val als = new ArrayBuffer[String]
granteds.foreach(granted=>{
opids.foreach(op=>{
val gs = Array{granted}
val os = Array{op}
val tmpmillis = System.currentTimeMillis()
val at = Authorize(IdTool.getRandomUUID, super_credit,gs , os,
TransferType.TRANSFER_REPEATEDLY, Option(Timestamp(tmpmillis / 1000, ((tmpmillis % 1000) * 1000000).toInt)),
_root_.scala.None, true, "1.0")
als += JsonFormat.toJsonString(at)
})
})
translist += ctx.getTransactionBuilder.createTransaction4Invoke(superAdmin, cid1, "grantOperate", Seq(SerializeUtils.compactJson(als)))
/*val tmpmillis = System.currentTimeMillis()
val at = Authorize(IdTool.getRandomUUID, super_credit, granteds, opids,
TransferType.TRANSFER_REPEATEDLY, Option(Timestamp(tmpmillis / 1000, ((tmpmillis % 1000) * 1000000).toInt)),
_root_.scala.None, true, "1.0")
var als: List[String] = List(JsonFormat.toJsonString(at))
translist += ctx.getTransactionBuilder.createTransaction4Invoke(superAdmin, cid1, "grantOperate", Seq(SerializeUtils.compactJson(als)))
*/
//部署应用合约--分账合约
val s2 = scala.io.Source.fromFile("src/main/scala/rep/sc/tpl/ContractAssetsTPL.scala", "UTF-8")

View File

@ -85,6 +85,18 @@ object IdTool {
}
}
def getNetworkIdFromName(config:RepChainConfig,name:String):String={
val flag1 = config.getChainNetworkId+IdTool.DIDPrefixSeparator
val flag2 = config.getIdentityNetName + IdTool.DIDPrefixSeparator
if(name.indexOf(flag1) >= 0){
config.getChainNetworkId
}else if(name.indexOf(flag2) >= 0){
config.getIdentityNetName
}else{
name
}
}
def getCompleteSignerName(config:RepChainConfig,signerName:String):String={
val flag1 = config.getChainNetworkId+IdTool.DIDPrefixSeparator
val flag2 = config.getIdentityNetName + IdTool.DIDPrefixSeparator