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

test: Add json marshal/unmarshal for test traces #1314

Merged
merged 32 commits into from
Sep 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d8dcf54
Add json marshal/unmarshal for test traces
p-offtermatt Sep 19, 2023
276e347
Remove auto-generated trace files
p-offtermatt Sep 19, 2023
28eec48
Add an example trace to see the input format
p-offtermatt Sep 19, 2023
ae67d35
Add comment in rapid test
p-offtermatt Sep 19, 2023
5d894e6
Remove duplicated test case
p-offtermatt Sep 19, 2023
5dfb63b
Remove TODO in favor of comment
p-offtermatt Sep 19, 2023
0948b05
Reduce code duplication
p-offtermatt Sep 19, 2023
e3e3e84
Run go mod tidy and make format
p-offtermatt Sep 19, 2023
010bec3
Correct testdata directory in gitignore
p-offtermatt Sep 19, 2023
f00e209
Remove testdata directory
p-offtermatt Sep 19, 2023
70350c2
Remove testdata from gitignore
p-offtermatt Sep 19, 2023
b02d4f7
Add tracehandler_testdata
p-offtermatt Sep 19, 2023
a519315
Remove example trace, since there are examples in the test data
p-offtermatt Sep 19, 2023
9eb0a1f
Revert unintentional change to .gitignore
p-offtermatt Sep 20, 2023
2f961cf
Remove propType field from generator
p-offtermatt Sep 20, 2023
760c67a
Add docstrings to action_rapid test and state_rapid_test to better ex…
p-offtermatt Sep 20, 2023
dcd49a4
bite -> byte
p-offtermatt Sep 20, 2023
b04adb3
Refactor: slashThrottleDequeue to slashThrottleDequeueAction
p-offtermatt Sep 20, 2023
4b4c76d
action name -> action type
p-offtermatt Sep 20, 2023
d146505
use method name as first word in docstring
p-offtermatt Sep 20, 2023
7209628
Simply remove simply
p-offtermatt Sep 20, 2023
b4e35e3
Clarify that WriteTrace overrides
p-offtermatt Sep 20, 2023
55d2686
Remove outdated comments
p-offtermatt Sep 20, 2023
5841fce
Add RegisteredConsumerRewardDenoms to rapid test
p-offtermatt Sep 20, 2023
1168aca
Add gen for submitChangeRewardDenomsProposalAction
p-offtermatt Sep 20, 2023
72729a8
Remove startChain steps
p-offtermatt Sep 20, 2023
9016327
Marshal step files with indent
p-offtermatt Sep 20, 2023
e837330
Add README that contains info about updates to trace format
p-offtermatt Sep 20, 2023
05232d9
Pull out the copied ChainState and Proposal types from methods
p-offtermatt Sep 21, 2023
f8c8329
Use shadowing to avoid relisting chainstate fields
p-offtermatt Sep 21, 2023
c77484e
Make format
p-offtermatt Sep 21, 2023
ccdd117
Remove log
p-offtermatt Sep 23, 2023
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
Prev Previous commit
Next Next commit
Run go mod tidy and make format
  • Loading branch information
p-offtermatt committed Sep 20, 2023
commit e3e3e84387f77067d22b8509d6f74260e80e87d7
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ require (
github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect
github.com/creachadair/taskgroup v0.4.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
@@ -88,7 +88,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.5.9
github.com/google/orderedcode v0.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
@@ -161,7 +161,7 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v0.5.5 // indirect
pgregory.net/rapid v0.5.5
sigs.k8s.io/yaml v1.3.0 // indirect
)

2 changes: 1 addition & 1 deletion tests/e2e/trace_handlers_test.go
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ func TestWriterThenParser(t *testing.T) {
}

