Skip to content

Commit

Permalink
Adjust tests for fee testing
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Nov 7, 2023
1 parent f509a26 commit 81bcd3b
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.gaia
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN if [ -n "${GAIA_TAG}" ]; \
then git checkout "${GAIA_TAG}"; \
# if GAIA_TAG is not set, build the latest tagged version
else \
git checkout $(git tag | tail -1); \
git checkout $(git tag | sort -Vr | head -n1); \
fi

# Also replace sdk version in the go.mod if specified
Expand Down
69 changes: 54 additions & 15 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (tr TestConfig) sendTokens(
tr.validatorConfigs[action.From].DelAddress,
tr.validatorConfigs[action.To].DelAddress,
fmt.Sprint(action.Amount)+`stake`,

`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--node`, tr.getValidatorNode(action.Chain, action.From),
Expand Down Expand Up @@ -205,6 +206,9 @@ func (tr TestConfig) submitTextProposal(
`--description`, action.Description,
`--deposit`, fmt.Sprint(action.Deposit)+`stake`,
`--from`, `validator`+fmt.Sprint(action.From),
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--node`, tr.getValidatorNode(action.Chain, action.From),
Expand Down Expand Up @@ -274,16 +278,22 @@ func (tr TestConfig) submitConsumerAdditionProposal(

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
// CONSUMER ADDITION PROPOSAL
bz, err = exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName,
cmd := exec.Command("docker", "exec", tr.containerConfig.InstanceName, tr.chainConfigs[action.Chain].BinaryName,
"tx", "gov", "submit-legacy-proposal", "consumer-addition", "/temp-proposal.json",
`--from`, `validator`+fmt.Sprint(action.From),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--gas`, `900000`,
`--gas`, "auto",
`--node`, tr.getValidatorNode(action.Chain, action.From),
`--keyring-backend`, `test`,
`-y`,
).CombinedOutput()
)

log.Println(cmd)

bz, err = cmd.CombinedOutput()

