Skip to content

Commit

Permalink
Merge pull request #1142 from maticnetwork/v1.0.4-candidate
Browse files Browse the repository at this point in the history
v1.0.4
  • Loading branch information
manav2401 authored Mar 5, 2024
2 parents 9437618 + 749012c commit 396e990
Show file tree
Hide file tree
Showing 53 changed files with 1,825 additions and 186 deletions.
1 change: 1 addition & 0 deletions .github/matic-cli-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ borDockerBuildContext: "https://github.com/maticnetwork/bor.git#develop"
heimdallDockerBuildContext: "../../heimdall"
sprintSizeBlockNumber:
- '0'
devnetBorFlags: config,config,config
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ In case this PR includes changes that must be applied only to a subset of nodes,
- [ ] I have added tests to CI
- [ ] I have tested this code manually on local environment
- [ ] I have tested this code manually on remote devnet using express-cli
- [ ] I have tested this code manually on mumbai
- [ ] I have tested this code manually on mumbai or amoy
- [ ] I have created new e2e tests into express-cli

### Manual tests
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/dockerimage.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/packager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,37 @@ jobs:
NODE: sentry
NETWORK: mumbai

- name: Setting up heimdalld for for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64
NODE: sentry
NETWORK: amoy
- name: Copying over the postinst file for for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/postinst.profile.amoy packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/postinst
env:
ARCH: amd64
NODE: sentry
NETWORK: amoy
- name: Copying systemd file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/systemd/heimdalld-amoy-sentry.service packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/lib/systemd/system/heimdalld.service
env:
ARCH: amd64
NODE: sentry
NETWORK: amoy
- name: Copying profile control file for for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.profile.amd64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: amd64
NODE: sentry
NETWORK: amoy
- name: Building heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }} profile
run: dpkg-deb --build --root-owner-group packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64
NODE: sentry
NETWORK: amoy

- name: Setting up heimdalld for for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
Expand Down Expand Up @@ -158,6 +189,43 @@ jobs:
NODE: validator
NETWORK: mumbai

- name: Setting heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64
NODE: validator
NETWORK: amoy
- name: Prepping control file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.validator packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: amd64
NODE: validator
NETWORK: amoy
- name: Prepping postinst file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/postinst.profile.amoy packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/postinst
env:
ARCH: amd64
NODE: validator
NETWORK: amoy
- name: Copying systemd file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/systemd/heimdalld-amoy-validator.service packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/lib/systemd/system/heimdalld.service
env:
ARCH: amd64
NODE: validator
NETWORK: amoy
- name: Copying profile control file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.profile.amd64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: amd64
NODE: validator
NETWORK: amoy
- name: Building heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }} profile
run: dpkg-deb --build --root-owner-group packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: amd64
NODE: validator
NETWORK: amoy

- name: Setting up heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
Expand Down Expand Up @@ -278,6 +346,37 @@ jobs:
NODE: validator
NETWORK: mumbai

- name: Setting heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
NODE: validator
NETWORK: amoy
- name: Copying over the postinst file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/postinst.profile.amoy packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN//postinst
env:
ARCH: arm64
NODE: validator
NETWORK: amoy
- name: Copying arm64 control file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.validator.arm64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: arm64
NODE: validator
NETWORK: amoy
- name: Copying systemd file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/systemd/heimdalld-amoy-validator.service packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/lib/systemd/system/heimdalld.service
env:
ARCH: arm64
NODE: validator
NETWORK: amoy
- name: Building heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }} profile
run: dpkg-deb --build --root-owner-group packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
NODE: validator
NETWORK: amoy

- name: Setting up heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
Expand Down Expand Up @@ -352,6 +451,43 @@ jobs:
NODE: sentry
NETWORK: mumbai

- name: Setting up heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy
- name: Copying control for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.arm64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy
- name: Copying postinst for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/postinst.arm64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/postinst
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy
- name: Copying systemd file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/systemd/heimdalld-amoy-sentry.service packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/lib/systemd/system/heimdalld.service
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy
- name: Copying arm64 control file for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/templates/package_scripts/control.profile.arm64 packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}/DEBIAN/control
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy
- name: Building heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }} profile
run: dpkg-deb --build --root-owner-group packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
ARCH: arm64
NODE: sentry
NETWORK: amoy

