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

Euler 0.1.1 #223

Merged
merged 38 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
dcd4fb5
Update cosmos to latest develop
hleb-albau Jan 23, 2019
9755204
#181 Change mint module to default cosmos module
hleb-albau Jan 23, 2019
a405b4d
#179 Change Bandwidth Price to Average for 24h Sliding Window. Refact…
arturalbov Jan 22, 2019
b12c051
#179 Change Bandwidth Price to Average for 24h Sliding Window
arturalbov Jan 23, 2019
97e1d8b
#179 Change Bandwidth Price to Average for 24h Sliding Window. Notes …
arturalbov Jan 24, 2019
dcff256
Fix rank calculation context data
hleb-albau Jan 24, 2019
e30ee3a
#171 Tx size reduction: switch to more compact links tx encoding
arturalbov Jan 24, 2019
90430bc
Update to cosmos-sdk v0.30.0
hleb-albau Jan 25, 2019
e63a8a6
#156 Add Missing euler tokens cmd
hleb-albau Jan 25, 2019
b0d9c77
#157 Change token name from CBD to CYB in the testnetwork
hleb-albau Jan 28, 2019
a723242
#184 Links Exporter. Base implementation
arturalbov Jan 26, 2019
9de4095
#184 Links Exporter. Buffered IO. Refactoring
arturalbov Jan 28, 2019
a9db6b6
#181 Constant Block Reward
hleb-albau Jan 28, 2019
3356025
Fix wrong home folder path
hleb-albau Jan 29, 2019
f4d4872
#197 Error on replay with wrong app hash calculation
hleb-albau Jan 28, 2019
d23b9fb
#160 CI: Cyberd docker image building. Include genesis file
arturalbov Jan 28, 2019
4c37378
#160 CI: Cyberd docker image building. Include genesis file. Remove ls
arturalbov Jan 29, 2019
4d20c38
#160 Add test files to IPFS
arturalbov Jan 29, 2019
63efdb5
#216 Link msg bandwidth cost doesn't take into account links count
arturalbov Jan 29, 2019
51139bb
Change config.toml hash
arturalbov Jan 29, 2019
d114d2a
Fix docker entrypoint.sh
arturalbov Jan 29, 2019
7e0b97f
#215 Fix gentx commands.
hleb-albau Jan 30, 2019
99ef2f5
Change devnet genesis files in Dockerfile
arturalbov Jan 30, 2019
2b9116f
Change chain-id
arturalbov Jan 30, 2019
c0bca46
#215 Fix pou distribution uses share not percentage
hleb-albau Jan 30, 2019
b182cbc
Fix genesis file
arturalbov Jan 30, 2019
84ae0c9
#201 Setup 0.1.1 chain params for staking, distr, slashing, mint modu…
hleb-albau Jan 26, 2019
37cc1ca
#201 Setup 0.1.1 chain params for staking, distr, slashing, mint modu…
hleb-albau Jan 26, 2019
feec443
Update overview.md
mastercyb Jan 26, 2019
3364f6f
There is strong raitonale behind this magic number
mastercyb Jan 27, 2019
99ff75f
#201 Add rank, mint, and bandwidth params
hleb-albau Jan 28, 2019
4022a5f
New parametrs
mastercyb Jan 29, 2019
ff36d03
Remove block time from parametrs
mastercyb Jan 29, 2019
d45decf
#202 Set final values
hleb-albau Jan 30, 2019
64e5516
Update docs
hleb-albau Jan 31, 2019
6c52bf0
Fix import reader
arturalbov Jan 31, 2019
45bc6ea
Change unbonding to 3 weeks
hleb-albau Jan 31, 2019
d21e4a6
Update release IPFS hashes for 0.1.1 testnet
arturalbov Jan 31, 2019
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
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ ENV GO_VERSION 1.11.2
ENV GO_ARCH 'linux-amd64'
ENV GO_BIN_SHA '1dfe664fa3d8ad714bbd15a36627992effd150ddabd7523931f077b3926d736d'

ENV IPGET_VERSION 0.3.0
ENV IPGET_ARCH 'linux-amd64'

# Install required dev tools to install go
###############################################################################
Expand All @@ -60,6 +62,19 @@ RUN url="https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" && \
tar -C /usr/local -xzf go.tgz &&\
rm go.tgz

# Download genesis file and links file from IPFS
###############################################################################
RUN url="https://dist.ipfs.io/ipget/v${IPGET_VERSION}/ipget_v${IPGET_VERSION}_${IPGET_ARCH}.tar.gz" && \
wget -O ipget.tgz "$url" && \
tar -xzf ipget.tgz && \
rm ipget.tgz

