Giter Site home page Giter Site logo

initc3 / honeybadgerswap Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 6.0 1.6 MB

Coming soon to a blockchain near you.

License: GNU General Public License v3.0

Dockerfile 2.89% Makefile 1.28% CSS 0.34% HTML 8.94% JavaScript 7.38% Ragel 20.52% Python 33.11% Shell 7.29% Solidity 0.10% Lex 15.20% Rust 2.96%

honeybadgerswap's People

Contributors

lilione avatar sbellem avatar wanglun1996 avatar xmhuangzhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

honeybadgerswap's Issues

GetInputmaskCnt error

2a98cedbbbfd48f299b979816f13f782 | Inputmaks shares used: <nil>
2a98cedbbbfd48f299b979816f13f782 | panic: runtime error: invalid memory address or nil pointer dereference
2a98cedbbbfd48f299b979816f13f782 | [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xaa377a]
2a98cedbbbfd48f299b979816f13f782 | goroutine 8 [running]:
2a98cedbbbfd48f299b979816f13f782 | math/big.(*Int).Int64(...)
2a98cedbbbfd48f299b979816f13f782 |      /usr/local/go/src/math/big/int.go:372
2a98cedbbbfd48f299b979816f13f782 | github.com/initc3/HoneyBadgerSwap/src/go/utils.GetInputmaskCnt(0xc000279170, 0x7, 0xc0000ab110, 0x3e)
2a98cedbbbfd48f299b979816f13f782 |      /go/src/github.com/initc3/HoneyBadgerSwap/src/go/utils/utils_hbswap.go:387 +0x19a
2a98cedbbbfd48f299b979816f13f782 | main.genInputmask()
2a98cedbbbfd48f299b979816f13f782 |      /go/src/github.com/initc3/HoneyBadgerSwap/src/go/server/server.go:47 +0xab
2a98cedbbbfd48f299b979816f13f782 | created by main.main
2a98cedbbbfd48f299b979816f13f782 |      /go/src/github.com/initc3/HoneyBadgerSwap/src/go/server/server.go:332 +0x5ef

Deploy mpc development network to the ground

Checklist

Not essential, but preferable whenever possible


UPDATE: We are using the docker compose cli ECS integration .

Since we already have docker containers + docker-compose to manage these containers, see what provider may be most convenient & simple.

Follow https://docs.docker.com/cloud/ecs-integration/#install-the-docker-compose-cli-on-linux

Resources

First stop for tooling: Amazon ECS developer tools overview

There seems to be 3 main approaches:

To re-use an existing compose file, the compose-cli may be best suited. See: https://aws.amazon.com/blogs/containers/deploy-applications-on-amazon-ecs-using-docker-compose/.

docker compose-cli

Secrets + Docker

Volumes

Other tools

copilot

ecs-cli

Challenges

Some challenges relating to deployments.

  • Key distribution
  • MPC programs deployments

init pool: Transaction nonce is too low

init.pool_1  | Sending 10 wei from 0x096f48173c8EB3849bb415F62D3113CB3b90C640 to 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5
init.pool_1  | Deposit user 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5 10 token 0x0000000000000000000000000000000000000000
init.pool_1  | 2021/03/10 00:46:56 transferETH ...
init.pool_1  | Sending 526470000000010 wei from 0x096f48173c8EB3849bb415F62D3113CB3b90C640 to 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5
init.pool_1  | 2021/03/10 00:46:56 Transaction nonce is too low. Try incrementing the nonce.
init.pool_1  | exit status 1
honeybadgerswap_init.pool_1 exited with code 1

mpc node error: insufficient data

Happened after 5 successful trades, on merge2 branch ... /cc @lilione

