Skip to content

Democracy.js Wiki

Paul Pham edited this page Dec 6, 2019 · 1 revision

Welcome to the Democracy.js Wiki

This is currently being used to document weird or interesting issues that are neither urgent blocking bugs or vital features.

You can find API documentation on the main Democracy.js homepage http://democracy.js.org

State variables of type Array or List are getting doubled in each stage due to Immutable.js mergeDeep

This was causing a problem with state variables like swapMethodParams and sourcePathList and occasioned me to add mergeNonLists in demo-utils and to prefer it to Immutable.js's mergeDeep.

You can test this by running in aztec-cli

NODE_ENV=DEVELOPMENT mocha -t 400000 tests/pt.spec.js
 1) Private trade
       succeeds in minting and private trade:
      Source path list has wrong length.      + expected - actual

      -9216      +3

sourcePathList in this pipeline has length 3 normally, so we divide by three to see the pattern of doubling, and end up close to a power of two.

 bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
9216 / 3
3072
3072 - 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128
2817
3072 - 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512
2049
3072 - 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512 - 1024
1025
3072 - 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512 - 1024 - 2048
-1023
3072 - 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128 - 256 - 512 - 1024
1025

There is room for about 11 or 12 stages of a pipeline, and ptPipeline indeed has 11 stages.

PIPE 0: argList                                                                                     in : proxyContractName::string proxySwapMethodName::string     bidder:(  address:  :ethereumAddress         password:  :string      publicKey:  :aztecPublicKey     noteHash:  :aztecNoteHash       tradeSymbol:  :string    )testAccountIndex::integer      wallet::wallet  testValueETH::string    unlockSeconds::integer     sourcePathList::array   seller:(  address:  :ethereumAddress      password:  :string         publicKey:  :aztecPublicKey     noteHash:  :aztecNoteHash       tradeSymbol:  :string    )                out: proxyContractName::string proxySwapMethodName::string     bidder:(  address:  :ethereumAddress         password:  :string      publicKey:  :aztecPublicKey     noteHash:  :aztecNoteHash          tradeSymbol:  :string )testAccountIndex::integer      wallet::wallet  testValueETH::string       unlockSeconds::integer  sourcePathList::array   seller:(  address:  :ethereumAddress         password:  :string      publicKey:  :aztecPublicKey     noteHash:  :aztecNoteHash  tradeSymbol:  :string )PIPE 1: deployer                                                                                    in : testValueETH::string      testAccountIndex::integer       unlockSeconds::integer  deployerAddress::ethereumAddress?  deployerPassword::string?                        out: chainId::string   deployerAddress::ethereumAddress   deployerPassword::string        deployerEth::ethereumSigner     wallet::wallet
PIPE 2: depart                                                                                     
 in : chainId::string   deployerEth::ethereumSigner     deployerAddress::ethereumAddress        departName::string?        autoConfig::boolean?    sourcePathList::array   compileFlatten::boolean?  compileOutputFull::boolean?                       out: getLinks::function        deployed::functiondeploy::function clean::function bm::bm  compile::function       minedTx::function       getDeploys::function       getCompiles::function   link::functionPIPE 3: ptPrep                                                                                      in : seller:(  tradeSymbol:  :string     address:  :ethereumAddress      password:  :string?     publicKey:  :aztecPublicKey        noteHash:  :aztecNoteHash     )bidder:(  tradeSymbol:  :string    address:  :ethereumAddress       password:  :string?     publicKey:  :aztecPublicKey     noteHash:  :aztecNoteHash        )deployerAddress::ethereumAddress       deployed::function      proxyContractName::string  transfererAddress::ethereumAddress?                      out: proxy::contractInstance      seller:(  senderPublicKey:  :aztecPublicKey       receiverAddress:  :ethereumAddress      receiverPublicKey:  :aztecPublicKey        senderPassword:  :string        senderNoteHash:  :aztecNoteHash    transferAll:  :boolean          tradeSymbol:  :string   transfererAddress:  :ethereumAddress      senderAddress:  :ethereumAddress      )bidder:(  senderPublicKey:  :aztecPublicKey      receiverAddress:  :ethereumAddress         receiverPublicKey:  :aztecPublicKey     senderPassword:  :string   senderNoteHash:  :aztecNoteHash         transferAll:  :boolean          tradeSymbol:  :string      transfererAddress:  :ethereumAddress    senderAddress:  :ethereumAddress      )
