Skip to content

Commit

Permalink
Merge pull request #791 from axone-protocol/refactor/logic-limits-type
Browse files Browse the repository at this point in the history
Refactor/logic limits type
  • Loading branch information
ccamel authored Oct 30, 2024
2 parents 107b920 + 6146f20 commit c83f177
Show file tree
Hide file tree
Showing 56 changed files with 5,859 additions and 944 deletions.
48 changes: 19 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ chain-stop: ## Stop the blockchain
@echo "${COLOR_CYAN} ✋️ Stopping chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} with configuration ${COLOR_YELLOW}${CHAIN_HOME}${COLOR_RESET}"
@killall axoned

chain-upgrade: build ## Test the chain upgrade from the given FROM_VERSION to the given TO_VERSION. You can pass also the proposal json file on PROPOSAL var
chain-upgrade: build ## Test the chain upgrade from the given FROM_VERSION to the given TO_VERSION.
@echo "${COLOR_CYAN} ⬆️ Upgrade the chain ${COLOR_RESET}${CHAIN}${COLOR_CYAN} from ${COLOR_YELLOW}${FROM_VERSION}${COLOR_RESET}${COLOR_CYAN} to ${COLOR_YELLOW}${TO_VERSION}${COLOR_RESET}"
@killall cosmovisor || \
rm -rf ${TARGET_FOLDER}/${FROM_VERSION}; \
Expand All @@ -249,49 +249,39 @@ chain-upgrade: build ## Test the chain upgrade from the given FROM_VERSION to th
echo $$BINARY_OLD; \
make chain-init CHAIN_BINARY=$$BINARY_OLD; \
\
echo "${COLOR_CYAN} 👩‍🚀 Prepare cosmovisor ${COLOR_RESET}"; \
echo "${COLOR_CYAN} 👩‍🚀 Preparing cosmovisor ${COLOR_RESET}"; \
export DAEMON_NAME=${DAEMON_NAME}; \
export DAEMON_HOME=${DAEMON_HOME}; \
\
PROPOSAL=${PROPOSAL}; \
if [[ ! -f "$$PROPOSAL" ]]; then \
echo "${COLOR_CYAN} 👩‍🚀 No proposal given ${COLOR_RESET}"; \
echo '{"messages": [{"@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade","authority": "axone10d07y265gmmuvt4z0w9aw880jnsr700jh7kd2g","plan": {"name": "","time": "0001-01-01T00:00:00Z","height": "10","info": "","upgraded_client_state": null}}],"title": "Software update", "summary": "Update the binary", "metadata": "ipfs://CID","deposit": "1uaxone"}' | \
jq --arg name "${TO_VERSION}" '.messages[].plan.name = $$name' > ${TARGET_FOLDER}/proposal.json; \
PROPOSAL=${TARGET_FOLDER}/proposal.json; \
fi; \
cat <<< $$(jq '.app_state.gov.params.voting_period = "30s"' ${CHAIN_HOME}/config/genesis.json) > ${CHAIN_HOME}/config/genesis.json; \
cat <<< $$(jq '.app_state.gov.params.voting_period = "20s"' ${CHAIN_HOME}/config/genesis.json) > ${CHAIN_HOME}/config/genesis.json; \
\
cosmovisor init $$BINARY_OLD; \
cosmovisor run start --moniker ${CHAIN_MONIKER} \
--home ${CHAIN_HOME} \
--log_level debug & \
sleep 10;\
$$BINARY_OLD tx gov submit-proposal $$PROPOSAL \
--from validator \
--yes \
--home ${CHAIN_HOME} \
--chain-id axone-${CHAIN} \
--keyring-backend test \
-b sync; \
\
sleep 5;\
$$BINARY_OLD tx gov deposit 1 10000000uaxone \
--from validator \
--yes \
--home ${CHAIN_HOME} \
--chain-id axone-${CHAIN} \
--keyring-backend test \
-b sync; \
sleep 10; \
echo "${COLOR_CYAN} 🗳️ Submitting software-upgrade tx ${COLOR_RESET}"; \
$$BINARY_OLD tx upgrade software-upgrade ${TO_VERSION}\
--title "Axoned upgrade" \
--summary "⬆️ Upgrade the chain from ${FROM_VERSION} to ${TO_VERSION}" \
--upgrade-height 20 \
--upgrade-info "{}" \
--deposit 10000000uaxone \
--no-validate \
--yes \
--from validator \
--keyring-backend test \
--chain-id axone-${CHAIN} \
--home ${CHAIN_HOME}; \
sleep 5;\
\
sleep 5;\
$$BINARY_OLD tx gov vote 1 yes \
--from validator \
--yes \
--home ${CHAIN_HOME} \
--chain-id axone-${CHAIN} \
--keyring-backend test \
-b sync; \
--keyring-backend test; \
mkdir -p ${DAEMON_HOME}/cosmovisor/upgrades/${TO_VERSION}/bin && cp ${CHAIN_BINARY} ${DAEMON_HOME}/cosmovisor/upgrades/${TO_VERSION}/bin; \
wait

Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,9 @@ func New(
panic(err)
}

// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
// registerUpgradeHandlers is used for registering any on-chain upgrades.
// Make sure it's called after `app.ModuleManager` and `app.configurator` are set.
app.RegisterUpgradeHandlers()
app.registerUpgradeHandlers()

autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.ModuleManager.Modules))
reflectionSvc, err := runtimeservices.NewReflectionService()
Expand Down
25 changes: 18 additions & 7 deletions app/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
package app

import (
"context"
"fmt"

v7 "github.com/axone-protocol/axoned/v10/app/upgrades/v7"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/types/module"
)