mpcnode2_1           | Output:                                                                                                                                                                 
mpcnode2_1           | ====================                                      
mpcnode2_1           | ====================                                                                                                                                        
mpcnode2_1           | Cmd:                                                     
mpcnode2_1           | ====================                                          
mpcnode2_1           | ./malicious-shamir-party.x -N 4 -T 1 -p 2 -pn 5000 -P 52435875175126190479447740508185965837690552500527637822603658699938581184513 --hostname mpcnode0 hbswap_calc_price
mpcnode2_1           | ====================                                                                      
mpcnode2_1           | s2 request: <Request GET /inputmasks/8,9 >                        
mpcnode2_1           | Push Trade  
mpcnode2_1           | err:                                                               
mpcnode2_1           | Using threshold 1 out of 4                               
mpcnode2_1           | Using GF(2^40)                                    
mpcnode2_1           | Starting networking for 2/4 with server on mpcnode0:4999 
mpcnode2_1           | Sent 2 to mpcnode0:4999                                
mpcnode2_1           | My Name = 192.168.32.3                            
mpcnode2_1           | My number = 2                                                                                                                                                            
mpcnode2_1           | 4 players                                                          
mpcnode2_1           | Player 0 is running on machine 192.168.32.5         
mpcnode2_1           | Player 1 is running on machine 192.168.32.6                        
mpcnode2_1           | Player 2 is running on machine 192.168.32.3                            
mpcnode2_1           | Player 3 is running on machine 192.168.32.4            
mpcnode2_1           | ServerSocket is bound on port 5002                  
mpcnode2_1           | deferring client on 192.168.32.5:33286 to thread                                                                                                                         
mpcnode2_1           | Using GF(2^40)                      
mpcnode2_1           | Using GF(2^40)                                         
mpcnode2_1           | Setting up send to self socket to 127.0.0.1:5002 with id 0xf02
mpcnode2_1           | client f00 is on socket 4                               
mpcnode2_1           | deferring client on 127.0.0.1:36218 to thread                      
mpcnode2_1           | Setting up client to 192.168.32.4:5003 with id 0xf02                   
mpcnode2_1           | client f01 is on socket 7                                 
mpcnode2_1           | As a server, waiting for client with id 0xf00 to connect.          
mpcnode2_1           | As a server, waiting for client with id 0xf01 to connect.     
mpcnode2_1           | As a server, waiting for client with id 0xf02 to connect.
mpcnode2_1           | client f02 is on socket 5                                              
mpcnode2_1           | MAC Key p = 0                                       
mpcnode2_1           | MAC Key 2 = 00000000000000000000000000000000              
mpcnode2_1           | client 1 is on socket 9                                            
mpcnode2_1           | Cost of first tape:                                      
mpcnode2_1           |   Type int                                                    
mpcnode2_1           |            330        Triples                                          
mpcnode2_1           |           1092           Bits              
mpcnode2_1           | Using encrypted single-threaded communication          
mpcnode2_1           | Setting up send to self socket to 127.0.0.1:5002 with id 0x2
mpcnode2_1           | deferring client on 127.0.0.1:36232 to thread            
mpcnode2_1           | Setting up client to 192.168.32.4:5003 with id 0x2            
mpcnode2_1           | As a server, waiting for client with id 0x0 to connect.  
mpcnode2_1           | client 2 is on socket 15                                           
mpcnode2_1           | deferring client on 192.168.32.5:33318 to thread         
mpcnode2_1           | client 0 is on socket 6                                     
mpcnode2_1           | As a server, waiting for client with id 0x1 to connect.  
mpcnode2_1           | As a server, waiting for client with id 0x2 to connect.
mpcnode2_1           | Using indirect communication.                          
mpcnode2_1           | Purging preprocessed data because something is wrong               
mpcnode2_1           | terminate called after throwing an instance of 'std::runtime_error'
mpcnode2_1           |   what():  insufficient data                 
mpcnode2_1           |                                                          
mpcnode2_1           | 2021/02/26 00:43:41 cmd.Run() failed with signal: aborted (core dumped)
mpcnode2_1           | exit status 1        

private reconstruction of inputmasks despite faulty server(s)

On the aws deployment, when a client requests inputmask shares from the MPC nodes, if one node does not respond the client does not reconstruct the inputmask from the available shares, or does it? In any case the expected subsequent trade fails to proceed.

main docker image clean up

  • see FIXME comments in Dockerfile
  • rename docker-compose.yml to local-network.yml
  • rename docker-compose-dev.yml to docker-compose.yml to simplify the dev flow
  • do we need to build geth? if yes, could we build it in a separate image and just copy it, to save time -- other wise when we re-build the image we re-build geth
  • is the go/python code still needed (the one not under ratel/)

malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0

main error is:

./malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory

Probably need to copy over the missing lib from the base image

full error trace:

