Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/aws-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . -f ./contrib/images/evmd-env/Dockerfile
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . -f ./contrib/images/ogd-env/Dockerfile
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "Image pushed: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COMMIT := $(shell git log -1 --format='%H')

BINDIR ?= $(GOPATH)/bin
BUILDDIR ?= $(CURDIR)/build
EXAMPLE_BINARY := evmd
EXAMPLE_BINARY := ogd

###############################################################################
### Repo Info ###
Expand All @@ -31,10 +31,10 @@ export GO111MODULE = on

# evmd is a separate module under ./evmd
EVMD_DIR := evmd
EVMD_MAIN_PKG := ./cmd/evmd
EVMD_MAIN_PKG := ./cmd/ogd

###############################################################################
### Build & Install evmd ###
### Build & Install ogd ###
###############################################################################

# process build tags
Expand Down Expand Up @@ -96,7 +96,7 @@ endif

# Build into $(BUILDDIR)
build: go.sum $(BUILDDIR)/
@echo "🏗️ Building evmd to $(BUILDDIR)/$(EXAMPLE_BINARY) ..."
@echo "🏗️ Building ogd to $(BUILDDIR)/$(EXAMPLE_BINARY) ..."
@echo "BUILD_FLAGS: $(BUILD_FLAGS)"
@cd $(EVMD_DIR) && CGO_ENABLED="1" \
go build $(BUILD_FLAGS) -o $(BUILDDIR)/$(EXAMPLE_BINARY) $(EVMD_MAIN_PKG)
Expand All @@ -107,7 +107,7 @@ build-linux:

# Install into $(BINDIR)
install: go.sum
@echo "🚚 Installing evmd to $(BINDIR) ..."
@echo "🚚 Installing ogd to $(BINDIR) ..."
@echo "BUILD_FLAGS: $(BUILD_FLAGS)"
@cd $(EVMD_DIR) && CGO_ENABLED="1" \
go install $(BUILD_FLAGS) $(EVMD_MAIN_PKG)
Expand Down Expand Up @@ -362,10 +362,10 @@ contracts-add:
###############################################################################

localnet-build-env:
$(MAKE) -C contrib/images evmd-env
$(MAKE) -C contrib/images ogd-env

