mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 03:16:45 +01:00
Use init SC vars and start block from events
Previously the Synchronizer required the initial variables of the smart contracts to be passed as a configuration parameter (that the node took from the configuration file). The same applied to the blockNumber. The last update of the smart contracts introduced events for each smart contract constructor (initializer), which allows querying the initial variables as well as the initial block number for each smart contract. Now the synchronizer uses this information, and thus the initial variables and the starting block numbers have been removed from the configuration.
This commit is contained in:
@@ -185,16 +185,7 @@ func newTestSynchronizer(t *testing.T, ethClient *test.Client, ethClientSetup *t
|
||||
modules modules) *synchronizer.Synchronizer {
|
||||
sync, err := synchronizer.NewSynchronizer(ethClient, modules.historyDB, modules.stateDB,
|
||||
synchronizer.Config{
|
||||
StartBlockNum: synchronizer.ConfigStartBlockNum{
|
||||
Rollup: 1,
|
||||
Auction: 1,
|
||||
WDelayer: 1,
|
||||
},
|
||||
InitialVariables: synchronizer.SCVariables{
|
||||
Rollup: *ethClientSetup.RollupVariables,
|
||||
Auction: *ethClientSetup.AuctionVariables,
|
||||
WDelayer: *ethClientSetup.WDelayerVariables,
|
||||
},
|
||||
StatsRefreshPeriod: 0 * time.Second,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
return sync
|
||||
@@ -311,7 +302,11 @@ func TestCoordCanForge(t *testing.T) {
|
||||
coord := newTestCoordinator(t, forger, ethClient, ethClientSetup, modules)
|
||||
_, err := ethClient.AuctionSetCoordinator(forger, "https://foo.bar")
|
||||
require.NoError(t, err)
|
||||
_, err = ethClient.AuctionBidSimple(2, big.NewInt(9999))
|
||||
bid, ok := new(big.Int).SetString("12000000000000000000", 10)
|
||||
if !ok {
|
||||
panic("bad bid")
|
||||
}
|
||||
_, err = ethClient.AuctionBidSimple(2, bid)
|
||||
require.NoError(t, err)
|
||||
|
||||
modules2 := newTestModules(t)
|
||||
@@ -359,7 +354,11 @@ func TestCoordHandleMsgSyncBlock(t *testing.T) {
|
||||
coord := newTestCoordinator(t, forger, ethClient, ethClientSetup, modules)
|
||||
_, err := ethClient.AuctionSetCoordinator(forger, "https://foo.bar")
|
||||
require.NoError(t, err)
|
||||
_, err = ethClient.AuctionBidSimple(2, big.NewInt(9999))
|
||||
bid, ok := new(big.Int).SetString("11000000000000000000", 10)
|
||||
if !ok {
|
||||
panic("bad bid")
|
||||
}
|
||||
_, err = ethClient.AuctionBidSimple(2, bid)
|
||||
require.NoError(t, err)
|
||||
|
||||
var msg MsgSyncBlock
|
||||
|
||||
Reference in New Issue
Block a user