root@c29e16f921d9:/usr/src/hbswap# python3 -m ratel.src.python.rockPaperScissors.interact 

s0 request: <Request GET /inputmasks/0 >
s0 response: 14149291143620736704497736583324948204706678171793285676800133554697996856173
s1 request: <Request GET /inputmasks/0 >
s2 request: <Request GET /inputmasks/0 >
s1 response: 51062922595238177707318728892795326882886146369076069294944190069398283156020
s3 request: <Request GET /inputmasks/0 >s2 response: 35540678871729428230691980694079739723375062065831215090484587884159988271354

s3 response: 20018435148220678754065232495364152563863977762586360886024985698921693386688
['./malicious-shamir-party.x -N 4 -T 1 -p 3 -pn 5000 -P 52435875175126190479447740508185965837690552500527637822603658699938581184513 rockPaperScissorsCreateGame1' exited with 127]
[stderr]
./malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory

['./malicious-shamir-party.x -N 4 -T 1 -p 0 -pn 5000 -P 52435875175126190479447740508185965837690552500527637822603658699938581184513 rockPaperScissorsCreateGame1' exited with 127]
[stderr]
./malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory

**** valid 0
**** valid 0
['./malicious-shamir-party.x -N 4 -T 1 -p 2 -pn 5000 -P 52435875175126190479447740508185965837690552500527637822603658699938581184513 rockPaperScissorsCreateGame1' exited with 127]
[stderr]
./malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory

['./malicious-shamir-party.x -N 4 -T 1 -p 1 -pn 5000 -P 52435875175126190479447740508185965837690552500527637822603658699938581184513 rockPaperScissorsCreateGame1' exited with 127]
[stderr]
./malicious-shamir-party.x: error while loading shared libraries: libboost_system.so.1.67.0: cannot open shared object file: No such file or directory

**** valid 0
**** valid 0
^CTraceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/src/hbswap/ratel/src/python/rockPaperScissors/interact.py", line 76, in <module>
    gameId = createGame(appContract, 1, client_1)
  File "/usr/src/hbswap/ratel/src/python/rockPaperScissors/interact.py", line 28, in createGame
    time.sleep(1)
KeyboardInterrupt

npm install -g truffle returned a non-zero code: 1

pinning truffle to 5.4.29 may work fo rnow ... see trufflesuite/truffle#4658

