Skip to content

Commit

Permalink
Merge branch 'increase-claim-timeout' into feat/implement-logic-for-h…
Browse files Browse the repository at this point in the history
…andling-token-economics
  • Loading branch information
shreyasbhat0 committed Sep 17, 2024
2 parents a4fa054 + 652f72c commit 085b6e8
Show file tree
Hide file tree
Showing 20 changed files with 293 additions and 97 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Contains all the PRs that improved the code without changing the behaviors.
- Updated Docs
- Fixed Consumer in Directory Service
- Fixed Regression Export
- Fixed localnet docker
- updated the genesis file
- claim timeout
- Updated Tests on arkeo module keeper

# v1.0.0-Prerelease
Expand Down
61 changes: 61 additions & 0 deletions Dockerfile.localnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# Arkeo
#

ARG GO_VERSION="1.21"

#
# Build
#
FROM golang:${GO_VERSION} as builder

ARG GIT_VERSION
ARG GIT_COMMIT

ENV GOBIN=/go/bin
ENV GOPATH=/go
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN go install github.com/jackc/tern/v2@latest

# Download go dependencies
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TAG=testnet
RUN make install

#
# Main
#
FROM ubuntu:lunar

# hadolint ignore=DL3008,DL4006
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
jq curl htop vim ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN update-ca-certificates

# Copy the compiled binaries over.
COPY --from=builder /go/bin/sentinel /go/bin/arkeod /go/bin/indexer /go/bin/api /go/bin/tern /usr/bin/
COPY scripts /scripts

ARG TAG=testnet
ENV NET=$TAG

EXPOSE 1317

EXPOSE 26656

EXPOSE 26657

ENTRYPOINT ["scripts/genesis.sh"]

# default to fullnode
CMD ["arkeod", "start"]
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,15 @@ docker-build-cross:
--clean \
--snapshot

build-docker-localnet:
@docker build . --file Dockerfile.localnet -t ${IMAGE}:${TAG}

# localnet: build-docker
# IMAGE_TAG=$(SHORT_COMMIT)-$(IMAGE_ARCH) docker-compose -f docker-compose-localnet.yaml up

localnet: build-docker
IMAGE_TAG=$(SHORT_COMMIT)-$(IMAGE_ARCH) docker-compose -f docker-compose-localnet.yaml up

localnet: build-docker-localnet
IMAGE_TAG=${IMAGE}:${TAG} docker-compose -f docker-compose-localnet.yaml up
# ------------------------------ Testnet ------------------------------

install-testnet-binary:
Expand Down
12 changes: 5 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ func NewArkeoApp(
app.GetSubspace(claimmoduletypes.ModuleName),
logger,
)
claimModule := claimmodule.NewAppModule(appCodec, app.Keepers.ClaimKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper)

// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
Expand Down Expand Up @@ -599,7 +598,6 @@ func NewArkeoApp(
govModuleAddr,
logger,
)
arkeoModule := arkeomodule.NewAppModule(appCodec, app.Keepers.ArkeoKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, *app.Keepers.StakingKeeper)

/**** Module Options ****/

