Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pullupstream/v0.5.6 #70

Merged
merged 75 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
6e8ad9e
fix migration batch wip field. fix sequence when no wip batch (#3126)
agnusmor Jan 23, 2024
22b2651
fix Leaves smtproof (#3127)
ARR552 Jan 23, 2024
1962ca1
Add l2block log dump when storing error. Refactor ProcessBatchV2 logs…
agnusmor Jan 24, 2024
c3dddf7
fix panic etherman (#3133)
ARR552 Jan 24, 2024
8e1e5e9
Fix GetL2Hash function. Use tx L2 hash returned by the executor when …
agnusmor Jan 24, 2024
19d493e
remove l2 tx hash computation and use data stored in the state return…
tclemos Jan 25, 2024
8124e52
etrog: fix permissionless errors (#3140)
joanestebanr Jan 25, 2024
895c1e0
Fix missing batch bookmark (#3122)
ToniRamirezM Jan 25, 2024
6feb7b8
fix wipL2Block deltaTimestamp (#3142)
agnusmor Jan 25, 2024
646603e
ensure tx order in stream (#3144)
ToniRamirezM Jan 25, 2024
4ddba20
fix wipL2Block stateRoot (#3145)
agnusmor Jan 25, 2024
1825164
fix panic NewStackTrie (#3146)
ARR552 Jan 25, 2024
bc51813
fix sync initalization for etrog (#3147)
tclemos Jan 25, 2024
4dc6258
fix wipL2block imStateRoot (#3148)
agnusmor Jan 26, 2024
86fcb5b
fix tracer to work by block stateroot instead of by tx (#3150)
tclemos Jan 26, 2024
75a957f
update prover image (#3151)
ToniRamirezM Jan 26, 2024
f69f0f9
if a trusted batch is empty and WIP just create the entry in state.ba…
joanestebanr Jan 26, 2024
65a507e
fix trace for tx index greater than 0 (#3153)
tclemos Jan 26, 2024
8f79b21
add cardona.zip (#3154)
joanestebanr Jan 26, 2024
c100d40
Fix default value when creating transaction.used_sha256_hashes field …
agnusmor Jan 26, 2024
1a8dd7d
add cardona testnet (#2909) (#3155)
joanestebanr Jan 26, 2024
f3b86d4
new fields in stream (#3149)
ToniRamirezM Jan 26, 2024
b47986a
set stateManagerPurge to false in Cardona (#3158)
joanestebanr Jan 26, 2024
eea3833
synchronizer: fix case emtpy batch and unittest (#3159)
joanestebanr Jan 27, 2024
7497d07
update prover image to v4.0.1 (#3160)
agnusmor Jan 27, 2024
12022c2
update prover image to v4.0.2 (#3162)
agnusmor Jan 27, 2024
a296484
Add a note in deployment instruction to restart rpc after forkId 7 (#…
joanestebanr Jan 27, 2024
5dfe003
change position of point 10
agnusmor Jan 27, 2024
479ba46
add point 11
agnusmor Jan 27, 2024
9e2a95d
add lines
agnusmor Jan 27, 2024
b216df0
add breakline
agnusmor Jan 27, 2024
f5bc983
add lines
agnusmor Jan 27, 2024
87bb731
add line
agnusmor Jan 27, 2024
18a75ff
Sync old network compatibility (#3166)
ARR552 Jan 30, 2024
f5346fa
synchronizer: unittest and remove pool_reorg (#3111) (#3168)
joanestebanr Jan 30, 2024
efbd360
fix parentHash when storing a new L2 block (#3171)
agnusmor Jan 30, 2024
6b49ba8
Fix/rom error (#3177)
ARR552 Jan 31, 2024
b55cf66
Cherrypick/#3179 geth version v1.13.11 (#3180)
ARR552 Jan 31, 2024
291ac85
Add sanity check: last L2 block timestamp in the sequence is also L1B…
agnusmor Jan 31, 2024
5583622
synchronizer: update fromTrusted fix cache update (#3169)
joanestebanr Feb 1, 2024
a110d2e
Feature/3173 sync trusted state in networks previous to ETROG (#3175)
joanestebanr Feb 1, 2024
10aaffb
Fix/3164 eth syncing dont return expected values (#3165)
joanestebanr Feb 1, 2024
f3dfbf2
fix im state root in stream (#3192)
ToniRamirezM Feb 2, 2024
6f81efa
sync: fix getting URL from contract in compatibility mode, and set se…
joanestebanr Feb 2, 2024
175e0f3
Fix isSynced function (#3188)
agnusmor Feb 2, 2024
3567c84
fix l2 block gas price to use value returned by the executor (#3186) …
tclemos Feb 2, 2024
284dda3
allow rpc to access the ForkID directly from DB (#3196)
tclemos Feb 2, 2024
95465ca
allow rpc to access the ForkID directly from DB (#3197)
tclemos Feb 3, 2024
112bdd0
Fix/3200 l1inforoot error on reorg (#3201)
joanestebanr Feb 5, 2024
a4059e6
Fix/3203 panic if batch process fail and must be closed (#3206)
joanestebanr Feb 5, 2024
d439c9f
Remove L1SynchronizationMode parameter from environments config files…
agnusmor Feb 5, 2024
78ba11d
allow GetL2TxHashByTxHash to return null for txs prior to Etrog (#3209)
tclemos Feb 5, 2024
d85d135
Fix L2 block gas limit to 2**50 (1125899906842624) (#3219)
agnusmor Feb 6, 2024
c29d96c
change 2^64-1 for an esmitation of blocks (#3220)
joanestebanr Feb 6, 2024
e616ee5
removed restart RPC on deploy instructions (#3221)
joanestebanr Feb 6, 2024
18b38d7
Cherry pick/3222 (#3224)
ToniRamirezM Feb 6, 2024
bab6187
add retries in is Synced function when last virtual batch is greater …
agnusmor Feb 7, 2024
6044b9b
wip
rachit77 Feb 7, 2024
e88984a
wip
rachit77 Feb 7, 2024
514deb9
update mocks
rachit77 Feb 7, 2024
df3f71b
wip
rachit77 Feb 7, 2024
1ed2128
modified sequencesender interfaces signatures
rachit77 Feb 7, 2024
a5b8cd5
linter fix
rachit77 Feb 7, 2024
aa6e27e
removed unused methods and linter fix
rachit77 Feb 7, 2024
c36fa1c
wip
rachit77 Feb 8, 2024
fb77471
update diff docs
rachit77 Feb 8, 2024
c456d1b
Fix errors when generating mocks and regenerate them
Stefan-Ethernal Feb 8, 2024
183d79b
cr fix
rachit77 Feb 8, 2024
72751c9
cr fix
rachit77 Feb 8, 2024
27bd054
docs update
rachit77 Feb 8, 2024
192d65c
Generate mock_etherman for sequencesender package
Stefan-Ethernal Feb 8, 2024
2f4df49
cr fix and docs update
rachit77 Feb 8, 2024
0d88a61
Fix etherman test
arnaubennassar Feb 8, 2024
e1625b4
fix UT
rachit77 Feb 8, 2024
decf4d5
update docs
rachit77 Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/0xPolygonHermez/zkevm-node/gasprice"
"github.com/0xPolygonHermez/zkevm-node/jsonrpc"
"github.com/0xPolygonHermez/zkevm-node/jsonrpc/client"
"github.com/0xPolygonHermez/zkevm-node/l1infotree"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/0xPolygonHermez/zkevm-node/merkletree"
"github.com/0xPolygonHermez/zkevm-node/metrics"
Expand Down Expand Up @@ -122,20 +121,17 @@ func start(cliCtx *cli.Context) error {
log.Fatal(err)
}

st := newState(cliCtx.Context, c, l2ChainID, []state.ForkIDInterval{}, stateSqlDB, eventLog, needsExecutor, needsStateTree)

etherman, err := newEtherman(*c, st)
etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil)
if err != nil {
log.Fatal(err)
}
forkIDIntervals, err := forkIDIntervals(cliCtx.Context, st, etherman, c.NetworkConfig.Genesis.BlockNumber)
st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false)

etherman, err = newEtherman(*c, st)
if err != nil {
log.Fatal("error getting forkIDs. Error: ", err)
log.Fatal(err)
}
st.UpdateForkIDIntervalsInMemory(forkIDIntervals)

currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId
log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId)
c.Aggregator.ChainID = l2ChainID
c.Sequencer.StreamServer.ChainID = l2ChainID
log.Infof("Chain ID read from POE SC = %v", l2ChainID)
Expand Down Expand Up @@ -220,6 +216,7 @@ func start(cliCtx *cli.Context) error {
for _, a := range cliCtx.StringSlice(config.FlagHTTPAPI) {
apis[a] = true
}
st, _ := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, true)
go runJSONRPCServer(*c, etherman, l2ChainID, poolInstance, st, apis)
case SYNCHRONIZER:
ev.Component = event.Component_Synchronizer
Expand Down Expand Up @@ -379,7 +376,7 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerS
log.Fatal("error getting trusted sequencer URI. Error: %v", err)
}
}
log.Debug("trustedSequencerURL ", trustedSequencerURL)
log.Info("trustedSequencerURL ", trustedSequencerURL)
}
zkEVMClient := client.NewClient(trustedSequencerURL)

Expand Down Expand Up @@ -543,9 +540,7 @@ func waitSignal(cancelFuncs []context.CancelFunc) {
}
}

func newState(ctx context.Context, c *config.Config, l2ChainID uint64, forkIDIntervals []state.ForkIDInterval, sqlDB *pgxpool.Pool, eventLog *event.EventLog, needsExecutor, needsStateTree bool) *state.State {
stateDb := pgstatestorage.NewPostgresStorage(c.State, sqlDB)

func newState(ctx context.Context, c *config.Config, etherman *etherman.Client, l2ChainID uint64, sqlDB *pgxpool.Pool, eventLog *event.EventLog, needsExecutor, needsStateTree, avoidForkIDInMemory bool) (*state.State, uint64) {
// Executor
var executorClient executor.ExecutorServiceClient
if needsExecutor {
Expand All @@ -562,30 +557,35 @@ func newState(ctx context.Context, c *config.Config, l2ChainID uint64, forkIDInt
stateCfg := state.Config{
MaxCumulativeGasUsed: c.State.Batch.Constraints.MaxCumulativeGasUsed,
ChainID: l2ChainID,
ForkIDIntervals: forkIDIntervals,
ForkIDIntervals: []state.ForkIDInterval{},
MaxResourceExhaustedAttempts: c.Executor.MaxResourceExhaustedAttempts,
WaitOnResourceExhaustion: c.Executor.WaitOnResourceExhaustion,
ForkUpgradeBatchNumber: c.ForkUpgradeBatchNumber,
ForkUpgradeNewForkId: c.ForkUpgradeNewForkId,
MaxLogsCount: c.RPC.MaxLogsCount,
MaxLogsBlockRange: c.RPC.MaxLogsBlockRange,
MaxNativeBlockHashBlockRange: c.RPC.MaxNativeBlockHashBlockRange,
AvoidForkIDInMemory: avoidForkIDInMemory,
}
allLeaves, err := stateDb.GetAllL1InfoRootEntries(ctx, nil)
stateDb := pgstatestorage.NewPostgresStorage(stateCfg, sqlDB)
st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil)
// This is to force to build cache, and check that DB is ok before starting the application
l1inforoot, err := st.GetCurrentL1InfoRoot(ctx, nil)
if err != nil {
log.Fatal("error getting all leaves. Error: ", err)
}
var leaves [][32]byte
for _, leaf := range allLeaves {
leaves = append(leaves, leaf.Hash())
log.Fatal("error getting current L1InfoRoot. Error: ", err)
}
mt, err := l1infotree.NewL1InfoTree(uint8(32), leaves) //nolint:gomnd
log.Infof("Starting L1InfoRoot: %v", l1inforoot.String())

forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.BlockNumber)
if err != nil {
log.Fatal("error creating L1InfoTree. Error: ", err)
log.Fatal("error getting forkIDs. Error: ", err)
}
st.UpdateForkIDIntervalsInMemory(forkIDIntervals)

currentForkID := forkIDIntervals[len(forkIDIntervals)-1].ForkId
log.Infof("Fork ID read from POE SC = %v", forkIDIntervals[len(forkIDIntervals)-1].ForkId)

st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, mt)
return st
return st, currentForkID
}

func createPool(cfgPool pool.Config, constraintsCfg state.BatchConstraintsCfg, l2ChainID uint64, st *state.State, eventLog *event.EventLog) *pool.Pool {
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Synchronizer.L1SynchronizationMode",
expectedValue: "parallel",
expectedValue: "sequential",
},
{
path: "Synchronizer.L1ParallelSynchronization.MaxClients",
Expand Down Expand Up @@ -491,7 +491,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "State.Batch.Constraints.MaxCumulativeGasUsed",
expectedValue: uint64(30000000),
expectedValue: uint64(1125899906842624),
},
{
path: "State.Batch.Constraints.MaxKeccakHashes",
Expand Down
4 changes: 2 additions & 2 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Outputs = ["stderr"]
[State.Batch.Constraints]
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 30000000
MaxCumulativeGasUsed = 1125899906842624
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
Expand Down Expand Up @@ -102,7 +102,7 @@ EnableHttpLog = true
SyncInterval = "1s"
SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc
L1SynchronizationMode = "parallel"
L1SynchronizationMode = "sequential"
[Synchronizer.L1ParallelSynchronization]
MaxClients = 10
MaxPendingNoProcessedBlocks = 25
Expand Down
2 changes: 1 addition & 1 deletion config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Outputs = ["stderr"]
[State.Batch.Constraints]
MaxTxsPerBatch = 300
MaxBatchBytesSize = 120000
MaxCumulativeGasUsed = 30000000
MaxCumulativeGasUsed = 1125899906842624
MaxKeccakHashes = 2145
MaxPoseidonHashes = 252357
MaxPoseidonPaddings = 135191
Expand Down
107 changes: 0 additions & 107 deletions config/mainnetgenesis.go

This file was deleted.

108 changes: 0 additions & 108 deletions config/testnetgenesis.go

This file was deleted.

12 changes: 7 additions & 5 deletions dataavailability/datacommittee/datacommittee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
"github.com/0xPolygonHermez/zkevm-node/log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient/simulated"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -63,7 +63,7 @@ func init() {
// This function prepare the blockchain, the wallet with funds and deploy the smc
func newTestingEnv(t *testing.T) (
dac *DataCommitteeBackend,
ethBackend *backends.SimulatedBackend,
ethBackend *simulated.Backend,
auth *bind.TransactOpts,
da *polygondatacommittee.Polygondatacommittee,
) {
Expand All @@ -87,7 +87,7 @@ func newTestingEnv(t *testing.T) (
// must be 1337. The address that holds the auth will have an initial balance of 10 ETH
func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
dacman *DataCommitteeBackend,
ethBackend *backends.SimulatedBackend,
ethBackend *simulated.Backend,
da *polygondatacommittee.Polygondatacommittee,
err error,
) {
Expand All @@ -105,17 +105,19 @@ func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
},
}
blockGasLimit := uint64(999999999999999999) //nolint:gomnd
client := backends.NewSimulatedBackend(genesisAlloc, blockGasLimit)
client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))

// DAC Setup
_, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client)
_, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client.Client())
if err != nil {
return &DataCommitteeBackend{}, nil, nil, err
}
client.Commit()
_, err = da.Initialize(auth)
if err != nil {
return &DataCommitteeBackend{}, nil, nil, err
}
client.Commit()
_, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{})
if err != nil {
return &DataCommitteeBackend{}, nil, nil, err
Expand Down
6 changes: 4 additions & 2 deletions db/migrations/state/0009.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
ALTER TABLE IF EXISTS state.fork_id DROP CONSTRAINT IF EXISTS fork_id_block_num_fkey;

-- +migrate Down
DELETE FROM state.fork_id f
WHERE NOT EXISTS(SELECT 1 FROM state.block b WHERE b.block_num = f.block_num);

ALTER TABLE IF EXISTS state.fork_id ADD CONSTRAINT fork_id_block_num_fkey
FOREIGN KEY(block_num)
REFERENCES state.block (block_num) ON DELETE CASCADE;
FOREIGN KEY(block_num) REFERENCES state.block (block_num) ON DELETE CASCADE;
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ services:
zkevm-prover:
container_name: zkevm-prover
restart: unless-stopped
image: hermeznetwork/zkevm-prover:v4.0.2
image: hermeznetwork/zkevm-prover:v4.0.4
depends_on:
zkevm-state-db:
condition: service_healthy
Expand Down
Loading