Compare commits

...

12 Commits

Author SHA1 Message Date
Mikelle
4462fd9c53 updated eth/README.md 2021-03-31 19:51:18 +03:00
Mikelle
49280afc1a fixed rollup_test.go 2021-03-30 21:11:50 +03:00
Mikelle
5d06bfc4e4 fixed synchronizer_test.go 2021-03-25 19:44:41 +03:00
Mikelle
bc9d7fdc90 updated RollupVariables init with empty buckets 2021-03-25 19:31:26 +03:00
Mikelle
dde99d6178 fixed TestNodeInfo test 2021-03-24 20:13:26 +03:00
Mikelle
2841b4e22c fixed struct in historydb_test.go 2021-03-24 19:20:10 +03:00
Mikelle
ad4e6e8dcb fixed pr remarks 2021-03-24 19:13:54 +03:00
Mikelle
aa1f0a2618 fixed rollup event parsing 2021-03-23 10:54:14 +03:00
Mikelle
0f4be6a946 updated rollup according new contract api 2021-03-19 16:02:26 +03:00
Mikelle
602e1e7634 Merge remote-tracking branch 'origin/feature/update-smart-contracts' into refactore/rollupUpdateBuckets
# Conflicts:
#	eth/contracts/hermez/Hermez.go
2021-03-19 14:44:16 +03:00
Mikelle
cd7cdef339 fixed blockstamp naming in BucketParamsAPI 2021-03-19 12:56:57 +03:00
Mikelle
379ca78b4e updated rollup buckets to the current state 2021-03-19 12:36:34 +03:00
12 changed files with 120 additions and 97 deletions

View File

@@ -499,12 +499,14 @@ func TestMain(m *testing.M) {
// Slot 7
nextForgers[6].Coordinator = nonBootForger
var buckets [common.RollupConstNumBuckets]common.BucketParams
buckets := make([]common.BucketParams, 5)
for i := range buckets {
buckets[i].CeilUSD = big.NewInt(int64(i) * 10)
buckets[i].Withdrawals = big.NewInt(int64(i) * 100)
buckets[i].BlockWithdrawalRate = big.NewInt(int64(i) * 1000)
buckets[i].MaxWithdrawals = big.NewInt(int64(i) * 10000)
buckets[i].BlockStamp = big.NewInt(int64(i) * 100)
buckets[i].Withdrawals = big.NewInt(int64(i) * 1000)
buckets[i].RateBlocks = big.NewInt(int64(i) * 10000)
buckets[i].RateWithdrawals = big.NewInt(int64(i) * 100000)
buckets[i].MaxWithdrawals = big.NewInt(int64(i) * 1000000)
}
// Generate SC vars and add them to HistoryDB (if needed)

View File

@@ -41,7 +41,6 @@ func newRollupConstants(publicConstants common.RollupConstants) *rollupConstants
MaxL1UserTx: common.RollupConstMaxL1UserTx,
MaxL1Tx: common.RollupConstMaxL1Tx,
InputSHAConstantBytes: common.RollupConstInputSHAConstantBytes,
NumBuckets: common.RollupConstNumBuckets,
MaxWithdrawalDelay: common.RollupConstMaxWithdrawalDelay,
ExchangeMultiplier: common.RollupConstExchangeMultiplier,
}

View File

