Skip to content

Commit

Permalink
fix ut and e2e test (#29)
Browse files Browse the repository at this point in the history
* fix ut

* update image

* bridgel2

* update doc
  • Loading branch information
zjg555543 authored Nov 1, 2023
1 parent 6991c3b commit c05ac23
Show file tree
Hide file tree
Showing 81 changed files with 5,010 additions and 1,403 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
go-version: [ 1.19.x ]
goarch: [ "amd64" ]
e2e-group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
e2e-group: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, dac-1 ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-from-prover.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test from zkevm-prover call
name: Test from xgon-prover call
on:
workflow_call:
inputs:
Expand Down
1 change: 1 addition & 0 deletions ci/e2e-group-dac-1/datacommittee_test.go
1 change: 0 additions & 1 deletion ci/e2e-group-dac/datacommittee_test.go

This file was deleted.

5 changes: 4 additions & 1 deletion ci/e2e-group10/forced_batches_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

const (
toAddressHex = "0x4d5Cf5032B2a844602278b01199ED191A86c93ff"
gerFinalityBlocks = uint64(250)
gerFinalityBlocks = uint64(2500)
forkID5 = 5
)

Expand Down Expand Up @@ -166,6 +166,8 @@ func sendForcedBatch(t *testing.T, txs []byte, opsman *operations.Manager) (*sta
require.NoError(t, err)

log.Debug("currentBlock.Time(): ", currentBlock.Time())
temp, _, err := st.GetLatestGer(ctx, gerFinalityBlocks)
log.Infof("temp: %v", temp.GlobalExitRoot.String())

// Send forceBatch
tx, err := zkEvm.ForceBatch(auth, txs, tip)
Expand Down Expand Up @@ -226,6 +228,7 @@ func sendForcedBatch(t *testing.T, txs []byte, opsman *operations.Manager) (*sta
finalGer, _, err := st.GetLatestGer(ctx, gerFinalityBlocks)
require.NoError(t, err)
if finalGer.GlobalExitRoot != rootInContractHash {
log.Infof("initialGer.GlobalExitRoot: %v, finalGer.GlobalExitRoot: %v, rootInContractHash: %v", initialGer.GlobalExitRoot.String(), finalGer.GlobalExitRoot.String(), rootInContractHash.String())
log.Fatal("global exit root is not updated")
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/ecdsa"
"errors"
"fmt"
"github.com/ethereum/go-ethereum/common"
"net"
"net/http"
"net/http/pprof"
Expand Down Expand Up @@ -37,6 +36,7 @@ import (
"github.com/0xPolygonHermez/zkevm-node/state"
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/0xPolygonHermez/zkevm-node/synchronizer"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/prometheus/client_golang/prometheus/promhttp"
Expand Down
12 changes: 6 additions & 6 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ func Test_Defaults(t *testing.T) {
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "SequenceSender.MaxTxSizeForL1",
expectedValue: uint64(131072),
path: "SequenceSender.MaxBatchesForL1",
expectedValue: uint64(10),
},
{
path: "Etherman.URL",
Expand Down Expand Up @@ -242,7 +242,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "MTClient.URI",
expectedValue: "zkevm-prover:50061",
expectedValue: "xgon-prover:50061",
},
{
path: "StateDB.User",
Expand All @@ -258,7 +258,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "StateDB.Host",
expectedValue: "zkevm-state-db",
expectedValue: "xgon-state-db",
},
{
path: "StateDB.Port",
Expand Down Expand Up @@ -319,7 +319,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Pool.DB.Host",
expectedValue: "zkevm-pool-db",
expectedValue: "xgon-pool-db",
},
{
path: "Pool.DB.Port",
Expand Down Expand Up @@ -375,7 +375,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Executor.URI",
expectedValue: "zkevm-prover:50071",
expectedValue: "xgon-prover:50071",
},
{
path: "Executor.MaxResourceExhaustedAttempts",
Expand Down
2 changes: 1 addition & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ MaxTxLifetime = "3h"
[SequenceSender]
WaitPeriodSendSequence = "5s"
LastBatchVirtualizationTimeMaxWaitPeriod = "5s"
MaxTxSizeForL1 = 1000
MaxBatchesForL1 = 10
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
UseValidium = true
Expand Down
6 changes: 3 additions & 3 deletions config/environments/local/local.genesis.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"l1Config" : {
"chainId": 1337,
"polygonZkEVMAddress": "0x610178dA211FEF7D417bC0e6FeD39F05609AD788",
"polygonZkEVMAddress": "0x0D9088C72Cd4F08e9dDe474D8F5394147f64b22C",
"maticTokenAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"polygonZkEVMGlobalExitRootAddress": "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6"
"polygonZkEVMGlobalExitRootAddress": "0xEd236da21Ff62bC7B62608AdB818da49E8549fa7"
},
"root": "0xd88680f1b151dd67518f9aca85161424c0cac61df2f5424a3ddc04ea25adecc7",
"genesisBlockNumber": 102,
Expand Down Expand Up @@ -39,7 +39,7 @@
"contractName": "PolygonZkEVMBridge proxy",
"balance": "200000000000000000000000000",
"nonce": "1",
"address": "0xff0EE8ea08cEf5cb4322777F5CC3E8A584B8A4A0",
"address": "0x10B65c586f795aF3eCCEe594fE4E38E1F059F780",
"bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
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 @@ -104,7 +104,7 @@ MaxTxLifetime = "3h"
[SequenceSender]
WaitPeriodSendSequence = "5s"
LastBatchVirtualizationTimeMaxWaitPeriod = "5s"
MaxTxSizeForL1 = 131072
MaxBatchesForL1 = 10
L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}

Expand Down
2 changes: 1 addition & 1 deletion config/environments/mainnet/prover.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"starkInfoFile": "zkevm.starkinfo.json",
"starkInfoC12aFile": "zkevm.c12a.starkinfo.json",
"starkInfoRecursive1File": "zkevm.recursive1.starkinfo.json",
"databaseURL": "postgresql://prover_user:prover_pass@zkevm-state-db:5432/prover_db",
"databaseURL": "postgresql://prover_user:prover_pass@xgon-state-db:5432/prover_db",
"dbNodesTableName": "state.nodes",
"dbProgramTableName": "state.program",
"dbAsyncWrite": false,
Expand Down
2 changes: 1 addition & 1 deletion config/environments/testnet/prover.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"starkInfoFile": "zkevm.starkinfo.json",
"starkInfoC12aFile": "zkevm.c12a.starkinfo.json",
"starkInfoRecursive1File": "zkevm.recursive1.starkinfo.json",
"databaseURL": "postgresql://prover_user:prover_pass@zkevm-state-db:5432/prover_db",
"databaseURL": "postgresql://prover_user:prover_pass@xgon-state-db:5432/prover_db",
"dbNodesTableName": "state.nodes",
"dbProgramTableName": "state.program",
"dbAsyncWrite": false,
Expand Down
4 changes: 2 additions & 2 deletions config/metrics/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ scrape_configs:
metrics_path: /metrics
static_configs:
- targets:
- zkevm-json-rpc:9091 #inside port of the zkevm-json-rpc
- zkevm-sequencer:9091 #inside port of the zkevm-sequencer
- xgon-json-rpc:9091 #inside port of the xgon-json-rpc
- xgon-sequencer:9091 #inside port of the xgon-sequencer
4 changes: 2 additions & 2 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (

const (
// StateMigrationName is the name of the migration used by packr to pack the migration file
StateMigrationName = "zkevm-state-db"
StateMigrationName = "xgon-state-db"
// PoolMigrationName is the name of the migration used by packr to pack the migration file
PoolMigrationName = "zkevm-pool-db"
PoolMigrationName = "xgon-pool-db"
)

var packrMigrations = map[string]*packr.Box{
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.5"
networks:
default:
name: Xgon
name: xgon
services:
xgon-rpc:
container_name: xgon-rpc
Expand Down Expand Up @@ -107,7 +107,7 @@ services:
xgon-prover:
container_name: xgon-prover
restart: unless-stopped
image: hermeznetwork/xgon-prover:v2.2.0
image: hermeznetwork/zkevm-prover:v2.2.0
depends_on:
xgon-state-db:
condition: service_healthy
Expand Down
Loading

0 comments on commit c05ac23

Please sign in to comment.