Skip to content

Commit

Permalink
Merge pull request #243 from aergoio/release/2.4.6
Browse files Browse the repository at this point in the history
Release/2.4.6
  • Loading branch information
hayarobi authored Aug 18, 2023
2 parents ed416a1 + e273c52 commit 712317e
Show file tree
Hide file tree
Showing 415 changed files with 1,590 additions and 1,601 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()

add_custom_target(build ALL DEPENDS aergocli aergosvr aergoluac brick)

add_custom_target(aergocli GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/cmd/aergocli/cmd.githash=`git describe --tags`\" ./cmd/aergocli/...
add_custom_target(aergocli GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/v2/cmd/aergocli/cmd.githash=`git describe --tags`\" ./cmd/aergocli/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)

Expand All @@ -28,14 +28,14 @@ add_custom_target(aergosvr GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS}
add_custom_target(polaris GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./cmd/polaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})

add_custom_target(colaris GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/cmd/colaris/cmd.githash=`git describe --tags`\" ./cmd/colaris/...
add_custom_target(colaris GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X github.com/aergoio/aergo/v2/cmd/colaris/cmd.githash=`git describe --tags`\" ./cmd/colaris/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})

add_custom_target(aergoluac GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} -ldflags \"-X main.githash=`git describe --tags`\" ./cmd/aergoluac/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)

add_custom_target(brick GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} ${GFLAG} -ldflags \"-X 'github.com/aergoio/aergo/cmd/brick/context.GitHash=`git describe --tags`'
add_custom_target(brick GO111MODULE=on GOBIN=${BIN_DIR} go install ${GCFLAGS} ${GFLAG} -ldflags \"-X 'github.com/aergoio/aergo/v2/cmd/brick/context.GitHash=`git describe --tags`'
-X 'github.com/aergoio/aergo-lib/log.defaultConfStr=`cat ./cmd/brick/arglog.toml`'\" ./cmd/brick/...
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS libtool)
Expand Down
14 changes: 7 additions & 7 deletions account/accountservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (

"github.com/aergoio/aergo-actor/actor"
"github.com/aergoio/aergo-lib/log"
"github.com/aergoio/aergo/account/key"
cfg "github.com/aergoio/aergo/config"
"github.com/aergoio/aergo/contract/name"
"github.com/aergoio/aergo/message"
"github.com/aergoio/aergo/pkg/component"
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/account/key"
cfg "github.com/aergoio/aergo/v2/config"
"github.com/aergoio/aergo/v2/contract/name"
"github.com/aergoio/aergo/v2/message"
"github.com/aergoio/aergo/v2/pkg/component"
"github.com/aergoio/aergo/v2/state"
"github.com/aergoio/aergo/v2/types"
)

type AccountService struct {
Expand Down
6 changes: 3 additions & 3 deletions account/accountservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"

"github.com/aergoio/aergo-lib/db"
"github.com/aergoio/aergo/config"
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/config"
"github.com/aergoio/aergo/v2/state"
"github.com/aergoio/aergo/v2/types"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions account/key/aergo_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"strings"
"sync"

crypto "github.com/aergoio/aergo/account/key/crypto"
"github.com/aergoio/aergo/types"
crypto "github.com/aergoio/aergo/v2/account/key/crypto"
"github.com/aergoio/aergo/v2/types"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion account/key/aergo_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"reflect"
"testing"

crypto "github.com/aergoio/aergo/account/key/crypto"
crypto "github.com/aergoio/aergo/v2/account/key/crypto"
"github.com/btcsuite/btcd/btcec"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion account/key/badgerdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sync"

"github.com/aergoio/aergo-lib/db"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
)

Expand Down
2 changes: 1 addition & 1 deletion account/key/badgerdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"reflect"
"testing"

crypto "github.com/aergoio/aergo/account/key/crypto"
crypto "github.com/aergoio/aergo/v2/account/key/crypto"
"github.com/btcsuite/btcd/btcec"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion account/key/crypto/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"crypto/ecdsa"
"encoding/binary"

"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/types"
)

// GenerateAddress calculates the raw (not-encoded) address for a private key.
Expand Down
2 changes: 1 addition & 1 deletion account/key/crypto/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package key
import (
"testing"

"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion account/key/crypto/v1strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"io"
"reflect"

"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
"golang.org/x/crypto/scrypt"
)
Expand Down
2 changes: 1 addition & 1 deletion account/key/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package key
import (
"encoding/binary"

"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
sha256 "github.com/minio/sha256-simd"
)
Expand Down
4 changes: 2 additions & 2 deletions account/key/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"sync"
"time"

crypto "github.com/aergoio/aergo/account/key/crypto"
"github.com/aergoio/aergo/types"
crypto "github.com/aergoio/aergo/v2/account/key/crypto"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
)

Expand Down
4 changes: 2 additions & 2 deletions account/key/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"sync"
"testing"

crypto "github.com/aergoio/aergo/account/key/crypto"
"github.com/aergoio/aergo/types"
crypto "github.com/aergoio/aergo/v2/account/key/crypto"
"github.com/aergoio/aergo/v2/types"
"github.com/btcsuite/btcd/btcec"
"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 2 additions & 2 deletions account/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package account

import (
"github.com/aergoio/aergo-actor/actor"
"github.com/aergoio/aergo/account/key"
"github.com/aergoio/aergo/message"
"github.com/aergoio/aergo/v2/account/key"
"github.com/aergoio/aergo/v2/message"
)

type Signer struct {
Expand Down
8 changes: 4 additions & 4 deletions chain/blockvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"errors"
"fmt"

"github.com/aergoio/aergo/internal/enc"
"github.com/aergoio/aergo/pkg/component"
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/internal/enc"
"github.com/aergoio/aergo/v2/pkg/component"
"github.com/aergoio/aergo/v2/state"
"github.com/aergoio/aergo/v2/types"
)

type BlockValidator struct {
Expand Down
4 changes: 2 additions & 2 deletions chain/chainanchor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package chain

import (
"github.com/aergoio/aergo/internal/enc"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/internal/enc"
"github.com/aergoio/aergo/v2/types"
)

type ChainAnchor []([]byte)
Expand Down
23 changes: 13 additions & 10 deletions chain/chaindb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"sync/atomic"

"github.com/aergoio/aergo-lib/db"
"github.com/aergoio/aergo/config"
"github.com/aergoio/aergo/consensus"
"github.com/aergoio/aergo/internal/common"
"github.com/aergoio/aergo/internal/enc"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/config"
"github.com/aergoio/aergo/v2/consensus"
"github.com/aergoio/aergo/v2/internal/common"
"github.com/aergoio/aergo/v2/internal/enc"
"github.com/aergoio/aergo/v2/types"
"github.com/golang/protobuf/proto"
)

Expand Down Expand Up @@ -386,7 +386,7 @@ func (cdb *ChainDB) connectToChain(dbtx db.Transaction, block *types.Block, skip
// Save the last consensus status.
if cdb.cc != nil {
if err := cdb.cc.Save(dbtx); err != nil {
logger.Error().Err(err).Msg("failed to save DPoS status")
logger.Error().Err(err).Uint64("blockNo", blockNo).Msg("failed to save DPoS status")
}
}

Expand Down Expand Up @@ -571,11 +571,14 @@ func (cdb *ChainDB) dropBlock(dropNo types.BlockNo) error {
}

func (cdb *ChainDB) getBestBlockNo() (latestNo types.BlockNo) {
var ok bool

aopv := cdb.latest.Load()
if aopv != nil {
latestNo = aopv.(types.BlockNo)
} else {
panic("ChainDB:latest is nil")
if aopv == nil {
logger.Panic().Msg("ChainService: latest is nil")
}
if latestNo, ok = aopv.(types.BlockNo); !ok {
logger.Panic().Msg("ChainService: latest is not types.BlockNo")
}
return latestNo
}
Expand Down
12 changes: 5 additions & 7 deletions chain/chaindbForRaft.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"errors"

"github.com/aergoio/aergo-lib/db"
"github.com/aergoio/aergo/consensus"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/consensus"
"github.com/aergoio/aergo/v2/types"
"github.com/aergoio/etcd/raft/raftpb"
"github.com/golang/protobuf/proto"
)
Expand Down Expand Up @@ -46,7 +46,7 @@ func (cdb *ChainDB) ResetWAL(hardStateInfo *types.HardStateInfo) error {

snapData := consensus.NewSnapshotData(nil, nil, snapBlock)
if snapData == nil {
panic("new snap failed")
logger.Panic().Uint64("SnapBlockNo", snapBlock.BlockNo()).Msg("new snap failed")
}

data, err := snapData.Encode()
Expand Down Expand Up @@ -129,7 +129,6 @@ func (cdb *ChainDB) WriteHardState(hardstate *raftpb.HardState) error {

if data, err = proto.Marshal(hardstate); err != nil {
logger.Panic().Msg("failed to marshal raft state")
return err
}
dbTx.Set(raftStateKey, data)
dbTx.Commit()
Expand All @@ -147,7 +146,6 @@ func (cdb *ChainDB) GetHardState() (*raftpb.HardState, error) {
state := &raftpb.HardState{}
if err := proto.Unmarshal(data, state); err != nil {
logger.Panic().Msg("failed to unmarshal raft state")
return nil, ErrInvalidHardState
}

logger.Info().Uint64("term", state.Term).Str("vote", types.Uint64ToHexaString(state.Vote)).Uint64("commit", state.Commit).Msg("load hard state")
Expand Down Expand Up @@ -199,14 +197,14 @@ func (cdb *ChainDB) WriteRaftEntry(ents []*consensus.WalEntry, blocks []*types.B

if entry.Type == consensus.EntryBlock {
if err := cdb.addBlock(dbTx, blocks[i]); err != nil {
panic("add block entry")
logger.Panic().Err(err).Uint64("BlockNo", blocks[i].BlockNo()).Msg("failed to add block entry")
}

targetNo = blocks[i].BlockNo()
}

if data, err = entry.ToBytes(); err != nil {
panic("failed to convert entry to bytes")
logger.Panic().Err(err).Uint64("BlockNo", blocks[i].BlockNo()).Uint64("index", entry.Index).Msg("failed to convert entry to bytes")
}

lastIdx = entry.Index
Expand Down
16 changes: 8 additions & 8 deletions chain/chainhandle.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"fmt"
"math/big"

"github.com/aergoio/aergo/consensus"
"github.com/aergoio/aergo/contract"
"github.com/aergoio/aergo/contract/name"
"github.com/aergoio/aergo/contract/system"
"github.com/aergoio/aergo/internal/enc"
"github.com/aergoio/aergo/message"
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/consensus"
"github.com/aergoio/aergo/v2/contract"
"github.com/aergoio/aergo/v2/contract/name"
"github.com/aergoio/aergo/v2/contract/system"
"github.com/aergoio/aergo/v2/internal/enc"
"github.com/aergoio/aergo/v2/message"
"github.com/aergoio/aergo/v2/state"
"github.com/aergoio/aergo/v2/types"
"github.com/golang/protobuf/proto"
)

Expand Down
12 changes: 6 additions & 6 deletions chain/chainhandle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"testing"

"github.com/aergoio/aergo-lib/db"
"github.com/aergoio/aergo/account/key"
"github.com/aergoio/aergo/contract"
"github.com/aergoio/aergo/contract/system"
"github.com/aergoio/aergo/internal/common"
"github.com/aergoio/aergo/state"
"github.com/aergoio/aergo/types"
"github.com/aergoio/aergo/v2/account/key"
"github.com/aergoio/aergo/v2/contract"
"github.com/aergoio/aergo/v2/contract/system"
"github.com/aergoio/aergo/v2/internal/common"
"github.com/aergoio/aergo/v2/state"
"github.com/aergoio/aergo/v2/types"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading

0 comments on commit 712317e

Please sign in to comment.