mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Update missing parts, improve til, and more
- Node - Updated configuration to initialize the interface to all the smart contracts - Common - Moved BlockData and BatchData types to common so that they can be shared among: historydb, til and synchronizer - Remove hash.go (it was never used) - Remove slot.go (it was never used) - Remove smartcontractparams.go (it was never used, and appropriate structs are defined in `eth/`) - Comment state / status method until requirements of this method are properly defined, and move it to Synchronizer - Synchronizer - Simplify `Sync` routine to only sync one block per call, and return useful information. - Use BlockData and BatchData from common - Check that events belong to the expected block hash - In L1Batch, query L1UserTxs from HistoryDB - Fill ERC20 token information - Test AddTokens with test.Client - HistryDB - Use BlockData and BatchData from common - Add `GetAllTokens` method - Uncomment and update GetL1UserTxs (with corresponding tests) - Til - Rename all instances of RegisterToken to AddToken (to follow the smart contract implementation naming) - Use BlockData and BatchData from common - Move testL1CoordinatorTxs and testL2Txs to a separate struct from BatchData in Context - Start Context with BatchNum = 1 (which the protocol defines to be the first batchNum) - In every Batch, set StateRoot and ExitRoot to a non-nil big.Int (zero). - In all L1Txs, if LoadAmount is not used, set it to 0; if Amount is not used, set it to 0; so that no *big.Int is nil. - In L1UserTx, don't set BatchNum, because when L1UserTxs are created and obtained by the synchronizer, the BatchNum is not known yet (it's a synchronizer job to set it) - In L1UserTxs, set `UserOrigin` and set `ToForgeL1TxsNum`.
This commit is contained in:
@@ -39,10 +39,10 @@ var typeNewBatchL1 common.TxType = "InstrTypeNewBatchL1"
|
||||
// common.TxType of a new ethereum block
|
||||
var typeNewBlock common.TxType = "InstrTypeNewBlock"
|
||||
|
||||
// typeRegisterToken is used for testing purposes only, and represents the
|
||||
// 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)
|
||||
var typeRegisterToken common.TxType = "InstrTypeRegisterToken" //nolint:gosec
|
||||
var typeAddToken common.TxType = "InstrTypeAddToken" //nolint:gosec
|
||||
|
||||
var txTypeCreateAccountDepositCoordinator common.TxType = "TypeCreateAccountDepositCoordinator"
|
||||
|
||||
@@ -306,7 +306,7 @@ func (p *parser) parseLine(setType setType) (*instruction, error) {
|
||||
} else {
|
||||
return c, fmt.Errorf("Invalid set type: '%s'. Valid set types: 'Blockchain', 'PoolL2'", lit)
|
||||
}
|
||||
} else if lit == "RegisterToken" {
|
||||
} else if lit == "AddToken" {
|
||||
if err := p.expectChar(c, "("); err != nil {
|
||||
return c, err
|
||||
}
|
||||
@@ -322,7 +322,7 @@ func (p *parser) parseLine(setType setType) (*instruction, error) {
|
||||
if err := p.expectChar(c, ")"); err != nil {
|
||||
return c, err
|
||||
}
|
||||
c.typ = typeRegisterToken
|
||||
c.typ = typeAddToken
|
||||
line, _ := p.s.r.ReadString('\n')
|
||||
c.literal += line
|
||||
return c, newEventLine
|
||||
@@ -519,8 +519,8 @@ func (p *parser) parse() (*parsedSet, error) {
|
||||
}
|
||||
instruction.lineNum = i
|
||||
if err == newEventLine {
|
||||
if instruction.typ == typeRegisterToken && instruction.tokenID == common.TokenID(0) {
|
||||
return ps, fmt.Errorf("Line %d: RegisterToken can not register TokenID 0", i)
|
||||
if instruction.typ == typeAddToken && instruction.tokenID == common.TokenID(0) {
|
||||
return ps, fmt.Errorf("Line %d: AddToken can not register TokenID 0", i)
|
||||
}
|
||||
ps.instructions = append(ps.instructions, *instruction)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user