@@ -43,7 +43,9 @@ func assertEqualRollupVariables(t *testing.T, rollupVariables common.RollupVaria
assert.Equal(t, rollupVariables.SafeMode, apiVariables.SafeMode)
if checkBuckets {
for i, bucket := range rollupVariables.Buckets {
assert.Equal(t, apitypes.NewBigIntStr(bucket.BlockWithdrawalRate), apiVariables.Buckets[i].BlockWithdrawalRate)
assert.Equal(t, apitypes.NewBigIntStr(bucket.BlockStamp), apiVariables.Buckets[i].BlockStamp)
assert.Equal(t, apitypes.NewBigIntStr(bucket.RateBlocks), apiVariables.Buckets[i].RateBlocks)
assert.Equal(t, apitypes.NewBigIntStr(bucket.RateWithdrawals), apiVariables.Buckets[i].RateWithdrawals)
assert.Equal(t, apitypes.NewBigIntStr(bucket.CeilUSD), apiVariables.Buckets[i].CeilUSD)
assert.Equal(t, apitypes.NewBigIntStr(bucket.MaxWithdrawals), apiVariables.Buckets[i].MaxWithdrawals)
assert.Equal(t, apitypes.NewBigIntStr(bucket.Withdrawals), apiVariables.Buckets[i].Withdrawals)

View File

@@ -2729,16 +2729,24 @@ components:
properties:
ceilUSD:
type: string
description: Max USD value
description: Max USD value that bucket holds
example: "1000"
blockStamp:
type: string
description: Block number of the last bucket update
example: "1"
withdrawals:
type: string
description: Available withdrawals of the bucket
example: "4"
blockWithdrawalRate:
rateBlocks:
type: string
description: Every `blockWithdrawalRate` blocks add 1 withdrawal
example: "8"
description: rateBlocks every `rateBlocks` blocks add `rateWithdrawals` withdrawal
example: "2"
rateWithdrawals:
type: string
description: add `rateWithdrawals` every `rateBlocks`
example: "3"
maxWithdrawals:
type: string
description: Max withdrawals the bucket can hold
@@ -2746,8 +2754,10 @@ components:
additionalProperties: false
required:
- ceilUSD
- blockStamp
- withdrawals
- blockWithdrawalRate
- rateBlocks
- rateWithdrawals
- maxWithdrawals
additionalProperties: false
required:

View File

@@ -37,8 +37,6 @@ const (
// _L1_USER_TOTALBYTES bytes] l1TxsData + totalL2TxsDataLength + feeIdxCoordinatorLength +
// [2 bytes] chainID = 18542 bytes + totalL2TxsDataLength + feeIdxCoordinatorLength
RollupConstInputSHAConstantBytes = 18546
// RollupConstNumBuckets Number of buckets
RollupConstNumBuckets = 5
// RollupConstMaxWithdrawalDelay max withdrawal delay in seconds
RollupConstMaxWithdrawalDelay = 2 * 7 * 24 * 60 * 60
// RollupConstExchangeMultiplier exchange multiplier
@@ -132,10 +130,12 @@ func (c *RollupConstants) FindVerifierIdx(MaxTx, NLevels int64) (int, error) {
// BucketParams are the parameter variables of each Bucket of Rollup Smart
// Contract
type BucketParams struct {
CeilUSD *big.Int
Withdrawals *big.Int
BlockWithdrawalRate *big.Int
MaxWithdrawals *big.Int
CeilUSD *big.Int
BlockStamp *big.Int
Withdrawals *big.Int
RateBlocks *big.Int
RateWithdrawals *big.Int
MaxWithdrawals *big.Int
}
// BucketUpdate are the bucket updates (tracking the withdrawals value changes)
@@ -158,12 +158,12 @@ type TokenExchange struct {
// RollupVariables are the variables of the Rollup Smart Contract
//nolint:lll
type RollupVariables struct {
EthBlockNum int64 `meddler:"eth_block_num"`
FeeAddToken *big.Int `meddler:"fee_add_token,bigint" validate:"required"`
ForgeL1L2BatchTimeout int64 `meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `meddler:"withdrawal_delay" validate:"required"`
Buckets [RollupConstNumBuckets]BucketParams `meddler:"buckets,json"`
SafeMode bool `meddler:"safe_mode"`
EthBlockNum int64 `meddler:"eth_block_num"`
FeeAddToken *big.Int `meddler:"fee_add_token,bigint" validate:"required"`
ForgeL1L2BatchTimeout int64 `meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `meddler:"withdrawal_delay" validate:"required"`
Buckets []BucketParams `meddler:"buckets,json"`
SafeMode bool `meddler:"safe_mode"`
}
// Copy returns a deep copy of the Variables

View File

@@ -738,7 +738,7 @@ func exampleInitSCVars() (*common.RollupVariables, *common.AuctionVariables, *co
big.NewInt(10),
12,
13,
[5]common.BucketParams{},
[]common.BucketParams{},
false,
}
//nolint:govet

View File

@@ -354,38 +354,43 @@ type BucketUpdateAPI struct {
// BucketParamsAPI are the parameter variables of each Bucket of Rollup Smart
// Contract
type BucketParamsAPI struct {
CeilUSD *apitypes.BigIntStr `json:"ceilUSD"`
Withdrawals *apitypes.BigIntStr `json:"withdrawals"`
BlockWithdrawalRate *apitypes.BigIntStr `json:"blockWithdrawalRate"`
MaxWithdrawals *apitypes.BigIntStr `json:"maxWithdrawals"`
CeilUSD *apitypes.BigIntStr `json:"ceilUSD"`
BlockStamp *apitypes.BigIntStr `json:"blockStamp"`
Withdrawals *apitypes.BigIntStr `json:"withdrawals"`
RateBlocks *apitypes.BigIntStr `json:"rateBlocks"`
RateWithdrawals *apitypes.BigIntStr `json:"rateWithdrawals"`
MaxWithdrawals *apitypes.BigIntStr `json:"maxWithdrawals"`
}
// RollupVariablesAPI are the variables of the Rollup Smart Contract
type RollupVariablesAPI struct {
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
FeeAddToken *apitypes.BigIntStr `json:"feeAddToken" meddler:"fee_add_token" validate:"required"`
ForgeL1L2BatchTimeout int64 `json:"forgeL1L2BatchTimeout" meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay" validate:"required"`
Buckets [common.RollupConstNumBuckets]BucketParamsAPI `json:"buckets" meddler:"buckets,json"`
SafeMode bool `json:"safeMode" meddler:"safe_mode"`
EthBlockNum int64 `json:"ethereumBlockNum" meddler:"eth_block_num"`
FeeAddToken *apitypes.BigIntStr `json:"feeAddToken" meddler:"fee_add_token" validate:"required"`
ForgeL1L2BatchTimeout int64 `json:"forgeL1L2BatchTimeout" meddler:"forge_l1_timeout" validate:"required"`
WithdrawalDelay uint64 `json:"withdrawalDelay" meddler:"withdrawal_delay" validate:"required"`
Buckets []BucketParamsAPI `json:"buckets" meddler:"buckets,json"`
SafeMode bool `json:"safeMode" meddler:"safe_mode"`
}
// NewRollupVariablesAPI creates a RollupVariablesAPI from common.RollupVariables
func NewRollupVariablesAPI(rollupVariables *common.RollupVariables) *RollupVariablesAPI {
buckets := make([]BucketParamsAPI, len(rollupVariables.Buckets))
rollupVars := RollupVariablesAPI{
EthBlockNum: rollupVariables.EthBlockNum,
FeeAddToken: apitypes.NewBigIntStr(rollupVariables.FeeAddToken),
ForgeL1L2BatchTimeout: rollupVariables.ForgeL1L2BatchTimeout,
WithdrawalDelay: rollupVariables.WithdrawalDelay,
SafeMode: rollupVariables.SafeMode,
Buckets: buckets,
}
for i, bucket := range rollupVariables.Buckets {
rollupVars.Buckets[i] = BucketParamsAPI{
CeilUSD: apitypes.NewBigIntStr(bucket.CeilUSD),
Withdrawals: apitypes.NewBigIntStr(bucket.Withdrawals),
BlockWithdrawalRate: apitypes.NewBigIntStr(bucket.BlockWithdrawalRate),
MaxWithdrawals: apitypes.NewBigIntStr(bucket.MaxWithdrawals),
CeilUSD: apitypes.NewBigIntStr(bucket.CeilUSD),
BlockStamp: apitypes.NewBigIntStr(bucket.BlockStamp),
Withdrawals: apitypes.NewBigIntStr(bucket.Withdrawals),
RateBlocks: apitypes.NewBigIntStr(bucket.RateBlocks),
RateWithdrawals: apitypes.NewBigIntStr(bucket.RateWithdrawals),
MaxWithdrawals: apitypes.NewBigIntStr(bucket.MaxWithdrawals),
}
}
return &rollupVars

View File

@@ -8,7 +8,7 @@ The first step is to clone the github repository where the contracts are located
While the prepared deployment is not found to master, branch in repository must be changed:
`git checkout feature/newDeploymentScript-eth-edu` (tested with commit `e6c5b7db8da2de1b9cc55e281c8d1dfa524b06f0`)
`git checkout feature/newDeploymentScript-eth-mik` (tested with commit `0eccd237dda102a4ad788a6e11f98361d39d0d9c`)
Now, install the dependencies:

View File

@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"math/big"
"strconv"
"strings"
"github.com/ethereum/go-ethereum"
@@ -61,21 +60,12 @@ type RollupEventInitialize struct {
// RollupVariables returns the RollupVariables from the initialize event
func (ei *RollupEventInitialize) RollupVariables() *common.RollupVariables {
var buckets [common.RollupConstNumBuckets]common.BucketParams
for i := range buckets {
buckets[i] = common.BucketParams{
CeilUSD: big.NewInt(0),
Withdrawals: big.NewInt(0),
BlockWithdrawalRate: big.NewInt(0),
MaxWithdrawals: big.NewInt(0),
}
}
return &common.RollupVariables{
EthBlockNum: 0,
FeeAddToken: ei.FeeAddToken,
ForgeL1L2BatchTimeout: int64(ei.ForgeL1L2BatchTimeout),
WithdrawalDelay: ei.WithdrawalDelay,
Buckets: buckets,
Buckets: []common.BucketParams{},
SafeMode: false,
}
}
@@ -146,20 +136,21 @@ type RollupEventUpdateWithdrawalDelay struct {
// RollupUpdateBucketsParameters are the bucket parameters used in an update
type RollupUpdateBucketsParameters struct {
CeilUSD *big.Int
Withdrawals *big.Int
BlockWithdrawalRate *big.Int
MaxWithdrawals *big.Int
CeilUSD *big.Int
BlockStamp *big.Int
Withdrawals *big.Int
RateBlocks *big.Int
RateWithdrawals *big.Int
MaxWithdrawals *big.Int
}
type rollupEventUpdateBucketsParametersAux struct {
ArrayBuckets [common.RollupConstNumBuckets][4]*big.Int
ArrayBuckets []*big.Int
}
// RollupEventUpdateBucketsParameters is an event of the Rollup Smart Contract
type RollupEventUpdateBucketsParameters struct {
// ArrayBuckets [common.RollupConstNumBuckets][4]*big.Int
ArrayBuckets [common.RollupConstNumBuckets]RollupUpdateBucketsParameters
ArrayBuckets []RollupUpdateBucketsParameters
SafeMode bool
}
@@ -493,8 +484,8 @@ func (c *RollupClient) RollupL1UserTxERC20ETH(fromBJJ babyjub.PublicKeyComp, fro
auth.Value = depositAmount
}
var permit []byte
return c.hermez.AddL1Transaction(auth, babyPubKey, fromIdxBig, uint16(depositAmountF),
uint16(amountF), tokenID, toIdxBig, permit)
return c.hermez.AddL1Transaction(auth, babyPubKey, fromIdxBig, big.NewInt(int64(depositAmountF)),
big.NewInt(int64(amountF)), tokenID, toIdxBig, permit)
},
); err != nil {
return nil, tracerr.Wrap(fmt.Errorf("Failed add L1 Tx ERC20/ETH: %w", err))
@@ -542,7 +533,7 @@ func (c *RollupClient) RollupL1UserTxERC20Permit(fromBJJ babyjub.PublicKeyComp,
signature, _ := c.client.ks.SignHash(*c.client.account, digest)
permit := createPermit(owner, spender, amount, deadline, digest, signature)
return c.hermez.AddL1Transaction(auth, babyPubKey, fromIdxBig,
uint16(depositAmountF), uint16(amountF), tokenID, toIdxBig, permit)
big.NewInt(int64(depositAmountF)), big.NewInt(int64(amountF)), tokenID, toIdxBig, permit)
},
); err != nil {
return nil, tracerr.Wrap(fmt.Errorf("Failed add L1 Tx ERC20Permit: %w", err))
@@ -604,18 +595,20 @@ func (c *RollupClient) RollupUpdateFeeAddToken(newFeeAddToken *big.Int) (tx *typ
// RollupUpdateBucketsParameters is the interface to call the smart contract function
func (c *RollupClient) RollupUpdateBucketsParameters(
arrayBuckets [common.RollupConstNumBuckets]RollupUpdateBucketsParameters,
arrayBuckets []RollupUpdateBucketsParameters,
) (tx *types.Transaction, err error) {
params := [common.RollupConstNumBuckets][4]*big.Int{}
for i, bucket := range arrayBuckets {
params[i][0] = bucket.CeilUSD
params[i][1] = bucket.Withdrawals
params[i][2] = bucket.BlockWithdrawalRate
params[i][3] = bucket.MaxWithdrawals
}
if tx, err = c.client.CallAuth(
12500000, //nolint:gomnd
func(ec *ethclient.Client, auth *bind.TransactOpts) (*types.Transaction, error) {
params := make([]*big.Int, len(arrayBuckets))
for i, bucket := range arrayBuckets {
params[i], err = c.hermez.PackBucket(c.opts,
bucket.CeilUSD, bucket.BlockStamp, bucket.Withdrawals,
bucket.RateBlocks, bucket.RateWithdrawals, bucket.MaxWithdrawals)
if err != nil {
return nil, tracerr.Wrap(fmt.Errorf("failed to pack bucket: %w", err))
}
}
return c.hermez.UpdateBucketsParameters(auth, params)
},
); err != nil {
@@ -739,7 +732,7 @@ var (
logHermezUpdateWithdrawalDelay = crypto.Keccak256Hash([]byte(
"UpdateWithdrawalDelay(uint64)"))
logHermezUpdateBucketsParameters = crypto.Keccak256Hash([]byte(
"UpdateBucketsParameters(uint256[4][" + strconv.Itoa(common.RollupConstNumBuckets) + "])"))
"UpdateBucketsParameters(uint256[])"))
logHermezUpdateTokenExchange = crypto.Keccak256Hash([]byte(
"UpdateTokenExchange(address[],uint64[])"))
logHermezSafeMode = crypto.Keccak256Hash([]byte(
@@ -906,11 +899,18 @@ func (c *RollupClient) RollupEventsByBlock(blockNum int64,
if err != nil {
return nil, tracerr.Wrap(err)
}
bucketsParameters.ArrayBuckets = make([]RollupUpdateBucketsParameters, len(bucketsParametersAux.ArrayBuckets))
for i, bucket := range bucketsParametersAux.ArrayBuckets {
bucketsParameters.ArrayBuckets[i].CeilUSD = bucket[0]
bucketsParameters.ArrayBuckets[i].Withdrawals = bucket[1]
bucketsParameters.ArrayBuckets[i].BlockWithdrawalRate = bucket[2]
bucketsParameters.ArrayBuckets[i].MaxWithdrawals = bucket[3]
bucket, err := c.hermez.UnpackBucket(c.opts, bucket)
if err != nil {
return nil, tracerr.Wrap(err)
}
bucketsParameters.ArrayBuckets[i].CeilUSD = bucket.CeilUSD
bucketsParameters.ArrayBuckets[i].BlockStamp = bucket.BlockStamp
bucketsParameters.ArrayBuckets[i].Withdrawals = bucket.Withdrawals
bucketsParameters.ArrayBuckets[i].RateBlocks = bucket.RateBlocks
bucketsParameters.ArrayBuckets[i].RateWithdrawals = bucket.RateWithdrawals
bucketsParameters.ArrayBuckets[i].MaxWithdrawals = bucket.MaxWithdrawals
}
rollupEvents.UpdateBucketsParameters =
append(rollupEvents.UpdateBucketsParameters, bucketsParameters)
@@ -932,8 +932,10 @@ func (c *RollupClient) RollupEventsByBlock(blockNum int64,
}
for i := range bucketsParameters.ArrayBuckets {
bucketsParameters.ArrayBuckets[i].CeilUSD = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].BlockStamp = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].Withdrawals = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].BlockWithdrawalRate = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].RateBlocks = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].RateWithdrawals = big.NewInt(0)
bucketsParameters.ArrayBuckets[i].MaxWithdrawals = big.NewInt(0)
}
rollupEvents.UpdateBucketsParameters = append(rollupEvents.UpdateBucketsParameters,

View File

@@ -234,12 +234,15 @@ func TestRollupUpdateFeeAddToken(t *testing.T) {
}
func TestRollupUpdateBucketsParameters(t *testing.T) {
var bucketsParameters [common.RollupConstNumBuckets]RollupUpdateBucketsParameters
bucketsParameters := make([]RollupUpdateBucketsParameters, 5)
ceilUSD, _ := new(big.Int).SetString("10000000", 10)
for i := range bucketsParameters {
bucketsParameters[i].CeilUSD = big.NewInt(int64((i + 1) * 100))
bucketsParameters[i].CeilUSD = big.NewInt(0).Mul(ceilUSD, big.NewInt(int64(i+1)))
bucketsParameters[i].BlockStamp = big.NewInt(int64(0))
bucketsParameters[i].Withdrawals = big.NewInt(int64(i + 1))
bucketsParameters[i].BlockWithdrawalRate = big.NewInt(int64(i+1) * 100)
bucketsParameters[i].MaxWithdrawals = big.NewInt(int64(100000000000))
bucketsParameters[i].RateBlocks = big.NewInt(int64(i+1) * 4)
bucketsParameters[i].RateWithdrawals = big.NewInt(int64(3))
bucketsParameters[i].MaxWithdrawals = big.NewInt(int64(1215752192))
}
_, err := rollupClient.RollupUpdateBucketsParameters(bucketsParameters)
require.NoError(t, err)
@@ -248,7 +251,14 @@ func TestRollupUpdateBucketsParameters(t *testing.T) {
blockStampBucket = currentBlockNum
rollupEvents, err := rollupClient.RollupEventsByBlock(currentBlockNum, nil)
require.NoError(t, err)
assert.Equal(t, bucketsParameters, rollupEvents.UpdateBucketsParameters[0].ArrayBuckets)
for i := range bucketsParameters {
assert.Equal(t, 0, bucketsParameters[i].CeilUSD.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].CeilUSD))
assert.Equal(t, 0, bucketsParameters[i].BlockStamp.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].BlockStamp))
assert.Equal(t, 0, bucketsParameters[i].Withdrawals.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].Withdrawals))
assert.Equal(t, 0, bucketsParameters[i].RateBlocks.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].RateBlocks))
assert.Equal(t, 0, bucketsParameters[i].RateWithdrawals.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].RateWithdrawals))
assert.Equal(t, 0, bucketsParameters[i].MaxWithdrawals.Cmp(rollupEvents.UpdateBucketsParameters[0].ArrayBuckets[i].MaxWithdrawals))
}
}
func TestRollupUpdateWithdrawalDelay(t *testing.T) {
@@ -1016,9 +1026,9 @@ func TestRollupWithdrawMerkleProof(t *testing.T) {
// Bucket 1
// Bucket[0].withdrawals = 1, Bucket[1].withdrawals = 2, ...
// Bucket[1].withdrawals - 1 = 1
assert.Equal(t, 1, rollupEvents.UpdateBucketWithdraw[0].NumBucket)
assert.Equal(t, blockStampBucket, rollupEvents.UpdateBucketWithdraw[0].BlockStamp)
assert.Equal(t, big.NewInt(1), rollupEvents.UpdateBucketWithdraw[0].Withdrawals)
assert.Equal(t, 0, rollupEvents.UpdateBucketWithdraw[0].NumBucket)
assert.Equal(t, int64(442), rollupEvents.UpdateBucketWithdraw[0].BlockStamp)
assert.Equal(t, big.NewInt(15), rollupEvents.UpdateBucketWithdraw[0].Withdrawals)
}
func TestRollupSafeMode(t *testing.T) {

View File

@@ -1125,10 +1125,12 @@ func (s *Synchronizer) rollupSync(ethBlock *common.Block) (*common.RollupData, e
for _, evt := range rollupEvents.UpdateBucketsParameters {
for i, bucket := range evt.ArrayBuckets {
s.vars.Rollup.Buckets[i] = common.BucketParams{
CeilUSD: bucket.CeilUSD,
Withdrawals: bucket.Withdrawals,
BlockWithdrawalRate: bucket.BlockWithdrawalRate,
MaxWithdrawals: bucket.MaxWithdrawals,
CeilUSD: bucket.CeilUSD,
BlockStamp: bucket.BlockStamp,
Withdrawals: bucket.Withdrawals,
RateBlocks: bucket.RateBlocks,
RateWithdrawals: bucket.RateWithdrawals,
MaxWithdrawals: bucket.MaxWithdrawals,
}
}
s.vars.Rollup.SafeMode = evt.SafeMode

View File

@@ -301,20 +301,11 @@ func NewClientSetupExample() *ClientSetup {
HermezAuctionContract: ethCommon.HexToAddress("0x8E442975805fb1908f43050c9C1A522cB0e28D7b"),
WithdrawDelayerContract: ethCommon.HexToAddress("0x5CB7979cBdbf65719BEE92e4D15b7b7Ed3D79114"),
}
var buckets [common.RollupConstNumBuckets]common.BucketParams
for i := range buckets {
buckets[i] = common.BucketParams{
CeilUSD: big.NewInt(0),
Withdrawals: big.NewInt(0),
BlockWithdrawalRate: big.NewInt(0),
MaxWithdrawals: big.NewInt(0),
}
}
rollupVariables := &common.RollupVariables{
FeeAddToken: big.NewInt(11),
ForgeL1L2BatchTimeout: 10,
WithdrawalDelay: 80,
Buckets: buckets,
Buckets: []common.BucketParams{},
}
auctionConstants := &common.AuctionConstants{
BlocksPerSlot: 40,