You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
3.3 KiB

  1. package api
  2. import (
  3. "math/big"
  4. "testing"
  5. ethCommon "github.com/ethereum/go-ethereum/common"
  6. "github.com/hermeznetwork/hermez-node/common"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func getConfigTest() configAPI {
  10. var config configAPI
  11. config.RollupConstants.ExchangeMultiplier = common.RollupConstExchangeMultiplier
  12. config.RollupConstants.ExitIdx = common.RollupConstExitIDx
  13. config.RollupConstants.ReservedIdx = common.RollupConstReservedIDx
  14. config.RollupConstants.LimitLoadAmount, _ = new(big.Int).SetString("340282366920938463463374607431768211456", 10)
  15. config.RollupConstants.LimitL2TransferAmount, _ = new(big.Int).SetString("6277101735386680763835789423207666416102355444464034512896", 10)
  16. config.RollupConstants.LimitTokens = common.RollupConstLimitTokens
  17. config.RollupConstants.L1CoordinatorTotalBytes = common.RollupConstL1CoordinatorTotalBytes
  18. config.RollupConstants.L1UserTotalBytes = common.RollupConstL1UserTotalBytes
  19. config.RollupConstants.MaxL1UserTx = common.RollupConstMaxL1UserTx
  20. config.RollupConstants.MaxL1Tx = common.RollupConstMaxL1Tx
  21. config.RollupConstants.InputSHAConstantBytes = common.RollupConstInputSHAConstantBytes
  22. config.RollupConstants.NumBuckets = common.RollupConstNumBuckets
  23. config.RollupConstants.MaxWithdrawalDelay = common.RollupConstMaxWithdrawalDelay
  24. var rollupPublicConstants common.RollupConstants
  25. rollupPublicConstants.AbsoluteMaxL1L2BatchTimeout = 240
  26. rollupPublicConstants.HermezAuctionContract = ethCommon.HexToAddress("0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e")
  27. rollupPublicConstants.HermezGovernanceDAOAddress = ethCommon.HexToAddress("0xeAD9C93b79Ae7C1591b1FB5323BD777E86e150d4")
  28. rollupPublicConstants.SafetyAddress = ethCommon.HexToAddress("0xE5904695748fe4A84b40b3fc79De2277660BD1D3")
  29. rollupPublicConstants.TokenHEZ = ethCommon.HexToAddress("0xf784709d2317D872237C4bC22f867d1BAe2913AB")
  30. rollupPublicConstants.WithdrawDelayerContract = ethCommon.HexToAddress("0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe")
  31. var verifier common.RollupVerifierStruct
  32. verifier.MaxTx = 512
  33. verifier.NLevels = 32
  34. rollupPublicConstants.Verifiers = append(rollupPublicConstants.Verifiers, verifier)
  35. var auctionConstants common.AuctionConstants
  36. auctionConstants.BlocksPerSlot = 40
  37. auctionConstants.GenesisBlockNum = 100
  38. auctionConstants.GovernanceAddress = ethCommon.HexToAddress("0xeAD9C93b79Ae7C1591b1FB5323BD777E86e150d4")
  39. auctionConstants.InitialMinimalBidding, _ = new(big.Int).SetString("10000000000000000000", 10)
  40. auctionConstants.HermezRollup = ethCommon.HexToAddress("0xEa960515F8b4C237730F028cBAcF0a28E7F45dE0")
  41. auctionConstants.TokenHEZ = ethCommon.HexToAddress("0xf784709d2317D872237C4bC22f867d1BAe2913AB")
  42. var wdelayerConstants common.WDelayerConstants
  43. wdelayerConstants.HermezRollup = ethCommon.HexToAddress("0xEa960515F8b4C237730F028cBAcF0a28E7F45dE0")
  44. wdelayerConstants.MaxEmergencyModeTime = uint64(1000000)
  45. wdelayerConstants.MaxWithdrawalDelay = uint64(10000000)
  46. config.RollupConstants.PublicConstants = rollupPublicConstants
  47. config.AuctionConstants = auctionConstants
  48. config.WDelayerConstants = wdelayerConstants
  49. return config
  50. }
  51. func TestGetConfig(t *testing.T) {
  52. endpoint := apiURL + "config"
  53. var configTest configAPI
  54. assert.NoError(t, doGoodReq("GET", endpoint, nil, &configTest))
  55. assert.Equal(t, config, configTest)
  56. assert.Equal(t, cg, &configTest)
  57. }