@@ -37,83 +37,6 @@ func init() {
3737 r = rand .New (s )
3838}
3939
40- << << << < HEAD
41- == == == =
42- func DefaultOracleSidecar (image ibc.DockerImage ) ibc.SidecarConfig {
43- return ibc.SidecarConfig {
44- ProcessName : "oracle" ,
45- Image : image ,
46- HomeDir : "/oracle" ,
47- Ports : []string {"8080" , "8081" },
48- StartCmd : []string {
49- "slinky" ,
50- "--oracle-config" , "/oracle/oracle.json" ,
51- },
52- ValidatorProcess : true ,
53- PreStart : true ,
54- }
55- }
56-
57- func DefaultOracleConfig (url string ) oracleconfig.OracleConfig {
58- cfg := marketmap .DefaultAPIConfig
59- cfg .Endpoints = []oracleconfig.Endpoint {
60- {
61- URL : url ,
62- },
63- }
64-
65- // Create the oracle config
66- oracleConfig := oracleconfig.OracleConfig {
67- UpdateInterval : 500 * time .Millisecond ,
68- MaxPriceAge : 1 * time .Minute ,
69- Host : "0.0.0.0" ,
70- Port : "8080" ,
71- Providers : map [string ]oracleconfig.ProviderConfig {
72- marketmap .Name : {
73- Name : marketmap .Name ,
74- API : cfg ,
75- Type : "market_map_provider" ,
76- },
77- },
78- }
79-
80- return oracleConfig
81- }
82-
83- func DefaultMarketMap () mmtypes.MarketMap {
84- return mmtypes.MarketMap {}
85- }
86-
87- func GetOracleSideCar (node * cosmos.ChainNode ) * cosmos.SidecarProcess {
88- if len (node .Sidecars ) == 0 {
89- panic ("no sidecars found" )
90- }
91- return node .Sidecars [0 ]
92- }
93-
94- type TestTxConfig struct {
95- SmallSendsNum int
96- LargeSendsNum int
97- TargetIncreaseGasPrice math.LegacyDec
98- }
99-
100- func (tx * TestTxConfig ) Validate () error {
101- if tx .SmallSendsNum < 1 || tx .LargeSendsNum < 1 {
102- return fmt .Errorf ("sends num should be greater than 1" )
103- }
104-
105- if tx .TargetIncreaseGasPrice .IsNil () {
106- return fmt .Errorf ("target increase gas price is nil" )
107- }
108-
109- if tx .TargetIncreaseGasPrice .LTE (math .LegacyZeroDec ()) {
110- return fmt .Errorf ("target increase gas price is less than or equal to 0" )
111- }
112-
113- return nil
114- }
115-
116- >> >> >> > daca8c8 (test : make extendable (#112 ))
11740// TestSuite runs the feemarket e2e test-suite against a given interchaintest specification
11841type TestSuite struct {
11942 suite.Suite
@@ -191,30 +114,18 @@ func WithChainConstructor(cc ChainConstructor) Option {
191114 }
192115}
193116
194- << << << < HEAD
195- func NewIntegrationSuite (spec * interchaintest.ChainSpec , opts ... Option ) * TestSuite {
117+ func NewIntegrationSuite (spec * interchaintest.ChainSpec , txCfg TestTxConfig , opts ... Option ) * TestSuite {
118+ if err := txCfg .Validate (); err != nil {
119+ panic (err )
120+ }
121+
196122 suite := & TestSuite {
197123 spec : spec ,
198124 denom : defaultDenom ,
199125 authority : authtypes .NewModuleAddress (govtypes .ModuleName ),
200126 icc : DefaultInterchainConstructor ,
201127 cc : DefaultChainConstructor ,
202- == == == =
203- func NewIntegrationSuite (spec * interchaintest .ChainSpec , oracleImage ibc .DockerImage , txCfg TestTxConfig , opts ... Option ) * TestSuite {
204- if err := txCfg .Validate (); err != nil {
205- panic (err )
206- }
207-
208- suite := & TestSuite {
209- spec : spec ,
210- oracleConfig : DefaultOracleSidecar (oracleImage ),
211- denom : defaultDenom ,
212- gasPrices : "" ,
213- authority : authtypes .NewModuleAddress (govtypes .ModuleName ),
214- icc : DefaultInterchainConstructor ,
215- cc : DefaultChainConstructor ,
216- txConfig : txCfg ,
217- >> >> >> > daca8c8 (test : make extendable (#112 ))
128+ txConfig : txCfg ,
218129 }
219130
220131 for _ , opt := range opts {
@@ -224,6 +135,28 @@ func NewIntegrationSuite(spec *interchaintest.ChainSpec, oracleImage ibc.DockerI
224135 return suite
225136}
226137
138+ type TestTxConfig struct {
139+ SmallSendsNum int
140+ LargeSendsNum int
141+ TargetIncreaseGasPrice math.LegacyDec
142+ }
143+
144+ func (tx * TestTxConfig ) Validate () error {
145+ if tx .SmallSendsNum < 1 || tx .LargeSendsNum < 1 {
146+ return fmt .Errorf ("sends num should be greater than 1" )
147+ }
148+
149+ if tx .TargetIncreaseGasPrice .IsNil () {
150+ return fmt .Errorf ("target increase gas price is nil" )
151+ }
152+
153+ if tx .TargetIncreaseGasPrice .LTE (math .LegacyZeroDec ()) {
154+ return fmt .Errorf ("target increase gas price is less than or equal to 0" )
155+ }
156+
157+ return nil
158+ }
159+
227160func (s * TestSuite ) WithKeyringOptions (cdc codec.Codec , opts keyring.Option ) {
228161 s .broadcasterOverrides = & KeyringOverride {
229162 cdc : cdc ,
@@ -353,13 +286,6 @@ func (s *TestSuite) TestSendTxDecrease() {
353286
354287 s .Run ("expect fee market state to decrease" , func () {
355288 s .T ().Log ("performing sends..." )
356- << << << < HEAD
357- for {
358- // send with the exact expected fee
359- height , err := s .chain .(* cosmos.CosmosChain ).Height (context .Background ())
360- s .Require ().NoError (err )
361- // send with the exact expected defaultGasPrice
362- == == == =
363289 sig := make (chan struct {})
364290 quit := make (chan struct {})
365291 defer close (quit )
@@ -384,7 +310,6 @@ func (s *TestSuite) TestSendTxDecrease() {
384310 break
385311
386312 case <- time .After (100 * time .Millisecond ):
387- >> >> >> > daca8c8 (test : make extendable (#112 ))
388313 wg := sync.WaitGroup {}
389314 wg .Add (3 )
390315
@@ -436,17 +361,6 @@ func (s *TestSuite) TestSendTxDecrease() {
436361 s .Require ().Equal (uint32 (0 ), txResp .DeliverTx .Code , txResp .DeliverTx )
437362 }()
438363 wg .Wait ()
439- << << << < HEAD
440- s .WaitForHeight (s .chain .(* cosmos.CosmosChain ), height + 1 )
441-
442- gasPrice := s .QueryDefaultGasPrice ()
443- s .T ().Log ("base defaultGasPrice" , gasPrice .String ())
444-
445- if gasPrice .Amount .Equal (params .MinBaseGasPrice ) {
446- break
447- }
448- == == == =
449- >> >> >> > daca8c8 (test : make extendable (#112 ))
450364 }
451365
452366 // wait for 5 blocks
@@ -475,13 +389,6 @@ func (s *TestSuite) TestSendTxIncrease() {
475389 nodes := cosmosChain .Nodes ()
476390 s .Require ().True (len (nodes ) > 0 )
477391
478- << << << < HEAD
479- baseGasPrice := s .QueryDefaultGasPrice ()
480- gas := int64 (20000100 )
481- sendAmt := int64 (100 )
482-
483- == == == =
484- >> >> >> > daca8c8 (test : make extendable (#112 ))
485392 params := s .QueryParams ()
486393
487394 gas := int64 (params .MaxBlockUtilization )
@@ -519,7 +426,7 @@ func (s *TestSuite) TestSendTxIncrease() {
519426 // add headroom
520427 minBaseFeeCoins := sdk .NewCoins (sdk .NewCoin (minBaseFee .Denom , minBaseFee .Amount .Add (math .LegacyNewDec (10 )).TruncateInt ()))
521428
522- height , err := s .chain .(* cosmos.CosmosChain ).Height (context .Background ())
429+ _ , err := s .chain .(* cosmos.CosmosChain ).Height (context .Background ())
523430 s .Require ().NoError (err )
524431 wg := sync.WaitGroup {}
525432 wg .Add (3 )
@@ -572,17 +479,6 @@ func (s *TestSuite) TestSendTxIncrease() {
572479 s .Require ().Equal (uint32 (0 ), txResp .DeliverTx .Code , txResp .DeliverTx )
573480 }()
574481 wg .Wait ()
575- << << << < HEAD
576- s .WaitForHeight (s .chain .(* cosmos.CosmosChain ), height + 1 )
577-
578- baseGasPrice = s .QueryDefaultGasPrice ()
579- s .T ().Log ("gas price" , baseGasPrice .String ())
580-
581- if baseGasPrice .Amount .GT (params .MinBaseGasPrice .Mul (math .LegacyNewDec (10 ))) {
582- break
583- }
584- == == == =
585- >> >> >> > daca8c8 (test : make extendable (#112 ))
586482 }
587483
588484 // wait for 5 blocks
0 commit comments