0
votes

So I'm trying to deploy a new bna file to test with. It's more so I can test the rest interface to create participants with some calling code I wrote than anything else - the javascript transaction processing file is pretty much empty at this juncture.

The .cto file has a couple of different participant types and a bunch of asset types which form a tree structure to represent the data.

Trying to start up a local rest server gives me the following error.

Discovering types from business network definition ... Discovered types from business network definition Generating schemas for all types in business network definition ... Exception: RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at LoopbackVisitor.visitClassDeclarationCommon (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:352:23) at LoopbackVisitor.visitAssetDeclaration (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:187:21) at LoopbackVisitor.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:74:25) at AssetDeclaration.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/classdeclaration.js:64:24) at LoopbackVisitor.visitField (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:494:18) at LoopbackVisitor.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:86:25) at Field.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/property.js:48:24) at classDeclaration.getProperties.forEach (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:373:66) at Array.forEach (native) at LoopbackVisitor.visitClassDeclarationCommon (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:370:42) at LoopbackVisitor.visitAssetDeclaration (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:187:21) at LoopbackVisitor.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:74:25) at AssetDeclaration.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/classdeclaration.js:64:24) at LoopbackVisitor.visitField (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:494:18) at LoopbackVisitor.visit (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:86:25) at Field.accept (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/introspect/property.js:48:24) at classDeclaration.getProperties.forEach (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-common/lib/codegen/fromcto/loopback/loopbackvisitor.js:373:66)

A little quality time with google gave me the fact that it's an out of memory error and probably caused by over recursion but after that I'm stuck.

The same network works just fine in the playground fwiw.

EDIT: There's no .qry file. This is as basic as it gets. I was trying to see if I could add Par1 and Par2 samples from a REST call I'd knocked up.

The ACL file is the standard allow-all-to-do-all from the basic-network sample.

I've scrubbed the .cto file to partly obscure the source, but it appears to still recur with the following:

/**
 * Sample business network definition.
 */
namespace xx.yy.zz

asset SomeTransmission identified by orderNumber {
  o String orderNumber  //Some order number
  --> Par2 aa
  --> Par1 bb
  o SomeTransmission[] messages
}

participant Par1 identified by code {
  o String mmm
  o String name
  o String prefix
  o String code
  o Boolean bool1
  o Boolean bool2
  o Boolean bool3
}

participant SomeSss identified by sss {
  o String sss
  o String mmm
  --> Par1 bb
  --> Par1 rep2
}

participant Par2 identified by id {
  o String id
  o String name
  o String address
}

transaction UpdateOrderTransaction {
  o String orderId
  --> Par2 aa
  --> Par1 bb
  o SomeTransmission transmission
}

event UpdateOrderEvent {
  --> SomeTransmission transmission
}

asset Some identified by uuid {
  o String uuid  //Unique identifier
}

asset AgencyOrder extends Some { 
    o AXZHDR agyhdr 
    o AXZDS1 agyds1
    o AXZDS2 agyds2
    o AXZDS3 agyds3
    o AXZDS4 agyds4
    o AXZSTD[] agystds
    o AXZCOM[] agycoms
    o AXZHIA[] agyhias
    o BxblineTransmission[] bxblines
    o AXZTLR agytlr
}

asset SomeRecord identified by uuid {
  o String uuid       
  o String id         
  o Long orderNumber  //Some order number
}

asset SomeModifier extends SomeRecord { 
    o Par2 tpar2
    o Par1 tpar1       
    o String dt       
    o String sss    
    o String cn         
    o String rts        
}

asset SomePreviousSssModifier extends SomeModifier {
  o String previousSssCallLetters 
}

asset SomeMultiple extends SomeRecord {
  o String continuation 
}

asset SomeComment extends SomeMultiple {
  o String comment 
}


asset AXZHDR extends SomePreviousSssModifier { 
    o String version         //Some version number
    o String routingCode
    o String mdaCode
    o String clientCode
  o String prxOneCode
  o String prxTwoCode
  o String estimateNumber
  o String startDate
  o String endDate
  o String cashOrTrade
  o String scheduleType
  o String scheduleStartDate
    o Long billWeekStartDay
    o String originalOrderNumber
    o Long revisionNumber
}

asset AXZDS1 extends SomeRecord {
    o String axyName
    o String axyAddress
}

asset AXZDS2 extends SomeRecord {
    o String clientName
    o String estimateDescription
  o String targetDmxx
  o String[] extraDmxxs
}

asset AXZDS3 extends SomeRecord {
    o String prxOneName
    o String prxTwoName
}

asset AXZDS4 extends SomeRecord {
    o String bxberCode
    o String bxberName
  o Long bxberTelephone
  o String bxberExtension
}

asset AXZSTD extends SomeComment {
}

asset AXZCOM extends SomeComment {
}

asset AXZHIA extends SomeMultiple {
  o String[] dates
}

asset AXZTLR extends SomeRecord {
    o Long numberOfRecords
    o Long totalOrderedSpx
    o Long totalOrderedDollars
}

//Bxb record details
asset BxblineTransmission identified by uuid{
  o String uuid
  o BXBHDR bxbhdr
    o BXBDEM bxbdem
    o BXBORB[] bxborbs
    o BXBCOM[] bxbcoms
    o BXBDTL[] bxbdtls
}

asset SomeBxbRecord extends SomeRecord {
    o Long sequenceNumber
    o String sbx
    o Long sbxStartDay
    o Long startTime
    o Long endTime
    o Long totalspxyLength
    o String lengthInUnits
    o Long cost
    o String costQualifier
    o Long prxOneTimeShare
    o String pppName
    o String scheduleType  
}

asset BXBHDR extends SomeBxbRecord {
  o Long makegoodForBxbline
}

asset BXBDEM extends SomeRecord {
  o Long[] demos
}

asset BXBORB extends SomeMultiple {
  o String sbx
    o Long sbxStartDay
    o Long startTime
    o Long endTime
    o String pppName  
}

asset BXBCOM extends SomeComment {
}

asset BXBDTL extends SomeMultiple {
  o Long cost
    o String startDate
    o Long numberOfWeeks
    o Long spxPerWeek
}
1
Could you post your .cto, .qry, .acl files ? - david_k

1 Answers

0
votes

The issue is:

asset SomeTransmission identified by orderNumber {
  o String orderNumber  //Some order number
  --> Par2 aa
  --> Par1 bb
  o SomeTransmission[] messages
}

The SomeTransmission[] messages causes the code to recurse, attempting to introspect the SomeTransmission class when it is already in the process of introspecting it.

It seems unusual to want to have an asset that contains an array of its own asset type. What are you trying to achieve, perhaps there's another way of modelling this?

I have created the issue https://github.com/hyperledger/composer/issues/2193 to fix this.