Step 37/44 : RUN npm install -g truffle        
 ---> Running in 1a7d067b73e6                                                                                                                               
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                                                                                                                                                                                                                                                                                                                                                 npm WARN deprecated [email protected]: this library is no longer supported                                                                                   
npm WARN deprecated [email protected]: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future                                                                                                                    
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                                                                                                                                                                                                                                                                                                                                                 npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated                                                              
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated                                                                                                                           
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                              
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated                                                                           
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                             
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.                                                        
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                 
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                 
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                 
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
npm WARN tar TAR_ENTRY_INFO stripping / from absolute path                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                  
npm WARN deprecated [email protected]: "Please update to latest v2.3 or v2.2"                                                                                                                                                                                   
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                    
npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                              
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                                                                                                                                                                                                                                                                                                                                                 npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-cbor and multiformats                                                
npm WARN deprecated @nodefactory/[email protected]: Package is deprecated in favour of @chainsafe/filsnap-adapter                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-pb and multiformats                                                                                                                                                                                                                   
npm WARN deprecated [email protected]: The `apollo-tracing` package is no longer part of Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#tracing for details                                                                                                                                                                                                                                                                                                                                                                                                                                                           npm WARN deprecated [email protected]: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/                                                                                                      
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                               
npm WARN deprecated [email protected]: The functionality provided by the `apollo-cache-control` package is built in to `apollo-server-core` starting with Apollo Server 3. See https://www.apollographql.com/docs/apollo-server/migration/#cachecontrol for details.                                                                                                                                                                                                                                                                                                                                                                              npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                   
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                  
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                
npm WARN deprecated [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410                                                                                                       
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                                                                                    
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                                                                   
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                               
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                   
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.                                                                                                   
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module                                                                                                                  
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)                                                                                                                                                                                                                                                                                                                                                                                                    
npm WARN deprecated [email protected]: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead                                                                                                                                                                                                                                                                                          
npm WARN deprecated [email protected]: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.                                                                                                                                                                                                                                                                                                          
npm ERR! code 1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
npm ERR! path /usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
npm ERR! command failed                                                                                                                                                                                           
npm ERR! command sh -c node-gyp rebuild                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
npm ERR! gyp info it worked if it ends with ok                                                                                                                                                                    
npm ERR! gyp info using [email protected]                                                                                                                                                                            
npm ERR! gyp info using [email protected] | linux | x64                                                                            
npm ERR! gyp info find Python using Python version 3.8.12 found at "/usr/local/bin/python3"                                                                                                                       
npm ERR! gyp info spawn /usr/local/bin/python3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
npm ERR! gyp info spawn args [                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
npm ERR! gyp info spawn args   '/usr/share/nodejs/node-gyp/gyp/gyp_main.py',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
npm ERR! gyp info spawn args   'binding.gyp',                                                                                                                                                                     
npm ERR! gyp info spawn args   '-f',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
npm ERR! gyp info spawn args   'make',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
npm ERR! gyp info spawn args   '-I',                                                                      
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer/build/config.gypi',                                                                                                                                                                         
npm ERR! gyp info spawn args   '-I',                                                                      
npm ERR! gyp info spawn args   '/usr/share/nodejs/node-gyp/addon.gypi',                                                       
npm ERR! gyp info spawn args   '-I',                                                                                                                                                                              
npm ERR! gyp info spawn args   '/usr/include/nodejs/common.gypi',                                                              
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',                                                                     
npm ERR! gyp info spawn args   '-Dvisibility=default',                                                                         
npm ERR! gyp info spawn args   '-Dnode_root_dir=/usr/include/nodejs',                                                          
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',                                                    
npm ERR! gyp info spawn args   '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',                                  
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer',                                                                                                                                                                         
npm ERR! gyp info spawn args   '-Dnode_engine=v8',                                                                             
npm ERR! gyp info spawn args   '--depth=.',                    
npm ERR! gyp info spawn args   '--no-parallel',                                                                                
npm ERR! gyp info spawn args   '--generator-output',                                                                                                           
npm ERR! gyp info spawn args   'build',                                                                                                                        
npm ERR! gyp info spawn args   '-Goutput_dir=.'                                                                                                                
npm ERR! gyp info spawn args ]                                                                                                                                 
npm ERR! Traceback (most recent call last):                                                                                                                    
npm ERR!   File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 33, in <module>                                                                             
npm ERR!     sys.exit(load_entry_point('gyp==0.1', 'console_scripts', 'gyp')())                                                                                
npm ERR!   File "/usr/share/nodejs/node-gyp/gyp/gyp_main.py", line 22, in importlib_load_entry_point                                                           
npm ERR!     for entry_point in distribution(dist_name).entry_points                                                                                           
npm ERR!   File "/usr/local/lib/python3.8/importlib/metadata.py", line 503, in distribution                                                                    
npm ERR!     return Distribution.from_name(distribution_name)                                                                                                  
npm ERR!   File "/usr/local/lib/python3.8/importlib/metadata.py", line 177, in from_name                                                                       
npm ERR!     raise PackageNotFoundError(name)                                                                                                                  
npm ERR! importlib.metadata.PackageNotFoundError: gyp                                                                                                          
npm ERR! gyp ERR! configure error                                                                                                                              
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1                                                                                                  
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/nodejs/node-gyp/lib/configure.js:355:16)                                                      
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:314:20)                                                                                            
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)                                                          
npm ERR! gyp ERR! System Linux 5.4.0-100-generic                                                                                                               
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild"                                                               
npm ERR! gyp ERR! cwd /usr/local/lib/node_modules/truffle/node_modules/ganache/node_modules/@trufflesuite/bigint-buffer                                        
npm ERR! gyp ERR! node -v v12.22.5                                                                                                                             
npm ERR! gyp ERR! node-gyp -v v7.1.2                                                                                                                           
npm ERR! gyp ERR! not ok                                                                                                                                       
                                                                                                                                                               
npm ERR! A complete log of this run can be found in:                                                                                                           
npm ERR!     /root/.npm/_logs/2022-03-01T07_38_09_660Z-debug.log                                                                                               
The command '/bin/sh -c npm install -g truffle' returned a non-zero code: 1                                                                                    
ERROR: Service 'dev' failed to build : Build failed                                                                                 

