Skip to content

Commit 283971e

Browse files
rachit77agnusmorARR552ToniRamirezMtclemos
authored
Pullupstream/v0.5.0 (#63)
* fix migration batch wip field. fix sequence when no wip batch (0xPolygonHermez#3126) * fix Leaves smtproof (0xPolygonHermez#3127) * fix Leaves smtproof * pointer protection * fix unit test * Add l2block log dump when storing error. Refactor ProcessBatchV2 logs (0xPolygonHermez#3129) * add l2block log dump when storing error. refactor ProcessBatchV2 logs * add AddL2Block log * fix index AddL2Block log * use aux variable to avoid reusing poiner --------- Co-authored-by: Toni Ramírez <[email protected]> * fix panic etherman (0xPolygonHermez#3133) * Fix GetL2Hash function. Use tx L2 hash returned by the executor when storing L2Block. Logs changes (0xPolygonHermez#3134) * fix l2 hash when to is nill * get l2 hash from executor * fix use tx L2 hash returned by the executor when storing L2Block. Logs changes * fix linter * add L2block tracking number to process tx logs * fix ProcessBatchV2 log format * fix UTs. set useMainExecGenerated to true * set prover image to v4.0.0-RC30 * test setting useMainExecGenerated = false * fix independent_test * fix non-e2e tests --------- Co-authored-by: Toni Ramírez <[email protected]> * remove l2 tx hash computation and use data stored in the state returned by the executor (0xPolygonHermez#3139) * etrog: fix permissionless errors (0xPolygonHermez#3140) * if got an error getting lastBlock produce a SIGSEGV * reduce info logs * fix unittest * Fix missing batch bookmark (0xPolygonHermez#3122) * fix missingBookMark * fix missingBookMark * fixes * fix * fix * fix seq-sender config * fixes * doc * fix wipL2Block deltaTimestamp (0xPolygonHermez#3142) * improve open new wipL2Block logs * fix wipL2Block deltaTimestamp * ensure tx order in stream (0xPolygonHermez#3144) * fix wipL2Block stateRoot (0xPolygonHermez#3145) * fix panic NewStackTrie (0xPolygonHermez#3146) * fix sync initalization for etrog (0xPolygonHermez#3147) * fix wipL2block imStateRoot (0xPolygonHermez#3148) * fix tracer to work by block stateroot instead of by tx (0xPolygonHermez#3150) * update prover image (0xPolygonHermez#3151) * if a trusted batch is empty and WIP just create the entry in state.batch (0xPolygonHermez#3152) * fix trace for tx index greater than 0 (0xPolygonHermez#3153) * add cardona.zip (0xPolygonHermez#3154) * Fix default value when creating transaction.used_sha256_hashes field in the pool (0xPolygonHermez#3156) * set DEFAULT 0 when creatingtransaction.used_sha256_hashes field in the pool * update prover image to v4.0.0 * add cardona testnet (0xPolygonHermez#2909) (0xPolygonHermez#3155) * add cardona testnet (0xPolygonHermez#2909) * update config * update cardona genesis --------- Co-authored-by: Thiago Coimbra Lemos <[email protected]> * new fields in stream (0xPolygonHermez#3149) * new fields in stream * update test * remove unused constant * add UpgradeEtrogBatchNumber handling to stream * doc * add log to test * add log to test * add protection * add check * fix * fix * set stateManagerPurge to false in Cardona (0xPolygonHermez#3158) * synchronizer: fix case emtpy batch and unittest (0xPolygonHermez#3159) * fix case emtpy batch and unittest * fix error in conversion * fix unittest * update prover image to v4.0.1 (0xPolygonHermez#3160) * update prover image to v4.0.2 (0xPolygonHermez#3162) * Add a note in deployment instruction to restart rpc after forkId 7 (0xPolygonHermez#3163) * note to restart zkevm-rpc * update comment * change position of point 10 * add point 11 * add lines * add breakline * add lines * add line * addressed comments * wip * updated mocks * CDK DAC interfaces got renamed, apply those updates to the Makefile mockery generation * Linter errors fixes * testnet files are needed for docker * revert go-ethereum to 1.13.2 * Bump only the version of the cdk-dac dependency to v0.0.4 * updated docs * Try removing testnet configuration * docs update --------- Co-authored-by: agnusmor <[email protected]> Co-authored-by: Alonso Rodriguez <[email protected]> Co-authored-by: Toni Ramírez <[email protected]> Co-authored-by: Thiago Coimbra Lemos <[email protected]> Co-authored-by: Joan Esteban <[email protected]> Co-authored-by: Toni Ramírez <[email protected]> Co-authored-by: agnusmor <[email protected]> Co-authored-by: Stefan Negovanović <[email protected]>
1 parent b423092 commit 283971e

File tree

101 files changed

+30924
-27126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+30924
-27126
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ RUN cd /src && make build
1414
# CONTAINER FOR RUNNING BINARY
1515
FROM alpine:3.18.4
1616
COPY --from=build /src/dist/zkevm-node /app/zkevm-node
17-
COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
1817
RUN apk update && apk add postgresql15-client
1918
EXPOSE 8123
2019
CMD ["/bin/sh", "-c", "/app/zkevm-node run"]

aggregator/aggregator.go

+19-11
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,15 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.
10041004
if err != nil {
10051005
return nil, err
10061006
}
1007+
leaves, err := a.State.GetLeafsByL1InfoRoot(ctx, *l1InfoRoot, nil)
1008+
if err != nil {
1009+
return nil, err
1010+
}
1011+
1012+
aLeaves := make([][32]byte, len(leaves))
1013+
for i, leaf := range leaves {
1014+
aLeaves[i] = l1infotree.HashLeafData(leaf.GlobalExitRoot.GlobalExitRoot, leaf.PreviousBlockHash, uint64(leaf.Timestamp.Unix()))
1015+
}
10071016

10081017
for _, l2blockRaw := range batchRawData.Blocks {
10091018
_, contained := l1InfoTreeData[l2blockRaw.IndexL1InfoTree]
@@ -1013,21 +1022,20 @@ func (a *Aggregator) buildInputProver(ctx context.Context, batchToVerify *state.
10131022
return nil, err
10141023
}
10151024

1016-
leaves, err := a.State.GetLeafsByL1InfoRoot(ctx, l1InfoTreeExitRootStorageEntry.L1InfoTreeRoot, nil)
1017-
if err != nil {
1018-
return nil, err
1019-
}
1020-
1021-
aLeaves := make([][32]byte, len(leaves))
1022-
for i, leaf := range leaves {
1023-
aLeaves[i] = l1infotree.HashLeafData(leaf.GlobalExitRoot.GlobalExitRoot, leaf.PreviousBlockHash, uint64(leaf.Timestamp.Unix()))
1024-
}
1025-
10261025
// Calculate smt proof
1027-
smtProof, _, err := tree.ComputeMerkleProof(l2blockRaw.IndexL1InfoTree, aLeaves)
1026+
smtProof, calculatedL1InfoRoot, err := tree.ComputeMerkleProof(l2blockRaw.IndexL1InfoTree, aLeaves)
10281027
if err != nil {
10291028
return nil, err
10301029
}
1030+
if l1InfoRoot != nil && *l1InfoRoot != calculatedL1InfoRoot {
1031+
for i, l := range aLeaves {
1032+
log.Info("AllLeaves[%d]: %s", i, common.Bytes2Hex(l[:]))
1033+
}
1034+
for i, s := range smtProof {
1035+
log.Info("smtProof[%d]: %s", i, common.Bytes2Hex(s[:]))
1036+
}
1037+
return nil, fmt.Errorf("error: l1InfoRoot mismatch. L1InfoRoot: %s, calculatedL1InfoRoot: %s. l1InfoTreeIndex: %d", l1InfoRoot.String(), calculatedL1InfoRoot.String(), l2blockRaw.IndexL1InfoTree)
1038+
}
10311039

10321040
protoProof := make([][]byte, len(smtProof))
10331041
for i, proof := range smtProof {

aggregator/aggregator_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ func TestTryGenerateBatchProof(t *testing.T) {
799799
TimestampBatchEtrog: &t,
800800
}
801801
m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice()
802+
m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice()
802803
expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
803804
require.NoError(err)
804805
m.proverMock.On("BatchProof", expectedInputProver).Return(nil, errBanana).Once()
@@ -840,6 +841,7 @@ func TestTryGenerateBatchProof(t *testing.T) {
840841
TimestampBatchEtrog: &t,
841842
}
842843
m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice()
844+
m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice()
843845
expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
844846
require.NoError(err)
845847
m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
@@ -882,6 +884,7 @@ func TestTryGenerateBatchProof(t *testing.T) {
882884
TimestampBatchEtrog: &t,
883885
}
884886
m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice()
887+
m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice()
885888
expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
886889
require.NoError(err)
887890
m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
@@ -924,6 +927,7 @@ func TestTryGenerateBatchProof(t *testing.T) {
924927
TimestampBatchEtrog: &t,
925928
}
926929
m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice()
930+
m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice()
927931
expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
928932
require.NoError(err)
929933
m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()
@@ -980,6 +984,7 @@ func TestTryGenerateBatchProof(t *testing.T) {
980984
TimestampBatchEtrog: &t,
981985
}
982986
m.stateMock.On("GetVirtualBatch", mock.Anything, lastVerifiedBatchNum+1, nil).Return(&vb, nil).Twice()
987+
m.stateMock.On("GetLeafsByL1InfoRoot", mock.Anything, *vb.L1InfoRoot, nil).Return([]state.L1InfoTreeExitRootStorageEntry{}, nil).Twice()
983988
expectedInputProver, err := a.buildInputProver(context.Background(), &batchToProve)
984989
require.NoError(err)
985990
m.proverMock.On("BatchProof", expectedInputProver).Return(&proofID, nil).Once()

cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
networkFlag = cli.StringFlag{
4848
Name: config.FlagNetwork,
4949
Aliases: []string{"net"},
50-
Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `custom`]",
50+
Usage: "Load default network configuration. Supported values: [`custom`]",
5151
Required: true,
5252
}
5353
customNetworkFlag = cli.StringFlag{

cmd/run.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Cl
349349
c.Etherman.URL,
350350
dacAddr,
351351
pk,
352-
&dataCommitteeClient.Factory{},
352+
dataCommitteeClient.NewFactory(),
353353
)
354354
if err != nil {
355355
return nil, err

config/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
FlagYes = "yes"
3232
// FlagCfg is the flag for cfg.
3333
FlagCfg = "cfg"
34-
// FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "custom"].
34+
// FlagNetwork is the flag for the network name. Valid values: ["custom"].
3535
FlagNetwork = "network"
3636
// FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
3737
FlagCustomNetwork = "custom-network-file"

config/environments/mainnet/example.env

-9
This file was deleted.

config/environments/mainnet/node.config.toml

-94
This file was deleted.

0 commit comments

Comments
 (0)