localnet-build-nodes:
$(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmos/evmd \
$(DOCKER) run --rm --entrypoint ogd -v $(CURDIR)/.testnets:/data cosmos/ogd \
testnet init-files --validator-count 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test --chain-id=local-4221 --use-docker=true
docker compose up -d

Expand All @@ -387,7 +387,7 @@ test-rpc-compat-stop:

test-system: build-v05 build
mkdir -p ./tests/systemtests/binaries/
cp $(BUILDDIR)/evmd ./tests/systemtests/binaries/
cp $(BUILDDIR)/$(EXAMPLE_BINARY) ./tests/systemtests/binaries/
cd tests/systemtests/Counter && forge build
$(MAKE) -C tests/systemtests test

Expand Down Expand Up @@ -472,4 +472,4 @@ d2gen-all: d2check
printf "📊 generating $$svgfile from $$d2file... "; \
$(D2_ENV_VARS) d2 "$$d2file" "$$svgfile" > /dev/null 2>&1 && echo "done ✅" || echo "failed ❌"; \
done
@echo "✅ svg files generated for all d2 diagrams"
@echo "✅ svg files generated for all d2 diagrams"
2 changes: 2 additions & 0 deletions ante/cosmos.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
evmante "github.com/cosmos/evm/ante/evm"
evmtypes "github.com/cosmos/evm/x/vm/types"
ibcante "github.com/cosmos/ibc-go/v10/modules/core/ante"
poaante "github.com/xrplevm/node/v10/x/poa/ante"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
Expand Down Expand Up @@ -40,5 +41,6 @@ func newCosmosAnteHandler(ctx sdk.Context, options HandlerOptions) sdk.AnteHandl
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
poaante.NewPoaDecorator(),
)
}
2 changes: 1 addition & 1 deletion client/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func LegacyEIP712Cmd() *cobra.Command {
return &cobra.Command{
Use: "legacy-eip712 [file] [evm-chain-id]",
Short: "Output types of legacy eip712 typed data according to the given transaction",
Example: fmt.Sprintf(`$ %s debug legacy-eip712 tx.json 4221 --chain-id evmd-1`, version.AppName),
Example: fmt.Sprintf(`$ %s debug legacy-eip712 tx.json 4221 --chain-id ogd-1`, version.AppName),
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
Expand Down
1 change: 1 addition & 0 deletions contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ export default {
},
paths: {
sources: "./solidity",
exclude: ["**/lib/**"]
},
};
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.0.0",
"description": "A collection of smart contracts used in the development of the Cosmos EVM blockchain.",
"devDependencies": {
"@openzeppelin/contracts": "^5.4.0",
"@openzeppelin/contracts": "4.9.6",
"hardhat": "^3.0.15"
},
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions contrib/images/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
all: evmd-env
all: ogd-env

evmd-env: evmd-rmi
docker build --tag cosmos/evmd -f evmd-env/Dockerfile \
ogd-env: ogd-rmi
docker build --tag cosmos/ogd -f ogd-env/Dockerfile \
$(shell git rev-parse --show-toplevel)

evmd-rmi:
docker rmi cosmos/evmd 2>/dev/null; true
ogd-rmi:
docker rmi cosmos/ogd 2>/dev/null; true

.PHONY: all evmd-env evmd-rmi
.PHONY: all ogd-env ogd-rmi
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ RUN adduser -D nonroot -u 1025 -G nonroot
EXPOSE 26656 26657 1317 9090 26660 8545 8100
STOPSIGNAL SIGTERM
VOLUME /evmd
WORKDIR /evmd
WORKDIR /ogd

# Copy the wrapper script and binary to expected locations
COPY contrib/images/evmd-env/wrapper.sh /usr/bin/wrapper.sh
COPY contrib/images/ogd-env/wrapper.sh /usr/bin/wrapper.sh
COPY test_deployment.sh /usr/bin/test_deployment.sh
COPY multi_node_startup.sh /usr/bin/multi_node_startup.sh
COPY --from=evmd-builder /work/build/evmd /evmd/
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
evmdnode0:
container_name: evmdnode0
image: "cosmos/evmd"
entrypoint: ["/usr/bin/wrapper.sh"]
command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"]
environment:
- DEBUG=0
- ID=0
Expand All @@ -28,6 +30,8 @@ services:
evmdnode1:
container_name: evmdnode1
image: "cosmos/evmd"
entrypoint: ["/usr/bin/wrapper.sh"]
command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"]
environment:
- DEBUG=0
- ID=1
Expand All @@ -52,6 +56,8 @@ services:
evmdnode2:
container_name: evmdnode2
image: "cosmos/evmd"
entrypoint: ["/usr/bin/wrapper.sh"]
command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"]
environment:
- DEBUG=0
- ID=2
Expand All @@ -76,6 +82,8 @@ services:
evmdnode3:
container_name: evmdnode3
image: "cosmos/evmd"
entrypoint: ["/usr/bin/wrapper.sh"]
command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"]
environment:
- DEBUG=0
- ID=3
Expand Down
13 changes: 10 additions & 3 deletions evmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ By default, this chain has the following configuration:

| Option | Value |
|---------------------|------------------------|
| Binary | `evmd` |
| Chain ID | `cosmos_262144-1` |
| Binary | `ogd` |
| Chain ID | `10740` |
| Custom Opcodes | - |
| Default Token Pairs | 1 for the native token |
| Denomination | `atest` |
| Denomination | `ogwei` |
| EVM permissioning | permissionless |
| Enabled Precompiles | all |

Expand Down Expand Up @@ -55,6 +55,12 @@ unhappy lunar seat`
![RPC URL Settings](guide/rpc_url.png "RPC URL")
![Overview of required settings](guide/settings.png "Settings Overview")

## Proof of Authority (PoA)

Currently this is a PoA chain. The validator set is managed through governance, not open staking. Regular staking transactions like delegate and undelegate are blocked at the ante handler level. Validators can only be added or removed via governance proposals. The PoA module is built by the [xrplevm/node](https://github.com/xrplevm/node) team.

See [evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md](docs/POA_ADD_VALIDATOR_VIA_GOV.md) for a step-by-step guide on adding a validator.

## Available Cosmos SDK Modules

As mentioned above, this exemplary chain implementation is a reduced version of `simapp`.
Expand All @@ -72,6 +78,7 @@ Specifically, instead of offering access to all Cosmos SDK modules, it just incl
- `gov`
- `mint`
- `params`
- `poa`
- `slashing`
- `staking`
- `upgrade`
46 changes: 44 additions & 2 deletions evmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,17 @@ import (
"github.com/cosmos/cosmos-sdk/x/mint"
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/cosmos-sdk/x/slashing"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/xrplevm/node/v10/x/poa"
poakeeper "github.com/xrplevm/node/v10/x/poa/keeper"
poatypes "github.com/xrplevm/node/v10/x/poa/types"
)

func init() {
Expand All @@ -136,7 +141,7 @@ func init() {
defaultNodeHome = evmconfig.MustGetDefaultNodeHome()
}

const appName = "evmd"
const appName = "ogd"

// defaultNodeHome default home directories for the application daemon
var defaultNodeHome string
Expand All @@ -160,6 +165,7 @@ type EVMD struct {

// keys to access the substores
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
oKeys map[string]*storetypes.ObjectStoreKey

// keepers
Expand All @@ -175,6 +181,8 @@ type EVMD struct {
EvidenceKeeper evidencekeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper
ParamsKeeper paramskeeper.Keeper
PoaKeeper poakeeper.Keeper

// IBC keepers
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
Expand Down Expand Up @@ -233,12 +241,14 @@ func NewExampleApp(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, consensusparamtypes.StoreKey,
paramstypes.StoreKey,
upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, authzkeeper.StoreKey,
// ibc keys
ibcexported.StoreKey, ibctransfertypes.StoreKey,
// Cosmos EVM store keys
evmtypes.StoreKey, feemarkettypes.StoreKey, erc20types.StoreKey, precisebanktypes.StoreKey,
)
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
oKeys := storetypes.NewObjectStoreKeys(banktypes.ObjectStoreKey, evmtypes.ObjectKey)

var nonTransientKeys []storetypes.StoreKey
Expand Down Expand Up @@ -267,10 +277,20 @@ func NewExampleApp(
txConfig: txConfig,
interfaceRegistry: interfaceRegistry,
keys: keys,
tkeys: tkeys,
oKeys: oKeys,
}

// removed x/params: no ParamsKeeper initialization
// params keeper is used by the PoA module
// it is deprecated in the SDK but still required for the xrplevm/node PoA keeper
app.ParamsKeeper = paramskeeper.NewKeeper(
appCodec,
legacyAmino,
keys[paramstypes.StoreKey],
tkeys[paramstypes.TStoreKey],
)
// Register subspace for PoA so GetSubspace(poatypes.ModuleName) returns a valid subspace.
app.ParamsKeeper.Subspace(poatypes.ModuleName).WithKeyTable(poatypes.ParamKeyTable())

// get authority address
authAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
Expand Down Expand Up @@ -550,6 +570,15 @@ func NewExampleApp(
tmLightClientModule := ibctm.NewLightClientModule(appCodec, storeProvider)
clientKeeper.AddRoute(ibctm.ModuleName, &tmLightClientModule)

app.PoaKeeper = *poakeeper.NewKeeper(
appCodec,
app.GetSubspace(poatypes.ModuleName),
app.MsgServiceRouter(),
app.BankKeeper,
app.StakingKeeper,
authAddr,
)

// Override the ICS20 app module
transferModule := transfer.NewAppModule(app.TransferKeeper)

Expand All @@ -570,6 +599,7 @@ func NewExampleApp(
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil, app.interfaceRegistry),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, nil),
poa.NewAppModule(appCodec, app.PoaKeeper, app.BankKeeper, app.StakingKeeper, app.AccountKeeper, app.interfaceRegistry),
upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()),
evidence.NewAppModule(app.EvidenceKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
Expand Down Expand Up @@ -641,6 +671,7 @@ func NewExampleApp(
banktypes.ModuleName,
govtypes.ModuleName,
stakingtypes.ModuleName,
poatypes.ModuleName,
authtypes.ModuleName,

// Cosmos EVM EndBlockers
Expand All @@ -662,6 +693,7 @@ func NewExampleApp(
genesisModuleOrder := []string{
authtypes.ModuleName, banktypes.ModuleName,
distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName,
poatypes.ModuleName,
minttypes.ModuleName,
ibcexported.ModuleName,

Expand Down Expand Up @@ -718,6 +750,7 @@ func NewExampleApp(
// initialize stores
app.MountKVStores(keys)
app.MountObjectStores(oKeys)
app.MountTransientStores(tkeys)

maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted))

Expand Down Expand Up @@ -918,6 +951,15 @@ func (app *EVMD) GetKey(storeKey string) *storetypes.KVStoreKey {
return app.keys[storeKey]
}

// GetSubspace returns a params subspace for a given module name.
func (app *EVMD) GetSubspace(moduleName string) paramstypes.Subspace {
subspace, ok := app.ParamsKeeper.GetSubspace(moduleName)
if !ok {
panic(fmt.Sprintf("subspace for module %s not registered", moduleName))
}
return subspace
}

// SimulationManager implements the SimulationApp interface
func (app *EVMD) SimulationManager() *module.SimulationManager {
return app.sm
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion evmd/cmd/evmd/cmd/root.go → evmd/cmd/ogd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewRootCmd() *cobra.Command {
WithLedgerHasProtobuf(true)

rootCmd := &cobra.Command{
Use: "evmd",
Use: "ogd",
Short: "exemplary Cosmos EVM app",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
Expand Down
Loading
Loading