mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
StateDB ZKInputs generation compatible with circom
- Add SignatureConstant to L1Tx.TxCompressedData
- ZKInputs generation works initial version working and compatible with circom Hermez circuit
- Lots of small updates for circuits compatibility
- Update version (with new changes) of `go-iden3-crypto` & `go-merkletree`
This commit is contained in:
@@ -42,12 +42,14 @@ var TypeNewBatchL1 common.TxType = "InstrTypeNewBatchL1"
|
||||
var TypeNewBlock common.TxType = "InstrTypeNewBlock"
|
||||
|
||||
// TypeAddToken is used for testing purposes only, and represents the
|
||||
// common.TxType of a new Token regsitration
|
||||
// It has 'nolint:gosec' as the string 'Token' triggers gosec as a potential leaked Token (which is not the case)
|
||||
// common.TxType of a new Token regsitration.
|
||||
// It has 'nolint:gosec' as the string 'Token' triggers gosec as a potential
|
||||
// leaked Token (which is not the case).
|
||||
var TypeAddToken common.TxType = "InstrTypeAddToken" //nolint:gosec
|
||||
|
||||
// TxTypeCreateAccountDepositCoordinator is used for testing purposes only, and represents the
|
||||
// common.TxType of a create acount deposit made by the coordinator
|
||||
// TxTypeCreateAccountDepositCoordinator is used for testing purposes only,
|
||||
// and represents the common.TxType of a create acount deposit made by the
|
||||
// coordinator
|
||||
var TxTypeCreateAccountDepositCoordinator common.TxType = "TypeCreateAccountDepositCoordinator"
|
||||
|
||||
//nolint
|
||||
|
||||
@@ -57,7 +57,8 @@ type Context struct {
|
||||
LastRegisteredTokenID common.TokenID
|
||||
l1CreatedAccounts map[string]*Account // (Name, TokenID) -> *Account
|
||||
|
||||
// rollupConstMaxL1UserTx Maximum L1-user transactions allowed to be queued in a batch
|
||||
// rollupConstMaxL1UserTx Maximum L1-user transactions allowed to be
|
||||
// queued in a batch
|
||||
rollupConstMaxL1UserTx int
|
||||
|
||||
idx int
|
||||
@@ -146,8 +147,8 @@ type L2Tx struct {
|
||||
L2Tx common.L2Tx
|
||||
}
|
||||
|
||||
// GenerateBlocks returns an array of BlockData for a given set made of a string. It uses the
|
||||
// users (keys & nonces) of the Context.
|
||||
// GenerateBlocks returns an array of BlockData for a given set made of a
|
||||
// string. It uses the users (keys & nonces) of the Context.
|
||||
func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
parser := newParser(strings.NewReader(set))
|
||||
parsedSet, err := parser.parse()
|
||||
@@ -164,8 +165,8 @@ func (tc *Context) GenerateBlocks(set string) ([]common.BlockData, error) {
|
||||
return tc.generateBlocks()
|
||||
}
|
||||
|
||||
// GenerateBlocksFromInstructions returns an array of BlockData for a given set made of instructions. It uses the
|
||||
// users (keys & nonces) of the Context.
|
||||
// GenerateBlocksFromInstructions returns an array of BlockData for a given set
|
||||
// made of instructions. It uses the users (keys & nonces) of the Context.
|
||||
func (tc *Context) GenerateBlocksFromInstructions(set []Instruction) ([]common.BlockData, error) {
|
||||
userNames := []string{}
|
||||
addedNames := make(map[string]bool)
|
||||
@@ -537,8 +538,8 @@ func (tc *Context) checkIfTokenIsRegistered(inst Instruction) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GeneratePoolL2Txs returns an array of common.PoolL2Tx from a given set made of a string. It
|
||||
// uses the users (keys) of the Context.
|
||||
// GeneratePoolL2Txs returns an array of common.PoolL2Tx from a given set made
|
||||
// of a string. It uses the users (keys) of the Context.
|
||||
func (tc *Context) GeneratePoolL2Txs(set string) ([]common.PoolL2Tx, error) {
|
||||
parser := newParser(strings.NewReader(set))
|
||||
parsedSet, err := parser.parse()
|
||||
@@ -555,8 +556,8 @@ func (tc *Context) GeneratePoolL2Txs(set string) ([]common.PoolL2Tx, error) {
|
||||
return tc.generatePoolL2Txs()
|
||||
}
|
||||
|
||||
// GeneratePoolL2TxsFromInstructions returns an array of common.PoolL2Tx from a given set made of instructions. It
|
||||
// uses the users (keys) of the Context.
|
||||
// GeneratePoolL2TxsFromInstructions returns an array of common.PoolL2Tx from a
|
||||
// given set made of instructions. It uses the users (keys) of the Context.
|
||||
func (tc *Context) GeneratePoolL2TxsFromInstructions(set []Instruction) ([]common.PoolL2Tx, error) {
|
||||
userNames := []string{}
|
||||
addedNames := make(map[string]bool)
|
||||
@@ -775,7 +776,8 @@ func (tc *Context) FillBlocksForgedL1UserTxs(blocks []common.BlockData) error {
|
||||
}
|
||||
|
||||
// FillBlocksExtra fills extra fields not generated by til in each block, so
|
||||
// that the blockData is closer to what the HistoryDB stores. The filled fields are:
|
||||
// that the blockData is closer to what the HistoryDB stores. The filled
|
||||
// fields are:
|
||||
// - blocks[].Rollup.Batch.EthBlockNum
|
||||
// - blocks[].Rollup.Batch.ForgerAddr
|
||||
// - blocks[].Rollup.Batch.ForgeL1TxsNum
|
||||
|
||||
Reference in New Issue
Block a user