fork版本 | 服务名称 | tag | 官方镜像 | |
---|---|---|---|---|
fork12 | zkevm-contracts | v8.0.0-fork.12 | ||
zkevm-prover-stateless-executor | v8.0.0-RC14-fork.12 | hermeznetwork/zkevm-prover:v8.0.0-RC14-fork.12 | ||
zkevm-prover-state-executor | v8.0.0-RC14-fork.12 | hermeznetwork/zkevm-prover:v8.0.0-RC14-fork.12 | ||
cdk-erigon-sequencer | v2.1.2 | hermeznetwork/cdk-erigon:v2.1.2 | ||
cdk-erigon-rpc | v2.1.2 | hermeznetwork/cdk-erigon:v2.1.2 | ||
zkevm-pool-manager | v0.1.2 | hermeznetwork/zkevm-pool-manager:v0.1.2 | ||
Sequence sender&Aggregator | v0.4.0-beta5 | ghcr.io/0xpolygon/cdk:0.4.0-beta5 | ||
cdk-data-availability | v0.0.10 | 0xpolygon/cdk-data-availability:0.0.10 | ||
bridge-service | v0.6.0-RC1 | hermeznetwork/zkevm-bridge-service:v0.6.0-RC1 |
polygon cdk fork12各服务版本对应关系
调研polygon cdk-fork12是否支持在polygon pos测试网amoy部署
背景
调研polygon cdk-fork12是否支持在polygon pos测试网amoy部署
前置结论
结论:polygon cdk-fork12依赖于以太坊PoS状态检查,polygon pos测试网amoy RPC未实现该逻辑导致不兼容,无法支持部署polygon网络
概述
在推荐配置下,da,sequencer,sync,pool-manager,bridge 各个核心服务正常运行,交易正常处理
但sequence-sender运行报错,跟进代码,由于交易状态检查逻辑中,会依次检查各个状态的过度:LatestBlock->SafeBlock->PendingBlock->FinalizedBlock,由于polygon pos测试网amoy没有像以太坊PoS完整实现,所以导致报错
2024-11-14T12:21:48.112Z ERROR l1_check_block/l1_block_by_name.go:171 checkL1block:: Error getting L1 block %!d(string=safe/0). err: safe block not found {"pid": 40}
github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer/l1_check_block.(*L1BlockNumberByNameFetch).BlockNumber
/go/pkg/mod/github.com/0x!polygon!hermez/zkevm-synchronizer-l1@v1.0.5/synchronizer/l1_check_block/l1_block_by_name.go:171
github.com/0xPolygon/zkevm-ethtx-manager/ethtxmanager.(*Client).waitMinedTxToBeSafe
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/ethtxmanager/ethtxmanager.go:525
github.com/0xPolygon/zkevm-ethtx-manager/ethtxmanager.(*Client).Start
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/ethtxmanager/ethtxmanager.go:458
2024-11-14T12:21:48.112Z ERROR ethtxmanager/ethtxmanager.go:927 failed to wait safe tx to be finalized: failed to get safe block number: safe block not found%!(EXTRA string=
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/log/log.go:140 github.com/0xPolygon/zkevm-ethtx-manager/log.appendStackTraceMaybeArgs()
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/log/log.go:249 github.com/0xPolygon/zkevm-ethtx-manager/log.Errorf()
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/ethtxmanager/ethtxmanager.go:927 github.com/0xPolygon/zkevm-ethtx-manager/ethtxmanager.(*Client).logErrorAndWait()
/go/pkg/mod/github.com/0x!polygon/zkevm-ethtx-manager@v0.2.1/ethtxmanager/ethtxmanager.go:460 github.com/0xPolygon/zkevm-ethtx-manager/ethtxmanager.(*Client).Start()
// BlockFinality indicates the status of the blocks that will be queried in order to sync
BlockFinality string `jsonschema:"enum=LatestBlock, enum=SafeBlock, enum=PendingBlock, enum=FinalizedBlock, enum=EarliestBlock" mapstructure:"BlockFinality"` //nolint:lll
polygon cdk变更TrustedSequencerURL
背景
特殊场景需要变更合约PolygonZkEVM.sol中的TrustedSequencerURL
合约代码
/**
* @notice Allow the admin to set the trusted sequencer URL
* @param newTrustedSequencerURL URL of trusted sequencer
*/
function setTrustedSequencerURL(
string memory newTrustedSequencerURL
) external onlyAdmin {
trustedSequencerURL = newTrustedSequencerURL;
emit SetTrustedSequencerURL(newTrustedSequencerURL);
}
ABI
[{
"inputs": [
{
"internalType": "string",
"name": "newTrustedSequencerURL",
"type": "string"
}
],
"name": "setTrustedSequencerURL",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}]
测试
当前合约内TrustedSequencerURL:http://172.18.36.173:8123
期望变更为:http://172.18.39.162:8123
直接使用在线工具:https://www.smartcontractgui.xyz/
PolygonZkEVM合约地址在create_rollup_output.json->rollupAddress: 0x584eF34da0d700082d3c29cD3844d9524e656950
import { ethers } from 'hardhat';
import path from 'path';
import fs from 'fs';
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
import createRollupParameters from './create_rollup_output.json';
async function main() {
const privateKey = path.join(__dirname, 'keystore', './admin.privateKey');
const data = fs.readFileSync(privateKey, 'UTF-8');
const wa = new ethers.Wallet(data, ethers.provider);
console.log(`Use ${wa.address}`);
const polygonZkEVM = (await ethers.getContractFactory('PolygonZkEVM', wa)).attach(createRollupParameters.rollupAddress);
console.log(await polygonZkEVM.trustedSequencerURL());
const tx = await polygonZkEVM.setTrustedSequencerURL("http://172.18.39.162:8123");
await tx.wait(1);
console.log(await polygonZkEVM.trustedSequencerURL());
}
main().catch((error) => {
console.error(error);
process.exit(1);
});
cdk-erigon - ChainDB name is not recognized
chain = ctx.String(ChainFlag.Name)
if strings.HasPrefix(chain, "dynamic") {
configFilePath := ctx.String(ConfigFlag.Name)
if configFilePath == "" {
Fatalf("Config file is required for dynamic chain")
}
// Be sure to set this first
params.DynamicChainConfigPath = filepath.Dir(configFilePath)
filename := path.Join(params.DynamicChainConfigPath, chain+"-conf.json")
genesis := core.GenesisBlockByChainName(chain)
dConf := DynamicConfig{}
if _, err := os.Stat(filename); err == nil {
dConfBytes, err := os.ReadFile(filename)
if err != nil {
panic(err)
}
if err := json.Unmarshal(dConfBytes, &dConf); err != nil {
panic(err)
}
}
genesis.Timestamp = dConf.Timestamp
genesis.GasLimit = dConf.GasLimit
genesis.Difficulty = big.NewInt(dConf.Difficulty)
cfg.Genesis = genesis
genesisHash := libcommon.HexToHash(dConf.Root)
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkID = params.NetworkIDByChainName(chain)
}
SetDNSDiscoveryDefaults(cfg, genesisHash)
} else {
switch chain {
default:
genesis := core.GenesisBlockByChainName(chain)
genesisHash := params.GenesisHashByChainName(chain)
if (genesis == nil) || (genesisHash == nil) {
Fatalf("ChainDB name is not recognized: %s", chain)
新建的自定义链,名称需要以dynamic
关键词,例如dynamic-bcskill-testnet
, 否则会获取对应的hash进行比对
cdk-data-availability之TrackSequence参数分析
// Start starts the SequencerTracker
func (st *Tracker) Start(parentCtx context.Context) {
st.startOnce.Do(func() {
ctx, cancel := context.WithTimeout(parentCtx, st.timeout)
defer cancel()
addr, err := st.em.TrustedSequencer(ctx)
if err != nil {
log.Fatalf("failed to get sequencer addr: %v", err)
return
}
log.Infof("current sequencer addr: %s", addr.Hex())
st.setAddr(addr)
url, err := st.em.TrustedSequencerURL(ctx)
if err != nil {
log.Fatalf("failed to get sequencer addr: %v", err)
return
}
log.Infof("current sequencer url: %s", url)
st.setUrl(url)
if st.trackChanges {
log.Info("sequencer tracking enabled")
go st.trackAddrChanges(parentCtx)
go st.trackUrlChanges(parentCtx)
}
})
}
分析
当TrackSequence设置为true时,会在TrackSequencerPollInterval间隔内,检查L1合约内的TrustedSequencer地址和URL是否有变更,并更新本地
场景
因为TrustedSequencer地址和URL变更频率很低,默认情况下TrackSequence可以设置为false,对比变更比较频繁的场景,可以将TrackSequence改为true
注:当cdk-data-availability服务重启时,会自动对齐配置