Skip to content

Commit

Permalink
Merge pull request #203 from DecentralCardGame/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
lxgr-linux authored Feb 28, 2024
2 parents 125b3fb + 07ea2fc commit 194fa00
Show file tree
Hide file tree
Showing 68 changed files with 3,241 additions and 1,517 deletions.
3 changes: 2 additions & 1 deletion .fleet/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"backend.maxHeapSizeMb": 2744
"backend.maxHeapSizeMb": 2744,
"editor.formatOnSave": true
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ RUN ignite chain init

COPY scripts/download_genesis.py download_genesis.py
RUN python3 download_genesis.py
RUN mv genesis.json $HOME/.Cardchain/config/genesis.json
RUN wget -O $HOME/.Cardchain/config/addrbook.json "https://raw.githubusercontent.com/DecentralCardGame/Testnet/main/addrbook.json"
RUN mv genesis.json $HOME/.cardchaind/config/genesis.json
RUN wget -O $HOME/.cardchaind/config/addrbook.json "https://raw.githubusercontent.com/DecentralCardGame/Testnet/main/addrbook.json"

RUN chmod +x ./docker-run.sh
ENTRYPOINT bash docker-run.sh
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(BUILDDIR)/:

# Install binary to ~/go/bin/
install: build
cp $(BUILDDIR)/Cardchaind ~/go/bin/
cp $(BUILDDIR)/cardchaind ~/go/bin/

