mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 19:36:44 +01:00
Reorganize smart contract types, udate eth tests, etc.
- Move smart contract constants and structs for variables to
common/{ethrollup.go, ethauction.go, ethwdelayer.go}:
- This removes repeated code of the structs for variables
- Allows reusing the constants and variables from all modules without
import cycles
- Remove unused common/scvars.go
- In common.BlockData, split data from each smart contract into a sepparate
field (Rollup, Auction, WDelayer). This affects the structures that til uses
as output, and HistoryDB in the AddBlockSCData.
- In Synchronizer:
- Pass starting block of each smart contract as config, instead of
incorrectly using the genesis block found in the acution constant (which
has a very different meaning)
- Use variable structs from common instead of an internal copy
- Synchronize more stuff (resolve some TODOs)
- Fix some issues found after initial testing with ganache
- In eth:
- In auction.go: Add method to get constants
- Update README to use ganache instead of buidlerevm as local blockchain
for testing
- Update env variables and test vectors to pass the tests with the
deployment in the ganache testnet.
- Use ethereum keys derived from paths (hdwallet) in testing to avoid
hardcoding private keys and generate the same keys from a mnemonic used
in the ganache tesnet.
This commit is contained in:
@@ -14,20 +14,61 @@ type Block struct {
|
||||
ParentHash ethCommon.Hash `meddler:"-"`
|
||||
}
|
||||
|
||||
// BlockData contains the information of a Block
|
||||
type BlockData struct {
|
||||
Block Block
|
||||
// Rollup
|
||||
// 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
|
||||
RollupVars *RollupVars
|
||||
// Auction
|
||||
Bids []Bid
|
||||
Coordinators []Coordinator
|
||||
AuctionVars *AuctionVars
|
||||
WithdrawDelayerVars *WithdrawDelayerVars
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user