Conversation
|
@leonprou I believe I'm supposed to sync up with you to figure out exactly how to structure the runtime logic for the changes. Everything works here, I just need to know exactly where you guys want to go with this feature. For example, who can submit signatures for which blocks (are cycles important), can validators submit signatures for multiple blocks at the same height, how many blocks should be confirmed before submitting the signatures, etc. |
sirpy
left a comment
There was a problem hiding this comment.
- contracts should not be here, they are irrelevant to the fuseapp
- what are all the changes to fuseapp files not related to the bridge?
- you are missing unit tests for the fuseapp bridge part, it is part of the bounty requirements
By default fuse+ethereum+bsc are always enabled no matter if they are in the list or not
@pmlambert you missed the comment above You are still not handling errors correctly in the .subscribe, better extract the whole .subscribe callback to a function |
app/index.js
Outdated
| logger.info('emitRegistry') | ||
| const currentBlock = (await web3.eth.getBlockNumber()).toNumber() | ||
| const chains = await blockRegistry.methods.getRpcs.call() | ||
| await Promise.all(chains.filter(chain => !blockchains[chain[0]] || blockchains[chain[0]].rpc != chain[1]).map(async (chain) => initBlockchain(...chain))) |
There was a problem hiding this comment.
if one initblockchain fail it shouldnt fail the whole function
app/index.js
Outdated
| if (chainId == 122) { | ||
| let cycleEnd = (await consensus.methods.getCurrentCycleEndBlock.call()).toNumber() | ||
| let validators = await consensus.methods.currentValidators().call() | ||
| const numValidators = validators.length | ||
| blockchains[chainId].blocks[block.hash] = await signFuse(block, chainId, blockchain.provider, blockchain.signer, cycleEnd, validators) | ||
| } | ||
| else { | ||
| blockchains[chainId].blocks[block.hash] = await sign(block, chainId, blockchain.provider, blockchain.signer) | ||
| } | ||
| }) |
There was a problem hiding this comment.
handle exceptions and extract to a function
|
Every step has its own requirement for unit tests. you can check the bounty and check boxes again for each step. |
app/index.js
Outdated
| logger.info(`initBlockRegistryContract`, process.env.BLOCK_REGISTRY_ADDRESS) | ||
| blockRegistry = new web3.eth.Contract(require(path.join(cwd, 'abi/blockRegistry')), process.env.BLOCK_REGISTRY_ADDRESS) | ||
| initBlockchain(1, process.env.ETH_RPC || throw "Missing ETH_RPC in environment") | ||
| initBlockchain(56, process.env.BSC_RPC || throw "Missing BSC_RPC in environment")) |
app/index.js
Outdated
| function initBlockRegistryContract() { | ||
| logger.info(`initBlockRegistryContract`, process.env.BLOCK_REGISTRY_ADDRESS) | ||
| blockRegistry = new web3.eth.Contract(require(path.join(cwd, 'abi/blockRegistry')), process.env.BLOCK_REGISTRY_ADDRESS) | ||
| initBlockchain(1, process.env.ETH_RPC || throw "Missing ETH_RPC in environment") |
app/index.js
Outdated
| logger.info('emitRegistry') | ||
| const currentBlock = (await web3.eth.getBlockNumber()).toNumber() | ||
| const chains = await blockRegistry.methods.getRpcs.call() | ||
| await Promise.all(chains.filter(chain => !blockchains[chain[0]] || blockchains[chain[0]].rpc != chain[1]).map(async (chain) => initBlockchain(...chain))) |
app/index.js
Outdated
| }) | ||
| }) | ||
| } catch(e) { | ||
| throw `emitRegistry failed trying to update rpcs` |
There was a problem hiding this comment.
i dont think that should prevent from calling addSignedBlocks part
app/index.js
Outdated
| } | ||
| await emitInitiateChange() | ||
| await emitRewardedOnCycle() | ||
| await emitRegistry() |
There was a problem hiding this comment.
i dont think an exception here should cause the fuseapp to exit
app/index.js
Outdated
| try { | ||
| logger.info('emitRegistry') | ||
| const currentBlock = (await web3.eth.getBlockNumber()).toNumber() | ||
| const chains = await blockRegistry.methods.getRpcs.call() |
There was a problem hiding this comment.
should be getRpcs()
and that's why I want unit tests or testnet deployment with mock contracts to see that this whole process is working
No description provided.