# Verify dependencies
go.sum: go.mod
Expand Down
6 changes: 3 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ import (

const (
AccountAddressPrefix = "cc"
Name = "Cardchain"
Name = "cardchain"
BondDenom = "ubpf"
// epochBlockTime defines how many blocks are one buffnerf epoch
epochBlockTime = 120000 // this is 1 week with 5s block time
Expand Down Expand Up @@ -213,7 +213,7 @@ func init() {
panic(err)
}

DefaultNodeHome = filepath.Join(userHomeDir, "."+Name)
DefaultNodeHome = filepath.Join(userHomeDir, "."+Name+"d")
}

// App extends an ABCI application, but with most of its parameters exported.
Expand Down Expand Up @@ -797,7 +797,7 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
if app.LastBlockHeight()%epochBlockTime == 0 {
cardchainmodule.UpdateNerfLevels(ctx, app.CardchainKeeper)
matchesEnabled, _ := app.CardchainKeeper.FeatureFlagModuleInstance.Get(ctx, string(cardchainmoduletypes.FeatureFlagName_Matches))
if matchesEnabled { // Only give voterigths to all users, when matches are not anabled
if matchesEnabled { // Only give voterigths to all users, when matches are not anabled
app.CardchainKeeper.AddVoteRightsToAllUsers(ctx)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/Cardchaind/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {

rootCmd := &cobra.Command{
Use: app.Name + "d",
Short: "Start Cardchaind node",
Short: "Start cardchaind node",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
3 changes: 2 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 1
build:
main: cmd/Cardchaind/
binary: "cardchaind"
proto:
path: proto
third_party_paths:
Expand Down Expand Up @@ -87,7 +88,7 @@ genesis:
staking:
params:
bond_denom: ubpf
chain_id: cardtestnet-8
chain_id: carddevnet-2
validators:
- name: alice
bonded: 5000000ubpf
Expand Down
24 changes: 12 additions & 12 deletions docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fi

SEEDS=""
echo "peers is:" $PEERS
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.Cardchain/config/config.toml
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.cardchaind/config/config.toml

if [ -z $USE_SNAP ]
then
Expand Down Expand Up @@ -79,7 +79,7 @@ then
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.Cardchain/config/config.toml ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.cardchaind/config/config.toml ; \

fi

Expand All @@ -90,24 +90,24 @@ pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="10"

sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.Cardchain/config/config.toml
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.Cardchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.Cardchain/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.Cardchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.Cardchain/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.cardchaind/config/config.toml
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.cardchaind/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.cardchaind/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.cardchaind/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.cardchaind/config/app.toml

echo -e "\033[0;32mstarting faucet \033[0m"
sed -i -e "s/^SECRET_KEY *=.*/SECRET_KEY = \"$FAUCET_SECRET_KEY\"/" go-faucet-master/.env
cd go-faucet-master
./go-faucet &
echo -e "\033[0;31mfaucet adress: \033[0;36m $(Cardchaind keys show alice --address) \033[0;31m must be registered!\033[0m use scripts/register_faucet.sh for that"
echo $(Cardchaind keys show alice --address) > /backup/faucetaddress.txt
echo -e "\033[0;31mfaucet adress: \033[0;36m $(cardchaind keys show alice --address) \033[0;31m must be registered!\033[0m use scripts/register_faucet.sh for that"
echo $(cardchaind keys show alice --address) > /backup/faucetaddress.txt

echo -e "\033[0;32mstarting Blockchain\033[0m"
Cardchaind start
cardchaind start

# backup area (this will be executed if the Cardchaind process is killed)
# backup area (this will be executed if the cardchaind process is killed)
now=$(date +"%d.%m.%Y")
Cardchaind export > /backup/genesis$now.json
cardchaind export > /backup/genesis$now.json
echo "BACKUP should be in /backup/genesis$now - don't forget to use migrate_with_data.py script in case you need it"
echo "fail? is backup folder owned by root? (no idea how this happens though)"
6 changes: 3 additions & 3 deletions docker-stop-and-export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
echo "please give write permission to backup folder:"
sudo chmod o+w backup

PID=$(docker-compose exec blockchain pidof Cardchaind)
PID=$(docker-compose exec blockchain pidof cardchaind)
echo PID:$PID

docker-compose exec blockchain pkill Cardchaind
docker-compose exec blockchain pkill cardchaind

while $(docker-compose exec blockchain pkill -0 Cardchaind); do
while $(docker-compose exec blockchain pkill -0 cardchaind); do
sleep 1
done

Expand Down
169 changes: 134 additions & 35 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33104,6 +33104,56 @@ paths:
in: path
required: true
type: string
format: uint64
tags:
- Query
/DecentralCardGame/Cardchain/cardchain/q_card_contents/{cardIds}:
get:
summary: Queries a list of QCardContents items.
operationId: DecentralCardGameCardchainCardchainQCardContents
responses:
'200':
description: A successful response.
schema:
type: object
properties:
cards:
type: array
items:
type: object
properties:
content:
type: string
hash:
type: string
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: cardIds
in: path
required: true
type: array
items:
type: string
format: uint64
collectionFormat: csv
minItems: 1
tags:
- Query
/DecentralCardGame/Cardchain/cardchain/q_cardchain_info:
Expand Down Expand Up @@ -33158,7 +33208,7 @@ paths:
additionalProperties: {}
tags:
- Query
/DecentralCardGame/Cardchain/cardchain/q_cards/{status}:
/DecentralCardGame/Cardchain/cardchain/q_cards:
get:
summary: Queries a list of QCards items.
operationId: DecentralCardGameCardchainCardchainQCards
Expand Down Expand Up @@ -33192,34 +33242,51 @@ paths:
type: string
additionalProperties: {}
parameters:
- name: status
in: path
required: true
type: string
enum:
- scheme
- prototype
- trial
- permanent
- suspended
- banned
- bannedSoon
- bannedVerySoon
- none
- playable
- unplayable
- name: owner
in: query
required: false
type: string
- name: cardType
- name: statuses
in: query
required: false
type: string
type: array
items:
type: string
enum:
- scheme
- prototype
- trial
- permanent
- suspended
- banned
- bannedSoon
- bannedVerySoon
- none
collectionFormat: multi
- name: cardTypes
in: query
required: false
type: array
items:
type: string
enum:
- place
- action
- entity
- headquarter
collectionFormat: multi
- name: classes
in: query
required: false
type: string
type: array
items:
type: string
enum:
- nature
- culture
- mysticism
- technology
collectionFormat: multi
- name: sortBy
in: query
required: false
Expand All @@ -33244,6 +33311,23 @@ paths:
in: query
required: false
type: boolean
- name: rarities
in: query
required: false
type: array
items:
type: string
enum:
- common
- uncommon
- rare
- exceptional
- unique
collectionFormat: multi
- name: multiClassOnly
in: query
required: false
type: boolean
tags:
- Query
/DecentralCardGame/Cardchain/cardchain/q_council/{councilId}:
Expand Down Expand Up @@ -68682,6 +68766,14 @@ definitions:
- active
- archived
default: design
DecentralCardGame.cardchain.cardchain.CardClass:
type: string
enum:
- nature
- culture
- mysticism
- technology
default: nature
DecentralCardGame.cardchain.cardchain.CardRarity:
type: string
enum:
Expand All @@ -68691,6 +68783,14 @@ definitions:
- exceptional
- unique
default: common
DecentralCardGame.cardchain.cardchain.CardType:
type: string
enum:
- place
- action
- entity
- headquarter
default: place
DecentralCardGame.cardchain.cardchain.CouncelingStatus:
type: string
enum:
Expand Down Expand Up @@ -68947,6 +69047,8 @@ definitions:
cardId:
type: string
format: uint64
DecentralCardGame.cardchain.cardchain.MsgChangeAliasResponse:
type: object
DecentralCardGame.cardchain.cardchain.MsgChangeArtistResponse:
type: object
DecentralCardGame.cardchain.cardchain.MsgCommitCouncilResponseResponse:
Expand Down Expand Up @@ -69318,6 +69420,18 @@ definitions:
type: string
hash:
type: string
DecentralCardGame.cardchain.cardchain.QueryQCardContentsResponse:
type: object
properties:
cards:
type: array
items:
type: object
properties:
content:
type: string
hash:
type: string
DecentralCardGame.cardchain.cardchain.QueryQCardchainInfoResponse:
type: object
properties:
Expand All @@ -69343,21 +69457,6 @@ definitions:
lastCardModified:
type: string
format: uint64
DecentralCardGame.cardchain.cardchain.QueryQCardsRequest.Status:
type: string
enum:
- scheme
- prototype
- trial
- permanent
- suspended
- banned
- bannedSoon
- bannedVerySoon
- none
- playable
- unplayable
default: scheme
DecentralCardGame.cardchain.cardchain.QueryQCardsResponse:
type: object
properties:
Expand Down
Loading

0 comments on commit 194fa00

Please sign in to comment.