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`.
4 years ago 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`.
4 years ago 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`.
4 years ago |
|
package common
import ( "time"
ethCommon "github.com/ethereum/go-ethereum/common" )
// Block represents of an Ethereum block
type Block struct { EthBlockNum int64 `meddler:"eth_block_num"` Timestamp time.Time `meddler:"timestamp,utctime"` Hash ethCommon.Hash `meddler:"hash"` ParentHash ethCommon.Hash `meddler:"-"` }
// RollupData contains information returned by the Rollup smart contract
type RollupData struct { // L1UserTxs that were submitted in the block
L1UserTxs []L1Tx Batches []BatchData AddedTokens []Token Withdrawals []WithdrawInfo Vars *RollupVariables }
// NewRollupData creates an empty RollupData with the slices initialized.
func NewRollupData() RollupData { return RollupData{ L1UserTxs: make([]L1Tx, 0), Batches: make([]BatchData, 0), AddedTokens: make([]Token, 0), Withdrawals: make([]WithdrawInfo, 0), Vars: nil, } }
// AuctionData contains information returned by the Action smart contract
type AuctionData struct { Bids []Bid Coordinators []Coordinator Vars *AuctionVariables }
// NewAuctionData creates an empty AuctionData with the slices initialized.
func NewAuctionData() AuctionData { return AuctionData{ Bids: make([]Bid, 0), Coordinators: make([]Coordinator, 0), Vars: nil, } }
// WDelayerData contains information returned by the WDelayer smart contract
type WDelayerData struct { Vars *WDelayerVariables }
// NewWDelayerData creates an empty WDelayerData.
func NewWDelayerData() WDelayerData { return WDelayerData{ Vars: nil, } }
// BlockData contains the information of a Block
type BlockData struct { Block Block Rollup RollupData Auction AuctionData WDelayer WDelayerData // TODO: enable when common.WithdrawalDelayerVars is Merged from Synchronizer PR
// WithdrawalDelayerVars *common.WithdrawalDelayerVars
}
// BatchData contains the information of a Batch
type BatchData struct { // L1UserTxs that were forged in the batch
L1Batch bool // TODO: Remove once Batch.ForgeL1TxsNum is a pointer
// L1UserTxs []common.L1Tx
L1CoordinatorTxs []L1Tx L2Txs []L2Tx CreatedAccounts []Account ExitTree []ExitInfo Batch Batch }
// NewBatchData creates an empty BatchData with the slices initialized.
func NewBatchData() *BatchData { return &BatchData{ L1Batch: false, // L1UserTxs: make([]common.L1Tx, 0),
L1CoordinatorTxs: make([]L1Tx, 0), L2Txs: make([]L2Tx, 0), CreatedAccounts: make([]Account, 0), ExitTree: make([]ExitInfo, 0), Batch: Batch{}, } }
|