Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the rest of the tests #1993

Merged
merged 40 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d2423e5
[1760]: Switch the internal provwasm ProposalContents to ProposalMsgs…
SpicyLemon May 17, 2024
8ab823a
[1760]: Get rid of a couple unused variables in the marker module.
SpicyLemon May 17, 2024
7e9305e
[1760]: Complete TODO in marker simulation tests.
SpicyLemon May 17, 2024
90afd43
[1760]: Change the sanction simulation stuff to just use a WeightedPr…
SpicyLemon May 17, 2024
4db69da
[1760]: Add some module sim type assertions to the provwasm simulation.
SpicyLemon May 17, 2024
7548f29
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 20, 2024
b638832
[1760]: Refactor the sanction cli tests to look more like our other c…
SpicyLemon May 21, 2024
b08bb3d
[1760]: In the oracle module sims, switch MsgUpdateOracle to use a We…
SpicyLemon May 21, 2024
d267990
[1760]: In the sanction ProposalMsgs simulation stuff, do the GetOrGe…
SpicyLemon May 21, 2024
b032a39
[1760]: Switch TestSimulateMsgSendQueryOracle to expect a no-op msg b…
SpicyLemon May 21, 2024
9f34297
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 21, 2024
fe0eecc
[1760]: Switch the ibcratelimit sims to WeightedProposalMsg for the u…
SpicyLemon May 21, 2024
5d25c6a
[1760]: Create some testutils for unit tests on the simulation stuff.…
SpicyLemon May 22, 2024
038f922
[1760]: Switch the ibcratelimit sim tests to the new helpers.
SpicyLemon May 23, 2024
ed2ef04
[1760]: Create the RandIntBetween helper func and get rid of all the …
SpicyLemon May 23, 2024
4b2929a
[1760]: Switch to GenerateTestingAccounts wherever applicable.
SpicyLemon May 23, 2024
ca7ff97
[1760]: Add an entriesType arg to SelectRandomEntries for better erro…
SpicyLemon May 23, 2024
39e4605
[1760]: Fix a couple unit tests that broke because the randomizer is …
SpicyLemon May 23, 2024
348aa2a
[1760]: Update the test github action to split things up normally again.
SpicyLemon May 23, 2024
e91e47f
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 23, 2024
5512f27
[1760]: Split the right file for the github test action.
SpicyLemon May 23, 2024
e5829ba
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 23, 2024
7000e1e
[1760]: Move the quarantine cli tests from part 3 to 0 to hopefully m…
SpicyLemon May 23, 2024
78bd039
[1760]: Fix the test workflow to remove the correct string from the p…
SpicyLemon May 23, 2024
7ff81ef
[1760]: Correctly put those tests in part 0 since I was trying to tak…
SpicyLemon May 23, 2024
07b4f5e
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 23, 2024
f45cae9
[1760]: Try moving sanction/simulation instead.
SpicyLemon May 23, 2024
ef4347b
[1760]: Also try moving the marker cli tests to 00 (from 01).
SpicyLemon May 23, 2024
0ff0210
[1760]: Move the marker keeper to 00 too.
SpicyLemon May 23, 2024
f6d73b2
[1760]: Take the marker keeper tests special movement out as it didn'…
SpicyLemon May 23, 2024
f0f66b5
[1760]: In DefaultTestNetworkConfig, use the tempapp just created to …
SpicyLemon May 24, 2024
6b312a6
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 24, 2024
72a6a28
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 24, 2024
a18a3d7
[1760]: Create a helper for creating the test keyrings, and switch to…
SpicyLemon May 24, 2024
d0bf77e
[1760]: Remove the 100ms sleep from test network cleanup. The SDK alr…
SpicyLemon May 28, 2024
53c68aa
[1760]: Move the GenerateTestingAccounts and GenerateTestingAccountsW…
SpicyLemon May 28, 2024
b57bfb4
[1760]: Delete some unused weight constants.
SpicyLemon May 28, 2024
cd571ee
[1760]: In the oracle sims, OracleFn, correctly handle the case where…
SpicyLemon May 28, 2024
61ec5f6
Merge branch 'main' into dwedul/1760-fix-sims
SpicyLemon May 28, 2024
775d1f4
[1760]: Add changelog entry.
SpicyLemon May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ jobs:
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt"
path: ./pkgs.txt
- name: Split pkgs into parts
# The x/marker/simulation test-race takes around 6ish minutes and is by far the longest running one.
# The next longest running is x/metadata/client/cli at 2.5ish minutes.
# So take x/marker/simulation out of the list, split the list into 3 parts and create a 4th part
# with just the x/marker/simulation test.
# Temporarily, several tests are known to still fail, so we make them all part 3, and split the rest among 0-2.
# TODO[1760]: Re-analyze how long tests tests take and change the splitting back to be based on speed.
# With a standard split, test-race (03) takes the longest of all these at around 6m35s.
# and test-race (00) is the shortest (of the race tests) at around 4m00s.
# The x/sanction/simulation test-race is one of the longer ones (at almost 2 minutes), and ends up in part 03.
# By forcing that one into 00, it ends up reducing the overall run-time of this whole workflow by about a minute.
# The x/marker/client/cli tests take around 30s (35s for race), and would be in 01.
# Moving it to 00 ends up leveling out the times a bit more.
run: |
grep -vF \
-e 'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \
-e 'github.com/provenance-io/provenance/x/oracle/simulation' \
-e 'github.com/provenance-io/provenance/x/sanction/simulation' \
-e 'github.com/provenance-io/provenance/x/marker/client/cli' \
pkgs.txt > pkgs.txt.tmp
split -d -n l/3 pkgs.txt.tmp pkgs.txt.part.
split -d -n l/4 pkgs.txt.tmp pkgs.txt.part.
printf '%s\n' \
'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \
'github.com/provenance-io/provenance/x/oracle/simulation' \
> pkgs.txt.part.03
'github.com/provenance-io/provenance/x/sanction/simulation' \
'github.com/provenance-io/provenance/x/marker/client/cli' \
>> pkgs.txt.part.00
- uses: actions/upload-artifact@v4
with:
name: "${{ steps.def-vars.outputs.file-prefix }}-pkgs.txt.part.00"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* `marker` add `UpdateParams` endpoint and cli [#1991](https://github.com/provenance-io/provenance/pull/1991).
* `name` add `UpdateParams` endpoint and cli [#2004](https://github.com/provenance-io/provenance/pull/2004).
* Update the exchange `commitment-settlement-fee-calc` cli query to utilize the keyring [#2001](https://github.com/provenance-io/provenance/pull/2001).
* Implement the ProposalMsgs module interface for the internal/provwasm, ibcratelimit, oracle, and sanction modules [#1993](https://github.com/provenance-io/provenance/pull/1993.)

### Client Breaking

Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ func New(

// IBC
ibc.NewAppModule(app.IBCKeeper),
ibcratelimitmodule.NewAppModule(appCodec, *app.RateLimitingKeeper, app.AccountKeeper, app.BankKeeper),
ibcratelimitmodule.NewAppModule(appCodec, *app.RateLimitingKeeper),
ibchooks.NewAppModule(app.AccountKeeper, *app.IBCHooksKeeper),
ibctransfer.NewAppModule(*app.TransferKeeper),
icqModule,
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func New(

// IBC
ibc.NewAppModule(app.IBCKeeper),
ibcratelimitmodule.NewAppModule(appCodec, *app.RateLimitingKeeper, app.AccountKeeper, app.BankKeeper),
ibcratelimitmodule.NewAppModule(appCodec, *app.RateLimitingKeeper),
ibchooks.NewAppModule(app.AccountKeeper, *app.IBCHooksKeeper),
ibctransfer.NewAppModule(*app.TransferKeeper),
icaModule,
Expand Down
15 changes: 1 addition & 14 deletions app/params/weights.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,19 @@ const (
DefaultWeightMsgDeleteDistinctAttribute int = 5
DefaultWeightMsgSetAccountData int = 10
// Marker
DefaultWeightSupplyIncreaseProposalContent int = 5
DefaultWeightSupplyDecreaseProposalContent int = 5
DefaultWeightSetAdministratorProposalContent int = 5
DefaultWeightRemoveAdministratorProposalContent int = 5
DefaultWeightChangeStatusProposalContent int = 5
DefaultWeightSetDenomMetadataProposalContent int = 5
// Adjusted marker operations to a cumulative weight of 100
DefaultWeightMsgAddMarker int = 30
DefaultWeightMsgChangeStatus int = 10
DefaultWeightMsgFinalize int = 10
DefaultWeightMsgAddAccess int = 10
DefaultWeightMsgAddFinalizeActivateMarker int = 10
DefaultWeightMsgAddMarkerProposal int = 40
DefaultWeightMsgUpdateDenySendList int = 10
// MsgFees
DefaultWeightAddMsgFeeProposalContent int = 75
DefaultWeightRemoveMsgFeeProposalContent int = 25
// Rewards
DefaultWeightSubmitCreateRewards int = 95
DefaultWeightSubmitEndRewards int = 5
// Trigger
DefaultWeightSubmitCreateTrigger int = 95
DefaultWeightSubmitDestroyTrigger int = 5
// Oracle
DefaultWeightUpdateOracle int = 25
DefaultWeightSendOracleQuery int = 75
// Ibc Rate Limiter
DefaultWeightUpdateParams int = 100
DefaultWeightIBCRLUpdateParams int = 100
)
43 changes: 43 additions & 0 deletions internal/helpers/rand.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package helpers

import (
"fmt"
"math/rand"

simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
)

// RandIntBetween generates a random number between min and max inclusive.
func RandIntBetween(r *rand.Rand, min, max int) int {
return r.Intn(max-min+1) + min
}

// SelectRandomEntries selects count entries from the ones provided.
// The entriesType string is used in the error message to describe the entries slice.
func SelectRandomEntries[E any](r *rand.Rand, entries []E, count int, entriesType string) ([]E, error) {
if count == 0 {
return nil, nil
}
if len(entries) < count {
return nil, fmt.Errorf("cannot choose %d %s because there are only %d", count, entriesType, len(entries))
}
if count == 1 {
if len(entries) == 1 {
return entries, nil
}
pivot := r.Intn(len(entries))
return entries[pivot : pivot+1], nil
}

randomized := make([]E, 0, len(entries))
randomized = append(randomized, entries...)
r.Shuffle(len(randomized), func(i, j int) {
randomized[i], randomized[j] = randomized[j], randomized[i]
})
return randomized[:count], nil
}

// SelectRandomAccounts selects count accounts from the ones provided.
func SelectRandomAccounts(r *rand.Rand, accs []simtypes.Account, count int) ([]simtypes.Account, error) {
return SelectRandomEntries(r, accs, count, "accounts")
}
Loading
Loading