GET /inputmasks/{idxes} can hang "forever"

Problem: The current backend logic is such that if a client requests an inputmask that cannot be found in the db, the backend will wait and until it can be found. In the meantime the request never returns.

Proposed solution: Try to access the requested inputmask just once, and if not found return a 404 not found error, and leave it up to the client to retry.

Add HTTPS support for deployments

For AWS deployments, use ACM (AWS Certificate Manager):

Resources

MP-SPDZ upgrade

Problems with compiling some *.mpc programs:

  • hbswap_add_liquidity
  • hbswap_remove_liquidity
  • hbswap_trade
  • hbswap_calc_individual_price

Example of error:

Compiling file /usr/src/MP-SPDZ/Programs/Source/hbswap_trade.mpc
Traceback (most recent call last):
  File "/usr/src/MP-SPDZ/Compiler/instructions_base.py", line 827, in check_args
    ArgFormats[f].check(arg)
  File "/usr/src/MP-SPDZ/Compiler/instructions_base.py", line 662, in check
    raise ArgumentError(arg, "Wrong register type '%s', expected '%s'" % \
Compiler.exceptions.ArgumentError: (s80, "Wrong register type 's', expected 'ci'")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./compile.py", line 111, in <module>
    main()
  File "./compile.py", line 108, in main
    compilation()
  File "./compile.py", line 96, in compilation
    prog = Compiler.run(args, options)
  File "/usr/src/MP-SPDZ/Compiler/compilerLib.py", line 77, in run
    exec(compile(infile.read(), infile.name, 'exec'), VARS)
  File "/usr/src/MP-SPDZ/Programs/Source/hbswap_trade.mpc", line 88, in <module>
    main()
  File "/usr/src/MP-SPDZ/Programs/Source/hbswap_trade.mpc", line 65, in main
    write_sfix(change_A)
  File "/usr/src/MP-SPDZ/Programs/Source/hbswap_trade.mpc", line 15, in write_sfix
    writesharestofile(x.v)
  File "/usr/src/MP-SPDZ/Compiler/instructions_base.py", line 788, in __init__
    self.check_args()
  File "/usr/src/MP-SPDZ/Compiler/instructions_base.py", line 829, in check_args
    raise CompilerError('Invalid argument %d "%s" to instruction: %s'
Compiler.exceptions.CompilerError: Invalid argument 0 "s80" to instruction: writesharestofile 1, s80
Wrong register type 's', expected 'ci'

aiohttp.http_exceptions.BadStatusLine: 400, 'invalid HTTP method'

Happens when initializing the pool via scripts/init_pool.sh.

Server side logs:

910a6d4f2766456990e6a2a7b772024b  | Error handling request
910a6d4f2766456990e6a2a7b772024b  | Traceback (most recent call last):
910a6d4f2766456990e6a2a7b772024b  |   File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
910a6d4f2766456990e6a2a7b772024b  |     messages, upgraded, tail = self._request_parser.feed_data(data)
910a6d4f2766456990e6a2a7b772024b  |   File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
910a6d4f2766456990e6a2a7b772024b  | aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"

Cient-side logs:

$ docker-compose -f liquidity-provider.yml up init.pool
init.pool_1  | Parsing config file:  /opt/hbswap/conf/client.toml
init.pool_1  | Eth network:  testnet
init.pool_1  | Eth hostname:  kovan.infura.io
init.pool_1  | Eth http endpoint:  https://kovan.infura.io/v3/6a82d2519efb4d748c02552e02e369c1
init.pool_1  | depositETH ...
init.pool_1  | FundEth ...
init.pool_1  | 2021/03/09 14:38:51 transferETH ...
init.pool_1  | Sending 10 wei from 0x096f48173c8EB3849bb415F62D3113CB3b90C640 to 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5
init.pool_1  | Deposit user 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5 10 token 0x0000000000000000000000000000000000000000
init.pool_1  | 2021/03/09 14:38:59 transferETH ...
init.pool_1  | 2021/03/09 14:38:59 transfer ctx: context.Background
init.pool_1  | Sending 1476299999999990 wei from 0x096f48173c8EB3849bb415F62D3113CB3b90C640 to 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5
init.pool_1  | On-chain balance user 0xeF860fb0634474AE0E6ceC1A8E0dBE7C70A280A5 token 0x0000000000000000000000000000000000000000: 130

Deploy UI to hosting service

We're currently using jsfiddle, which is useful as a sandbox, to tweak things, but it would also be desirable to deploy the UI to a hosting service under a *.honeybadgerswap.[org,com] domain.

What to do if a multi-party computation fails?

In the current system, each node listens to on-chain events, and for some events it launches a multi-party computation. To perform a multi-party computation, each node invokes an MP-SPDZ executable (malicious-shamir-party.x) with some arguments. This step is "blocking" in the sense that the program flow stops until malicious-shamir-party.x returns.

For instance (complete code link):

// ...

cmd = exec.Command(
	"./malicious-shamir-party.x",
	"-N", players,
	"-T", threshold,
	"-p", serverID,
	"-pn", mpcPort,
	"-P", blsPrime,
	"--hostname", leaderHostname,
	"hbswap_trade"
)
err := cmd.Run()
if err != nil {
    log.Fatalf("cmd.Run() failed with %s\n", err)
}

// ...

The call to log.Fatalf() will call os.exit(1) which will cause the program to terminate immediately:

Exit causes the current program to exit with the given status code. Conventionally, code zero indicates success, non-zero an error. The program terminates immediately; deferred functions are not run.

Could we improve this? Could the server let others know that: "Hey, had a problem with this computation ... we need to re-try ..."? Would it make sense to create an event on-chain, which could then used as a coordinating mechanism for the MPC nodes to react in a consistent/safe way with respect to this failed computation?

GET /price/{trade_seq} 404 (not found)

For some reasons, sometimes, the price is not yet available, but a few seconds later may be. For clients (e.g. frontend) it would be good to add retry logic. See https://blog.bearer.sh/add-retry-to-api-calls-javascript-node/ for some examples if needed.

OR: maybe the problem also stems from the backend. For instance, one server crashed after a few requests, all returning 404:

1a2f5e7d109040fc8a53d17996913847  | s0 processing request GET /price/28
1a2f5e7d109040fc8a53d17996913847  | INFO:     172.31.41.90:33092 - "GET /price/28 HTTP/1.1" 404 Not Found
c312f4f4eb794b4e87aee305a1aab9bc  | err:
c312f4f4eb794b4e87aee305a1aab9bc  | Using threshold 1 out of 4
c312f4f4eb794b4e87aee305a1aab9bc  | Using GF(2^40)
c312f4f4eb794b4e87aee305a1aab9bc  | Starting networking for 2/4 with server on mpcnode0:4999
c312f4f4eb794b4e87aee305a1aab9bc  | Sent 2 to mpcnode0:4999
c312f4f4eb794b4e87aee305a1aab9bc  | terminate called after throwing an instance of 'closed_connection'
c312f4f4eb794b4e87aee305a1aab9bc  | 2021/03/25 01:43:10 cmd.Run() failed with signal: aborted (core dumped)
c312f4f4eb794b4e87aee305a1aab9bc  | exit status 1

pitaya operation

Work from demo branch (coconut-lilione)

priority 1

  • run each MPC node in separate containers
  • introduce "fake" latency for testing the concurrency issues

priority 2

  • ratel compiler: try it out, re-organize code structure

priority 3

  • connect Ethereum testnet (kovan)
  • run in separate geo locations (regions) -- (e.g.: would be cool if deployment is on aws, google compute, azure, on my laptop)

Notes on code organization

Organize the code to reflect the different users:

  • Ratel developer
  • MPC node operator
  • Ethereum node operator

ethash/difficulty.go:55:25: not enough arguments in call to uint256.NewInt

This error happens when building the mpc server go code.

# github.com/ethereum/go-ethereum/consensus/ethash
/go/src/github.com/ethereum/go-ethereum/consensus/ethash/difficulty.go:55:25: not enough arguments in call to uint256.NewInt
        have ()
        want (uint64)
/go/src/github.com/ethereum/go-ethereum/consensus/ethash/difficulty.go:99:25: not enough arguments in call to uint256.NewInt
        have ()
        want (uint64)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.