Add circuit configuration to node config

- Remove MaxL1CoordTxs parameter from the TxSelector because this parameter
  doesn't exist
- Use ChainID in l1tx byte encoding
- Pass txprocessor configuration to batch builder via an existing parameter
This commit is contained in:
Eduard S
2020-12-30 13:32:19 +01:00
parent a9804dcc2b
commit 18c854fbaa
12 changed files with 88 additions and 107 deletions

View File

@@ -1,56 +1,14 @@
package common
import (
"fmt"
"math/big"
ethCommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/hermeznetwork/tracerr"
)
// RollupVars contain the Rollup smart contract variables
// type RollupVars struct {
// EthBlockNum uint64
// ForgeL1Timeout *big.Int
// FeeL1UserTx *big.Int
// FeeAddToken *big.Int
// TokensHEZ eth.Address
// Governance eth.Address
// }
// AuctionVars contain the Auction smart contract variables
// type AuctionVars struct {
// EthBlockNum uint64
// SlotDeadline uint
// CloseAuctionSlots uint
// OpenAuctionSlots uint
// Governance eth.Address
// MinBidSlots MinBidSlots
// Outbidding int
// DonationAddress eth.Address
// GovernanceAddress eth.Address
// AllocationRatio AllocationRatio
// }
// WithdrawDelayerVars contains the Withdrawal Delayer smart contract variables
// type WithdrawDelayerVars struct {
// HermezRollupAddress eth.Address
// HermezGovernanceAddress eth.Address
// EmergencyCouncilAddress eth.Address
// WithdrawalDelay uint
// EmergencyModeStartingTime time.Time
// EmergencyModeEnabled bool
// }
// MinBidSlots TODO
// type MinBidSlots [6]uint
//
// // AllocationRatio TODO
// type AllocationRatio struct {
// Donation uint
// Burn uint
// Forger uint
// }
const (
// RollupConstMaxFeeIdxCoordinator is the maximum number of tokens the
// coordinator can use to collect fees (determines the number of tokens
@@ -146,6 +104,18 @@ type RollupConstants struct {
WithdrawDelayerContract ethCommon.Address `json:"withdrawDelayerContract"`
}
// FindVerifierIdx tries to find a matching verifier in the RollupConstants and
// returns its index
func (c *RollupConstants) FindVerifierIdx(MaxTx, NLevels int64) (int, error) {
for i, verifier := range c.Verifiers {
if verifier.MaxTx == MaxTx && verifier.NLevels == NLevels {
return i, nil
}
}
return 0, tracerr.Wrap(fmt.Errorf("verifier not found for MaxTx: %v, NLevels: %v",
MaxTx, NLevels))
}
// BucketParams are the parameter variables of each Bucket of Rollup Smart
// Contract
type BucketParams struct {