PIPE 4: jsContract                                                                                 
 in : deployed::function                         out: joinSplitContract::contractInstance
PIPE 5: tokenContracts                                                                             
 in : deployed::function        seller:(  tradeSymbol:  :string )bidder:(  tradeSymbol:  :string  ) out: seller:(  erc20Token:  :contractInstance    zkToken:  :contractInstance     zkTokenAddress:  :ethereumAddress        )bidder:(  erc20Token:  :contractInstance         zkToken:  :contractInstance        zkTokenAddress:  :ethereumAddress     )
PIPE 6: signers                                                                                    
 in : wallet::wallet    seller:(  senderAddress:  :ethereumAddress        senderPassword:  :string)bidder:(  senderAddress:  :ethereumAddress        senderPassword:  :string      )                out: 
PIPE 7: publicKey                                                                                  
 in : wallet::wallet    seller:(  senderAddress:  :ethereumAddress        senderPassword:  :string)bidder:(  senderAddress:  :ethereumAddress        senderPassword:  :string      )                out: senderPublicKey::aztecPublicKey
PIPE 8: prep                                                                                       
 in : deployerAddress::ethereumAddress  joinSplitContract::contractInstance     deployed::functionbm::bm   bidder:(  senderPublicKey:  :aztecPublicKey       transferAmount:  :bn?   receiverAddress:  :ethereumAddress         receiverPublicKey:  :aztecPublicKey     zkTokenAddress:  :ethereumAddress  senderPassword:  :string        senderNoteHash:  :aztecNoteHash         transferAll:  :boolean?   transfererAddress:  :ethereumAddress     senderAddress:  :ethereumAddress      )minedTx::functionwallet::wallet   chainId::string seller:(  senderPublicKey:  :aztecPublicKey       transferAmount:  :bn?      receiverAddress:  :ethereumAddress      receiverPublicKey:  :aztecPublicKey     zkTokenAddress:  :ethereumAddress          senderPassword:  :string        senderNoteHash:  :aztecNoteHash   transferAll:  :boolean?          transfererAddress:  :ethereumAddress    senderAddress:  :ethereumAddress )                out: seller:(  jsSenderKey:  :string     jsSignatures:  :hexPrefixed     jsProofData:  :hexPrefixed         jsChangeKey:  :string   jsReceiverKey:  :string         jsProofHash:  :keccak256Hash       jsReceiverNote:  :aztecPrivateNote      jsChangeNote:  :aztecPrivateNote  jsSenderNote:  :aztecPrivateNote         swapMethodParams:  :array       jsProofOutput:  :hexPrefixed       jsTransferValue:  :bn )bidder:(  jsSenderKey:  :string          jsSignatures:  :hexPrefixed
   jsProofData:  :hexPrefixed      jsChangeKey:  :string   jsReceiverKey:  :string         jsProofHash:  :keccak256Hash       jsReceiverNote:  :aztecPrivateNote      jsChangeNote:  :aztecPrivateNote
  jsSenderNote:  :aztecPrivateNote        swapMethodParams:  :array       jsProofOutput:  :hexPrefixed       jsTransferValue:  :bn )
PIPE 9: swapTransform                                                                              
 in : proxy::contractInstance   proxySwapMethodName::string     seller:(  zkToken:  :contractInstance        transfererAddress:  :ethereumAddress    jsProofData:  :hexPrefixed      jsSignatures:  :hexPrefixed        swapMethodParams:  :array?    )bidder:(  zkToken:  :contractInstance    transfererAddress:  :ethereumAddress       jsProofData:  :hexPrefixed      jsSignatures:  :hexPrefixed     swapMethodParams:  :array?       )minedTx::function                       out: ptTxHash::ethereumTxHash
PIPE 10: finish                                                                                    
 in : bm::bm    seller:(  jsChangeKey:  :string   jsChangeNote:  :aztecPrivateNote        jsReceiverKey:  :string    jsReceiverNote:  :aztecPrivateNote      jsTransferValue:  :bn )bidder:(  jsChangeK

Clone this wiki locally