mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Merge pull request #250 from hermeznetwork/feature/integration9
Reorganize smart contract types, udate eth tests, etc.
This commit is contained in:
@@ -329,7 +329,7 @@ func (hdb *HistoryDB) SyncPoD(
|
||||
blockNum uint64,
|
||||
bids []common.Bid,
|
||||
coordinators []common.Coordinator,
|
||||
vars *common.AuctionVars,
|
||||
vars *common.AuctionVariables,
|
||||
) error {
|
||||
return nil
|
||||
}
|
||||
@@ -1122,40 +1122,40 @@ func (hdb *HistoryDB) AddBlockSCData(blockData *common.BlockData) (err error) {
|
||||
}
|
||||
|
||||
// Add Coordinators
|
||||
if len(blockData.Coordinators) > 0 {
|
||||
err = hdb.addCoordinators(txn, blockData.Coordinators)
|
||||
if len(blockData.Auction.Coordinators) > 0 {
|
||||
err = hdb.addCoordinators(txn, blockData.Auction.Coordinators)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Add Bids
|
||||
if len(blockData.Bids) > 0 {
|
||||
err = hdb.addBids(txn, blockData.Bids)
|
||||
if len(blockData.Auction.Bids) > 0 {
|
||||
err = hdb.addBids(txn, blockData.Auction.Bids)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Add Tokens
|
||||
if len(blockData.AddedTokens) > 0 {
|
||||
err = hdb.addTokens(txn, blockData.AddedTokens)
|
||||
if len(blockData.Rollup.AddedTokens) > 0 {
|
||||
err = hdb.addTokens(txn, blockData.Rollup.AddedTokens)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Add l1 Txs
|
||||
if len(blockData.L1UserTxs) > 0 {
|
||||
err = hdb.addL1Txs(txn, blockData.L1UserTxs)
|
||||
if len(blockData.Rollup.L1UserTxs) > 0 {
|
||||
err = hdb.addL1Txs(txn, blockData.Rollup.L1UserTxs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Add Batches
|
||||
for i := range blockData.Batches {
|
||||
batch := &blockData.Batches[i]
|
||||
for i := range blockData.Rollup.Batches {
|
||||
batch := &blockData.Rollup.Batches[i]
|
||||
// Add Batch: this will trigger an update on the DB
|
||||
// that will set the batch num of forged L1 txs in this batch
|
||||
err = hdb.addBatch(txn, &batch.Batch)
|
||||
@@ -1200,6 +1200,8 @@ func (hdb *HistoryDB) AddBlockSCData(blockData *common.BlockData) (err error) {
|
||||
// TODO: INSERT CONTRACTS VARS
|
||||
}
|
||||
|
||||
// TODO: Process withdrawals
|
||||
|
||||
return txn.Commit()
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +408,7 @@ func TestGetL1UserTxs(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
// Sanity check
|
||||
require.Equal(t, 1, len(blocks))
|
||||
require.Equal(t, 5, len(blocks[0].L1UserTxs))
|
||||
require.Equal(t, 5, len(blocks[0].Rollup.L1UserTxs))
|
||||
// fmt.Printf("DBG Blocks: %+v\n", blocks)
|
||||
|
||||
toForgeL1TxsNum := int64(1)
|
||||
@@ -421,7 +421,7 @@ func TestGetL1UserTxs(t *testing.T) {
|
||||
l1UserTxs, err := historyDB.GetL1UserTxs(toForgeL1TxsNum)
|
||||
require.Nil(t, err)
|
||||
assert.Equal(t, 5, len(l1UserTxs))
|
||||
assert.Equal(t, blocks[0].L1UserTxs, l1UserTxs)
|
||||
assert.Equal(t, blocks[0].Rollup.L1UserTxs, l1UserTxs)
|
||||
|
||||
// No l1UserTxs for this toForgeL1TxsNum
|
||||
l1UserTxs, err = historyDB.GetL1UserTxs(2)
|
||||
|
||||
Reference in New Issue
Block a user