Skip to content

Commit

Permalink
broadcast node's height info into p2p network (#3758)
Browse files Browse the repository at this point in the history
* move IsValidCandidateName to action package (#3706)

* move IsValidCandidateName to action package

* move IsValidCandidateName to action package

* delete validations.go

* update tests

* delete ErrInvalidAmount in staking

* Remove stale comment "This is an alpha release and is not ...." in all files (#3713)

* remove stale comment

* remove stale comment

* remove nonce field (#3714)

Co-authored-by: dustinxie <dahuaxie@gmail.com>

* [evm] proper handle refundSnapshot and upgrade go-ethereum release (#3715)

* [ioctl] modify did command parameters (#3668)

* modify action.Read default parameters

* use constant

* use config.GasStation instead of config.API #3718 (#3721)

Co-authored-by: dustinxie <dahuaxie@gmail.com>

* [genesis] set Okhotsk to activate at 01-11-2023 12am UTC (#3720)

* [tests] add more cases for gas refund (#3707)

* add more cases for gas refund

* remove debug flag

Co-authored-by: dustinxie <dahuaxie@gmail.com>

* [api] web3 rewarding action (#3691)

* add rewarding execute action

* add rewarding execute test

* add commmet for public type

* add builder test

* complete web3 rewarding read

* complete web3 rewarding read test

* remove read api and receive create rewarding action enterance

* add test to rlp tx test

* change name

* revert fix amount bug for deposit cost bug

* change check error style

* add entrance for web3 rewarding

Co-authored-by: dustinxie <dahuaxie@gmail.com>

* update mockgen (#3733)

* [ioctl] use candidate.OperatorAddress to show probated delegates (#3727)

Co-authored-by: dustinxie <dahuaxie@gmail.com>

* [config] move config.Consensus to consensus package (#3735)

* [action] validate candidate name  (#3705)

* Update release.yaml

* [config] move config.Blocksync to blocksync package (#3736)

* move config.BlockSync to blocksync package

* remove def of BlockSync in config

* rename newBlockSyncer to newBlockSyncerForTest

* [ioctl] Build contract deploy command line into new ioctl (#3708)

* [ioctl] build contract deploy command line into new ioctl

* build unittest to cover the modification1~

* group iotex-core packages

* remove stale comments

Co-authored-by: huofei <68298506@qq.com>

* [ioctl] Build contract invoke command line into new ioctl (#3709)

* [ioctl] build contract invoke command line into new ioctl

* build unittest to cover the modification1~

* remove stale comments

Co-authored-by: huofei <68298506@qq.com>

* [github] Update codeowner (#3742)

* [ioctl] Build contract compile command line into new ioctl (#3676)

* [ioctl] build contract compile command line into new ioctl

Co-authored-by: huof6890 <68298506@qq.com>

* [config] move config.API to api package (#3739)

* move config.GasStation to gasstation package

* move config.API to api package

* make fields of testConfig  to be private

Co-authored-by: CoderZhi <thecoderzhi@gmail.com>

* complete web3 intergrity test (#3743)

* complete tests

* complete requires

* format

* init monitor message framework

* [ioctl/newcmd] fix node delegate run failed  (#3729)

* fix grpc error and show right datas

* check chainMeta.Epoch

* modify as currEpochNum

* init broadcast framework

* update broadcast framework

* update broadcast framework

* [ioctl] Build contract test bytecode command line into new ioctl (#3738)

* [ioctl] build contract test bytecode command line into new ioctl

* build unittest to cover the modification

* format

Co-authored-by: huofei <68298506@qq.com>

* [ioctl] Build contract prepare command line into new ioctl (#3737)

* [ioctl] build contract prepare command line into new ioctl

* build unittest to cover the modification

* fix commit

* update assert message

* update solc version

* update solc message version

* format

* brew install solidity

Co-authored-by: huofei <68298506@qq.com>

* add node package to handle node info manager

* update

* Update release.yaml

* Revert "adding .dockerignore file to fix git submodule builds (#3689)" (#3750)

This reverts commit c14dcca.

Co-authored-by: Jeremi [IoTeX] Rynkiewicz JRPC <63042547+jrynkiew@users.noreply.github.com>

* update docker build command (#3751)

* [actpool] Improve actqueue efficiency (#3377)

* opt actpool.Add()

* improve actqueue efficiency

* add node info request and response message

* remove delegate manager dependency

* add message sign

* add sign for node info message

* fix unittest error

* Update CODEOWNERS (#3754)

* [rewarding] add active web3 rewarding settings (#3740)

* add active web3 rewarding settings

* check active when encoding is web3

* check active with deposit action

* remove check logic to workingset

* add check in API module

* fix check validte web3 rewarding bug

Co-authored-by: Haaai <55118568+Liuhaai@users.noreply.github.com>

* add unittest for node

* add pubkey in nodeinfo message

* fix compile error

* update go.mod

Co-authored-by: millken <millken@gmail.com>
Co-authored-by: huofei <68298506@qq.com>
Co-authored-by: dustinxie <dahuaxie@gmail.com>
Co-authored-by: Xueping Yang <xueping.yang@gmail.com>
Co-authored-by: xianhuawei <258022429@qq.com>
Co-authored-by: Jeremy Chou <lucky90322@gmail.com>
Co-authored-by: Haaai <55118568+Liuhaai@users.noreply.github.com>
Co-authored-by: CoderZhi <thecoderzhi@gmail.com>
Co-authored-by: Jeremi [IoTeX] Rynkiewicz JRPC <63042547+jrynkiew@users.noreply.github.com>
  • Loading branch information
10 people authored Jan 12, 2023
1 parent 2476e19 commit 849e9bc
Show file tree
Hide file tree
Showing 694 changed files with 6,788 additions and 4,059 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

19 changes: 19 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,22 @@

# These owners will be the default owners for everything in the repo.
* @iotexproject/protocol-team

#Specific owners
/consensus/ @CoderZhi
/ioctl/ @huof6829 @CoderZhi
/api/ @Liuhaai @millken @CoderZhi
/config/ @dustinxie @CoderZhi
/p2p/ @Liuhaai @dustinxie

/action/ @CoderZhi @dustinxie
/blockchain/ @CoderZhi @dustinxie
/blockindex/ @CoderZhi @dustinxie
/crypto/ @CoderZhi @dustinxie
/db/ @CoderZhi @dustinxie
/dispatcher/ @CoderZhi @dustinxie
/pkg/ @dustinxie
/server/ @CoderZhi @dustinxie
/state/ @CoderZhi @dustinxie
/actpool/ @CoderZhi @Liuhaai
/.github/workflows @dustinxie @xianhuawei
89 changes: 72 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release
name: Release

on:
push:
tags:
- 'v*'
- "v*"

jobs:
build:
Expand All @@ -14,13 +14,13 @@ jobs:
include:
- os: ubuntu-latest
artifact_name: ioctl-linux-amd64
asset_name: ioctl-linux-amd64
server_artifact_name: iotex-core-linux-amd64
- os: windows-latest
artifact_name: ioctl-windows-amd64.exe
asset_name: ioctl-windows-amd64.exe
server_artifact_name: iotex-core-windows-amd64.exe
- os: macos-latest
artifact_name: ioctl-darwin-amd64
asset_name: ioctl-darwin-amd64
server_artifact_name: iotex-core-darwin-amd64
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -30,20 +30,75 @@ jobs:
with:
go-version: 1.18.5

- name: make ioctl
- name: make iotex-server/ioctl
if: startsWith(matrix.os, 'windows-latest') != true
run: |
set CGO_ENABLED=1
set GOARCH=amd64
go build -tags netgo -o ./${{ matrix.artifact_name }} -v ./tools/ioctl
# - uses: release-drafter/release-drafter@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload binaries to release
make build
- name: make iotex-server/ioctl windows
if: startsWith(matrix.os, 'windows-latest')
run: |
make ioctl
- name: Upload iotex-core binaries to release
if: startsWith(matrix.os, 'windows-latest') != true
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./bin/server
asset_name: ${{ matrix.server_artifact_name }}
tag: ${{ github.ref }}

- name: Configure iotex-core GPG Linux/MacOS
if: startsWith(matrix.os, 'windows-latest') != true
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
export GPG_TTY=$(tty)
echo "$GPG_SIGNING_KEY" | gpg --batch --import
echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab ./bin/server
- name: Upload iotex-core signature
if: startsWith(matrix.os, 'windows-latest') != true
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: ${{ matrix.server_artifact_name }}.asc
file: ./bin/server.asc
tag: ${{ github.ref }}

- name: Upload ioctl binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./bin/ioctl
asset_name: ${{ matrix.artifact_name }}
tag: ${{ github.ref }}

- name: Configure ioctl GPG Linux/MacOS
if: startsWith(matrix.os, 'windows-latest') != true
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
export GPG_TTY=$(tty)
echo "$GPG_SIGNING_KEY" | gpg --batch --import
echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab ./bin/ioctl
- name: Configure ioctl GPG Windows
if: startsWith(matrix.os, 'windows-latest')
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo $env:GPG_SIGNING_KEY | gpg --batch --import
gpg --passphrase "$env:GPG_PASSPHRASE" --batch --pinentry-mode loopback -ab ./bin/ioctl
- name: Upload ioctl signature
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
asset_name: ${{ matrix.artifact_name }}.asc
file: ./bin/ioctl.asc
tag: ${{ github.ref }}
23 changes: 0 additions & 23 deletions CODEOWNERS

This file was deleted.

7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
########################################################################################################################
# Copyright (c) 2019 IoTeX Foundation
# This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
# warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
# permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
# License 2.0 that can be found in the LICENSE file.
# This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
# or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
# This source code is governed by Apache License 2.0 that can be found in the LICENSE file.
########################################################################################################################

# Go parameters
Expand Down
7 changes: 3 additions & 4 deletions action/actctx.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand Down
7 changes: 3 additions & 4 deletions action/action.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand Down
7 changes: 3 additions & 4 deletions action/action_deserializer.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2022 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand Down
7 changes: 3 additions & 4 deletions action/action_deserializer_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2022 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand Down
7 changes: 3 additions & 4 deletions action/action_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand Down
37 changes: 32 additions & 5 deletions action/builder.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

Expand All @@ -23,7 +22,8 @@ type Builder struct {
}

var (
_stakingProtocolAddr, _ = address.FromString(address.StakingProtocolAddr)
_stakingProtocolAddr, _ = address.FromString(address.StakingProtocolAddr)
_rewardingProtocolAddr, _ = address.FromString(address.RewardingProtocol)
)

// SetVersion sets action's version.
Expand Down Expand Up @@ -203,6 +203,20 @@ func (b *EnvelopeBuilder) BuildStakingAction(tx *types.Transaction) (Envelope, e
return b.build(), nil
}

// BuildRewardingAction loads rewarding action into envelope from abi-encoded data
func (b *EnvelopeBuilder) BuildRewardingAction(tx *types.Transaction) (Envelope, error) {
if !bytes.Equal(tx.To().Bytes(), _rewardingProtocolAddr.Bytes()) {
return nil, ErrInvalidAct
}
b.setEnvelopeCommonFields(tx)
act, err := newRewardingActionFromABIBinary(tx.Data())
if err != nil {
return nil, err
}
b.elp.payload = act
return b.build(), nil
}

func newStakingActionFromABIBinary(data []byte) (actionPayload, error) {
if len(data) <= 4 {
return nil, ErrInvalidABI
Expand Down Expand Up @@ -236,3 +250,16 @@ func newStakingActionFromABIBinary(data []byte) (actionPayload, error) {
}
return nil, ErrInvalidABI
}

func newRewardingActionFromABIBinary(data []byte) (actionPayload, error) {
if len(data) <= 4 {
return nil, ErrInvalidABI
}
if act, err := NewClaimFromRewardingFundFromABIBinary(data); err == nil {
return act, nil
}
if act, err := NewDepositToRewardingFundFromABIBinary(data); err == nil {
return act, nil
}
return nil, ErrInvalidABI
}
48 changes: 44 additions & 4 deletions action/builder_test.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright (c) 2019 IoTeX Foundation
// This is an alpha (internal) release and is not suitable for production. This source code is provided 'as is' and no
// warranties are given as to title or non-infringement, merchantability or fitness for purpose and, to the extent
// permitted by law, all liability for your use of the code is disclaimed. This source code is governed by Apache
// License 2.0 that can be found in the LICENSE file.
// This source code is provided 'as is' and no warranties are given as to title or non-infringement, merchantability
// or fitness for purpose and, to the extent permitted by law, all liability for your use of the code is disclaimed.
// This source code is governed by Apache License 2.0 that can be found in the LICENSE file.

package action

import (
"encoding/hex"
"math/big"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/iotexproject/iotex-core/pkg/version"
)
Expand All @@ -28,3 +31,40 @@ func TestActionBuilder(t *testing.T) {
assert.Equal(t, uint64(10003), act.GasLimit())
assert.Equal(t, big.NewInt(10004), act.GasPrice())
}

func TestBuildRewardingAction(t *testing.T) {
r := require.New(t)

eb := &EnvelopeBuilder{}
eb.SetChainID(2)

claimData, _ := hex.DecodeString("2df163ef000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000")
tx := types.NewTransaction(1, common.HexToAddress("0x0000000000000000000000000000000000000001"), big.NewInt(100), 10000, big.NewInt(10004), claimData)

env, err := eb.BuildRewardingAction(tx)
r.Nil(env)
r.EqualValues("invalid action type", err.Error())

tx = types.NewTransaction(1, common.HexToAddress(_rewardingProtocolAddr.Hex()), big.NewInt(100), 10000, big.NewInt(10004), claimData)
env, err = eb.BuildRewardingAction(tx)
r.Nil(err)
r.IsType(&ClaimFromRewardingFund{}, env.Action())
r.EqualValues(big.NewInt(10004), env.GasPrice())
r.EqualValues(10000, env.GasLimit())
r.EqualValues(big.NewInt(101), env.Action().(*ClaimFromRewardingFund).Amount())

depositData, _ := hex.DecodeString("27852a6b000000000000000000000000000000000000000000000000000000000000006500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003")
tx = types.NewTransaction(1, common.HexToAddress("0x0000000000000000000000000000000000000001"), big.NewInt(100), 10000, big.NewInt(10004), depositData)

env, err = eb.BuildRewardingAction(tx)
r.Nil(env)
r.EqualValues("invalid action type", err.Error())

tx = types.NewTransaction(1, common.HexToAddress(_rewardingProtocolAddr.Hex()), big.NewInt(100), 10000, big.NewInt(10004), depositData)
env, err = eb.BuildRewardingAction(tx)
r.Nil(err)
r.IsType(&DepositToRewardingFund{}, env.Action())
r.EqualValues(big.NewInt(10004), env.GasPrice())
r.EqualValues(10000, env.GasLimit())
r.EqualValues(big.NewInt(101), env.Action().(*DepositToRewardingFund).Amount())
}
Loading

0 comments on commit 849e9bc

Please sign in to comment.