// RegisterUpgradeHandlers registers the chain upgrade handlers.
func (app *App) RegisterUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
v7.UpgradeName,
v7.CreateUpgradeHandler(app.ModuleManager, app.configurator),
)
var upgrades = []string{
"v11.0.0",
}

// registerUpgradeHandlers registers the chain upgrade handlers.
func (app *App) registerUpgradeHandlers() {
for _, upgrade := range upgrades {
app.UpgradeKeeper.SetUpgradeHandler(
upgrade,
func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return app.ModuleManager.RunMigrations(ctx, app.configurator, vm)
},
)
}

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand Down
20 changes: 0 additions & 20 deletions app/upgrades/v7/upgrade.go

This file was deleted.

2 changes: 1 addition & 1 deletion docs/command/axoned_tx_logic_update-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ axoned tx logic update-params [flags]
--note string Note to add a description to the transaction (previously --memo)
--offline Offline mode (does not allow any online functionality)
-o, --output string Output format (text|json) (default "json")
--params logic.v1beta2.Params (json)
--params logic.v1beta3.Params (json)
-s, --sequence uint The sequence number of the signing account (offline mode only)
--sign-mode string Choose sign mode (direct|amino-json|direct-aux|textual), this is an advanced feature
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
Expand Down
14 changes: 7 additions & 7 deletions docs/predicate/bech32_address_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bech32_address(Address, 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4').

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Address"]
Expand Down Expand Up @@ -72,7 +72,7 @@ bech32_address(-(Hrp, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4').

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Hrp", "Address"]
Expand Down Expand Up @@ -102,7 +102,7 @@ bech32_address(-(axone, Address), 'axone15wn30a9z4uc692s0kkx5fp5d4qfr3ac77gvjg4'

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Address"]
Expand All @@ -129,7 +129,7 @@ bech32_address(-('axone', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,1

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Bech32"]
Expand Down Expand Up @@ -162,7 +162,7 @@ axone_addr('axone1p8u47en82gmzfm259y6z93r9qe63l25d858vqu').

``` yaml
height: 42
gas_used: 4141
gas_used: 3976
answer:
has_more: false
results:
Expand All @@ -188,7 +188,7 @@ bech32_address(Address, axoneincorrect).

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Address"]
Expand All @@ -215,7 +215,7 @@ bech32_address(-('axone', X), foo(bar)).

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["X"]
Expand Down
4 changes: 2 additions & 2 deletions docs/predicate/block_height_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ block_height(Height).

``` yaml
height: 100
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Height"]
Expand Down Expand Up @@ -79,7 +79,7 @@ Height > 100.

``` yaml
height: 101
gas_used: 4141
gas_used: 3976
answer:
has_more: false
variables: ["Height"]
Expand Down
4 changes: 2 additions & 2 deletions docs/predicate/block_time_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ block_time(Time).

``` yaml
height: 42
gas_used: 4140
gas_used: 3975
answer:
has_more: false
variables: ["Time"]
Expand Down Expand Up @@ -80,7 +80,7 @@ Time > 1709550216.

``` yaml
height: 42
gas_used: 4141
gas_used: 3976
answer:
has_more: false
variables: ["Time"]
Expand Down
6 changes: 3 additions & 3 deletions docs/predicate/consult_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ hello(Who).

``` yaml
height: 42
gas_used: 4143
gas_used: 3978
answer:
has_more: false
variables: ["Who"]
Expand Down Expand Up @@ -129,7 +129,7 @@ response: |

``` yaml
height: 42
gas_used: 4142
gas_used: 3977
answer:
has_more: false
variables: ["X"]
Expand Down Expand Up @@ -194,7 +194,7 @@ source_file(File).

``` yaml
height: 42
gas_used: 4141
gas_used: 3976
answer:
has_more: false
variables: ["File"]
Expand Down
16 changes: 8 additions & 8 deletions docs/predicate/current_output_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Here are the steps of the scenario:
``` json
{
"limits": {
"max_user_output_size": "5"
"max_user_output_size": 5
}
}
```
Expand All @@ -61,7 +61,7 @@ write_char_to_user_output(x).

``` yaml
height: 42
gas_used: 4241
gas_used: 4043
answer:
has_more: false
variables:
Expand All @@ -83,7 +83,7 @@ Here are the steps of the scenario:
``` json
{
"limits": {
"max_user_output_size": "15"
"max_user_output_size": 15
}
}
```
Expand All @@ -108,7 +108,7 @@ log_message('Hello world!').

``` yaml
height: 42
gas_used: 4276
gas_used: 4045
answer:
has_more: false
variables:
Expand All @@ -131,7 +131,7 @@ Here are the steps of the scenario:
``` json
{
"limits": {
"max_user_output_size": "5"
"max_user_output_size": 5
}
}
```
Expand All @@ -155,7 +155,7 @@ log_message('Hello world!').

``` yaml
height: 42
gas_used: 4242
gas_used: 4044
answer:
has_more: false
variables:
Expand All @@ -179,7 +179,7 @@ Here are the steps of the scenario:
``` json
{
"limits": {
"max_user_output_size": "5"
"max_user_output_size": 5
}
}
```
Expand All @@ -205,7 +205,7 @@ log_message("Hello 🧙!").

``` yaml
height: 42
gas_used: 4263
gas_used: 4065
answer:
has_more: false
variables:
Expand Down
2 changes: 1 addition & 1 deletion docs/predicate/open_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ open(

``` yaml
height: 42
gas_used: 4141
gas_used: 3976
answer:
has_more: false
variables:
Expand Down
Loading

0 comments on commit c83f177

Please sign in to comment.