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

broadcast node's height info into p2p network #3758

Merged
merged 46 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3a231c3
move IsValidCandidateName to action package (#3706)
millken Dec 8, 2022
db2969c
Remove stale comment "This is an alpha release and is not ...." in al…
huof6829 Dec 14, 2022
5d3910b
remove nonce field (#3714)
huof6829 Dec 16, 2022
4149d95
[evm] proper handle refundSnapshot and upgrade go-ethereum release (#…
dustinxie Dec 19, 2022
3ed15c6
[ioctl] modify did command parameters (#3668)
huof6829 Dec 20, 2022
83548f2
use config.GasStation instead of config.API #3718 (#3721)
envestcc Dec 20, 2022
1ea076c
[genesis] set Okhotsk to activate at 01-11-2023 12am UTC (#3720)
dustinxie Dec 20, 2022
09ece37
[tests] add more cases for gas refund (#3707)
millken Dec 21, 2022
308c59d
[api] web3 rewarding action (#3691)
ququzone Dec 22, 2022
ef48257
update mockgen (#3733)
dustinxie Dec 23, 2022
6d507a2
[ioctl] use candidate.OperatorAddress to show probated delegates (#3727)
huof6829 Dec 24, 2022
027edc8
[config] move config.Consensus to consensus package (#3735)
dustinxie Dec 24, 2022
4d2ee17
[action] validate candidate name (#3705)
millken Dec 27, 2022
22c21bb
Update release.yaml
Dec 27, 2022
ba5fe4a
[config] move config.Blocksync to blocksync package (#3736)
envestcc Dec 27, 2022
de9bd7a
[ioctl] Build contract deploy command line into new ioctl (#3708)
LuckyPigeon Dec 27, 2022
14a7168
[ioctl] Build contract invoke command line into new ioctl (#3709)
LuckyPigeon Dec 27, 2022
3f4e6b9
[github] Update codeowner (#3742)
Liuhaai Dec 28, 2022
a446944
[ioctl] Build contract compile command line into new ioctl (#3676)
LuckyPigeon Dec 28, 2022
16bc04b
[config] move config.API to api package (#3739)
envestcc Dec 29, 2022
6a93361
complete web3 intergrity test (#3743)
huof6829 Dec 29, 2022
2412217
init monitor message framework
envestcc Dec 29, 2022
b56a665
[ioctl/newcmd] fix node delegate run failed (#3729)
huof6829 Dec 30, 2022
0f70388
init broadcast framework
envestcc Dec 30, 2022
5507558
update broadcast framework
envestcc Dec 30, 2022
47e97d5
update broadcast framework
envestcc Dec 30, 2022
35c8528
[ioctl] Build contract test bytecode command line into new ioctl (#3738)
LuckyPigeon Dec 30, 2022
7371c44
[ioctl] Build contract prepare command line into new ioctl (#3737)
LuckyPigeon Dec 30, 2022
935f9cc
add node package to handle node info manager
envestcc Jan 3, 2023
3ecc432
update
envestcc Jan 3, 2023
fedf9aa
Update release.yaml
Jan 4, 2023
8898cfd
Revert "adding .dockerignore file to fix git submodule builds (#3689)…
dustinxie Jan 5, 2023
52cd6b1
update docker build command (#3751)
envestcc Jan 5, 2023
902ebe7
[actpool] Improve actqueue efficiency (#3377)
Liuhaai Jan 5, 2023
1090b2a
add node info request and response message
envestcc Jan 6, 2023
6eb404d
remove delegate manager dependency
envestcc Jan 6, 2023
98884a2
add message sign
envestcc Jan 9, 2023
eb56750
add sign for node info message
envestcc Jan 10, 2023
37af551
fix unittest error
envestcc Jan 10, 2023
553e501
Update CODEOWNERS (#3754)
CoderZhi Jan 10, 2023
abcb5c8
[rewarding] add active web3 rewarding settings (#3740)
ququzone Jan 10, 2023
96d185a
add unittest for node
envestcc Jan 11, 2023
5c0b500
add pubkey in nodeinfo message
envestcc Jan 11, 2023
b15fea7
Merge branch 'master' into monitor_msg
envestcc Jan 11, 2023
6e191c6
fix compile error
envestcc Jan 11, 2023
4660879
update go.mod
envestcc Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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.

6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ COPY go.sum .
RUN go mod download

COPY . .

ARG PACKAGE_VERSION
ARG PACKAGE_COMMIT_ID
ARG GIT_STATUS
RUN mkdir -p $GOPATH/pkg/linux_amd64/github.com/iotexproject/ && \
make clean build-all
PACKAGE_VERSION=$PACKAGE_VERSION PACKAGE_COMMIT_ID=$PACKAGE_COMMIT_ID GIT_STATUS=$GIT_STATUS make clean build-all

FROM alpine

Expand Down
17 changes: 11 additions & 6 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 Expand Up @@ -38,13 +37,19 @@ ROOT_PKG := "github.com/iotexproject/iotex-core"
DOCKERCMD=docker

# Package Info
ifndef PACKAGE_VERSION
PACKAGE_VERSION := $(shell git describe --tags)
endif
ifndef PACKAGE_COMMIT_ID
PACKAGE_COMMIT_ID := $(shell git rev-parse HEAD)
endif
ifndef GIT_STATUS
GIT_STATUS := $(shell git status --porcelain)
ifdef GIT_STATUS
GIT_STATUS := "dirty"
GIT_STATUS := "dirty"
else
GIT_STATUS := "clean"
GIT_STATUS := "clean"
endif
endif
GO_VERSION := $(shell go version)
BUILD_TIME=$(shell date +%F-%Z/%T)
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