WORKDIR /ipget
RUN ./ipget QmSFTpNaXB3FhB4EWjsrUydupZXTL8Z44c2j18o5CGnN5h -o /genesis.json
RUN ./ipget QmepwmLe7vQcK2W6WmvfEk46de3cJ4Jp6jXRXNhuR2AfJ9 -o /links
RUN ./ipget QmdHeSsjkuThTe6VVDD4FUUfpQFH79R8tYrC2bgWwHC2bh -o /config.toml

WORKDIR /

# Copy compiled kernel and binaries
###############################################################################
Expand All @@ -69,11 +84,8 @@ COPY --from=build_stage /sources/cyberdcli /usr/bin/cyberdcli
COPY --from=build_stage /usr/lib/cbdrank.h /usr/lib/cbdrank.h
COPY --from=build_stage /usr/lib/libcbdrank.so /usr/lib/libcbdrank.so


# Copy configs and startup scripts
# Copy startup scripts
###############################################################################
COPY ./testnet/genesis.json /genesis.json
COPY ./testnet/config.toml /config.toml

COPY start_script.sh start_script.sh
COPY entrypoint.sh /entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# cyberd. Knowledge consensus computer
![banner](logo.png)

[![testnet](https://img.shields.io/badge/testnet-euler-green.svg?style=flat-square)](https://github.com/cybercongress/cyberd/blob/master/docs/run_validator.md)
[![testnet](https://img.shields.io/badge/testnet-euler--1-green.svg?style=flat-square)](https://github.com/cybercongress/cyberd/blob/master/docs/run_validator.md)
[![version](https://img.shields.io/github/release/cybercongress/cyberd.svg?style=flat-square)](https://github.com/cosmos/cosmos-sdk/releases/latest)
[![CircleCI](https://img.shields.io/circleci/project/github/cybercongress/cyberd.svg?style=flat-square)](https://circleci.com/gh/cybercongress/cyberd/tree/master)
[![license](https://img.shields.io/badge/License-Cyber-brightgreen.svg?style=flat-square)](https://github.com/cybercongress/cyberd/blob/master/LICENSE)
Expand Down
99 changes: 99 additions & 0 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package app

import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
)

// should be removed after cosmos refactor
func NewAnteHandler(ak auth.AccountKeeper) sdk.AnteHandler {
return func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, res sdk.Result, abort bool) {

//todo really need it?
newCtx = auth.SetGasMeter(true, ctx, 0)

// all transactions must be of type auth.StdTx
stdTx, ok := tx.(auth.StdTx)
if !ok {
return newCtx, sdk.ErrInternal("tx must be StdTx").Result(), true
}

params := ak.GetParams(ctx)
if err := tx.ValidateBasic(); err != nil {
return newCtx, err.Result(), true
}

if res := validateMemo(stdTx, params); !res.IsOK() {
return newCtx, res, true
}

// stdSigs contains the sequence number, account number, and signatures.
// When simulating, this would just be a 0-length slice.
signerAddrs := stdTx.GetSigners()
stdSigs := stdTx.GetSignatures()
isGenesis := ctx.BlockHeight() == 0
signerAccs := make([]auth.Account, len(signerAddrs))

for i := 0; i < len(stdSigs); i++ {

signerAccs[i], res = auth.GetSignerAcc(newCtx, ak, signerAddrs[i])
if !res.IsOK() {
return newCtx, res, true
}

// check signature, return account with incremented nonce
signBytes := auth.GetSignBytes(newCtx.ChainID(), stdTx, signerAccs[i], isGenesis)
signerAccs[i], res = processSig(signerAccs[i], stdSigs[i], signBytes, simulate)
if !res.IsOK() {
return newCtx, res, true
}

ak.SetAccount(newCtx, signerAccs[i])
}

return newCtx, sdk.Result{}, false // continue...
}
}

func validateMemo(stdTx auth.StdTx, params auth.Params) sdk.Result {
memoLength := len(stdTx.GetMemo())
if uint64(memoLength) > params.MaxMemoCharacters {
return sdk.ErrMemoTooLarge(
fmt.Sprintf(
"maximum number of characters is %d but received %d characters",
params.MaxMemoCharacters, memoLength,
),
).Result()
}

return sdk.Result{}
}

// verify the signature and increment the sequence. If the account doesn't have a pubkey, set it.
func processSig(
acc auth.Account, sig auth.StdSignature, signBytes []byte, simulate bool,
) (updatedAcc auth.Account, res sdk.Result) {

pubKey, res := auth.ProcessPubKey(acc, sig, simulate)
if !res.IsOK() {
return nil, res
}

err := acc.SetPubKey(pubKey)
if err != nil {
return nil, sdk.ErrInternal("setting PubKey on signer's account").Result()
}

if !simulate && !pubKey.VerifyBytes(signBytes, sig.Signature) {
return nil, sdk.ErrUnauthorized("signature verification failed").Result()
}

err = acc.SetSequence(acc.GetSequence() + 1)
if err != nil {
// Handle w/ #870
panic(err)
}

return acc, res
}
Loading