- name: Setting up heimdalld for ${{ env.NODE }} on ${{ env.NETWORK }} on ${{ env.ARCH }}
run: cp -rp packaging/deb/heimdalld packaging/deb/heimdalld-${{ env.NETWORK }}-${{ env.NODE }}-config_${{ env.GIT_TAG }}-${{ env.ARCH }}
env:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ $ make install
$ heimdalld init
$ heimdalld init --chain=mainnet Will init with genesis.json for mainnet
$ heimdalld init --chain=mumbai Will init with genesis.json for mumbai
$ heimdalld init --chain=amoy Will init with genesis.json for amoy
```
### Run-heimdall
```bash
Expand All @@ -28,6 +29,7 @@ $ heimdalld start
$ heimdalld start Will start for mainnet by default
$ heimdalld start --chain=mainnet Will start for mainnet
$ heimdalld start --chain=mumbai Will start for mumbai
$ heimdalld start --chain=amoy Will start for amoy
$ heimdalld start --chain=local Will start for local with NewSelectionAlgoHeight = 0
```

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func (app *HeimdallApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain)
}
}

// TODO make sure old validtors dont go in validator updates ie deactivated validators have to be removed
// TODO make sure old validators dont go in validator updates ie deactivated validators have to be removed
// update validators
return abci.ResponseInitChain{
// validator updates
Expand Down
2 changes: 1 addition & 1 deletion app/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (

// SetupSimulation creates the config, db (levelDB), temporary directory and logger for
// the simulation tests. If `FlagEnabledValue` is false it skips the current test.
// Returns error on an invalid db intantiation or temp dir creation.
// Returns error on an invalid db instantiation or temp dir creation.
func SetupSimulation(dirPrefix, dbName string) (simTypes.Config, dbm.DB, string, log.Logger, bool, error) {
config := NewConfigFromFlags()
config.ChainID = SimAppChainID
Expand Down
132 changes: 132 additions & 0 deletions auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Auth Module

## Table of Contents

* [Overview](#overview)
* [Gas and Fees](#gas-and-fees)
* [Types](#types)
* [Parameters](#parameters)
* [Query Commands](#query-commands)

## Overview

The auth module is responsible for specifying the base transaction and account types for an application. It contains the ante handler, where all basic transaction validity checks (signatures, nonces, auxiliary fields) are performed, and exposes the account keeper, which allows other modules to read, write, and modify accounts.

### Gas and Fees

Fees serve two purposes for an operator of the network.

Fees limit the growth of the state stored by every full node and allow for general purpose censorship of transactions of little economic value. Fees are best suited as an anti-spam mechanism where validators are disinterested in the use of the network and identities of users.

Since Heimdall doesn't support custom contract or code for any transaction, it uses fixed cost transactions. For fixed cost transactions, the validator can top up their accounts on the Ethereum chain and get tokens on Heimdall using the Topup module.

### Types

Besides accounts (specified in State), the types exposed by the auth module are StdSignature, the combination of an optional public key and a cryptographic signature as a byte array, StdTx, a struct that implements the sdk.Tx interface using StdSignature, and StdSignDoc, a replay-prevention structure for StdTx which transaction senders must sign over.

#### StdSignature

A StdSignature is the types of a byte array.
```
// StdSignature represents a sig
type StdSignature []byte
```

#### StdTx

A StdTx is a struct that implements the sdk.Tx interface, and is likely to be generic enough to serve the purposes of many types of transactions.

```
type StdTx struct {
Msg sdk.Msg `json:"msg" yaml:"msg"`
Signature StdSignature `json:"signature" yaml:"signature"`
Memo string `json:"memo" yaml:"memo"`
}
```

#### StdSignDoc

A StdSignDoc is a replay-prevention structure to be signed over, which ensures that any submitted transaction (which is simply a signature over a particular byte string) will only be executable once on a Heimdall.

```
// StdSignDoc is replay-prevention structure.
// It includes the result of msg.GetSignBytes(),
// as well as the ChainID (prevent cross chain replay)
// and the Sequence numbers for each signature (prevent
// inchain replay and enforce tx ordering per account).
type StdSignDoc struct {
ChainID string `json:"chain_id" yaml:"chain_id"`
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
Sequence uint64 `json:"sequence" yaml:"sequence"`
Msg json.RawMessage `json:"msg" yaml:"msg"`
Memo string `json:"memo" yaml:"memo"`
}
```

#### Account

It manages addresses, coins and nonce for transactions. It also signs and validates transactions.

```
type BaseAccount struct {
Address types.HeimdallAddress `json:"address" yaml:"address"`
Coins types.Coins `json:"coins" yaml:"coins"`
PubKey crypto.PubKey `json:"public_key" yaml:"public_key"`
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
Sequence uint64 `json:"sequence" yaml:"sequence"`
}
```

### Parameters

The auth module contains the following parameters:

|Key |Type |Default value |
|----------------------|------|------------------|
|MaxMemoCharacters |uint64|256 |
|TxSigLimit |uint64|7 |
|TxSizeCostPerByte |uint64|10 |
|SigVerifyCostED25519 |uint64|590 |
|SigVerifyCostSecp256k1|uint64|1000 |
|DefaultMaxTxGas |uint64|1000000 |
|DefaultTxFees |string|"1000000000000000"|

## Query Commands

One can run the following query command from the auth module.

- `account` - Query account details of a given address
- `params` - Query auth module parameters

To know your account details, run the following command:

```
heimdalld show-account
```
Expected response:
```
{
"address": "0x68243159a498cf20d945cf3E4250918278BA538E",
"pub_key": "0x040a9f6879c7cdab7ecc67e157cda15e8b2ddbde107a04bc22d02f50032e393f6360a05e85c7c1ecd201ad30dfb886af12dd02b47e4463f6f0f6f94159dc9f10b8"
}
```

### CLI Commands

```
heimdallcli query auth account <address> --trust-node
```

```
heimdallcli query auth params
```

### REST Endpoints

```
curl http://localhost:1317/auth/accounts/<address>
```

```
curl http://localhost:1317/auth/params
```
2 changes: 1 addition & 1 deletion auth/types/stdtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (ss StdSignature) String() string {

// StdFee includes the amount of coins paid in fees and the maximum
// gas to be used by the transaction. The ratio yields an effective "gasprice",
// which must be above some miminum to be accepted into the mempool.
// which must be above some minimum to be accepted into the mempool.
type StdFee struct {
Amount sdk.Coins `json:"amount"`
Gas uint64 `json:"gas"`
Expand Down
Loading

0 comments on commit 396e990

Please sign in to comment.