-
Notifications
You must be signed in to change notification settings - Fork 3
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
force L1 origin to be finalized L1 block #3
base: develop
Are you sure you want to change the base?
Conversation
这是不对的,Casper共识算法的延迟没有人可以预测
根据前面的描述,这是必要的 |
Silas提到derivation逻辑已经在维护finalized header,所以我们不用自己去调RPC |
还有个问题待确认:我们的sequencing window是相对L1 finalized block定义的吗?如果不是的话,L1迟迟不finalize block可能将我们逼出sequencing windows。 |
我也同意要用L1那边给出的finalized block做L1 origin,而不能自己用
我的理解是的,所以我们要根据需要增加sequencing window的大小。 |
… instead of confDepth
已经修改为通过rpc获取的 |
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.
Our current devnet setting does not have a drift between L1 head (latest) and L1 finalized blocks -- the finalized and latest block are always the same in Reth's dev mode. We may need to setup a separate testing environment (or modify current devnet) to test this PR.
l1Finalized := c.l1Finalized() | ||
if num > l1Finalized.Number { | ||
return eth.L1BlockRef{}, ethereum.NotFound | ||
} | ||
// Don't apply the conf depth if l1Head is empty (as it is during the startup case before the l1State is initialized). | ||
l1Head := c.l1Head() |
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.
Since l1Head
is always ahead of l1Finalized
, the following code (the original logic) is effectively dead code. I am not sure whether we should remove them in this PR or just keep them for reference.
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.
dead code是指37行以后吗?如果是的,它不会是dead code, 因为num = previous_l1_origin + 1,正常运行情况下是走37行后面逻辑的
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.
我意思是其原来的获取l1Head的相关的逻辑。我们现在应该是不需要l1Head这个函数了对吧?
这里可以做的是让sequencer在发现自己很可能没有时间提交(比如现在的L1 latest和sequencing window右边界相差不到12小时时)主动停止出块(开启新的epoch) |
sequencing drift可能也要调 |
I would be open to merging the usage |
Great! We will add the command line option. |
此PR需要解决的问题是: 强制让l1_origin是 finalized block, 这样即使l1发生reorg, l2也不会发生reorg.
mega-reth match branch: https://github.com/megaeth-labs/mega-reth/tree/clay/feature/l1_origin_finalized
修改位置:
对第2点修改的解释: 通过 --sequencer.l1-conf = 10这个值来保证获取的块一定是
finalized
, 换句话说,如果现在l1-latest=100, 那么l2的l1origin最多是90, 那么在第90个块必定是finalized, 生产环境可以设置为64(一个块的finalized最长时间是2个epoch = 2 * 32 slot = 2 * 32 * 1 个块 = 2 * 32 = 64;另外一种方法是在findL1origin这个函数里加一个 eth_getBlockByNumber('finalized', false)获取最新
finalized
区块比较;(这个相对保险但感觉没必要);