// Write a trace to a file, then reads it back and compares to the original.
func WriteReadCompareTrace(trace []Step, filename string, name string) error {
func WriteReadCompareTrace(trace []Step, filename, name string) error {
err := WriteAndReadTrace(GlobalJSONParser, GlobalJSONWriter, trace, filename)
if err != nil {
return fmt.Errorf("in testcase %v, got error writing trace to file: %v", name, err)
1 change: 1 addition & 0 deletions tests/e2e/tracehandler_testdata/changeover.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"ActionType":"main.StartSovereignChainAction","Action":{"Chain":"sover","Validators":[{"Id":"alice","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":""},"State":{"sover":{"ValBalances":{"alice":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"sover","From":"alice","To":"alice","Amount":11000000},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":0,"carol":0},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.StartChainAction","Action":{"Chain":"provi","Validators":[{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":"","SkipGentx":false},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000,"carol":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.createIbcClientsAction","Action":{"ChainA":"sover","ChainB":"provi"},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"sover","ChainB":"provi","ConnectionA":0,"PortA":"transfer","PortB":"transfer","Order":"unordered","Version":"ics20-1"},"State":{}},{"ActionType":"main.LegacyUpgradeProposalAction","Action":{"ChainID":"sover","UpgradeTitle":"sovereign-changeover","Proposer":"alice","UpgradeHeight":110},"State":{"sover":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Title":"sovereign-changeover","Description":"","UpgradeHeight":110,"Type":"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal","Deposit":10000000,"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.UpgradeProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"sover","From":["alice"],"Vote":["yes"],"PropNumber":1},"State":{"sover":{"ValBalances":null,"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Title":"sovereign-changeover","Description":"","UpgradeHeight":110,"Type":"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal","Deposit":10000000,"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.UpgradeProposal"}}}}},{"ActionType":"main.waitUntilBlockAction","Action":{"Block":110,"Chain":"sover"},"State":{}},{"ActionType":"main.submitConsumerAdditionProposalAction","Action":{"PreCCV":true,"Chain":"provi","From":"alice","Deposit":10000001,"ConsumerChain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"DistributionChannel":"channel-0"},"State":{"provi":{"ValBalances":{"alice":9489999999,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"Status":"PROPOSAL_STATUS_VOTING_PERIOD"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.voteGovProposalAction","Action":{"Chain":"provi","From":["alice","bob","carol"],"Vote":["yes","yes","yes"],"PropNumber":1},"State":{"provi":{"ValBalances":{"alice":9500000000,"bob":9500000000},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":{"1":{"RawProposal":{"Deposit":10000001,"Chain":"sover","SpawnTime":0,"InitialHeight":{"revision_height":111},"Status":"PROPOSAL_STATUS_PASSED"},"Type":"main.ConsumerAdditionProposal"}}}}},{"ActionType":"main.ChangeoverChainAction","Action":{"SovereignChain":"sover","ProviderChain":"provi","Validators":[{"Id":"alice","Allocation":10000000000,"Stake":500000000},{"Id":"bob","Allocation":10000000000,"Stake":500000000},{"Id":"carol","Allocation":10000000000,"Stake":500000000}],"GenesisChanges":".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\""},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.addIbcConnectionAction","Action":{"ChainA":"sover","ChainB":"provi","ClientA":1,"ClientB":1},"State":{}},{"ActionType":"main.addIbcChannelAction","Action":{"ChainA":"sover","ChainB":"provi","ConnectionA":1,"PortA":"consumer","PortB":"provider","Order":"ordered","Version":""},"State":{}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"sover","From":"alice","To":"bob","Amount":100},"State":{"sover":{"ValBalances":{"bob":0},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.delegateTokensAction","Action":{"Chain":"provi","From":"alice","To":"alice","Amount":11000000},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":500,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"sover","Port":"provider","Channel":1},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.SendTokensAction","Action":{"Chain":"sover","From":"alice","To":"bob","Amount":100},"State":{"sover":{"ValBalances":{"bob":100},"ValPowers":null,"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.unbondTokensAction","Action":{"Chain":"provi","Sender":"alice","UnbondFrom":"alice","Amount":1000000},"State":{"provi":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null},"sover":{"ValBalances":null,"ValPowers":{"alice":511,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}},{"ActionType":"main.relayPacketsAction","Action":{"ChainA":"provi","ChainB":"sover","Port":"provider","Channel":1},"State":{"sover":{"ValBalances":null,"ValPowers":{"alice":510,"bob":500,"carol":500},"RepresentativePowers":null,"Params":null,"Rewards":null,"ConsumerChains":null,"AssignedKeys":null,"ProviderKeys":null,"ConsumerChainQueueSizes":null,"GlobalSlashQueueSize":null,"RegisteredConsumerRewardDenoms":null,"Proposals":null}}}]
insumity marked this conversation as resolved.
Show resolved Hide resolved
p-offtermatt marked this conversation as resolved.
Show resolved Hide resolved
Loading