Skip to content

Commit

Permalink
improve the code and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
idirall22 committed Jul 5, 2021
1 parent b4b8ac0 commit 879edc9
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 224 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@ gen-contracts:
cd contracts/eth/nearbridge/ && yarn && yarn build
cd contracts/eth/nearprover/ && yarn && yarn build

# start near blockchain and connect with ganache.
start-ethash:
cli/index.js clean
cli/index.js prepare
cli/index.js start near-node
cli/index.js start ganache

# start near blockchain and connect with binance test net.
start-bsc:
cli/index.js clean
cli/index.js prepare --core-src ${HOME}/Desktop/core
cli/index.js prepare
cli/index.js start near-node
cli/index.js start binance-smart-chain



# deploy contracts
full-bsc-contracts:
cli/index.js init-near-contracts
Expand All @@ -45,7 +50,7 @@ light-bsc-contracts:
# start-relayer eth2near-relay, near2eth-relay and bridge-watchdog
start-relayer:
cli/index.js start eth2near-relay
cli/index.js start near2eth-relay
cli/index.js start near2eth-relay
cli/index.js start bridge-watchdog
pm2 logs

Expand All @@ -58,4 +63,4 @@ build-eth-client:
test-eth-client:
cd contracts/near/eth-client && ./test.sh

.PHONEY: help init start-ethash start-bsc gen-contracts deploy-contracts start-relayer stop-all build-eth-client
.PHONY: help init yarn-init gen-contracts start-bsc full-bsc-contracts light-bsc-contracts start-relayer stop-all build-eth-client test-eth-client start-ethash
12 changes: 8 additions & 4 deletions cli/commands/start/binance-smart-chain.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// Binance Smart chain configurations to connect with testnet
class StartBinanceSmartChainNodeCommand {
static async execute () {
static async execute ({ ethNodeUrl, ethMasterSk, nearClientValidateHeader }) {
if (nearClientValidateHeader !== 'true' && nearClientValidateHeader !== 'false') {
nearClientValidateHeader = 'true'
}

return {
ethNodeUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545',
ethMasterSk: '0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200',
nearClientValidateHeader: 'true',
ethNodeUrl: ethNodeUrl !== '' ? ethNodeUrl : 'https://data-seed-prebsc-1-s1.binance.org:8545',
ethMasterSk: ethMasterSk !== '' ? ethMasterSk : '0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200',
nearClientValidateHeader: nearClientValidateHeader,
nearClientValidateHeaderMode: 'bsc'
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/start/eth2near-relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class StartEth2NearRelayCommand {
)
await clientContract.accessKeyInit()
console.log('Initializing eth2near-relay...', { ethNodeUrl, metricsPort })
relay.initialize(clientContract, { ethNodeUrl, totalSubmitBlock, gasPerTransaction, metricsPort, nearClientValidateHeaderMode})
relay.initialize(clientContract, { ethNodeUrl, totalSubmitBlock, gasPerTransaction, metricsPort, nearClientValidateHeaderMode })
console.log('Starting eth2near-relay...')
await relay.run()
}
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/start/ganache.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class StartGanacheNodeCommand {
ethNodeUrl: 'ws://localhost:9545',
ethMasterSk: '0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200',
nearClientValidateHeader: 'false',
nearClientValidateHeaderMode: "ethash"
nearClientValidateHeaderMode: 'ethash'
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ RainbowConfig.addOptions(
RainbowConfig.addOptions(
startCommand.command('binance-smart-chain'),
StartBinanceSmartChainNodeCommand.execute,
[]
[
'eth-node-url',
'eth-master-sk',
'near-client-validate-header'
]
)

RainbowConfig.addOptions(
Expand Down
1 change: 0 additions & 1 deletion contracts/near/eth-client/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ else
userflag=""
fi

# simple:latest \
docker run \
--mount type=bind,source=$DIR/..,target=/host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined $userflag \
Expand Down
Loading

0 comments on commit 879edc9

Please sign in to comment.