diff --git a/Makefile b/Makefile index 7019f83f0..c8a72db59 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ ################## update dependencies #################### -ETHEREUM_SUBMODULE_COMMIT_OR_TAG := morph-v2.2.1 -ETHEREUM_TARGET_VERSION := morph-v2.2.1 -TENDERMINT_TARGET_VERSION := v0.3.6 +ETHEREUM_SUBMODULE_COMMIT_OR_TAG := morph-v2.2.2 +ETHEREUM_TARGET_VERSION := morph-v2.2.2 +TENDERMINT_TARGET_VERSION := v0.3.7 ETHEREUM_MODULE_NAME := github.com/morph-l2/go-ethereum diff --git a/bindings/go.mod b/bindings/go.mod index 172b9cad2..23e199622 100644 --- a/bindings/go.mod +++ b/bindings/go.mod @@ -2,9 +2,9 @@ module morph-l2/bindings go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 -require github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 +require github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca require ( github.com/VictoriaMetrics/fastcache v1.12.2 // indirect diff --git a/bindings/go.sum b/bindings/go.sum index 6bff7f937..59b4694bb 100644 --- a/bindings/go.sum +++ b/bindings/go.sum @@ -111,8 +111,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= diff --git a/contracts/go.mod b/contracts/go.mod index 597d2ffa8..0022fa257 100644 --- a/contracts/go.mod +++ b/contracts/go.mod @@ -2,11 +2,11 @@ module morph-l2/contract go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( github.com/iden3/go-iden3-crypto v0.0.16 - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/stretchr/testify v1.10.0 ) diff --git a/contracts/go.sum b/contracts/go.sum index fc0b74087..0c859cc2c 100644 --- a/contracts/go.sum +++ b/contracts/go.sum @@ -138,8 +138,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/go-ethereum b/go-ethereum index 62952ec7d..045be0fdc 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 62952ec7d188953ee7b3224c3693baffa97c8084 +Subproject commit 045be0fdc7ca6f80e18eb4e26f7452500292ccec diff --git a/go.work.sum b/go.work.sum index 4af762d6c..c3da941e8 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1288,6 +1288,7 @@ github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= @@ -1351,15 +1352,18 @@ golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210915214749-c084706c2272/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d h1:+W8Qf4iJtMGKkyAygcKohjxTk4JPsL9DpzApJ22m5Ic= golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= @@ -1369,9 +1373,10 @@ golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhp golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1384,10 +1389,14 @@ golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -1399,15 +1408,19 @@ golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2 h1:IRJeR9r1pYWsHKTRe/IInb7lYvbBVIqOgsX/u0mbOWY= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b h1:DU+gwOBXU+6bO0sEyO7o/NeMlxZxCZEvI7v+J4a1zRQ= golang.org/x/telemetry v0.0.0-20250710130107-8d8967aff50b/go.mod h1:4ZwOYna0/zsOKwuR5X/m0QFOJpSZvAxFfkQT+Erd9D4= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU= golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= @@ -1416,13 +1429,18 @@ golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1432,11 +1450,12 @@ golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df h1:5Pf6pFKu98ODmgnpvkJ3kFUOQGGLIzLIkbzUHp47618= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= diff --git a/node/cmd/keyconverter/key_converter.go b/node/cmd/keyconverter/key_converter.go deleted file mode 100644 index a10dd3662..000000000 --- a/node/cmd/keyconverter/key_converter.go +++ /dev/null @@ -1,50 +0,0 @@ -package keyconverter - -import ( - "encoding/base64" - "fmt" - - "github.com/morph-l2/go-ethereum/common/hexutil" - "github.com/morph-l2/go-ethereum/crypto/bls12381" - "github.com/tendermint/tendermint/blssignatures" - "github.com/urfave/cli" -) - -func ConvertKey(ctx *cli.Context) error { - args := ctx.Args() - if len(args) != 1 { - return fmt.Errorf("wrong args length, expected: %d, actual: %d", 1, len(args)) - } - base64EncodedKey := args[0] - raw, err := base64.StdEncoding.DecodeString(base64EncodedKey) - if err != nil { - return fmt.Errorf("failed to decode base64 keys, err: %v", err) - } - keyType := ctx.String("type") - switch keyType { - case "tm": - if len(raw) != 32 { - return fmt.Errorf("wrong public key length, expected: 32, actual: %d", len(raw)) - } - fmt.Printf("converted tendermint public key: %v \n", hexutil.Encode(raw)) - case "bls": - blsPublicKey, err := blssignatures.PublicKeyFromBytes(raw, true) - if err != nil { - return fmt.Errorf("failed to decode base64 keys, err: %v", err) - } - encodedPoint := bls12381.NewG2().EncodePoint(blsPublicKey.Key) - fmt.Printf("converted bls encoded key: %v \n", hexutil.Encode(encodedPoint)) - - default: - return fmt.Errorf("unknown key type provided. expected: tm/bls") - } - return nil -} - -var Flags = []cli.Flag{ - cli.StringFlag{ - Name: "type", - Usage: "the key type being converted: tm/bls. tm: tendermint public key for the consensus; bls: bls public key for bls signature", - Value: "tm", - }, -} diff --git a/node/cmd/node/main.go b/node/cmd/node/main.go index bc39e33cf..5884fe6fd 100644 --- a/node/cmd/node/main.go +++ b/node/cmd/node/main.go @@ -21,7 +21,6 @@ import ( "morph-l2/bindings/bindings" "morph-l2/node/blocktag" - "morph-l2/node/cmd/keyconverter" node "morph-l2/node/core" "morph-l2/node/db" "morph-l2/node/derivation" @@ -34,21 +33,12 @@ import ( "morph-l2/node/validator" ) -var keyConverterCmd = cli.Command{ - Name: "key-converter", - Aliases: []string{"kc"}, - Usage: "tools to convert base64-encoded keys(tendermint key/bls key) to the format used by contracts", - Action: keyconverter.ConvertKey, - Flags: keyconverter.Flags, -} - func main() { app := cli.NewApp() app.Flags = flags.Flags app.Name = "morphnode" app.Action = L2NodeMain app.Commands = []cli.Command{ - keyConverterCmd, versionCmd, } err := app.Run(os.Args) diff --git a/node/core/batch.go b/node/core/batch.go deleted file mode 100644 index 987c4bf03..000000000 --- a/node/core/batch.go +++ /dev/null @@ -1,353 +0,0 @@ -package node - -import ( - "bytes" - "context" - "fmt" - "math/big" - - "morph-l2/node/types" - - "github.com/morph-l2/go-ethereum/common" - eth "github.com/morph-l2/go-ethereum/core/types" - "github.com/morph-l2/go-ethereum/crypto" - "github.com/morph-l2/go-ethereum/crypto/bls12381" - "github.com/tendermint/tendermint/l2node" - tmtypes "github.com/tendermint/tendermint/types" -) - -type BatchingCache struct { - parentBatchHeader *types.BatchHeaderBytes - prevStateRoot common.Hash - - // accumulated batch data - batchData *types.BatchData - totalL1MessagePopped uint64 - postStateRoot common.Hash - withdrawRoot common.Hash - - lastPackedBlockHeight uint64 - // caches sealedBatchHeader according to the above accumulated batch data - sealedBatchHeader *types.BatchHeaderBytes - sealedSidecar *eth.BlobTxSidecar - - currentBlockContext []byte - currentTxsPayload []byte - currentTxs tmtypes.Txs - currentL1TxsHashes []common.Hash - totalL1MessagePoppedAfterCurBlock uint64 - currentStateRoot common.Hash - currentWithdrawRoot common.Hash - currentBlockBytes []byte - currentTxsHash []byte -} - -func NewBatchingCache() *BatchingCache { - return &BatchingCache{ - batchData: types.NewBatchData(), - } -} - -func (bc *BatchingCache) IsEmpty() bool { - return bc.batchData == nil || bc.batchData.IsEmpty() -} - -func (bc *BatchingCache) IsCurrentEmpty() bool { - return len(bc.currentBlockContext) == 0 -} - -func (bc *BatchingCache) ClearCurrent() { - bc.currentTxsPayload = nil - bc.currentTxs = nil - bc.currentL1TxsHashes = nil - bc.currentBlockContext = nil - bc.totalL1MessagePoppedAfterCurBlock = 0 - bc.currentStateRoot = common.Hash{} - bc.currentWithdrawRoot = common.Hash{} - bc.currentBlockBytes = nil - bc.currentTxsHash = nil -} - -// CalculateCapWithProposalBlock calculate the transaction payload size and chunks count with the proposed block. -// It queries the blocks from the last batch point to now, in order to seal a new batch by SealBatch with these blocks. -// It stores the proposed block as the `currentBlockContext`, which is used by PackCurrentBlock to pack it to batch. -// It can be called by multiple times during the same height consensus process. -func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs, get l2node.GetFromBatchStartFunc) (bool, error) { - e.logger.Info("CalculateCapWithProposalBlock request", "block size", len(currentBlockBytes), "txs size", len(currentTxs)) - if e.batchingCache.IsEmpty() { - parentBatchHeaderBytes, blocks, transactions, err := get() - if err != nil { - return false, err - } - - var parentBatchHeader types.BatchHeaderBytes - if len(parentBatchHeaderBytes) == 0 { - genesisHeader, err := e.l2Client.HeaderByNumber(context.Background(), big.NewInt(0)) - if err != nil { - return false, err - } - genesisBatchHeader, err := GenesisBatchHeader(genesisHeader) - if err != nil { - return false, err - } - parentBatchHeader = genesisBatchHeader.Bytes() - } else { - parentBatchHeader = parentBatchHeaderBytes - } - - var txsPayload []byte - var l1TxHashes []common.Hash - var lastHeightBeforeCurrentBatch uint64 - var lastBlockStateRoot common.Hash - var lastBlockWithdrawRoot common.Hash - var l2TxNum int - - totalL1MessagePopped, err := parentBatchHeader.TotalL1MessagePopped() - if err != nil { - e.logger.Error("failed to get totalL1MessagePopped from parentBatchHeader", "error", err) - return false, err - } - - for i, blockBz := range blocks { - wBlock := new(types.WrappedBlock) - if err = wBlock.UnmarshalBinary(blockBz); err != nil { - return false, err - } - - if i == 0 { - lastHeightBeforeCurrentBatch = wBlock.Number - 1 - } - - if i == len(blocks)-1 { // last block - lastBlockStateRoot = wBlock.StateRoot - lastBlockWithdrawRoot = wBlock.WithdrawTrieRoot - } - - totalL1MessagePoppedBefore := totalL1MessagePopped - txsPayload, l1TxHashes, totalL1MessagePopped, l2TxNum, err = ParsingTxs(transactions[i], totalL1MessagePoppedBefore) - if err != nil { - return false, err - } - l1TxNum := int(totalL1MessagePopped - totalL1MessagePoppedBefore) - e.logger.Info("fetched block", "block height", wBlock.Number, "involved transaction count", len(transactions[i]), "l2 tx num", l2TxNum, "l1 tx num", l1TxNum) - blockContext := wBlock.BlockContextBytes(l2TxNum+l1TxNum, l1TxNum) - e.batchingCache.batchData.Append(blockContext, txsPayload, l1TxHashes) - e.batchingCache.totalL1MessagePopped = totalL1MessagePopped - e.batchingCache.lastPackedBlockHeight = wBlock.Number - } - - // make sure passed block is the next block of the last packed block - curHeight, err := types.HeightFromBlockBytes(currentBlockBytes) - if err != nil { - return false, err - } - if curHeight != e.batchingCache.lastPackedBlockHeight+1 { - return false, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, curHeight) - } - - e.batchingCache.parentBatchHeader = &parentBatchHeader - header, err := e.l2Client.HeaderByNumber(context.Background(), big.NewInt(int64(lastHeightBeforeCurrentBatch))) - if err != nil { - return false, err - } - e.batchingCache.prevStateRoot = header.Root - e.batchingCache.postStateRoot = lastBlockStateRoot - e.batchingCache.withdrawRoot = lastBlockWithdrawRoot - - // initialize latest batch index - index, _ := e.batchingCache.parentBatchHeader.BatchIndex() - e.metrics.BatchIndex.Set(float64(index)) - } - - block, err := types.WrappedBlockFromBytes(currentBlockBytes) - if err != nil { - return false, err - } - height := block.Number - if height <= e.batchingCache.lastPackedBlockHeight { - return false, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, height) - } else if height > e.batchingCache.lastPackedBlockHeight+1 { // skipped some blocks, cache is dirty. need rebuild the cache - e.batchingCache = NewBatchingCache() // clean the cache, recall the function - e.logger.Info("the proposed block height is discontinuous from the block height in the cache, start to clean the cache and recall the function", - "proposed block height", height, - "batchingCache.lastPackedBlockHeight", e.batchingCache.lastPackedBlockHeight) - return e.CalculateCapWithProposalBlock(currentBlockBytes, currentTxs, get) - } - - if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil { - return false, err - } - - var exceeded bool - if e.isBatchUpgraded(block.Timestamp) { - exceeded, err = e.batchingCache.batchData.WillExceedCompressedSizeLimit(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload) - } else { - exceeded, err = e.batchingCache.batchData.EstimateCompressedSizeWithNewPayload(e.batchingCache.currentTxsPayload) - } - return exceeded, err -} - -func (e *Executor) AppendBlsData(height int64, batchHash []byte, data l2node.BlsData) error { - if len(batchHash) != 32 { - return fmt.Errorf("wrong batchHash length. expected: 32, actual: %d", len(batchHash)) - } - blsSig, err := e.ConvertBlsData(data) - if err != nil { - return err - } - var hash common.Hash - copy(hash[:], batchHash) - return e.l2Client.AppendBlsSignature(context.Background(), hash, *blsSig) -} - -// PackCurrentBlock pack the current block data in batchingCache into the batch -// It is supposed to be called when the current block is confirmed. -func (e *Executor) PackCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs) error { - // It is ok here to return nil, as `CalculateBatchSizeWithProposalBlock` will search historic blocks belongs to the batch being sealed. - if e.batchingCache.IsCurrentEmpty() { - return nil // nothing to pack - } - - // reconstruct current block context - // it is possible that the confirmed current block is different from the existing cached current block context - if !bytes.Equal(currentBlockBytes, e.batchingCache.currentBlockBytes) || - !bytes.Equal(currentTxs.Hash(), e.batchingCache.currentTxsHash) { - e.logger.Info("current block is changed, reconstructing current context...") - if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil { - return err - } - } - - curHeight, err := types.HeightFromBlockBytes(currentBlockBytes) - if err != nil { - return err - } - if e.batchingCache.batchData == nil { - e.batchingCache.batchData = types.NewBatchData() - } - e.batchingCache.batchData.Append(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload, e.batchingCache.currentL1TxsHashes) - e.batchingCache.totalL1MessagePopped = e.batchingCache.totalL1MessagePoppedAfterCurBlock - e.batchingCache.withdrawRoot = e.batchingCache.currentWithdrawRoot - e.batchingCache.postStateRoot = e.batchingCache.currentStateRoot - e.batchingCache.lastPackedBlockHeight = curHeight - e.batchingCache.ClearCurrent() - - e.logger.Info("Packed current block into the batch") - return nil -} - -func (e *Executor) BatchHash(batchHeaderBytes []byte) ([]byte, error) { - return crypto.Keccak256Hash(batchHeaderBytes).Bytes(), nil -} - -func (e *Executor) setCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs) error { - currentTxsPayload, curL1TxsHashes, totalL1MessagePopped, l2TxNum, err := ParsingTxs(currentTxs, e.batchingCache.totalL1MessagePopped) - if err != nil { - return err - } - var curBlock = new(types.WrappedBlock) - if err = curBlock.UnmarshalBinary(currentBlockBytes); err != nil { - return err - } - - l1TxNum := int(totalL1MessagePopped - e.batchingCache.totalL1MessagePopped) - currentBlockContext := curBlock.BlockContextBytes(l2TxNum+l1TxNum, l1TxNum) - e.batchingCache.currentBlockContext = currentBlockContext - e.batchingCache.currentTxsPayload = currentTxsPayload - e.batchingCache.currentTxs = currentTxs - e.batchingCache.currentL1TxsHashes = curL1TxsHashes - e.batchingCache.totalL1MessagePoppedAfterCurBlock = totalL1MessagePopped - e.batchingCache.currentStateRoot = curBlock.StateRoot - e.batchingCache.currentWithdrawRoot = curBlock.WithdrawTrieRoot - e.batchingCache.currentBlockBytes = currentBlockBytes - e.batchingCache.currentTxsHash = currentTxs.Hash() - return nil -} - -func ParsingTxs(transactions tmtypes.Txs, totalL1MessagePoppedBefore uint64) (txsPayload []byte, l1TxHashes []common.Hash, totalL1MessagePopped uint64, l2TxNum int, err error) { - // the next queue index that we need to process - nextIndex := totalL1MessagePoppedBefore - - for i, txBz := range transactions { - var tx eth.Transaction - if err = tx.UnmarshalBinary(txBz); err != nil { - return nil, nil, 0, 0, fmt.Errorf("transaction %d is not valid: %v", i, err) - } - - if isL1MessageTxType(txBz) { - l1TxHashes = append(l1TxHashes, tx.Hash()) - - currentIndex := tx.L1MessageQueueIndex() - - if currentIndex < nextIndex { - return nil, nil, 0, 0, fmt.Errorf("unexpected batch payload, expected queue index: %d, got: %d. transaction hash: %v", nextIndex, currentIndex, tx.Hash()) - } - - nextIndex = currentIndex + 1 - continue - } - l2TxNum++ - txsPayload = append(txsPayload, txBz...) - } - - totalL1MessagePopped = nextIndex - return -} - -func GenesisBatchHeader(genesisHeader *eth.Header) (types.BatchHeaderV0, error) { - wb := types.WrappedBlock{ - ParentHash: genesisHeader.ParentHash, - Miner: genesisHeader.Coinbase, - Number: genesisHeader.Number.Uint64(), - GasLimit: genesisHeader.GasLimit, - BaseFee: genesisHeader.BaseFee, - Timestamp: genesisHeader.Time, - StateRoot: genesisHeader.Root, - GasUsed: genesisHeader.GasUsed, - ReceiptRoot: genesisHeader.ReceiptHash, - } - blockContext := wb.BlockContextBytes(0, 0) - batchData := types.NewBatchData() - batchData.Append(blockContext, nil, nil) - - return types.BatchHeaderV0{ - BatchIndex: 0, - L1MessagePopped: 0, - TotalL1MessagePopped: 0, - DataHash: batchData.DataHash(), - BlobVersionedHash: types.EmptyVersionedHash, - PostStateRoot: genesisHeader.Root, - ParentBatchHash: common.Hash{}, - }, nil -} - -func (e *Executor) ConvertBlsDatas(blsDatas []l2node.BlsData) (ret []eth.BatchSignature, err error) { - for _, blsData := range blsDatas { - bs, err := e.ConvertBlsData(blsData) - if err != nil { - return nil, err - } - ret = append(ret, *bs) - } - return -} - -func (e *Executor) ConvertBlsData(blsData l2node.BlsData) (*eth.BatchSignature, error) { - var signer [32]byte - copy(signer[:], blsData.Signer) - val, found := e.valsByTmKey[signer] - if !found { - return nil, fmt.Errorf("found invalid validator: %x", blsData.Signer) - } - - bs := eth.BatchSignature{ - Signer: val.address, - SignerPubKey: new(bls12381.G2).EncodePoint(val.blsPubKey.Key), - Signature: blsData.Signature, - } - return &bs, nil -} - -func (e *Executor) isBatchUpgraded(blockTime uint64) bool { - return blockTime >= e.UpgradeBatchTime -} diff --git a/node/core/batch_commit.go b/node/core/batch_commit.go deleted file mode 100644 index c0f161768..000000000 --- a/node/core/batch_commit.go +++ /dev/null @@ -1,113 +0,0 @@ -package node - -import ( - "bytes" - "context" - "fmt" - "math/big" - "morph-l2/node/types" - - "github.com/morph-l2/go-ethereum/accounts/abi/bind" - eth "github.com/morph-l2/go-ethereum/core/types" - "github.com/tendermint/tendermint/l2node" - tmtypes "github.com/tendermint/tendermint/types" -) - -// CommitBatch commits the sealed batch. It does nothing if no batch header is sealed. -// It should be called when the current block is confirmed. -func (e *Executor) CommitBatch(currentBlockBytes []byte, currentTxs tmtypes.Txs, blsDatas []l2node.BlsData) error { - // If no batch data is available, do nothing - if e.batchingCache.IsEmpty() || e.batchingCache.sealedBatchHeader == nil { - return nil - } - - // Reconstruct current block context if needed - if !bytes.Equal(currentBlockBytes, e.batchingCache.currentBlockBytes) || !bytes.Equal(currentTxs.Hash(), e.batchingCache.currentTxsHash) { - e.logger.Info("Current block has changed. Reconstructing current context...") - if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil { - return fmt.Errorf("failed to set current block: %w", err) - } - } - - // Get current block height - curHeight, err := types.HeightFromBlockBytes(e.batchingCache.currentBlockBytes) - if err != nil { - return fmt.Errorf("failed to parse current block height: %w", err) - } - - // Convert BlsData to batch signatures (if applicable) - var batchSigs []eth.BatchSignature - if !e.devSequencer { - batchSigs, err = e.ConvertBlsDatas(blsDatas) - if err != nil { - return fmt.Errorf("failed to convert BLS data: %w", err) - } - } - - // Get the sequencer set at current height - 1 - callOpts := &bind.CallOpts{BlockNumber: big.NewInt(int64(curHeight - 1))} - sequencerSetBytes, err := e.sequencerCaller.GetSequencerSetBytes(callOpts) - if err != nil { - e.logger.Error("Failed to GetSequencerSetBytes", "blockHeight", curHeight-1, "error", err) - return fmt.Errorf("failed to get sequencer set bytes: %w", err) - } - - // Encode batch data and commit batch to L2 client - blockContexts, err := e.batchingCache.batchData.Encode() - if err != nil { - return fmt.Errorf("failed to encode block contexts: %w", err) - } - - version, err := e.batchingCache.sealedBatchHeader.Version() - if err != nil { - return fmt.Errorf("failed to get batch version: %w", err) - } - - parentBatchIndex, _ := e.batchingCache.parentBatchHeader.BatchIndex() - hash, _ := e.batchingCache.sealedBatchHeader.Hash() - l1MessagePopped, _ := e.batchingCache.sealedBatchHeader.L1MessagePopped() - // Construct the batch and commit it - if err = e.l2Client.CommitBatch(context.Background(), ð.RollupBatch{ - Version: uint(version), - Index: parentBatchIndex + 1, - Hash: hash, - ParentBatchHeader: *e.batchingCache.parentBatchHeader, - CurrentSequencerSetBytes: sequencerSetBytes, - BlockContexts: blockContexts, - PrevStateRoot: e.batchingCache.prevStateRoot, - PostStateRoot: e.batchingCache.postStateRoot, - WithdrawRoot: e.batchingCache.withdrawRoot, - Sidecar: e.batchingCache.sealedSidecar, - LastBlockNumber: e.batchingCache.lastPackedBlockHeight, - NumL1Messages: uint16(l1MessagePopped), - }, batchSigs); err != nil { - return fmt.Errorf("failed to commit batch to L2 client: %w", err) - } - - // Update batch index metric - e.metrics.BatchIndex.Set(float64(parentBatchIndex + 1)) - - // Commit the batch and reset the cache for the next batch - e.commitSealedBatch(curHeight) - - e.logger.Info("Committed batch", "batchIndex", parentBatchIndex+1) - return nil -} - -// commitSealedBatch commits the sealed batch and resets cache for the next batch. -func (e *Executor) commitSealedBatch(curHeight uint64) { - e.batchingCache.parentBatchHeader = e.batchingCache.sealedBatchHeader - e.batchingCache.prevStateRoot = e.batchingCache.postStateRoot - e.batchingCache.sealedBatchHeader = nil - e.batchingCache.sealedSidecar = nil - - e.batchingCache.totalL1MessagePopped = e.batchingCache.totalL1MessagePoppedAfterCurBlock - e.batchingCache.postStateRoot = e.batchingCache.currentStateRoot - e.batchingCache.withdrawRoot = e.batchingCache.currentWithdrawRoot - e.batchingCache.lastPackedBlockHeight = curHeight - - // Reset batch data and current context - e.batchingCache.batchData = types.NewBatchData() - e.batchingCache.batchData.Append(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload, e.batchingCache.currentL1TxsHashes) - e.batchingCache.ClearCurrent() -} diff --git a/node/core/batch_seal.go b/node/core/batch_seal.go deleted file mode 100644 index be02cdfe1..000000000 --- a/node/core/batch_seal.go +++ /dev/null @@ -1,151 +0,0 @@ -package node - -import ( - "errors" - "fmt" - - "morph-l2/node/types" - - "github.com/morph-l2/go-ethereum/common" - eth "github.com/morph-l2/go-ethereum/core/types" -) - -// SealBatch seals the accumulated blocks into a batch. -// It ensures proper compression and data preparation based on the batch version. -// It should be called after CalculateBatchSizeWithProposalBlock which ensure the accumulated blocks is correct. -func (e *Executor) SealBatch() ([]byte, []byte, error) { - // Ensure the batching cache is not empty - if e.batchingCache.IsEmpty() { - return nil, nil, errors.New("failed to seal batch: batch cache is empty") - } - - // Parse the current block from the cache - block, err := types.WrappedBlockFromBytes(e.batchingCache.currentBlockBytes) - if err != nil { - return nil, nil, fmt.Errorf("failed to parse current block: %w", err) - } - - // Compress and get data hash based on batch version - compressedPayload, batchDataHash, err := e.handleBatchSealing(block.Timestamp) - if err != nil { - return nil, nil, err - } - - // Generate sidecar for blob data - sidecar, err := types.MakeBlobTxSidecar(compressedPayload) - if err != nil { - return nil, nil, fmt.Errorf("failed to create blob sidecar: %w", err) - } - - // Retrieve sequencer verification hash - sequencerSetVerifyHash, err := e.sequencerCaller.SequencerSetVerifyHash(nil) - if err != nil { - return nil, nil, fmt.Errorf("failed to get sequencer set verification hash: %w", err) - } - - // Create batch header - batchHeader := e.createBatchHeader(batchDataHash, sidecar, sequencerSetVerifyHash, block.Timestamp) - - // Cache the sealed header and sidecar - e.batchingCache.sealedBatchHeader = &batchHeader - e.batchingCache.sealedSidecar = sidecar - - batchHash, err := batchHeader.Hash() - if err != nil { - return nil, nil, fmt.Errorf("failed to hash sealed batch header: %w", err) - } - // Log information about the sealed batch - e.logSealedBatch(batchHeader, batchHash) - // Return the batch hash and encoded batch header - return batchHash[:], batchHeader, nil -} - -// handleBatchSealing determines which version to use for compression and calculates the data hash. -func (e *Executor) handleBatchSealing(blockTimestamp uint64) ([]byte, common.Hash, error) { - var ( - compressedPayload []byte - batchDataHash common.Hash - err error - ) - - // Check if the batch should use the upgraded version - if e.isBatchUpgraded(blockTimestamp) { - compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayloadV2()) - if err != nil { - return nil, common.Hash{}, fmt.Errorf("failed to compress upgraded payload: %w", err) - } - - if len(compressedPayload) <= types.MaxBlobBytesSize { - batchDataHash, err = e.batchingCache.batchData.DataHashV2() - if err != nil { - return nil, common.Hash{}, fmt.Errorf("failed to calculate upgraded data hash: %w", err) - } - return compressedPayload, batchDataHash, nil - } - } - - // Fallback to old version if upgraded is not used - compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayload()) - if err != nil { - return nil, common.Hash{}, fmt.Errorf("failed to compress payload: %w", err) - } - batchDataHash = e.batchingCache.batchData.DataHash() - - return compressedPayload, batchDataHash, nil -} - -// createBatchHeader creates a BatchHeader from the given parameters. -func (e *Executor) createBatchHeader(dataHash common.Hash, sidecar *eth.BlobTxSidecar, sequencerSetVerifyHash common.Hash, blockTimestamp uint64) types.BatchHeaderBytes { - blobHashes := []common.Hash{types.EmptyVersionedHash} - if sidecar != nil && len(sidecar.Blobs) > 0 { - blobHashes = sidecar.BlobHashes() - } - - parentBatchHeaderTotalL1, _ := e.batchingCache.parentBatchHeader.TotalL1MessagePopped() - - l1MessagePopped := e.batchingCache.totalL1MessagePopped - parentBatchHeaderTotalL1 - - parentBatchIndex, _ := e.batchingCache.parentBatchHeader.BatchIndex() - parentBatchHash, _ := e.batchingCache.parentBatchHeader.Hash() - batchHeaderV0 := types.BatchHeaderV0{ - BatchIndex: parentBatchIndex + 1, - L1MessagePopped: l1MessagePopped, - TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped, - DataHash: dataHash, - BlobVersionedHash: blobHashes[0], - PrevStateRoot: e.batchingCache.prevStateRoot, - PostStateRoot: e.batchingCache.postStateRoot, - WithdrawalRoot: e.batchingCache.withdrawRoot, - SequencerSetVerifyHash: sequencerSetVerifyHash, - ParentBatchHash: parentBatchHash, - } - if e.isBatchUpgraded(blockTimestamp) { - batchHeaderV1 := types.BatchHeaderV1{ - BatchHeaderV0: batchHeaderV0, - LastBlockNumber: e.batchingCache.lastPackedBlockHeight, - } - return batchHeaderV1.Bytes() - } - - return batchHeaderV0.Bytes() -} - -// logSealedBatch logs the details of the sealed batch for debugging purposes. -func (e *Executor) logSealedBatch(batchHeader types.BatchHeaderBytes, batchHash common.Hash) { - e.logger.Info("Sealed batch header", "batchHash", batchHash.Hex()) - batchIndex, _ := batchHeader.BatchIndex() - l1MessagePopped, _ := batchHeader.L1MessagePopped() - totalL1MessagePopped, _ := batchHeader.TotalL1MessagePopped() - dataHash, _ := batchHeader.DataHash() - parentBatchHash, _ := batchHeader.ParentBatchHash() - e.logger.Info(fmt.Sprintf("===batchIndex: %d \n===L1MessagePopped: %d \n===TotalL1MessagePopped: %d \n===dataHash: %x \n===blockNum: %d \n===ParentBatchHash: %x \n", - batchIndex, - l1MessagePopped, - totalL1MessagePopped, - dataHash, - e.batchingCache.batchData.BlockNum(), - parentBatchHash)) - - blockContexts, _ := e.batchingCache.batchData.Encode() - e.logger.Info(fmt.Sprintf("===blockContexts: %x \n", blockContexts)) -} diff --git a/node/core/batch_test.go b/node/core/batch_test.go deleted file mode 100644 index 2b4023a62..000000000 --- a/node/core/batch_test.go +++ /dev/null @@ -1 +0,0 @@ -package node diff --git a/node/core/config.go b/node/core/config.go index 0c288e9fe..dbd6e19ca 100644 --- a/node/core/config.go +++ b/node/core/config.go @@ -23,9 +23,6 @@ import ( ) var ( - MainnetUpgradeBatchTime uint64 = 0 - MainnetBlsKeyCheckForkHeight uint64 = 18409547 - // L1 Mainnet Contract Addresses MainnetRollupContractAddress = common.HexToAddress("0x759894ced0e6af42c26668076ffa84d02e3cef60") ) @@ -34,11 +31,8 @@ type Config struct { L2 *types.L2Config `json:"l2"` L2CrossDomainMessengerAddress common.Address `json:"cross_domain_messenger_address"` SequencerAddress common.Address `json:"sequencer_address"` - GovAddress common.Address `json:"gov_address"` L2StakingAddress common.Address `json:"l2staking_address"` MaxL1MessageNumPerBlock uint64 `json:"max_l1_message_num_per_block"` - UpgradeBatchTime uint64 `json:"upgrade_batch_time"` - BlsKeyCheckForkHeight uint64 `json:"bls_key_check_fork_height"` DevSequencer bool `json:"dev_sequencer"` Logger tmlog.Logger `json:"logger"` } @@ -50,7 +44,6 @@ func DefaultConfig() *Config { MaxL1MessageNumPerBlock: 100, L2CrossDomainMessengerAddress: predeploys.L2CrossDomainMessengerAddr, SequencerAddress: predeploys.SequencerAddr, - GovAddress: predeploys.GovAddr, L2StakingAddress: predeploys.L2StakingAddr, } } @@ -149,32 +142,9 @@ func (c *Config) SetCliContext(ctx *cli.Context) error { } } - if ctx.GlobalIsSet(flags.GovAddr.Name) { - addr := common.HexToAddress(ctx.GlobalString(flags.GovAddr.Name)) - c.GovAddress = addr - if len(c.GovAddress.Bytes()) == 0 { - return errors.New("invalid GovAddr") - } - } - if ctx.GlobalIsSet(flags.DevSequencer.Name) { c.DevSequencer = ctx.GlobalBool(flags.DevSequencer.Name) } - if ctx.GlobalIsSet(flags.BlsKeyCheckForkHeight.Name) { - c.BlsKeyCheckForkHeight = ctx.GlobalUint64(flags.BlsKeyCheckForkHeight.Name) - } - - // setup batch upgrade index and fork heights - switch { - case ctx.GlobalIsSet(flags.MainnetFlag.Name): - c.UpgradeBatchTime = MainnetUpgradeBatchTime - c.BlsKeyCheckForkHeight = MainnetBlsKeyCheckForkHeight - logger.Info("set UpgradeBatchTime: ", c.UpgradeBatchTime, "BlsKeyCheckForkHeight: ", c.BlsKeyCheckForkHeight) - case ctx.GlobalIsSet(flags.UpgradeBatchTime.Name): - c.UpgradeBatchTime = ctx.GlobalUint64(flags.UpgradeBatchTime.Name) - logger.Info("set UpgradeBatchTime: ", ctx.GlobalUint64(flags.UpgradeBatchTime.Name)) - } - return nil } diff --git a/node/core/executor.go b/node/core/executor.go index 4efe6e8b4..fa8bf0a88 100644 --- a/node/core/executor.go +++ b/node/core/executor.go @@ -5,12 +5,9 @@ import ( "errors" "fmt" "math/big" - "time" - "github.com/morph-l2/go-ethereum/accounts/abi" "github.com/morph-l2/go-ethereum/accounts/abi/bind" "github.com/morph-l2/go-ethereum/common" - "github.com/morph-l2/go-ethereum/common/hexutil" eth "github.com/morph-l2/go-ethereum/core/types" "github.com/morph-l2/go-ethereum/eth/catalyst" "github.com/morph-l2/go-ethereum/ethclient" @@ -19,7 +16,6 @@ import ( "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/l2node" tmlog "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "morph-l2/bindings/bindings" "morph-l2/node/sync" @@ -38,24 +34,17 @@ type Executor struct { newSyncerFunc NewSyncerFunc syncer *sync.Syncer - govCaller *bindings.GovCaller sequencerCaller *bindings.SequencerCaller l2StakingCaller *bindings.L2StakingCaller currentSeqHash *[32]byte - valsByTmKey map[[tmKeySize]byte]validatorInfo + seqTmKeySet map[[tmKeySize]byte]struct{} nextValidators [][]byte - batchParams tmproto.BatchParams tmPubKey []byte isSequencer bool devSequencer bool - UpgradeBatchTime uint64 - blsKeyCheckForkHeight uint64 - rollupABI *abi.ABI - batchingCache *BatchingCache - logger tmlog.Logger metrics *Metrics } @@ -91,40 +80,27 @@ func NewExecutor(newSyncFunc NewSyncerFunc, config *Config, tmPubKey crypto.PubK if err != nil { return nil, err } - gov, err := bindings.NewGovCaller(config.GovAddress, l2Client) - if err != nil { - return nil, err - } l2Staking, err := bindings.NewL2StakingCaller(config.L2StakingAddress, l2Client) if err != nil { return nil, err } - rollupAbi, err := bindings.RollupMetaData.GetAbi() - if err != nil { - return nil, err - } var tmPubKeyBytes []byte if tmPubKey != nil { tmPubKeyBytes = tmPubKey.Bytes() } executor := &Executor{ - l2Client: l2Client, - bc: &Version1Converter{}, - govCaller: gov, - sequencerCaller: sequencer, - l2StakingCaller: l2Staking, - tmPubKey: tmPubKeyBytes, - nextL1MsgIndex: index, - maxL1MsgNumPerBlock: config.MaxL1MessageNumPerBlock, - newSyncerFunc: newSyncFunc, - devSequencer: config.DevSequencer, - rollupABI: rollupAbi, - batchingCache: NewBatchingCache(), - UpgradeBatchTime: config.UpgradeBatchTime, - blsKeyCheckForkHeight: config.BlsKeyCheckForkHeight, - logger: logger, - metrics: PrometheusMetrics("morphnode"), + l2Client: l2Client, + bc: &Version1Converter{}, + sequencerCaller: sequencer, + l2StakingCaller: l2Staking, + tmPubKey: tmPubKeyBytes, + nextL1MsgIndex: index, + maxL1MsgNumPerBlock: config.MaxL1MessageNumPerBlock, + newSyncerFunc: newSyncFunc, + devSequencer: config.DevSequencer, + logger: logger, + metrics: PrometheusMetrics("morphnode"), } if config.DevSequencer { @@ -263,31 +239,30 @@ func (e *Executor) CheckBlockData(txs [][]byte, metaData []byte) (valid bool, er return validated, err } -func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2node.ConsensusData) (nextBatchParams *tmproto.BatchParams, nextValidatorSet [][]byte, err error) { +func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2node.ConsensusData) (nextValidatorSet [][]byte, err error) { e.logger.Info("DeliverBlock request", "txs length", len(txs), - "blockMeta length", len(metaData), - "batchHash", hexutil.Encode(consensusData.BatchHash)) + "blockMeta length", len(metaData)) height, err := e.l2Client.BlockNumber(context.Background()) if err != nil { - return nil, nil, err + return nil, err } if metaData == nil { e.logger.Error("blockMeta cannot be nil") - return nil, nil, errors.New("blockMeta cannot be nil") + return nil, errors.New("blockMeta cannot be nil") } wrappedBlock := new(types.WrappedBlock) if err = wrappedBlock.UnmarshalBinary(metaData); err != nil { e.logger.Error("failed to UnmarshalBinary meta data bytes", "err", err) - return nil, nil, err + return nil, err } if wrappedBlock.Number <= height { e.logger.Info("block already delivered by geth (via P2P sync)", "block_number", wrappedBlock.Number) if e.devSequencer { - return nil, consensusData.ValidatorSet, nil + return consensusData.ValidatorSet, nil } - return e.getParamsAndValsAtHeight(int64(wrappedBlock.Number)) + return e.getValidatorsAtHeight(int64(wrappedBlock.Number)) } // We only accept the continuous blocks for now. @@ -296,11 +271,7 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n e.logger.Error("geth is behind", "consensus_block", wrappedBlock.Number, "geth_height", height) - return nil, nil, types.ErrWrongBlockNumber - } - - if len(consensusData.BatchHash) > 0 { - e.metrics.BatchPointHeight.Set(float64(wrappedBlock.Number)) + return nil, types.ErrWrongBlockNumber } l2Block := &catalyst.ExecutableL2Data{ @@ -320,38 +291,27 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n Transactions: txs, } - var batchHash *common.Hash - if consensusData.BatchHash != nil { - batchHash = new(common.Hash) - copy(batchHash[:], consensusData.BatchHash) - } - err = e.l2Client.NewL2Block(context.Background(), l2Block, batchHash) + err = e.l2Client.NewL2Block(context.Background(), l2Block) if err != nil { e.logger.Error("failed to NewL2Block", "error", err, "block_number", l2Block.Number, "block_timestamp", l2Block.Timestamp) - return nil, nil, err + return nil, err } - // end block e.updateNextL1MessageIndex(l2Block) - var newValidatorSet = consensusData.ValidatorSet - var newBatchParams *tmproto.BatchParams + newValidatorSet := consensusData.ValidatorSet if !e.devSequencer { if newValidatorSet, err = e.updateSequencerSet(l2Block.Number); err != nil { - return nil, nil, err - } - if newBatchParams, err = e.batchParamsUpdates(l2Block.Number); err != nil { - return nil, nil, err + return nil, err } } e.metrics.Height.Set(float64(l2Block.Number)) - return newBatchParams, newValidatorSet, - nil + return newValidatorSet, nil } // EncodeTxs @@ -382,43 +342,23 @@ func (e *Executor) RequestHeight(tmHeight int64) (int64, error) { return int64(curHeight), nil } -func (e *Executor) getParamsAndValsAtHeight(height int64) (*tmproto.BatchParams, [][]byte, error) { +func (e *Executor) getValidatorsAtHeight(height int64) ([][]byte, error) { callOpts := &bind.CallOpts{ BlockNumber: big.NewInt(height), } - batchBlockInterval, err := e.govCaller.BatchBlockInterval(callOpts) - if err != nil { - return nil, nil, err - } - batchTimeout, err := e.govCaller.BatchTimeout(callOpts) - if err != nil { - return nil, nil, err - } - // fetch current sequencerSet info at certain height addrs, err := e.sequencerCaller.GetSequencerSet2(callOpts) if err != nil { - return nil, nil, err + return nil, err } stakesInfo, err := e.l2StakingCaller.GetStakesInfo(callOpts, addrs) if err != nil { - return nil, nil, err + return nil, err } newValidators := make([][]byte, 0, len(addrs)) for i := range stakesInfo { - // validate blsKey to keep consistent with sequencerSetUpdates - if _, err := decodeBlsPubKey(stakesInfo[i].BlsKey); err != nil { - e.logger.Error("getParamsAndValsAtHeight: failed to decode bls key", "key bytes", hexutil.Encode(stakesInfo[i].BlsKey), "error", err) - if e.isBlsKeyCheckFork(uint64(height)) { - continue - } - } newValidators = append(newValidators, stakesInfo[i].TmKey[:]) } - - return &tmproto.BatchParams{ - BlocksInterval: batchBlockInterval.Int64(), - Timeout: time.Duration(batchTimeout.Int64() * int64(time.Second)), - }, newValidators, nil + return newValidators, nil } func (e *Executor) L2Client() *types.RetryableClient { @@ -498,8 +438,7 @@ func (e *Executor) ApplyBlockV2(block *l2node.BlockV2) error { return types.ErrWrongBlockNumber } - // Apply the block (no batch hash in sequencer mode for now) - err = e.l2Client.NewL2Block(context.Background(), execBlock, nil) + err = e.l2Client.NewL2Block(context.Background(), execBlock) if err != nil { e.logger.Error("failed to apply block v2", "error", err) return err diff --git a/node/core/metrics.gen.go b/node/core/metrics.gen.go index 22c6ab90f..719cff18c 100644 --- a/node/core/metrics.gen.go +++ b/node/core/metrics.gen.go @@ -20,18 +20,6 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { Name: "height", Help: "", }, labels).With(labelsAndValues...), - BatchPointHeight: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Namespace: namespace, - Subsystem: MetricsSubsystem, - Name: "batch_point_height", - Help: "", - }, labels).With(labelsAndValues...), - BatchIndex: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ - Namespace: namespace, - Subsystem: MetricsSubsystem, - Name: "batch_index", - Help: "", - }, labels).With(labelsAndValues...), NextL1MessageQueueIndex: prometheus.NewGaugeFrom(stdprometheus.GaugeOpts{ Namespace: namespace, Subsystem: MetricsSubsystem, @@ -44,8 +32,6 @@ func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { func NopMetrics() *Metrics { return &Metrics{ Height: discard.NewGauge(), - BatchPointHeight: discard.NewGauge(), - BatchIndex: discard.NewGauge(), NextL1MessageQueueIndex: discard.NewGauge(), } } diff --git a/node/core/metrics.go b/node/core/metrics.go index a6850529e..048a4ad8d 100644 --- a/node/core/metrics.go +++ b/node/core/metrics.go @@ -12,7 +12,5 @@ const ( type Metrics struct { Height metrics.Gauge - BatchPointHeight metrics.Gauge - BatchIndex metrics.Gauge NextL1MessageQueueIndex metrics.Gauge } diff --git a/node/core/sequencers.go b/node/core/sequencers.go index 771bff752..e56b522b3 100644 --- a/node/core/sequencers.go +++ b/node/core/sequencers.go @@ -2,73 +2,20 @@ package node import ( "bytes" - "errors" - "fmt" - "math/big" "slices" - "time" "github.com/morph-l2/go-ethereum/common" - "github.com/morph-l2/go-ethereum/common/hexutil" - "github.com/morph-l2/go-ethereum/crypto/bls12381" - "github.com/tendermint/tendermint/blssignatures" "github.com/tendermint/tendermint/crypto/ed25519" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) const tmKeySize = ed25519.PubKeySize -// isBlsKeyCheckFork returns true if blsKey validation should be enforced at the given height. -// For mainnet, blsKey validation is skipped before fork height to maintain historical compatibility. -func (e *Executor) isBlsKeyCheckFork(height uint64) bool { - return e.blsKeyCheckForkHeight == 0 || height > e.blsKeyCheckForkHeight -} - -type validatorInfo struct { - address common.Address - blsPubKey blssignatures.PublicKey -} - -func (e *Executor) getBlsPubKeyByTmKey(tmPubKey []byte) (blssignatures.PublicKey, bool) { - var tmKey [32]byte - copy(tmKey[:], tmPubKey) - val, found := e.valsByTmKey[tmKey] - if !found { - return blssignatures.PublicKey{}, false - } - return val.blsPubKey, true -} - -func (e *Executor) VerifySignature(tmPubKey []byte, messageHash []byte, blsSig []byte) (bool, error) { - if e.devSequencer { - e.logger.Info("we are in dev mode, do not verify the bls signature") - return true, nil - } - if len(e.valsByTmKey) == 0 { - return false, errors.New("no available sequencers found in layer2") - } - - blsKey, found := e.getBlsPubKeyByTmKey(tmPubKey) - if !found { - return false, errors.New("it is not a valid sequencer") - } - - sig, err := blssignatures.SignatureFromBytes(blsSig) - if err != nil { - e.logger.Error("failed to recover bytes to signature", "error", err) - return false, fmt.Errorf("failed to recover bytes to signature, error: %v", err) - } - return blssignatures.VerifySignature(sig, messageHash, blsKey) -} - func (e *Executor) sequencerSetUpdates(height uint64) ([][]byte, error) { seqHash, err := e.sequencerCaller.SequencerSetVerifyHash(nil) if err != nil { return nil, err } - // Don't use cache at fork height boundary to ensure correct blsKey validation behavior change - atForkBoundary := e.blsKeyCheckForkHeight > 0 && (height == e.blsKeyCheckForkHeight || height == e.blsKeyCheckForkHeight+1) - if e.currentSeqHash != nil && bytes.Equal(e.currentSeqHash[:], seqHash[:]) && !atForkBoundary { + if e.currentSeqHash != nil && bytes.Equal(e.currentSeqHash[:], seqHash[:]) { return e.nextValidators, nil } @@ -88,8 +35,7 @@ func (e *Executor) sequencerSetUpdates(height uint64) ([][]byte, error) { cache := make(map[common.Address]struct{}) requestAddrs := make([]common.Address, 0) for _, addr := range append(append(sequencerSet0, sequencerSet1...), sequencerSet2...) { - _, ok := cache[addr] - if !ok { + if _, ok := cache[addr]; !ok { cache[addr] = struct{}{} requestAddrs = append(requestAddrs, addr) } @@ -100,63 +46,23 @@ func (e *Executor) sequencerSetUpdates(height uint64) ([][]byte, error) { return nil, err } - valsByTmKey := make(map[[tmKeySize]byte]validatorInfo) - nextValidators := make([][]byte, 0) + seqTmKeySet := make(map[[tmKeySize]byte]struct{}, len(stakesInfo)) + nextValidators := make([][]byte, 0, len(sequencerSet2)) for i := range stakesInfo { - blsPK, err := decodeBlsPubKey(stakesInfo[i].BlsKey) - if err != nil { - e.logger.Error("failed to decode bls key", "key bytes", hexutil.Encode(stakesInfo[i].BlsKey), "error", err) - if e.isBlsKeyCheckFork(height) { - continue - } - } // sequencerSet2 is the latest updated sequencer set which is considered as the next validator set for tendermint if slices.Contains(sequencerSet2, stakesInfo[i].Addr) { nextValidators = append(nextValidators, stakesInfo[i].TmKey[:]) } - valsByTmKey[stakesInfo[i].TmKey] = validatorInfo{ - address: stakesInfo[i].Addr, - blsPubKey: blsPK, - } + seqTmKeySet[stakesInfo[i].TmKey] = struct{}{} } - e.logger.Info("sequencers updates, sequencer verified hash changed") - e.valsByTmKey = valsByTmKey + e.logger.Info("sequencers updates, sequencer verified hash changed", "height", height) + e.seqTmKeySet = seqTmKeySet e.nextValidators = nextValidators e.currentSeqHash = &seqHash return nextValidators, nil } -func (e *Executor) batchParamsUpdates(height uint64) (*tmproto.BatchParams, error) { - var ( - batchBlockInterval, batchTimeout *big.Int - err error - ) - - if batchBlockInterval, err = e.govCaller.BatchBlockInterval(nil); err != nil { - return nil, err - } - if batchTimeout, err = e.govCaller.BatchTimeout(nil); err != nil { - return nil, err - } - - changed := e.batchParams.BlocksInterval != batchBlockInterval.Int64() || - int64(e.batchParams.Timeout.Seconds()) != batchTimeout.Int64() - - if changed { - e.batchParams.BlocksInterval = batchBlockInterval.Int64() - e.batchParams.Timeout = time.Duration(batchTimeout.Int64() * int64(time.Second)) - e.logger.Info("batch params changed", "height", height, - "batchBlockInterval", batchBlockInterval.Int64(), - "batchTimeout", batchTimeout.Int64()) - return &tmproto.BatchParams{ - BlocksInterval: batchBlockInterval.Int64(), - Timeout: time.Duration(batchTimeout.Int64() * int64(time.Second)), - }, nil - } - return nil, nil -} - func (e *Executor) updateSequencerSet(height uint64) ([][]byte, error) { validatorUpdates, err := e.sequencerSetUpdates(height) if err != nil { @@ -166,7 +72,7 @@ func (e *Executor) updateSequencerSet(height uint64) ([][]byte, error) { var tmPKBz [tmKeySize]byte copy(tmPKBz[:], e.tmPubKey) - _, isSequencer := e.valsByTmKey[tmPKBz] + _, isSequencer := e.seqTmKeySet[tmPKBz] if !e.isSequencer && isSequencer { e.logger.Info("I am a sequencer, start to launch syncer") if e.syncer == nil { @@ -188,11 +94,3 @@ func (e *Executor) updateSequencerSet(height uint64) ([][]byte, error) { e.isSequencer = isSequencer return validatorUpdates, nil } - -func decodeBlsPubKey(in []byte) (blssignatures.PublicKey, error) { - g2P, err := bls12381.NewG2().DecodePoint(in) - if err != nil { - return blssignatures.PublicKey{}, err - } - return blssignatures.NewTrustedPublicKey(g2P), nil -} diff --git a/node/flags/flags.go b/node/flags/flags.go index 017dbd35b..19325a4b0 100644 --- a/node/flags/flags.go +++ b/node/flags/flags.go @@ -58,12 +58,6 @@ var ( EnvVar: prefixEnvVar("L2_SEQUENCER_CONTRACT_ADDRESS"), } - GovAddr = cli.StringFlag{ - Name: "govContractAddr", - Usage: "gov contract address", - EnvVar: prefixEnvVar("GOV_CONTRACT_ADDRESS"), - } - L1NodeAddr = cli.StringFlag{ Name: "l1.rpc", Usage: "Address of L1 User JSON-RPC endpoint to use (eth namespace required)", @@ -253,12 +247,6 @@ var ( EnvVar: prefixEnvVar("SEQUENCER_PRIVATE_KEY"), } - // Batch rules - UpgradeBatchTime = cli.Uint64Flag{ - Name: "upgrade.batchTime", - Usage: "Batch index at which the sequencers start to upgrade the batch format", - EnvVar: prefixEnvVar("UPGRADE_BATCH_TIME"), - } MainnetFlag = cli.BoolFlag{ Name: "mainnet", Usage: "Morph mainnet", @@ -331,12 +319,6 @@ var ( Value: 26660, EnvVar: prefixEnvVar("METRICS_PORT"), } - - BlsKeyCheckForkHeight = cli.Uint64Flag{ - Name: "bls-key-check-fork-height", - Usage: "The height at which the BLS key check fork occurs", - EnvVar: prefixEnvVar("BLS_KEY_CHECK_FORK_HEIGHT"), - } ) var Flags = []cli.Flag{ @@ -350,7 +332,6 @@ var Flags = []cli.Flag{ MaxL1MessageNumPerBlock, L2CrossDomainMessengerContractAddr, L2SequencerAddr, - GovAddr, // sync optioins SyncDepositContractAddr, @@ -396,8 +377,6 @@ var Flags = []cli.Flag{ // consensus ConsensusSwitchHeight, - // batch rules - UpgradeBatchTime, MainnetFlag, // logger @@ -412,6 +391,4 @@ var Flags = []cli.Flag{ MetricsServerEnable, MetricsPort, MetricsHostname, - - BlsKeyCheckForkHeight, } diff --git a/node/go.mod b/node/go.mod index 71ff23104..2394b047a 100644 --- a/node/go.mod +++ b/node/go.mod @@ -2,16 +2,15 @@ module morph-l2/node go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( github.com/cenkalti/backoff/v4 v4.1.3 github.com/go-kit/kit v0.12.0 github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/golang-lru v1.0.2 - github.com/holiman/uint256 v1.2.4 github.com/klauspost/compress v1.17.9 - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/prometheus/client_golang v1.17.0 github.com/spf13/viper v1.13.0 github.com/stretchr/testify v1.10.0 @@ -64,6 +63,7 @@ require ( github.com/hashicorp/go-bexpr v0.1.13 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect + github.com/holiman/uint256 v1.2.4 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/iden3/go-iden3-crypto v0.0.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect diff --git a/node/go.sum b/node/go.sum index 769ef70e5..c8b895f05 100644 --- a/node/go.sum +++ b/node/go.sum @@ -361,10 +361,10 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= -github.com/morph-l2/tendermint v0.3.6 h1:N9FWdbAV7PSBifnCnVXgMUj9jKHMITNdrPniB8hiXlQ= -github.com/morph-l2/tendermint v0.3.6/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/tendermint v0.3.7 h1:6dHC0GYGKxP2eHzC3e/l1NBtjuqE3H6S1N/RgM0LOBI= +github.com/morph-l2/tendermint v0.3.7/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/node/sequencer/mock/sequencer.go b/node/sequencer/mock/sequencer.go index 55e9e6017..c6a9b0d37 100644 --- a/node/sequencer/mock/sequencer.go +++ b/node/sequencer/mock/sequencer.go @@ -57,7 +57,7 @@ func (s *Sequencer) Start() { log.Error("validating failed") continue } - if err := s.engine.L2Client().NewL2Block(context.Background(), l2Data, nil); err != nil { + if err := s.engine.L2Client().NewL2Block(context.Background(), l2Data); err != nil { log.Error("error occurs when creating l2 block", "error", err) continue } diff --git a/node/sequencer/tm_node.go b/node/sequencer/tm_node.go index b9cbffe38..9e47cbe1e 100644 --- a/node/sequencer/tm_node.go +++ b/node/sequencer/tm_node.go @@ -7,10 +7,8 @@ import ( "github.com/spf13/viper" tmtypes "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/blssignatures" "github.com/tendermint/tendermint/config" tmlog "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" tmnode "github.com/tendermint/tendermint/node" "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/proxy" @@ -71,14 +69,6 @@ func SetupNode( return nil, err } - if !tmos.FileExists(tmCfg.BLSKeyFile()) { - blssignatures.GenFileBLSKey().Save(tmCfg.BLSKeyFile()) - } - blsPrivKey, err := blssignatures.PrivateKeyFromBytes(blssignatures.LoadBLSKey(tmCfg.BLSKeyFile()).PrivKey) - if err != nil { - return nil, fmt.Errorf("failed to load bls priv key") - } - // Build verifier (SequencerVerifier implements tmsequencer.SequencerVerifier interface) var tmVerifier tmsequencer.SequencerVerifier if verifier != nil { @@ -89,7 +79,6 @@ func SetupNode( tmCfg, executor, privValidator, - &blsPrivKey, nodeKey, proxy.NewLocalClientCreator(NewApplication(tmtypes.NewBaseApplication(), executor.L2Client())), tmnode.DefaultGenesisDocProviderFunc(tmCfg), diff --git a/node/types/batch.go b/node/types/batch.go index c9746dfc7..3038dbb74 100644 --- a/node/types/batch.go +++ b/node/types/batch.go @@ -1,18 +1,10 @@ package types import ( - "encoding/binary" - "fmt" - - "morph-l2/node/zstd" - "github.com/morph-l2/go-ethereum/accounts/abi/bind" - "github.com/morph-l2/go-ethereum/common" - "github.com/morph-l2/go-ethereum/crypto" ) var ( - EmptyVersionedHash = common.HexToHash("0x010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014") LegacyRollupMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_chainID\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrorIncorrectBatchLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrorNoBlockInBatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"winner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"res\",\"type\":\"string\"}],\"name\":\"ChallengeRes\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ChallengeRewardClaim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"challengeDeposit\",\"type\":\"uint256\"}],\"name\":\"ChallengeState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"CommitBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"}],\"name\":\"FinalizeBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ProveRemainingClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"RevertBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"UpdateChallenger\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldPeriod\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newPeriod\",\"type\":\"uint256\"}],\"name\":\"UpdateFinalizationPeriodSeconds\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newPercent\",\"type\":\"uint256\"}],\"name\":\"UpdateProofRewardPercent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldWindow\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newWindow\",\"type\":\"uint256\"}],\"name\":\"UpdateProofWindow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldVerifier\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newVerifier\",\"type\":\"address\"}],\"name\":\"UpdateVerifier\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LAYER_2_CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"__maxNumTxInChunk\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"addChallenger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"batchChallengeReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batchChallenged\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchChallengedSuccess\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchDataStore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"originTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"finalizeTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"signedSequencersBitmap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchExist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchInChallenge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchInsideChallengeWindow\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"_batchHash\",\"type\":\"bytes32\"}],\"name\":\"challengeState\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"challenges\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"challengeDeposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"challengeSuccess\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"finished\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"claimProveRemaining\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"claimReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"parentBatchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blockContexts\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"skippedL1MessageBitmap\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawalRoot\",\"type\":\"bytes32\"}],\"internalType\":\"structIRollup.BatchDataInput\",\"name\":\"batchDataInput\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"signedSequencersBitmap\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"sequencerSets\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIRollup.BatchSignatureInput\",\"name\":\"batchSignatureInput\",\"type\":\"tuple\"}],\"name\":\"commitBatch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"committedBatches\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationPeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"}],\"name\":\"finalizeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"finalizedStateRoots\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"}],\"name\":\"importGenesisBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inChallenge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1StakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_messageQueue\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_finalizationPeriodSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_proofWindow\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_proofRewardPercent\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"}],\"name\":\"isBatchFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"challengerAddress\",\"type\":\"address\"}],\"name\":\"isChallenger\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isChallenger\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1StakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastCommittedBatchIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastFinalizedBatchIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proofRewardPercent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proofWindow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proveRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_batchProof\",\"type\":\"bytes\"}],\"name\":\"proveState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"removeChallenger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"revertBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revertReqIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"updateFinalizePeriodSeconds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newWindow\",\"type\":\"uint256\"}],\"name\":\"updateProofWindow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newProofRewardPercent\",\"type\":\"uint256\"}],\"name\":\"updateRewardPercentage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newVerifier\",\"type\":\"address\"}],\"name\":\"updateVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"withdrawalRoot\",\"type\":\"bytes32\"}],\"name\":\"withdrawalRoots\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"exist\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } @@ -20,151 +12,3 @@ var ( ABI: "[{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_chainID\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrZeroAddress\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrorIncorrectBatchLength\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrorNoBlockInBatch\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"winner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"string\",\"name\":\"res\",\"type\":\"string\"}],\"name\":\"ChallengeRes\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ChallengeRewardClaim\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"challengeDeposit\",\"type\":\"uint256\"}],\"name\":\"ChallengeState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"CommitBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"}],\"name\":\"FinalizeBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ProveRemainingClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"RevertBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"UpdateChallenger\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldPeriod\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newPeriod\",\"type\":\"uint256\"}],\"name\":\"UpdateFinalizationPeriodSeconds\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldPercent\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newPercent\",\"type\":\"uint256\"}],\"name\":\"UpdateProofRewardPercent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldWindow\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newWindow\",\"type\":\"uint256\"}],\"name\":\"UpdateProofWindow\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"oldVerifier\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newVerifier\",\"type\":\"address\"}],\"name\":\"UpdateVerifier\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"LAYER_2_CHAIN_ID\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"__maxNumTxInChunk\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"addChallenger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"batchChallengeReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batchChallenged\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchChallengedSuccess\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchDataStore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"originTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"finalizeTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"signedSequencersBitmap\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchExist\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchInChallenge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"batchInsideChallengeWindow\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"_batchHash\",\"type\":\"bytes32\"}],\"name\":\"challengeState\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"challenges\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"batchIndex\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"challengeDeposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"startTime\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"challengeSuccess\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"finished\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"claimProveRemaining\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"claimReward\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"parentBatchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"blockContexts\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawalRoot\",\"type\":\"bytes32\"}],\"internalType\":\"structIRollup.BatchDataInput\",\"name\":\"batchDataInput\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"signedSequencersBitmap\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"sequencerSets\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIRollup.BatchSignatureInput\",\"name\":\"batchSignatureInput\",\"type\":\"tuple\"}],\"name\":\"commitBatch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"committedBatches\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"committedStateRoots\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"finalizationPeriodSeconds\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"}],\"name\":\"finalizeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"finalizedStateRoots\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"}],\"name\":\"importGenesisBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inChallenge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_l1StakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_messageQueue\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_verifier\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_finalizationPeriodSeconds\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_proofWindow\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_proofRewardPercent\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_prevStateRoot\",\"type\":\"bytes32\"}],\"name\":\"initialize2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_batchIndex\",\"type\":\"uint256\"}],\"name\":\"isBatchFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"challengerAddress\",\"type\":\"address\"}],\"name\":\"isChallenger\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isChallenger\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1StakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastCommittedBatchIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastFinalizedBatchIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proofRewardPercent\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proofWindow\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"proveRemaining\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_batchProof\",\"type\":\"bytes\"}],\"name\":\"proveState\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_account\",\"type\":\"address\"}],\"name\":\"removeChallenger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"name\":\"revertBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"revertReqIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"updateFinalizePeriodSeconds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newWindow\",\"type\":\"uint256\"}],\"name\":\"updateProofWindow\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newProofRewardPercent\",\"type\":\"uint256\"}],\"name\":\"updateRewardPercentage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newVerifier\",\"type\":\"address\"}],\"name\":\"updateVerifier\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifier\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"withdrawalRoot\",\"type\":\"bytes32\"}],\"name\":\"withdrawalRoots\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"exist\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } ) - -type BatchData struct { - blockContexts []byte - l1TxHashes []byte - l1TxNum uint16 - blockNum uint16 - txsPayload []byte - - hash *common.Hash -} - -func NewBatchData() *BatchData { - return &BatchData{ - blockContexts: make([]byte, 0), - l1TxHashes: make([]byte, 0), - txsPayload: make([]byte, 0), - } -} - -func (cks *BatchData) Append(blockContext, txsPayload []byte, l1TxHashes []common.Hash) { - if cks == nil { - return - } - cks.blockContexts = append(cks.blockContexts, blockContext...) - cks.txsPayload = append(cks.txsPayload, txsPayload...) - cks.blockNum++ - for _, txHash := range l1TxHashes { - cks.l1TxHashes = append(cks.l1TxHashes, txHash.Bytes()...) - } - cks.l1TxNum += uint16(len(l1TxHashes)) -} - -// Encode encodes the data into bytes -// Below is the encoding, total 60*n+1+m bytes. -// Field Bytes Type Index Comments -// numBlocks 2 uint16 0 The number of blocks in this chunk -// block[0] 60 BlockContext 1 The first block in this chunk -// ...... -// block[i] 60 BlockContext 60*i+1 The (i+1)'th block in this chunk -// ...... -// block[n-1] 60 BlockContext 60*n-59 The last block in this chunk -func (cks *BatchData) Encode() ([]byte, error) { - if cks == nil || cks.blockNum == 0 { - return []byte{}, nil - } - - data := make([]byte, 2) - binary.BigEndian.PutUint16(data, cks.blockNum) - data = append(data, cks.blockContexts...) - return data, nil -} - -func (cks *BatchData) IsEmpty() bool { - return cks == nil || len(cks.blockContexts) == 0 -} - -func (cks *BatchData) DataHash() common.Hash { - if cks.hash != nil { - return *cks.hash - } - - var bz []byte - for i := 0; i < int(cks.blockNum); i++ { - bz = append(bz, cks.blockContexts[i*60:i*60+58]...) - } - bz = append(bz, cks.l1TxHashes...) - return crypto.Keccak256Hash(bz) -} - -// DataHashV2 computes the Keccak-256 hash of the batch data, incorporating -// the last block height, L1 transaction count, and L1 transaction hashes. -func (cks *BatchData) DataHashV2() (common.Hash, error) { - // Validate blockContexts length - if len(cks.blockContexts) < 60 { - return common.Hash{}, fmt.Errorf("blockContexts too short, length: %d", len(cks.blockContexts)) - } - - // Extract the last 60 bytes - lastBlockContext := cks.blockContexts[len(cks.blockContexts)-60:] - - // Parse block height - height, err := HeightFromBlockContextBytes(lastBlockContext) - if err != nil { - return common.Hash{}, fmt.Errorf("failed to parse blockContext: context length=%d, lastBlockContext=%x, err=%w", - len(cks.blockContexts), lastBlockContext, err) - } - - // Compute the hash - return cks.calculateHash(height), nil -} - -func (cks *BatchData) calculateHash(height uint64) common.Hash { - // Preallocate memory for efficiency - hashData := make([]byte, 8+2+len(cks.l1TxHashes)) // 8 bytes for height, 2 bytes for l1TxNum - copy(hashData[:8], Uint64ToBigEndianBytes(height)) - copy(hashData[8:10], Uint16ToBigEndianBytes(cks.l1TxNum)) - copy(hashData[10:], cks.l1TxHashes) - - return crypto.Keccak256Hash(hashData) -} - -func (cks *BatchData) TxsPayload() []byte { - return cks.txsPayload -} - -// TxsPayloadV2 returns the bytes combining the block contexts with the tx payload -func (cks *BatchData) TxsPayloadV2() []byte { - return append(cks.blockContexts, cks.txsPayload...) -} - -func (cks *BatchData) BlockNum() uint16 { return cks.blockNum } - -func (cks *BatchData) EstimateCompressedSizeWithNewPayload(txPayload []byte) (bool, error) { - blobBytes := append(cks.txsPayload, txPayload...) - if len(blobBytes) <= MaxBlobBytesSize { - return false, nil - } - compressed, err := zstd.CompressBatchBytes(blobBytes) - if err != nil { - return false, err - } - return len(compressed) > MaxBlobBytesSize, nil -} - -func (cks *BatchData) combinePayloads(newBlockContext, newTxPayload []byte) []byte { - totalLength := len(cks.blockContexts) + len(newBlockContext) + len(cks.txsPayload) + len(newTxPayload) - combined := make([]byte, totalLength) - copy(combined, cks.blockContexts) - copy(combined[len(cks.blockContexts):], newBlockContext) - copy(combined[len(cks.blockContexts)+len(newBlockContext):], cks.txsPayload) - copy(combined[len(cks.blockContexts)+len(newBlockContext)+len(cks.txsPayload):], newTxPayload) - return combined -} - -// WillExceedCompressedSizeLimit checks if the size of the combined block contexts -// and transaction payloads (after compression) exceeds the maximum allowed size. -func (cks *BatchData) WillExceedCompressedSizeLimit(newBlockContext, newTxPayload []byte) (bool, error) { - // Combine the existing and new block contexts and transaction payloads - combinedBytes := cks.combinePayloads(newBlockContext, newTxPayload) - if len(combinedBytes) <= MaxBlobBytesSize { - return false, nil - } - compressed, err := zstd.CompressBatchBytes(combinedBytes) - if err != nil { - return false, fmt.Errorf("compression failed: %w", err) - } - return len(compressed) > MaxBlobBytesSize, nil -} diff --git a/node/types/batch_header.go b/node/types/batch_header.go index d8832a7e8..1616d8962 100644 --- a/node/types/batch_header.go +++ b/node/types/batch_header.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/morph-l2/go-ethereum/common" - "github.com/morph-l2/go-ethereum/common/hexutil" "github.com/morph-l2/go-ethereum/crypto" ) @@ -146,70 +145,3 @@ func (b BatchHeaderBytes) LastBlockNumber() (uint64, error) { } return binary.BigEndian.Uint64(b[249:257]), nil } - -// structed batch header for version 0 -type BatchHeaderV0 struct { - BatchIndex uint64 - L1MessagePopped uint64 - TotalL1MessagePopped uint64 - DataHash common.Hash - BlobVersionedHash common.Hash - PrevStateRoot common.Hash - PostStateRoot common.Hash - WithdrawalRoot common.Hash - SequencerSetVerifyHash common.Hash - ParentBatchHash common.Hash - - //cache - EncodedBytes hexutil.Bytes -} - -func (b BatchHeaderV0) Bytes() BatchHeaderBytes { - if len(b.EncodedBytes) > 0 { - return BatchHeaderBytes(b.EncodedBytes) - } - batchBytes := make([]byte, expectedLengthV0) - batchBytes[0] = BatchHeaderVersion0 - binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex) - binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped) - binary.BigEndian.PutUint64(batchBytes[17:], b.TotalL1MessagePopped) - copy(batchBytes[25:], b.DataHash[:]) - copy(batchBytes[57:], b.BlobVersionedHash[:]) - copy(batchBytes[89:], b.PrevStateRoot[:]) - copy(batchBytes[121:], b.PostStateRoot[:]) - copy(batchBytes[153:], b.WithdrawalRoot[:]) - copy(batchBytes[185:], b.SequencerSetVerifyHash[:]) - copy(batchBytes[217:], b.ParentBatchHash[:]) - b.EncodedBytes = batchBytes - return batchBytes -} - -type BatchHeaderV1 struct { - BatchHeaderV0 - LastBlockNumber uint64 - - //cache - EncodedBytes hexutil.Bytes -} - -func (b BatchHeaderV1) Bytes() BatchHeaderBytes { - if len(b.EncodedBytes) > 0 { - return BatchHeaderBytes(b.EncodedBytes) - } - batchBytes := make([]byte, expectedLengthV1) - batchBytes[0] = BatchHeaderVersion1 - binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex) - binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped) - binary.BigEndian.PutUint64(batchBytes[17:], b.TotalL1MessagePopped) - copy(batchBytes[25:], b.DataHash[:]) - copy(batchBytes[57:], b.BlobVersionedHash[:]) - copy(batchBytes[89:], b.PrevStateRoot[:]) - copy(batchBytes[121:], b.PostStateRoot[:]) - copy(batchBytes[153:], b.WithdrawalRoot[:]) - copy(batchBytes[185:], b.SequencerSetVerifyHash[:]) - copy(batchBytes[217:], b.ParentBatchHash[:]) - binary.BigEndian.PutUint64(batchBytes[249:], b.LastBlockNumber) - - b.EncodedBytes = batchBytes - return batchBytes -} diff --git a/node/types/batch_test.go b/node/types/batch_test.go deleted file mode 100644 index 97a3393e8..000000000 --- a/node/types/batch_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package types - -import ( - "math/big" - "morph-l2/bindings/bindings" - "testing" - - "github.com/morph-l2/go-ethereum/common" - "github.com/stretchr/testify/require" -) - -func TestBatchHeader(t *testing.T) { - expectedBatchHeaderV0 := BatchHeaderV0{ - BatchIndex: 10, - L1MessagePopped: 5, - TotalL1MessagePopped: 20, - DataHash: common.BigToHash(big.NewInt(100)), - BlobVersionedHash: EmptyVersionedHash, - PrevStateRoot: common.BigToHash(big.NewInt(101)), - PostStateRoot: common.BigToHash(big.NewInt(102)), - WithdrawalRoot: common.BigToHash(big.NewInt(103)), - SequencerSetVerifyHash: common.BigToHash(big.NewInt(104)), - ParentBatchHash: common.BigToHash(big.NewInt(200)), - } - batchHeaderBytes := expectedBatchHeaderV0.Bytes() - - version, err := batchHeaderBytes.Version() - require.NoError(t, err) - batchIndex, err := batchHeaderBytes.BatchIndex() - require.NoError(t, err) - l1MessagePopped, err := batchHeaderBytes.L1MessagePopped() - require.NoError(t, err) - totalL1MessagePopped, err := batchHeaderBytes.TotalL1MessagePopped() - require.NoError(t, err) - dataHash, err := batchHeaderBytes.DataHash() - require.NoError(t, err) - blobVersionedHash, err := batchHeaderBytes.BlobVersionedHash() - require.NoError(t, err) - prevStateRoot, err := batchHeaderBytes.PrevStateRoot() - require.NoError(t, err) - postStateRoot, err := batchHeaderBytes.PostStateRoot() - require.NoError(t, err) - withdrawalRoot, err := batchHeaderBytes.WithdrawalRoot() - require.NoError(t, err) - sequencerSetVerifyHash, err := batchHeaderBytes.SequencerSetVerifyHash() - require.NoError(t, err) - parentBatchHash, err := batchHeaderBytes.ParentBatchHash() - require.NoError(t, err) - - require.EqualValues(t, 0, version) - require.EqualValues(t, expectedBatchHeaderV0.BatchIndex, batchIndex) - require.EqualValues(t, expectedBatchHeaderV0.L1MessagePopped, l1MessagePopped) - require.EqualValues(t, expectedBatchHeaderV0.TotalL1MessagePopped, totalL1MessagePopped) - require.EqualValues(t, expectedBatchHeaderV0.DataHash, dataHash) - require.EqualValues(t, expectedBatchHeaderV0.BlobVersionedHash, blobVersionedHash) - require.EqualValues(t, expectedBatchHeaderV0.PrevStateRoot, prevStateRoot) - require.EqualValues(t, expectedBatchHeaderV0.PostStateRoot, postStateRoot) - require.EqualValues(t, expectedBatchHeaderV0.WithdrawalRoot, withdrawalRoot) - require.EqualValues(t, expectedBatchHeaderV0.SequencerSetVerifyHash, sequencerSetVerifyHash) - require.EqualValues(t, expectedBatchHeaderV0.ParentBatchHash, parentBatchHash) - - expectedBatchHeaderV1 := BatchHeaderV1{ - BatchHeaderV0: expectedBatchHeaderV0, - LastBlockNumber: 1000, - }.Bytes() - version, err = expectedBatchHeaderV1.Version() - require.NoError(t, err) - lastBlockNumber, err := expectedBatchHeaderV1.LastBlockNumber() - require.NoError(t, err) - require.EqualValues(t, 1, version) - require.EqualValues(t, 1000, lastBlockNumber) -} - -func TestMethodID(t *testing.T) { - beforeSkipABI, err := LegacyRollupMetaData.GetAbi() - require.NoError(t, err) - beforeMoveBlockCtxABI, err := BeforeMoveBlockCtxABI.GetAbi() - require.NoError(t, err) - currentABI, err := bindings.RollupMetaData.GetAbi() - require.NoError(t, err) - require.NotEqualValues(t, beforeSkipABI.Methods["commitBatch"].ID, beforeMoveBlockCtxABI.Methods["commitBatch"].ID, currentABI.Methods["commitBatch"].ID) -} diff --git a/node/types/blob.go b/node/types/blob.go index 3dcd1750c..49b158bc1 100644 --- a/node/types/blob.go +++ b/node/types/blob.go @@ -3,10 +3,8 @@ package types import ( "bytes" "encoding/binary" - "errors" "fmt" "io" - "morph-l2/node/zstd" eth "github.com/morph-l2/go-ethereum/core/types" "github.com/morph-l2/go-ethereum/crypto/kzg4844" @@ -15,32 +13,6 @@ import ( const MaxBlobBytesSize = 4096 * 31 -var ( - emptyBlob = new(kzg4844.Blob) - emptyBlobCommit, _ = kzg4844.BlobToCommitment(emptyBlob) - emptyBlobProof, _ = kzg4844.ComputeBlobProof(emptyBlob, emptyBlobCommit) -) - -// MakeBlobCanonical converts the raw blob data into the canonical blob representation of 4096 BLSFieldElements. -func MakeBlobCanonical(blobBytes []byte) (b *kzg4844.Blob, err error) { - if len(blobBytes) > MaxBlobBytesSize { - return nil, fmt.Errorf("data is too large for blob. len=%v", len(blobBytes)) - } - offset := 0 - b = new(kzg4844.Blob) - // encode (up to) 31 bytes of remaining input data at a time into the subsequent field element - for i := 0; i < 4096; i++ { - offset += copy(b[i*32+1:i*32+32], blobBytes[offset:]) - if offset == len(blobBytes) { - break - } - } - if offset < len(blobBytes) { - return nil, fmt.Errorf("failed to fit all data into blob. bytes remaining: %v", len(blobBytes)-offset) - } - return -} - func RetrieveBlobBytes(blob *kzg4844.Blob) ([]byte, error) { data := make([]byte, MaxBlobBytesSize) for i := 0; i < 4096; i++ { @@ -52,69 +24,6 @@ func RetrieveBlobBytes(blob *kzg4844.Blob) ([]byte, error) { return data, nil } -func makeBlobCommitment(bz []byte) (b kzg4844.Blob, c kzg4844.Commitment, err error) { - blob, err := MakeBlobCanonical(bz) - if err != nil { - return - } - b = *blob - c, err = kzg4844.BlobToCommitment(&b) - if err != nil { - return - } - return -} - -func MakeBlobTxSidecar(blobBytes []byte) (*eth.BlobTxSidecar, error) { - if len(blobBytes) == 0 { - return ð.BlobTxSidecar{ - Blobs: []kzg4844.Blob{*emptyBlob}, - Commitments: []kzg4844.Commitment{emptyBlobCommit}, - Proofs: []kzg4844.Proof{emptyBlobProof}, - }, nil - } - if len(blobBytes) > 2*MaxBlobBytesSize { - return nil, errors.New("only 2 blobs at most is allowed") - } - blobCount := len(blobBytes)/(MaxBlobBytesSize+1) + 1 - var ( - err error - blobs = make([]kzg4844.Blob, blobCount) - commitments = make([]kzg4844.Commitment, blobCount) - ) - switch blobCount { - case 1: - blobs[0], commitments[0], err = makeBlobCommitment(blobBytes) - if err != nil { - return nil, err - } - case 2: - blobs[0], commitments[0], err = makeBlobCommitment(blobBytes[:MaxBlobBytesSize]) - if err != nil { - return nil, err - } - blobs[1], commitments[1], err = makeBlobCommitment(blobBytes[MaxBlobBytesSize:]) - if err != nil { - return nil, err - } - } - return ð.BlobTxSidecar{ - Blobs: blobs, - Commitments: commitments, - }, nil -} - -func CompressBatchBytes(batchBytes []byte) ([]byte, error) { - if len(batchBytes) == 0 { - return nil, nil - } - compressedBatchBytes, err := zstd.CompressBatchBytes(batchBytes) - if err != nil { - return nil, fmt.Errorf("failed to compress batch bytes, err: %w", err) - } - return compressedBatchBytes, nil -} - func DecodeTxsFromBytes(txsBytes []byte) (eth.Transactions, error) { reader := bytes.NewReader(txsBytes) txs := make(eth.Transactions, 0) diff --git a/node/types/blob_test.go b/node/types/blob_test.go deleted file mode 100644 index c7a70148e..000000000 --- a/node/types/blob_test.go +++ /dev/null @@ -1,203 +0,0 @@ -package types - -import ( - "math/big" - "testing" - - "github.com/holiman/uint256" - "github.com/morph-l2/go-ethereum/accounts/abi/bind" - "github.com/morph-l2/go-ethereum/common" - eth "github.com/morph-l2/go-ethereum/core/types" - "github.com/morph-l2/go-ethereum/crypto" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/rand" -) - -func TestBlobFromSealedTxPayload(t *testing.T) { - sealedTxPayload := rand.Bytes(31) - _, err := MakeBlobCanonical(sealedTxPayload) - require.NoError(t, err) - - sealedTxPayload = rand.Bytes(MaxBlobBytesSize) - _, err = MakeBlobCanonical(sealedTxPayload) - require.NoError(t, err) - - sealedTxPayload = make([]byte, 0) - blob, err := MakeBlobCanonical(sealedTxPayload) - require.NoError(t, err) - require.EqualValues(t, make([]byte, 4096*32), blob) - - blob, err = MakeBlobCanonical(nil) - require.NoError(t, err) - require.EqualValues(t, make([]byte, 4096*32), blob) -} - -func generateTransferTx(isLegacy bool) (*eth.Transaction, error) { - privKey, _ := crypto.GenerateKey() - address := crypto.PubkeyToAddress(privKey.PublicKey) - auth, _ := bind.NewKeyedTransactorWithChainID(privKey, big.NewInt(2810)) - to := common.BigToAddress(big.NewInt(100)) - var inner eth.TxData - if isLegacy { - inner = ð.LegacyTx{ - Nonce: 1, - GasPrice: big.NewInt(1), - Gas: 21000, - To: &to, - Value: big.NewInt(1), - } - } else { - inner = ð.DynamicFeeTx{ - ChainID: big.NewInt(2810), - Nonce: 1, - GasFeeCap: big.NewInt(1), - GasTipCap: big.NewInt(1), - Gas: 21000, - To: &to, - Value: big.NewInt(1), - } - } - transferTx := eth.NewTx(inner) - return auth.Signer(address, transferTx) -} - -func generateContractTx(isLegacy bool) (*eth.Transaction, error) { - privKey, _ := crypto.GenerateKey() - address := crypto.PubkeyToAddress(privKey.PublicKey) - auth, _ := bind.NewKeyedTransactorWithChainID(privKey, big.NewInt(2810)) - to := common.BigToAddress(big.NewInt(100)) - data := rand.Bytes(100) - var inner eth.TxData - if isLegacy { - inner = ð.LegacyTx{ - Nonce: 1, - GasPrice: big.NewInt(1e10), - Gas: 500000, - To: &to, - Value: big.NewInt(1), - Data: data, - } - } else { - inner = ð.DynamicFeeTx{ - ChainID: big.NewInt(2810), - Nonce: 1, - GasFeeCap: big.NewInt(1e10), - GasTipCap: big.NewInt(1e8), - Gas: 500000, - To: &to, - Value: big.NewInt(1), - Data: data, - AccessList: []eth.AccessTuple{{ - Address: address, - StorageKeys: []common.Hash{common.BigToHash(big.NewInt(2))}, - }}, - } - } - contractTx := eth.NewTx(inner) - return auth.Signer(address, contractTx) -} - -func generateSetCodeTx() *eth.Transaction { - privKey, _ := crypto.GenerateKey() - address := crypto.PubkeyToAddress(privKey.PublicKey) - to := common.BigToAddress(big.NewInt(100)) - data := rand.Bytes(100) - inner := ð.SetCodeTx{ - ChainID: uint256.NewInt(2810), - Nonce: 1, - GasFeeCap: uint256.NewInt(1e10), - GasTipCap: uint256.NewInt(1e8), - Gas: 500000, - To: to, - Value: uint256.NewInt(1), - Data: data, - AccessList: []eth.AccessTuple{{ - Address: address, - StorageKeys: []common.Hash{common.BigToHash(big.NewInt(2))}, - }}, - AuthList: []eth.SetCodeAuthorization{}, - } - return eth.NewTx(inner) - -} - -func TestDecodeTxsFromBytes(t *testing.T) { - transferTx, err := generateTransferTx(false) - require.NoError(t, err) - transferTxBz, err := transferTx.MarshalBinary() - require.NoError(t, err) - - legacyContractTx, err := generateContractTx(true) - require.NoError(t, err) - legacyContractTxBz, err := legacyContractTx.MarshalBinary() - require.NoError(t, err) - - contractTx, err := generateContractTx(false) - require.NoError(t, err) - contractTxBz, err := contractTx.MarshalBinary() - require.NoError(t, err) - - setCodeTx := generateSetCodeTx() - require.NoError(t, err) - setCodeTxBz, err := setCodeTx.MarshalBinary() - require.NoError(t, err) - - cks := BatchData{ - txsPayload: append(append(append(transferTxBz, legacyContractTxBz...), contractTxBz...), setCodeTxBz...), - } - txs, err := DecodeTxsFromBytes(cks.TxsPayload()) - require.NoError(t, err) - require.EqualValues(t, 4, txs.Len()) - require.EqualValues(t, transferTx.Hash(), txs[0].Hash()) - require.EqualValues(t, legacyContractTx.Hash(), txs[1].Hash()) - require.EqualValues(t, contractTx.Hash(), txs[2].Hash()) -} - -func TestDecodeTxsFromBytes_MorphTxV0(t *testing.T) { - morphV0Bytes := common.FromHex("0x7ff8b7820b02820374835a527f8378d6ff830186a094cfb1186f4e93d60e60a8bdd997427d1f33bc372b80b844a9059cbb000000000000000000000000b055051fb2889be5e9831524f1624941299c49bb0000000000000000000000000000000000000000000000000000000000000064c0068398968080a0953c962c4a4583dadc0ff338166d9f1176a6403a3689b7edcedf583ca401c4cba06ab5c3ef27fa3a8966ae61d994cb658c0d809434ed33dc35f90f9300fcc000c8") - txs, err := DecodeTxsFromBytes(morphV0Bytes) - require.NoError(t, err) - require.EqualValues(t, 1, txs.Len()) - require.EqualValues(t, eth.MorphTxType, txs[0].Type()) -} - -func TestDecodeTxsFromBytes_MorphTxV1(t *testing.T) { - morphV1Bytes := common.FromHex("0x7f01f8a1820b5e808326ff9b8345841b8252089425db2115628f08d952e4aacf06b341c8bc04a7f28080c00480a0deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef936d6f72706820686f6f6469207465737420747801a07c085d4f1dafac10ee14bf91dc549c6fb0b7aad797569881aa78f4461eb92903a070038e7e5551422168f4745b90854affd790c0f3a0886a926e53127ea3d0be65") - txs, err := DecodeTxsFromBytes(morphV1Bytes) - require.NoError(t, err) - require.EqualValues(t, 1, txs.Len()) - require.EqualValues(t, eth.MorphTxType, txs[0].Type()) -} - -func TestDecodeTxsFromBytes_MixedWithMorphTx(t *testing.T) { - morphV0Bytes := common.FromHex("7ff8b7820b02820374835a527f8378d6ff830186a094cfb1186f4e93d60e60a8bdd997427d1f33bc372b80b844a9059cbb000000000000000000000000b055051fb2889be5e9831524f1624941299c49bb0000000000000000000000000000000000000000000000000000000000000064c0068398968080a0953c962c4a4583dadc0ff338166d9f1176a6403a3689b7edcedf583ca401c4cba06ab5c3ef27fa3a8966ae61d994cb658c0d809434ed33dc35f90f9300fcc000c8") - morphV1Bytes := common.FromHex("7f01f8a1820b5e808326ff9b8345841b8252089425db2115628f08d952e4aacf06b341c8bc04a7f28080c00480a0deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef936d6f72706820686f6f6469207465737420747801a07c085d4f1dafac10ee14bf91dc549c6fb0b7aad797569881aa78f4461eb92903a070038e7e5551422168f4745b90854affd790c0f3a0886a926e53127ea3d0be65") - - // Generate other tx types - transferTx, err := generateTransferTx(false) - require.NoError(t, err) - transferTxBz, err := transferTx.MarshalBinary() - require.NoError(t, err) - - legacyTx, err := generateContractTx(true) - require.NoError(t, err) - legacyTxBz, err := legacyTx.MarshalBinary() - require.NoError(t, err) - - // Concatenate: DynamicFee + MorphV0 + Legacy + MorphV1 - var txsBytes []byte - txsBytes = append(txsBytes, transferTxBz...) - txsBytes = append(txsBytes, morphV0Bytes...) - txsBytes = append(txsBytes, legacyTxBz...) - txsBytes = append(txsBytes, morphV1Bytes...) - - txs, err := DecodeTxsFromBytes(txsBytes) - require.NoError(t, err) - require.EqualValues(t, 4, txs.Len()) - require.EqualValues(t, eth.DynamicFeeTxType, txs[0].Type()) - require.EqualValues(t, transferTx.Hash(), txs[0].Hash()) - require.EqualValues(t, eth.MorphTxType, txs[1].Type()) - require.EqualValues(t, eth.LegacyTxType, txs[2].Type()) - require.EqualValues(t, legacyTx.Hash(), txs[2].Hash()) - require.EqualValues(t, eth.MorphTxType, txs[3].Type()) -} diff --git a/node/types/consensus_message.go b/node/types/consensus_message.go index 94742380b..1fdbe491d 100644 --- a/node/types/consensus_message.go +++ b/node/types/consensus_message.go @@ -3,7 +3,6 @@ package types import ( "bytes" "encoding/binary" - "fmt" "math/big" "github.com/morph-l2/go-ethereum/common" @@ -146,26 +145,3 @@ func (wb *WrappedBlock) DecodeBlockContext(bc []byte) (uint16, uint16, error) { } return txsNum, l1MsgNum, nil } - -func WrappedBlockFromBytes(blockBytes []byte) (*WrappedBlock, error) { - var curBlock = new(WrappedBlock) - if err := curBlock.UnmarshalBinary(blockBytes); err != nil { - return nil, err - } - return curBlock, nil -} - -func HeightFromBlockBytes(blockBytes []byte) (uint64, error) { - curBlock, err := WrappedBlockFromBytes(blockBytes) - if err != nil { - return 0, err - } - return curBlock.Number, nil -} - -func HeightFromBlockContextBytes(blockContextBytes []byte) (uint64, error) { - if len(blockContextBytes) != 60 { - return 0, fmt.Errorf("wrong block context bytes length, input: %x", blockContextBytes) - } - return binary.BigEndian.Uint64(blockContextBytes[:8]), nil -} diff --git a/node/types/retryable_client.go b/node/types/retryable_client.go index 0efdd0c90..8e26fcfb9 100644 --- a/node/types/retryable_client.go +++ b/node/types/retryable_client.go @@ -85,9 +85,9 @@ func (rc *RetryableClient) ValidateL2Block(ctx context.Context, executableL2Data return } -func (rc *RetryableClient) NewL2Block(ctx context.Context, executableL2Data *catalyst.ExecutableL2Data, batchHash *common.Hash) (err error) { +func (rc *RetryableClient) NewL2Block(ctx context.Context, executableL2Data *catalyst.ExecutableL2Data) (err error) { if retryErr := backoff.Retry(func() error { - respErr := rc.authClient.NewL2Block(ctx, executableL2Data, batchHash) + respErr := rc.authClient.NewL2Block(ctx, executableL2Data) if respErr != nil { rc.logger.Error("NewL2Block failed", "block_number", executableL2Data.Number, @@ -122,40 +122,6 @@ func (rc *RetryableClient) NewSafeL2Block(ctx context.Context, safeL2Data *catal return } -func (rc *RetryableClient) CommitBatch(ctx context.Context, batch *eth.RollupBatch, signatures []eth.BatchSignature) (err error) { - if retryErr := backoff.Retry(func() error { - respErr := rc.authClient.CommitBatch(ctx, batch, signatures) - if respErr != nil { - rc.logger.Info("failed to CommitBatch", "error", respErr) - if retryableError(respErr) { - return respErr - } - err = respErr - } - return nil - }, rc.b); retryErr != nil { - return retryErr - } - return -} - -func (rc *RetryableClient) AppendBlsSignature(ctx context.Context, batchHash common.Hash, signature eth.BatchSignature) (err error) { - if retryErr := backoff.Retry(func() error { - respErr := rc.authClient.AppendBlsSignature(ctx, batchHash, signature) - if respErr != nil { - rc.logger.Info("failed to call AppendBlsSignature", "error", respErr) - if retryableError(respErr) { - return respErr - } - err = respErr - } - return nil - }, rc.b); retryErr != nil { - return retryErr - } - return -} - func (rc *RetryableClient) BlockNumber(ctx context.Context) (ret uint64, err error) { if retryErr := backoff.Retry(func() error { resp, respErr := rc.ethClient.BlockNumber(ctx) diff --git a/ops/devnet-morph/devnet/setup_nodes.py b/ops/devnet-morph/devnet/setup_nodes.py index 9169e74fc..d3b968687 100644 --- a/ops/devnet-morph/devnet/setup_nodes.py +++ b/ops/devnet-morph/devnet/setup_nodes.py @@ -104,12 +104,9 @@ def setup_devnet_nodes(): print(f"Error: Missing source or destination directory for {node}. Exiting.") sys.exit(1) - # Copy specific files shutil.copyfile(os.path.join(source_dir, "node_key.json"), os.path.join(dest_dir, "node_key.json")) - # Skip copying for node4 bls_key.json and priv_validator_key.json if node != "node4": - shutil.copyfile(os.path.join(source_dir, "bls_key.json"), os.path.join(dest_dir, "bls_key.json")) shutil.copyfile(os.path.join(source_dir, "priv_validator_key.json"), os.path.join(dest_dir, "priv_validator_key.json")) # Copy and rename genesis file diff --git a/ops/docker/Dockerfile.l2-node-4 b/ops/docker/Dockerfile.l2-node-4 index c449038e1..cc00d03de 100644 --- a/ops/docker/Dockerfile.l2-node-4 +++ b/ops/docker/Dockerfile.l2-node-4 @@ -42,7 +42,6 @@ sed -i "s#unconditional_peer_ids = \"\"#$TO_REPLACED_UNCONDITIONAL_PEER_ID#g" / FROM builder as node0 COPY --from=builder /morph/node/build/bin/morphnode /usr/local/bin/ COPY --from=initializer /data/node0 /data -COPY ./ops/docker/node0/bls_key.json /data/config/bls_key.json COPY ./ops/docker/node0/priv_validator_key.json /data/config/priv_validator_key.json COPY ./ops/docker/node0/node_key.json /data/config/node_key.json COPY ./ops/docker/tendermint-devnet-genesis.json /data/config/genesis.json @@ -51,7 +50,6 @@ CMD ["morphnode", "--home", "/data"] FROM builder as node1 COPY --from=builder /morph/node/build/bin/morphnode /usr/local/bin/ COPY --from=initializer /data/node1 /data -COPY ./ops/docker/node1/bls_key.json /data/config/bls_key.json COPY ./ops/docker/node1/priv_validator_key.json /data/config/priv_validator_key.json COPY ./ops/docker/node1/node_key.json /data/config/node_key.json COPY ./ops/docker/tendermint-devnet-genesis.json /data/config/genesis.json @@ -60,7 +58,6 @@ CMD ["morphnode", "--home", "/data"] FROM builder as node2 COPY --from=builder /morph/node/build/bin/morphnode /usr/local/bin/ COPY --from=initializer /data/node2 /data -COPY ./ops/docker/node2/bls_key.json /data/config/bls_key.json COPY ./ops/docker/node2/priv_validator_key.json /data/config/priv_validator_key.json COPY ./ops/docker/node2/node_key.json /data/config/node_key.json COPY ./ops/docker/tendermint-devnet-genesis.json /data/config/genesis.json @@ -69,7 +66,6 @@ CMD ["morphnode", "--home", "/data"] FROM builder as node3 COPY --from=builder /morph/node/build/bin/morphnode /usr/local/bin/ COPY --from=initializer /data/node3 /data -COPY ./ops/docker/node3/bls_key.json /data/config/bls_key.json COPY ./ops/docker/node3/priv_validator_key.json /data/config/priv_validator_key.json COPY ./ops/docker/node3/node_key.json /data/config/node_key.json COPY ./ops/docker/tendermint-devnet-genesis.json /data/config/genesis.json diff --git a/ops/docker/node0/bls_key.json b/ops/docker/node0/bls_key.json deleted file mode 100644 index d3ba72af8..000000000 --- a/ops/docker/node0/bls_key.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pub_key": "YAeCqjTgVRcMjB1py0LvG98Fn5begwmi/2tcpq7thUwUUNwjv2Ogr4nbrtgg+gwxLA+j/wVmfkTfumTWCzFB5Xl99C6G3ANy95p7TgW+a991rlw1OS7pOsfa3D2XH0WKLwxda6BLyblnTdKsv8XK7Tl2wbi+LskKA9eN/+kkZItPuoIiWv9Dx0QxDGpgGFt1rAla1GXCiV7oJcfU8bYKGHNNtX1BCDaeR8bjqU7hWEb4JcBtrV2Y9QO9Mezh2flLEQsvBmNOXqcZaCwwkRyU37Vg8Ldla1w0qHHqA14/57BBiFQg+P4eJR8czlzbdRSGng/Oa+AByHGhG52xxsFfCmmZ3lZGlBp0SGIG3HhPCz/+EXmSEvP0TvdUtKDx7PhWOQ==", - "priv_key": "LeCQSBuifYNlWXwHneku1zpiPlL7RzW8waWDA8/+Ow4=" -} \ No newline at end of file diff --git a/ops/docker/node1/bls_key.json b/ops/docker/node1/bls_key.json deleted file mode 100644 index f702d36fd..000000000 --- a/ops/docker/node1/bls_key.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pub_key": "YBlUi5pKjvgLE0M4izSpxtDUwC7+q1FSqxz+A+Sr7LUOrXJQ3JD/9iAGRg6qdKl6cgdt9dt5MpFhMmXIuag9jW55kBMLXZzidcwEnrQLQKKUMPWZL5WiZUMY+AT6HbWSaggBrqFWl6tNeoCL5FN35PDS9UhX/cBAMeR2QC/xbGamy8xfCahL+FQAyK+6vtAGYBAXOurE/zF+jmBJP5YrkdvSdhTh9llOF9GKApaL0f1pi2cDCSq4YizSLWlI2UIRVgiMSg3/zMlrzkeu8OF2sSlFel864WUbEy3bQY6fe1hQo4xv7Bvm0WnriNwWGWSL9BX8cbLE6BFIJ05hacnJqs6MNPpgMFR2UCQrbDJSfdI6mWQW4yZAvOT0laCvq8fbuQ==", - "priv_key": "Xh73PxEljB6q2Us6KcasJu+1guWnz6xkRRoHb5cHa60=" -} \ No newline at end of file diff --git a/ops/docker/node2/bls_key.json b/ops/docker/node2/bls_key.json deleted file mode 100644 index 16f191d01..000000000 --- a/ops/docker/node2/bls_key.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pub_key": "YAaLSL8lg5h8nYUcZ5KsrloEVaff2JMSH+bN187H84NOnjina5TQkDrp9GDCVUc3SheeM375x/SYIMU20jOcq5SRIuFcRwjr1WaJJwPJm2m3bsAXj/EGWK2Yde18bzpLJATALzYJoPYdEv5zfcuwR9UlO9P/kFtVwOD5MrR2/XfRcqWLcu8PUGQHhwmI3WA4IgP9lGiozv/BtpaHRRd3fvi/3JobrelcSA7iYkkD5kjByvAcZd5bT9qIdqOg6NnwiRImE4gTvemK80ZO0DZJ2McxvE5cs9JrU790g/QQXRi7s/GeI5BRGeFW59AD0v0SXBf6V2WJn2D3pY+Mzaqilc3lWZIjFxBnJpK6anGk+qlXL3KPQ43tZVdqVw1X4Z/TBA==", - "priv_key": "IeHRomT30ZYujlvZFqV4a1a+VK1VLTCr+IghrPP+ysw=" -} \ No newline at end of file diff --git a/ops/docker/node3/bls_key.json b/ops/docker/node3/bls_key.json deleted file mode 100644 index 5075ddb61..000000000 --- a/ops/docker/node3/bls_key.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "pub_key": "YAZUu0pI4XooAtG7SXf5q8CTh0ThBpJZ2LUBfEXcjER2LGxcmHQ9e+eoZITloR0cnwk3Z7Dx5aizSPOOz8tbqBmFPEtVNv5jzP7SG0Pe/Izbe3aEJsuJ93eFtOZTKRSddhOZab2SUiETwGFWWYdNH64xGtgVLQWEx7V//BSScGdIbc+GQTxWhPzMEWPuLUXBwRCb8ComNsDcGWiwpQ23clHrCQw+n1HiorxgxKxyIT9B8B8KNOksLgYlvWLijifttRDd46zKALT/G0l2UAqPl+kiRvQ/eMrclcSZPfxPTFAcM9QqS/Ulh/STEoe1liMUnA8XJgP3Cgcw0QCtbSi95HcZWYcGLoreg7gtCTk12Vb/IMp2jCYmNXewlPHLdWrcQA==", - "priv_key": "ZJzK/UiOuqjVwOU+WL7cmGsOQ42uvdco/SQcEZLIVCg=" -} \ No newline at end of file diff --git a/ops/l2-genesis/cmd/genesis/cmd.go b/ops/l2-genesis/cmd/genesis/cmd.go index aac68d399..d72b6a19b 100644 --- a/ops/l2-genesis/cmd/genesis/cmd.go +++ b/ops/l2-genesis/cmd/genesis/cmd.go @@ -10,13 +10,13 @@ import ( "strings" "github.com/morph-l2/go-ethereum/common" + "github.com/morph-l2/go-ethereum/common/hexutil" "github.com/morph-l2/go-ethereum/core/types" "github.com/morph-l2/go-ethereum/ethclient" "github.com/urfave/cli" "morph-l2/bindings/hardhat" "morph-l2/morph-deployer/morph-chain-ops/genesis" - node "morph-l2/node/core" ) var Subcommands = cli.Commands{ @@ -111,15 +111,15 @@ var Subcommands = cli.Commands{ var genesisBatchHeaderBytes []byte genBatchHeaderFile := ctx.String("outfile.genbatchheader") if len(genBatchHeaderFile) > 0 { - genesisBatchHeader, err := node.GenesisBatchHeader(l2GenesisBlock.Header()) + var err error + genesisBatchHeaderBytes, err = genesis.GenesisBatchHeader(l2GenesisBlock.Header()) if err != nil { return err } - fmt.Printf("generated genesis batch header bytes: %x \n", genesisBatchHeader.Bytes()) - if err := writeGenesisFile(genBatchHeaderFile, genesisBatchHeader); err != nil { + fmt.Printf("generated genesis batch header bytes: %x \n", genesisBatchHeaderBytes) + if err := writeGenesisFile(genBatchHeaderFile, hexutil.Bytes(genesisBatchHeaderBytes)); err != nil { return err } - genesisBatchHeaderBytes = genesisBatchHeader.Bytes() } rollupConfig, err := config.RollupConfig(l1StartBlock, l2GenesisBlockHash, l2GenesisBlock.Number().Uint64(), l2GenesisBlock.Root(), withdrawRoot, genesisBatchHeaderBytes) diff --git a/ops/l2-genesis/go.mod b/ops/l2-genesis/go.mod index 3d56ff008..057a0a1fd 100644 --- a/ops/l2-genesis/go.mod +++ b/ops/l2-genesis/go.mod @@ -2,11 +2,11 @@ module morph-l2/morph-deployer go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( github.com/holiman/uint256 v1.2.4 - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/stretchr/testify v1.10.0 github.com/urfave/cli v1.22.17 ) diff --git a/ops/l2-genesis/go.sum b/ops/l2-genesis/go.sum index 13f451e94..e02dd1d3f 100644 --- a/ops/l2-genesis/go.sum +++ b/ops/l2-genesis/go.sum @@ -141,8 +141,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/ops/l2-genesis/morph-chain-ops/genesis/batch.go b/ops/l2-genesis/morph-chain-ops/genesis/batch.go new file mode 100644 index 000000000..edc5b3593 --- /dev/null +++ b/ops/l2-genesis/morph-chain-ops/genesis/batch.go @@ -0,0 +1,59 @@ +package genesis + +import ( + "encoding/binary" + + "github.com/morph-l2/go-ethereum/common" + ethtypes "github.com/morph-l2/go-ethereum/core/types" + "github.com/morph-l2/go-ethereum/crypto" + + nodetypes "morph-l2/node/types" +) + +const ( + genesisBatchVersion = uint8(0) + genesisBatchHeaderLength = 249 +) + +// emptyBlobVersionedHash is the KZG versioned hash of an empty blob. +var emptyBlobVersionedHash = common.HexToHash("0x010657f37554c781402a22917dee2f75def7ab966d7b770905398eba3c444014") + +// GenesisBatchHeader builds the raw batch header bytes committed to L1 alongside +// the L2 genesis block. It is called by ops/l2-genesis when bootstrapping a +// fresh chain. +func GenesisBatchHeader(genesisHeader *ethtypes.Header) ([]byte, error) { + wb := nodetypes.WrappedBlock{ + ParentHash: genesisHeader.ParentHash, + Miner: genesisHeader.Coinbase, + Number: genesisHeader.Number.Uint64(), + GasLimit: genesisHeader.GasLimit, + BaseFee: genesisHeader.BaseFee, + Timestamp: genesisHeader.Time, + StateRoot: genesisHeader.Root, + GasUsed: genesisHeader.GasUsed, + ReceiptRoot: genesisHeader.ReceiptHash, + } + blockContext := wb.BlockContextBytes(0, 0) + // Data hash for a single-block batch with no L1 messages: + // keccak256(blockContext[:58]). The last 2 bytes (numL1Messages) are excluded. + dataHash := crypto.Keccak256Hash(blockContext[:58]) + + // V0 batch header layout (249 bytes): + // version(1) | batchIndex(8) | l1MsgPopped(8) | totalL1MsgPopped(8) | + // dataHash(32) | blobVersionedHash(32) | prevStateRoot(32) | + // postStateRoot(32) | withdrawalRoot(32) | sequencerSetVerifyHash(32) | + // parentBatchHash(32) + header := make([]byte, genesisBatchHeaderLength) + header[0] = genesisBatchVersion + binary.BigEndian.PutUint64(header[1:], 0) // batchIndex + binary.BigEndian.PutUint64(header[9:], 0) // l1MessagePopped + binary.BigEndian.PutUint64(header[17:], 0) // totalL1MessagePopped + copy(header[25:], dataHash[:]) + copy(header[57:], emptyBlobVersionedHash[:]) + // prevStateRoot (89:121) — zero for genesis + copy(header[121:], genesisHeader.Root[:]) // postStateRoot + // withdrawalRoot (153:185) — zero for genesis + // sequencerSetVerifyHash (185:217) — zero for genesis + // parentBatchHash (217:249) — zero for genesis + return header, nil +} diff --git a/ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go b/ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go index 56f945ac7..4c507f96c 100644 --- a/ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go +++ b/ops/l2-genesis/morph-chain-ops/genesis/layer_two_test.go @@ -9,8 +9,6 @@ import ( "github.com/morph-l2/go-ethereum/common/hexutil" "github.com/morph-l2/go-ethereum/core/types" "github.com/stretchr/testify/require" - - node "morph-l2/node/core" ) func Test_BuildL2DeveloperGenesis(t *testing.T) { @@ -78,7 +76,7 @@ func Test_BuildL2DeveloperGenesis(t *testing.T) { require.NoError(t, err) l2GenesisBlock := l2Genesis.ToBlock(nil) - genesisBatchHeader, err := node.GenesisBatchHeader(l2GenesisBlock.Header()) + genesisBatchHeaderBytes, err := GenesisBatchHeader(l2GenesisBlock.Header()) require.NoError(t, err) - t.Logf("generated genesis batch header bytes: %x \n", genesisBatchHeader.Bytes()) + t.Logf("generated genesis batch header bytes: %x \n", genesisBatchHeaderBytes) } diff --git a/ops/tools/bls12381/main.go b/ops/tools/bls12381/main.go deleted file mode 100644 index 28df5f300..000000000 --- a/ops/tools/bls12381/main.go +++ /dev/null @@ -1,140 +0,0 @@ -package main - -import ( - "bytes" - "fmt" - - "github.com/morph-l2/go-ethereum/common" - "github.com/morph-l2/go-ethereum/common/hexutil" - "github.com/morph-l2/go-ethereum/core/vm" - "github.com/morph-l2/go-ethereum/crypto" - "github.com/morph-l2/go-ethereum/crypto/bls12381" - "github.com/tendermint/tendermint/blssignatures" -) - -var n = 100 - -// the expected process on contracts: -// A. get the left side value of the equation e(`G1 point(message)`, `G2 point(agg public key)`) -// 1. map signed message to a point on G1, returns `128` bytes of G1 point encoding -// - convert signed message to the required 64bytes input: append([32]bytes{}, keccak256(signedMessage)) -// - call bls12381MapG1 to map the input to a point on G1 -// -// 2. aggregate bls public keys, produced the point on G2, returns `256` bytes of G2 point encoding -// - call bls12381G2Add recursively to aggregate public keys -// - the bls public key is supposed to be 256 bytes(encoded style) -// -// 3. paring the above G1(message) and G2(aggregated public keys) points, returns the `32` bytes. -// - combine G1 and G2 bytes, get the 384 size bytes -// - call the bls12381Pairing with this 384 input -// -// B. get the right side value of the equation e(`G1 point(agg signature)`, `G2 point(1)`) -// 1. acquire the aggregated signature from the calldata. the agg signature should be the `128` bytes of G1 point encoding. -// -// 2. acquire the value `one` which is encoded as a G2 point with 256 bytes. -// - this value can be defined as the immutable value on the contracts: `0x00000000000000000000000000000000024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80000000000000000000000000000000013e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e000000000000000000000000000000000ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801000000000000000000000000000000000606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be` -// -// 3. paring the above G1(agg signature) and G2(one) points, returns the `32` bytes. -// - combine G1 and G2 bytes, get the 384 size bytes -// - call the bls12381Pairing with this 384 input -// -// final step: compares the left side value and the right side value, true if they are equal -func main() { - message := []byte("messageneedtobesigned") - fmt.Println("message length: ", len(message)) - - messageHash := crypto.Keccak256(message) - var err error - pubKeys := make([]blssignatures.PublicKey, n) - privKeys := make([]blssignatures.PrivateKey, n) - messageSigs := make([]blssignatures.Signature, n) - for i := 0; i < n; i++ { - pubKeys[i], privKeys[i], err = blssignatures.GenerateKeys() - if err != nil { - panic(err) - } - } - - for i := 0; i < n; i++ { - messageSigs[i], err = blssignatures.SignMessage(privKeys[i], messageHash) - if err != nil { - panic(err) - } - } - - aggPubKeys := blssignatures.AggregatePublicKeys(pubKeys) - aggSig := blssignatures.AggregateSignatures(messageSigs) - - verified, err := blssignatures.VerifySignature(aggSig, messageHash, aggPubKeys) - if err != nil { - panic(err) - } - fmt.Println("verified: ", verified) - - var prefix [32]byte - messageInput := append(prefix[:], crypto.Keccak256(messageHash)...) - - var costGas uint64 - - // hashToG1Curve - bls12381MapG1 := vm.PrecompiledContractsEmerald[common.BytesToAddress([]byte{17})] - messagePointOnCurveBz, err := bls12381MapG1.Run(messageInput) - if err != nil { - panic(err) - } - costGas += bls12381MapG1.RequiredGas(messageInput) - - bls12381Pairing := vm.PrecompiledContractsEmerald[common.BytesToAddress([]byte{16})] - // left side add pair, message(point on g1) & public key(point on g2) - byteRaw := blssignatures.PublicKeyToBytes(aggPubKeys) - fmt.Println("aggPubKeys length: ", len(byteRaw)) - - //the below behavior acts like: bls12381.NewG2().EncodePoint(aggPubKeys.key) - byteRaw = byteRaw[1:] - out := make([]byte, 256) - // encode x - copy(out[16:16+48], byteRaw[48:96]) - copy(out[80:80+48], byteRaw[:48]) - // encode y - copy(out[144:144+48], byteRaw[144:]) - copy(out[208:208+48], byteRaw[96:144]) - - leftBls12381PairingInput := append(messagePointOnCurveBz, out...) - leftPairingResult, err := bls12381Pairing.Run(leftBls12381PairingInput) - if err != nil { - panic(err) - } - costGas += bls12381Pairing.RequiredGas(leftBls12381PairingInput) - - sigRawBytes := blssignatures.SignatureToBytes(aggSig) - fmt.Println("sigRawBytes length: ", len(sigRawBytes)) - sigOut := bls12381.NewG1().EncodePoint(aggSig) - - oneEncoded := bls12381.NewG2().EncodePoint(bls12381.NewG2().One()) - fmt.Println("oneEncoded: ", hexutil.Encode(oneEncoded)) - rightBls12381PairingInput := append(sigOut, oneEncoded...) - rightPairingResult, err := bls12381Pairing.Run(rightBls12381PairingInput) - if err != nil { - panic(err) - } - costGas += bls12381Pairing.RequiredGas(rightBls12381PairingInput) - - // e[message(point on g1) , agg public key(point on g2)] = e[agg sig(point on g1), one(point on g2)] - fmt.Println("verified via precompiled bytes, result: ", bytes.Equal(leftPairingResult, rightPairingResult)) - fmt.Println("total gas cost for verification: ", costGas) -} - -//func verifySignature2(sig Signature, message []byte, publicKey PublicKey, keyValidationMode bool) (bool, error) { -// pointOnCurve, err := hashToG1Curve(message, keyValidationMode) -// if err != nil { -// return false, err -// } -// -// engine := bls12381.NewPairingEngine() -// engine.Reset() -// engine.AddPair(pointOnCurve, publicKey.key) -// leftSide := engine.Result() -// engine.AddPair(sig, engine.G2.One()) -// rightSide := engine.Result() -// return leftSide.Equal(rightSide), nil -//} diff --git a/ops/tools/go.mod b/ops/tools/go.mod index 50a927568..3c4a68b2a 100644 --- a/ops/tools/go.mod +++ b/ops/tools/go.mod @@ -2,10 +2,10 @@ module morph-l2/tools go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/tendermint/tendermint v0.35.9 ) diff --git a/ops/tools/go.sum b/ops/tools/go.sum index b56cee95c..0c575f0b2 100644 --- a/ops/tools/go.sum +++ b/ops/tools/go.sum @@ -163,10 +163,10 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= -github.com/morph-l2/tendermint v0.3.6 h1:N9FWdbAV7PSBifnCnVXgMUj9jKHMITNdrPniB8hiXlQ= -github.com/morph-l2/tendermint v0.3.6/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/tendermint v0.3.7 h1:6dHC0GYGKxP2eHzC3e/l1NBtjuqE3H6S1N/RgM0LOBI= +github.com/morph-l2/tendermint v0.3.7/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/ops/tools/keygen/main.go b/ops/tools/keygen/main.go index 2e22d7c4d..2ad71d31e 100644 --- a/ops/tools/keygen/main.go +++ b/ops/tools/keygen/main.go @@ -4,8 +4,6 @@ import ( "fmt" "github.com/morph-l2/go-ethereum/crypto" - "github.com/morph-l2/go-ethereum/crypto/bls12381" - "github.com/tendermint/tendermint/blssignatures" "github.com/tendermint/tendermint/crypto/ed25519" tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/p2p" @@ -36,21 +34,6 @@ func main() { fmt.Printf("%v \n", string(nodeKeyJsBz)) fmt.Printf("nodeID: %v \n", nodeKey.ID()) - fmt.Println() - fmt.Printf("--------------------------generating content for bls_key.json--------------------------\n") - fileBlsKey := blssignatures.GenFileBLSKey() - bkJsBz, err := tmjson.MarshalIndent(fileBlsKey, "", " ") - if err != nil { - panic(err) - } - fmt.Printf("%v \n", string(bkJsBz)) - blsPublicKey, err := blssignatures.PublicKeyFromBytes(fileBlsKey.PubKey, true) - if err != nil { - panic(err) - } - encodedPoint := bls12381.NewG2().EncodePoint(blsPublicKey.Key) - fmt.Printf("converted bls encoded key: 0x%x \n", encodedPoint) - fmt.Println() fmt.Printf("--------------------------generating a new ETH account--------------------------\n") ethPrivKey, err := crypto.GenerateKey() diff --git a/oracle/go.mod b/oracle/go.mod index dd488397e..cc360e234 100644 --- a/oracle/go.mod +++ b/oracle/go.mod @@ -2,12 +2,12 @@ module morph-l2/oracle go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( github.com/go-kit/kit v0.12.0 github.com/morph-l2/externalsign v0.3.1 - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.10.0 github.com/tendermint/tendermint v0.35.9 diff --git a/oracle/go.sum b/oracle/go.sum index 46a777301..b7399e6ff 100644 --- a/oracle/go.sum +++ b/oracle/go.sum @@ -174,10 +174,10 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morph-l2/externalsign v0.3.1 h1:UYFDZFB0L85A4rDvuwLNBiGEi0kSmg9AZ2v8Q5O4dQo= github.com/morph-l2/externalsign v0.3.1/go.mod h1:b6NJ4GUiiG/gcSJsp3p8ExsIs4ZdphlrVALASnVoGJE= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= -github.com/morph-l2/tendermint v0.3.6 h1:N9FWdbAV7PSBifnCnVXgMUj9jKHMITNdrPniB8hiXlQ= -github.com/morph-l2/tendermint v0.3.6/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/tendermint v0.3.7 h1:6dHC0GYGKxP2eHzC3e/l1NBtjuqE3H6S1N/RgM0LOBI= +github.com/morph-l2/tendermint v0.3.7/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/token-price-oracle/go.mod b/token-price-oracle/go.mod index 30326dcfa..ea333b578 100644 --- a/token-price-oracle/go.mod +++ b/token-price-oracle/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/morph-l2/remote-signer-client/go v0.0.0-20260312080033-d078d86ddbe9 github.com/prometheus/client_golang v1.17.0 github.com/sirupsen/logrus v1.9.3 diff --git a/token-price-oracle/go.sum b/token-price-oracle/go.sum index 6f64e3fee..528b47d38 100644 --- a/token-price-oracle/go.sum +++ b/token-price-oracle/go.sum @@ -145,8 +145,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= github.com/morph-l2/remote-signer-client/go v0.0.0-20260312080033-d078d86ddbe9 h1:d2nKLUgiEJsQmpSWEiGbsC+sZXQCM4y/3EzyXkoMM60= github.com/morph-l2/remote-signer-client/go v0.0.0-20260312080033-d078d86ddbe9/go.mod h1:slD6GmYEwLHn4Yj/kO8/1QF3iaYlVVAXg2ZnGr8SW/8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= diff --git a/tx-submitter/batch/batch_cache.go b/tx-submitter/batch/batch_cache.go index cef6fa008..293466552 100644 --- a/tx-submitter/batch/batch_cache.go +++ b/tx-submitter/batch/batch_cache.go @@ -690,7 +690,6 @@ func (bc *BatchCache) SealBatch(sequencerSets []byte, blockTimestamp uint64) (ui NumL1Messages: numL1Messages, Sidecar: *sidecar, Signatures: []eth.RPCBatchSignature{}, - CollectedL1Fee: nil, } bc.sealedBatches[batchIndex] = sealedBatch // Store batch header copy diff --git a/tx-submitter/go.mod b/tx-submitter/go.mod index 1bab05e0c..b428cee23 100644 --- a/tx-submitter/go.mod +++ b/tx-submitter/go.mod @@ -2,14 +2,14 @@ module morph-l2/tx-submitter go 1.24.0 -replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.6 +replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.7 require ( github.com/consensys/gnark-crypto v0.16.0 github.com/crate-crypto/go-eth-kzg v1.4.0 github.com/holiman/uint256 v1.2.4 github.com/morph-l2/externalsign v0.3.1 - github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 + github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.10.0 github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a diff --git a/tx-submitter/go.sum b/tx-submitter/go.sum index 989a37571..61b3d092a 100644 --- a/tx-submitter/go.sum +++ b/tx-submitter/go.sum @@ -163,8 +163,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morph-l2/externalsign v0.3.1 h1:UYFDZFB0L85A4rDvuwLNBiGEi0kSmg9AZ2v8Q5O4dQo= github.com/morph-l2/externalsign v0.3.1/go.mod h1:b6NJ4GUiiG/gcSJsp3p8ExsIs4ZdphlrVALASnVoGJE= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32 h1:nWcBwsUNXJvC8rmnX4zoRAwZmXQDDawoS+aTC2nqG3g= -github.com/morph-l2/go-ethereum v1.10.14-0.20260317041928-1d4605778e32/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca h1:ogHsgxvm1wzyNKYDSAsIi0PJZeu9VhQECSL91X/KTWI= +github.com/morph-l2/go-ethereum v1.10.14-0.20260506071313-045be0fdc7ca/go.mod h1:nkVzHjQWCOjvukQW8ittlwX+Xz9gmVHrP7mUi7zoHTs= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/tx-submitter/services/rollup.go b/tx-submitter/services/rollup.go index e9d6b875e..4d92869b4 100644 --- a/tx-submitter/services/rollup.go +++ b/tx-submitter/services/rollup.go @@ -490,38 +490,6 @@ func (r *Rollup) updateFeeMetrics(tx *ethtypes.Transaction, receipt *ethtypes.Re if err != nil { return fmt.Errorf("failed to update rollup fee sum in leveldb: %w", err) } - - // Calculate and update L1 fee metrics - batchIndex := utils.ParseParentBatchIndex(tx.Data()) + 1 - var rollupBatch *eth.RPCRollupBatch - exist := true - if r.cfg.SealBatch { - rollupBatch, err = r.batchCache.Get(batchIndex) - } else { - rollupBatch, exist = r.batchCacheLegacy.Get(batchIndex) - } - if err != nil || !exist || rollupBatch == nil { - log.Warn("rollupBatch not found in cache", "batch_index", batchIndex, "error", err) - } else { - if rollupBatch.CollectedL1Fee == nil { - return nil - } - collectedL1Fee := new(big.Float).Quo(new(big.Float).SetInt(rollupBatch.CollectedL1Fee.ToInt()), new(big.Float).SetInt(big.NewInt(params.Ether))) - collectedL1FeeFloat, _ := collectedL1Fee.Float64() - - // Update metrics - r.collectedL1FeeSum += collectedL1FeeFloat - r.metrics.CollectedL1FeeSum.Add(collectedL1FeeFloat) - - // Update leveldb - err = r.ldb.PutFloat(collectedL1FeeSumKey, r.collectedL1FeeSum) - if err != nil { - log.Error("failed to update collected L1 fee sum in leveldb", "error", err) - } - log.Info("Updated L1 fee metrics", - "batch_index", batchIndex, - "l1_fee_eth", collectedL1FeeFloat) - } } else if method == constants.MethodFinalizeBatch { r.finalizeFeeSum += txFeeFloat r.metrics.FinalizeCostSum.Add(txFeeFloat)