Expand All @@ -612,7 +610,7 @@ func NewArkeoApp(

app.mm = module.NewManager(
genutil.NewAppModule(
app.Keepers.AccountKeeper, app.Keepers.StakingKeeper, app,
app.Keepers.AccountKeeper, app.Keepers.StakingKeeper, app.BaseApp,
encodingConfig.TxConfig,
),
auth.NewAppModule(appCodec, app.Keepers.AccountKeeper, nil, app.GetSubspace(authtypes.ModuleName)),
Expand All @@ -634,8 +632,8 @@ func NewArkeoApp(
params.NewAppModule(app.Keepers.ParamsKeeper),
transferModule,
icaModule,
arkeoModule,
claimModule,
arkeomodule.NewAppModule(appCodec, app.Keepers.ArkeoKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, *app.Keepers.StakingKeeper),
claimmodule.NewAppModule(appCodec, app.Keepers.ClaimKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper),
// this line is used by starport scaffolding # stargate/app/appModule
)

Expand Down Expand Up @@ -773,8 +771,8 @@ func NewArkeoApp(
evidence.NewAppModule(app.Keepers.EvidenceKeeper),
ibc.NewAppModule(app.Keepers.IBCKeeper),
transferModule,
arkeoModule,
claimModule,
arkeomodule.NewAppModule(appCodec, app.Keepers.ArkeoKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper, *app.Keepers.StakingKeeper),
claimmodule.NewAppModule(appCodec, app.Keepers.ClaimKeeper, app.Keepers.AccountKeeper, app.Keepers.BankKeeper),
// this line is used by starport scaffolding # stargate/app/appModule
)
app.sm.RegisterStoreDecoders()
Expand Down
5 changes: 2 additions & 3 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ func (app *ArkeoApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs
/* Handle slashing state. */

// reset start height on signing infos
err = app.Keepers.SlashingKeeper.IterateValidatorSigningInfos(
if err := app.Keepers.SlashingKeeper.IterateValidatorSigningInfos(
ctx,
func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) {
info.StartHeight = 0
Expand All @@ -253,8 +253,7 @@ func (app *ArkeoApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs
}
return false
},
)
if err != nil {
); err != nil {
panic(err)
}
}
61 changes: 61 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,67 @@ genesis:
staking:
params:
bond_denom: "uarkeo"
claimarkeo:
module_account_balance:
denom: ''
amount: '0'
params:
airdrop_start_time: '2024-08-27T04:35:10.833785853Z'
duration_until_decay: 7884000s
duration_of_decay: 7884000s
claim_denom: uarkeo
initial_gas_amount:
claim_records:
- chain: ARKEO
address: tarkeo19358z26jwh3e4rd6psxqf8q6f3pe6f8s7v0x2a
amount_claim:
denom: uarkeo
amount: '1000'
amount_vote:
denom: uarkeo
amount: '1000'
amount_delegate:
denom: uarkeo
amount: '1000'
is_transferable: true
- chain: ARKEO
address: tarkeo1dllfyp57l4xj5umqfcqy6c2l3xfk0qk6zpc3t7
amount_claim:
denom: uarkeo
amount: '1000'
amount_vote:
denom: uarkeo
amount: '1000'
amount_delegate:
denom: uarkeo
amount: '1000'
is_transferable: true
- chain: ARKEO
address: tarkeo1xrz7z3zwtpc45xm72tpnevuf3wn53re8q4u4nr
amount_claim:
denom: uarkeo
amount: '1000'
amount_vote:
denom: uarkeo
amount: '1000'
amount_delegate:
denom: uarkeo
amount: '1000'
is_transferable: true
- chain: ETHEREUM
address: '0x92E14917A0508Eb56C90C90619f5F9Adbf49f47d'
amount_claim:
denom: uarkeo
amount: '500000'
amount_vote:
denom: uarkeo
amount: '600000'
amount_delegate:
denom: uarkeo
amount: '700000'
is_transferable: true


accounts:
- name: reserve
coins:
Expand Down
3 changes: 3 additions & 0 deletions directory/indexer/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ func convertEventToMap(event abcitypes.Event) (map[string]any, error) {
if attr.Key == "msg_index" {
continue
}
if attr.Key == "mode" {
continue
}
switch attrValue[0] {
case '{':
var nest any
Expand Down
19 changes: 12 additions & 7 deletions docker-compose-localnet.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
---
version: "3"

services:
node:
image: ghcr.io/arkeonetwork/arkeo-dev:${IMAGE_TAG}
image: ${IMAGE_TAG}
build:
context: .
dockerfile: Dockerfile.localnet # Ensure the Dockerfile is correctly referenced
entrypoint:
- sh
- /opt/genesis.sh
- bash
- -c
- |
./genesis.sh && \
arkeod start
ports:
- 9090:9090
- 1317:1317
- 26657:26657
- 26656:26656
volumes:
- ./scripts:/opt:z
working_dir: /opt
- ./scripts:/scripts:z
working_dir: /scripts
9 changes: 9 additions & 0 deletions scripts/genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,28 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then
add_account "$BOB" $TOKEN 1000000000000000 # bob, 1m
add_claim_records "ARKEO" "$BOB" 1000 1000 1000 true

# Thorchain derived test addresses
add_account "tarkeo1dllfyp57l4xj5umqfcqy6c2l3xfk0qk6zpc3t7" $TOKEN 1000000000000000 # bob, 10m
add_claim_records "ARKEO" "tarkeo1dllfyp57l4xj5umqfcqy6c2l3xfk0qk6zpc3t7" 1000 1000 1000 true
add_account "tarkeo1xrz7z3zwtpc45xm72tpnevuf3wn53re8q4u4nr" $TOKEN 1000000000000000
add_claim_records "ARKEO" "tarkeo1xrz7z3zwtpc45xm72tpnevuf3wn53re8q4u4nr" 1000 1000 1000 true

# add_claim_records "ARKEO" "{YOUR ARKEO ADDRESS}" 500000 500000 500000 true
# add_account "{YOUR ARKEO ADDRESS}" $TOKEN 1000000000000000

# add_claim_records "ETHEREUM" "{YOUR ETH ADDRESS}" 500000 600000 700000 true
add_claim_records "ETHEREUM" "0x92E14917A0508Eb56C90C90619f5F9Adbf49f47d" 500000 600000 700000 true

# enable CORs on testnet/localnet
sed -i 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' ~/.arkeo/config/app.toml
sed -i 's/cors_allowed_origins = \[\]/cors_allowed_origins = \["*"\]/g' ~/.arkeo/config/config.toml
fi

sed -i 's/"stake"/"uarkeo"/g' ~/.arkeo/config/genesis.json
sed -i '/"duration_until_decay"\|"duration_of_decay"/s/"3600s"/"7884000s"/' ~/.arkeo/config/genesis.json
sed -i 's/enable = false/enable = true/g' ~/.arkeo/config/app.toml
sed -i 's/127.0.0.1:26657/0.0.0.0:26657/g' ~/.arkeo/config/config.toml
sed -i 's/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/g' ~/.arkeo/config/app.toml

# Update the supply field in genesis.json using jq
jq --arg DENOM "$TOKEN" --arg AMOUNT "$TOTAL_SUPPLY" '.app_state.bank.supply = [{"denom": $DENOM, "amount": $AMOUNT}]' <~/.arkeo/config/genesis.json >/tmp/genesis.json
Expand Down
39 changes: 17 additions & 22 deletions test/regression/mnt/exports/suites_contracts_pay-as-you-go.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"authorization": "STRICT",
"client": "tarkeopub1addwnpepq2res6tu0m73ulk5sepgp6g3y37schfgymxy8z6l3lc78k7ju9u45yajwem",
"delegate": "",
"deposit": "100",
"deposit": "3",
"duration": "10",
"height": "2",
"id": "1",
Expand All @@ -40,7 +40,7 @@
},
"service": 1,
"settlement_duration": "11",
"settlement_height": "0",
"settlement_height": "15",
"type": "PAY_AS_YOU_GO"
}
],
Expand Down Expand Up @@ -72,16 +72,7 @@
]
}
],
"user_contract_sets": [
{
"contract_set": {
"contract_ids": [
"1"
]
},
"user": "tarkeopub1addwnpepq2res6tu0m73ulk5sepgp6g3y37schfgymxy8z6l3lc78k7ju9u45yajwem"
}
],
"user_contract_sets": [],
"version": "0"
},
"auth": {
Expand Down Expand Up @@ -273,20 +264,11 @@
}
]
},
{
"address": "tarkeo1kz2dkl8zlxwte008astc5e65htrxdcse6x3h3h",
"coins": [
{
"amount": "97",
"denom": "uarkeo"
}
]
},
{
"address": "tarkeo1uhapc6jjq6ns0ydnk7zld5x7f5kl2ukemjw5fg",
"coins": [
{
"amount": "999999899999900",
"amount": "999999899999997",
"denom": "uarkeo"
}
]
Expand Down Expand Up @@ -340,6 +322,19 @@
}
]
},
"claimarkeo": {
"claim_records": [],
"module_account_balance": {
"amount": "0",
"denom": "uarkeo"
},
"params": {
"claim_denom": "uarkeo",
"duration_of_decay": "3600s",
"duration_until_decay": "3600s",
"initial_gas_amount": null
}
},
"crisis": {
"constant_fee": {
"amount": "1000",
Expand Down
Loading

0 comments on commit 085b6e8

Please sign in to comment.