-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BlockHeaderRegistry #123
base: master
Are you sure you want to change the base?
BlockHeaderRegistry #123
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if one initblockchain fail it shouldnt fail the whole function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bsc has public rpc
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use cloudflare eth endpoint
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not done
app/index.js
Outdated
}) | ||
}) | ||
} catch(e) { | ||
throw `emitRegistry failed trying to update rpcs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think that should prevent from calling addSignedBlocks part
app/index.js
Outdated
const isValidator = await consensus.methods.isValidator(web3.utils.toChecksumAddress(account)).call() | ||
if (!isValidator) { | ||
logger.warn(`${account} is not a validator, skipping`) | ||
return | ||
} | ||
await emitInitiateChange() | ||
await emitRewardedOnCycle() | ||
await emitRegistry() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.