mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-08 03:46:52 +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:
@@ -16,8 +16,8 @@ func TestParseBlockchainTxs(t *testing.T) {
|
||||
Type: Blockchain
|
||||
|
||||
// token registrations
|
||||
RegisterToken(1)
|
||||
RegisterToken(2)
|
||||
AddToken(1)
|
||||
AddToken(2)
|
||||
|
||||
// deposits
|
||||
Deposit(1) A: 10
|
||||
@@ -34,7 +34,7 @@ func TestParseBlockchainTxs(t *testing.T) {
|
||||
|
||||
// set new batch
|
||||
> batch
|
||||
RegisterToken(3)
|
||||
AddToken(3)
|
||||
|
||||
DepositTransfer(1) A-B: 15, 10 (1)
|
||||
Transfer(1) C-A : 3 (1)
|
||||
@@ -121,7 +121,7 @@ func TestParseErrors(t *testing.T) {
|
||||
|
||||
s = `
|
||||
Type: Blockchain
|
||||
RegisterToken(1)
|
||||
AddToken(1)
|
||||
Deposit(1) A: 10 20
|
||||
`
|
||||
parser = newParser(strings.NewReader(s))
|
||||
@@ -146,7 +146,7 @@ func TestParseErrors(t *testing.T) {
|
||||
|
||||
s = `
|
||||
Type: Blockchain
|
||||
RegisterToken(1)
|
||||
AddToken(1)
|
||||
Transfer(1) A-B: 10 (255)
|
||||
`
|
||||
parser = newParser(strings.NewReader(s))
|
||||
@@ -206,10 +206,10 @@ func TestParseErrors(t *testing.T) {
|
||||
assert.Equal(t, "Line 2: Instruction of 'Type: Blockchain' when there is already a previous instruction 'Type: PoolL2' defined", err.Error())
|
||||
|
||||
s = `Type: Blockchain
|
||||
RegisterToken(1)
|
||||
RegisterToken(0)
|
||||
AddToken(1)
|
||||
AddToken(0)
|
||||
`
|
||||
parser = newParser(strings.NewReader(s))
|
||||
_, err = parser.parse()
|
||||
assert.Equal(t, "Line 3: RegisterToken can not register TokenID 0", err.Error())
|
||||
assert.Equal(t, "Line 3: AddToken can not register TokenID 0", err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user