if err != nil {
log.Fatal(err, "\n", string(bz))
Expand Down Expand Up @@ -338,10 +348,12 @@ func (tr TestConfig) submitConsumerRemovalProposal(
"tx", "gov", "submit-legacy-proposal", "consumer-removal",
"/temp-proposal.json",
`--from`, `validator`+fmt.Sprint(action.From),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--node`, tr.getValidatorNode(action.Chain, action.From),
`--gas`, "900000",
`--gas`, "auto",
`--keyring-backend`, `test`,
`-y`,
).CombinedOutput()
Expand Down Expand Up @@ -414,10 +426,12 @@ func (tr TestConfig) submitParamChangeProposal(
"tx", "gov", "submit-legacy-proposal", "param-change", "/params-proposal.json",

`--from`, `validator`+fmt.Sprint(action.From),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--node`, tr.getValidatorNode(action.Chain, action.From),
`--gas`, "900000",
`--gas`, "auto",
`--keyring-backend`, `test`,
`-y`,
)
Expand Down Expand Up @@ -490,7 +504,9 @@ func (tr TestConfig) submitEquivocationProposal(action submitEquivocationProposa
`--chain-id`, string(providerChain.ChainId),
`--home`, tr.getValidatorHome(providerChain.ChainId, action.From),
`--node`, tr.getValidatorNode(providerChain.ChainId, action.From),
`--gas`, "9000000",
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--keyring-backend`, `test`,
`-y`,
).CombinedOutput()
Expand Down Expand Up @@ -527,11 +543,13 @@ func (tr *TestConfig) voteGovProposal(
fmt.Sprint(action.PropNumber), vote,

`--from`, `validator`+fmt.Sprint(val),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, val),
`--node`, tr.getValidatorNode(action.Chain, val),
`--keyring-backend`, `test`,
`--gas`, "900000",
`--gas`, "auto",
`-y`,
).CombinedOutput()
if err != nil {
Expand Down Expand Up @@ -740,7 +758,7 @@ websocket_addr = "%s"
[chains.gas_price]
denom = "stake"
price = 0.000
price = 0.025
[chains.trust_threshold]
denominator = "3"
Expand Down Expand Up @@ -1015,6 +1033,10 @@ func (tr TestConfig) addIbcConnectionHermes(
"--b-client", "07-tendermint-"+fmt.Sprint(action.ClientB),
)

if verbose {
log.Println("addIbcConnectionHermes cmd: ", cmd.String())
}

cmdReader, err := cmd.StdoutPipe()
if err != nil {
log.Fatal(err)
Expand Down Expand Up @@ -1386,6 +1408,9 @@ func (tr TestConfig) delegateTokens(
fmt.Sprint(action.Amount)+`stake`,

`--from`, `validator`+fmt.Sprint(action.From),
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.From),
`--node`, tr.getValidatorNode(action.Chain, action.From),
Expand Down Expand Up @@ -1430,10 +1455,12 @@ func (tr TestConfig) unbondTokens(
fmt.Sprint(action.Amount)+`stake`,

`--from`, `validator`+fmt.Sprint(action.Sender),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.Sender),
`--node`, tr.getValidatorNode(action.Chain, action.Sender),
`--gas`, "900000",
`--gas`, "auto",
`--keyring-backend`, `test`,
`-y`,
)
Expand Down Expand Up @@ -1497,10 +1524,12 @@ func (tr TestConfig) cancelUnbondTokens(
fmt.Sprint(action.Amount)+`stake`,
fmt.Sprint(creationHeight),
`--from`, `validator`+fmt.Sprint(action.Delegator),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.Delegator),
`--node`, tr.getValidatorNode(action.Chain, action.Delegator),
`--gas`, "900000",
`--gas`, "auto",
`--keyring-backend`, `test`,
`-o`, `json`,
`-y`,
Expand Down Expand Up @@ -1550,11 +1579,13 @@ func (tr TestConfig) redelegateTokens(action redelegateTokensAction, verbose boo
redelegateDst,
fmt.Sprint(action.Amount)+`stake`,
`--from`, `validator`+fmt.Sprint(action.TxSender),
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, action.TxSender),
`--node`, tr.getValidatorNode(action.Chain, action.TxSender),
// Need to manually set gas limit past default (200000), since redelegate has a lot of operations
`--gas`, "900000",
`--gas`, "auto",
`--keyring-backend`, `test`,
`-y`,
)
Expand Down Expand Up @@ -1680,7 +1711,9 @@ func (tr TestConfig) unjailValidator(action unjailValidatorAction, verbose bool)
`--chain-id`, string(tr.chainConfigs[action.Provider].ChainId),
`--home`, tr.getValidatorHome(action.Provider, action.Validator),
`--node`, tr.getValidatorNode(action.Provider, action.Validator),
`--gas`, "900000",
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--keyring-backend`, `test`,
`-y`,
)
Expand Down Expand Up @@ -1738,6 +1771,9 @@ func (tr TestConfig) registerRepresentative(
`--commission-max-change-rate`, "0.01",
`--min-self-delegation`, "1",
`--from`, `validator`+fmt.Sprint(val),
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--chain-id`, string(tr.chainConfigs[action.Chain].ChainId),
`--home`, tr.getValidatorHome(action.Chain, val),
`--node`, tr.getValidatorNode(action.Chain, val),
Expand Down Expand Up @@ -1802,7 +1838,9 @@ func (tr TestConfig) submitChangeRewardDenomsProposal(action submitChangeRewardD
`--chain-id`, string(providerChain.ChainId),
`--home`, tr.getValidatorHome(providerChain.ChainId, action.From),
`--node`, tr.getValidatorNode(providerChain.ChainId, action.From),
`--gas`, "9000000",
`--gas`, "auto",
`--gas-prices`, `0.0025stake`,
`--gas-adjustment`, `1.5`,
`--keyring-backend`, `test`,
`-y`,
).CombinedOutput()
Expand Down Expand Up @@ -1955,7 +1993,7 @@ func (tr TestConfig) assignConsumerPubKey(action assignConsumerPubKeyAction, ver
gas = "9000000"
}
assignKey := fmt.Sprintf(
`%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas %s --keyring-backend test -y -o json`,
`%s tx provider assign-consensus-key %s '%s' --from validator%s --chain-id %s --home %s --node %s --gas %s --gas-prices %s --gas-adjustment 1.5 --keyring-backend test -y -o json`,
tr.chainConfigs[ChainID("provi")].BinaryName,
string(tr.chainConfigs[action.Chain].ChainId),
action.ConsumerPubkey,
Expand All @@ -1964,6 +2002,7 @@ func (tr TestConfig) assignConsumerPubKey(action assignConsumerPubKeyAction, ver
tr.getValidatorHome(ChainID("provi"), action.Validator),
tr.getValidatorNode(ChainID("provi"), action.Validator),
gas,
`0.0025stake`,
)

//#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments.
Expand Down
41 changes: 5 additions & 36 deletions tests/e2e/steps_start_chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,12 @@ func stepStartProviderChain() []Step {
Action: StartChainAction{
Chain: ChainID("provi"),
Validators: []StartChainValidator{
{Id: ValidatorID("bob"), Stake: 500000000, Allocation: 10000000000},
{Id: ValidatorID("alice"), Stake: 500000000, Allocation: 10000000000},
{Id: ValidatorID("carol"), Stake: 500000000, Allocation: 10000000000},
},
},
State: State{
ChainID("provi"): ChainState{
ValBalances: &map[ValidatorID]uint{
ValidatorID("alice"): 9500000000,
ValidatorID("bob"): 9500000000,
ValidatorID("carol"): 9500000000,
},
{Id: ValidatorID("bob"), Stake: 500000000, Allocation: 1000000000000000},
{Id: ValidatorID("alice"), Stake: 500000000, Allocation: 1000000000000000},
{Id: ValidatorID("carol"), Stake: 500000000, Allocation: 1000000000000000},
},
},
State: State{},
},
}
}
Expand All @@ -41,10 +33,6 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
},
State: State{
ChainID("provi"): ChainState{
ValBalances: &map[ValidatorID]uint{
ValidatorID("alice"): 9489999999,
ValidatorID("bob"): 9500000000,
},
Proposals: &map[uint]Proposal{
proposalIndex: ConsumerAdditionProposal{
Deposit: 10000001,
Expand Down Expand Up @@ -133,10 +121,6 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
Status: "PROPOSAL_STATUS_PASSED",
},
},
ValBalances: &map[ValidatorID]uint{
ValidatorID("alice"): 9500000000,
ValidatorID("bob"): 9500000000,
},
},
},
},
Expand All @@ -156,22 +140,7 @@ func stepsStartConsumerChain(consumerName string, proposalIndex, chainIndex uint
// values from the genesis file.
GenesisChanges: ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0.05\"",
},
State: State{
ChainID("provi"): ChainState{
ValBalances: &map[ValidatorID]uint{
ValidatorID("alice"): 9500000000,
ValidatorID("bob"): 9500000000,
ValidatorID("carol"): 9500000000,
},
},
ChainID(consumerName): ChainState{
ValBalances: &map[ValidatorID]uint{
ValidatorID("alice"): 10000000000,
ValidatorID("bob"): 10000000000,
ValidatorID("carol"): 10000000000,
},
},
},
State: State{},
},
{
Action: addIbcConnectionAction{
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/testnet-scripts/start-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ do
#'s/foo/bar/;s/abc/def/'
sed -i "$TENDERMINT_CONFIG_TRANSFORM" $CHAIN_ID/validator$VAL_ID/config/config.toml
fi
sed -i 's/minimum-gas-prices = "0stake"/minimum-gas-prices = "0.0025stake"/g' $CHAIN_ID/validator$VAL_ID/config/app.toml
done


Expand Down

0 comments on commit 81bcd3b

Please sign in to comment.