Skip to content

Commit

Permalink
[goMod] Upgrade iotex-proto to 0.5.13 (#3799)
Browse files Browse the repository at this point in the history
* upgrade iotex-proto to 0.5.13
  • Loading branch information
dustinxie committed Feb 15, 2023
1 parent 42c13fe commit 23984f0
Show file tree
Hide file tree
Showing 33 changed files with 105 additions and 142 deletions.
4 changes: 2 additions & 2 deletions actpool/actpool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ func TestActPool_GetPendingNonce(t *testing.T) {
require.NoError(acct.AddBalance(big.NewInt(100000000000000000)))

return 0, nil
}).Times(10)
}).Times(9)
sf.EXPECT().Height().Return(uint64(1), nil).AnyTimes()

ctx := genesis.WithGenesisContext(context.Background(), genesis.Default)
Expand Down Expand Up @@ -906,7 +906,7 @@ func TestActPool_GetUnconfirmedActs(t *testing.T) {
require.NoError(acct.AddBalance(big.NewInt(100000000000000000)))

return 0, nil
}).Times(10)
}).Times(8)
sf.EXPECT().Height().Return(uint64(1), nil).AnyTimes()
ctx := genesis.WithGenesisContext(context.Background(), genesis.Default)
require.NoError(ap.Add(ctx, tsf1))
Expand Down
2 changes: 1 addition & 1 deletion api/grpcserver_integrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ func TestGrpcServer_GetEpochMetaIntegrity(t *testing.T) {
} else if test.pollProtocolType == "governanceChainCommittee" {
committee := mock_committee.NewMockCommittee(ctrl)
mbc := mock_blockchain.NewMockBlockchain(ctrl)
mbc.EXPECT().Genesis().Return(cfg.genesis).Times(10)
mbc.EXPECT().Genesis().Return(cfg.genesis).Times(3)
indexer, err := poll.NewCandidateIndexer(db.NewMemKVStore())
require.NoError(err)
slasher, _ := poll.NewSlasher(
Expand Down
17 changes: 9 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/ethereum/go-ethereum v1.10.21
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
github.com/go-redis/redis/v8 v8.11.4
github.com/golang/mock v1.4.4
github.com/golang/mock v1.5.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4
github.com/gorilla/websocket v1.4.2
Expand All @@ -20,7 +20,7 @@ require (
github.com/iotexproject/iotex-address v0.2.8
github.com/iotexproject/iotex-antenna-go/v2 v2.5.1
github.com/iotexproject/iotex-election v0.3.5-0.20210611041425-20ddf674363d
github.com/iotexproject/iotex-proto v0.5.10-0.20220726212046-4fbdc50b0b59
github.com/iotexproject/iotex-proto v0.5.13
github.com/libp2p/go-libp2p-core v0.8.5
github.com/mattn/go-sqlite3 v1.14.8 // indirect
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
Expand All @@ -45,10 +45,10 @@ require (
go.uber.org/config v1.3.1
go.uber.org/zap v1.16.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/net v0.0.0-20220607020251-c690dde0001d
golang.org/x/net v0.3.0
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb
google.golang.org/grpc v1.43.0
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v2 v2.4.0
)
Expand All @@ -58,10 +58,11 @@ require (
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible
github.com/shirou/gopsutil/v3 v3.22.2
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0
golang.org/x/text v0.3.7
golang.org/x/text v0.5.0
)

require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/benbjohnson/clock v1.0.3 // indirect
github.com/beorn7/perks v1.0.1 // indirect
Expand Down Expand Up @@ -191,8 +192,8 @@ require (
go.opentelemetry.io/otel/metric v0.31.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
Expand Down
51 changes: 23 additions & 28 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ioctl/newcmd/account/accountcreateadd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestNewAccountCreateAdd(t *testing.T) {
"bbb": "io1uwnr55vqmhf3xeg5phgurlyl702af6eju542s1",
},
}).Times(4)
client.EXPECT().NewKeyStore().Return(ks).Times(2)
client.EXPECT().NewKeyStore().Return(ks).Times(1)
client.EXPECT().SetAliasAndSave(gomock.Any(), gomock.Any()).Return(nil).Times(2)

t.Run("CryptoSm2 is true", func(t *testing.T) {
Expand Down
4 changes: 0 additions & 4 deletions ioctl/newcmd/account/accountlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ func TestNewAccountList(t *testing.T) {
t.Run("When NewAccountList returns error", func(t *testing.T) {
client.EXPECT().IsCryptoSm2().Return(true)
client.EXPECT().Config().Return(config.Config{}).Times(1)
client.EXPECT().AliasMap().Return(map[string]string{
"io1uwnr55vqmhf3xeg5phgurlyl702af6eju542sx": "a",
"io1uwnr55vqmhf3xeg5phgurlyl702af6eju542s1": "b",
}).Times(2)
expectedErr := errors.New("failed to get sm2 accounts")

cmd := NewAccountList(client)
Expand Down
2 changes: 1 addition & 1 deletion ioctl/newcmd/account/accountsign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestNewAccountSign(t *testing.T) {
})

t.Run("valid_account", func(t *testing.T) {
client.EXPECT().IsCryptoSm2().Return(false).Times(2)
client.EXPECT().IsCryptoSm2().Return(false).Times(1)
const pwd = "test"
acc, _ := ks.NewAccount(pwd)
accAddr, _ := address.FromBytes(acc.Address.Bytes())
Expand Down
38 changes: 17 additions & 21 deletions ioctl/newcmd/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func TestSendRaw(t *testing.T) {
callbackInsecure := func(cb func(*bool, string, bool, string)) {
cb(&test.insecure, "insecure", !test.insecure, "insecure usage")
}
client.EXPECT().SetEndpointWithFlag(gomock.Any()).Do(callbackEndpoint).Times(3)
client.EXPECT().SetInsecureWithFlag(gomock.Any()).Do(callbackInsecure).Times(3)
client.EXPECT().SetEndpointWithFlag(gomock.Any()).Do(callbackEndpoint).AnyTimes()
client.EXPECT().SetInsecureWithFlag(gomock.Any()).Do(callbackInsecure).AnyTimes()

t.Run("sends raw action to blockchain", func(t *testing.T) {
response := &iotexapi.SendActionResponse{}
Expand Down Expand Up @@ -153,11 +153,11 @@ func TestSendAction(t *testing.T) {
Balance: cost.String(),
}}

client.EXPECT().SelectTranslation(gomock.Any()).Return("action", config.English).Times(64)
client.EXPECT().SetEndpointWithFlag(gomock.Any()).Times(8)
client.EXPECT().SetInsecureWithFlag(gomock.Any()).Times(8)
client.EXPECT().IsCryptoSm2().Return(false).Times(15)
client.EXPECT().NewKeyStore().Return(ks).Times(15)
client.EXPECT().SelectTranslation(gomock.Any()).Return("action", config.English).AnyTimes()
client.EXPECT().SetEndpointWithFlag(gomock.Any()).AnyTimes()
client.EXPECT().SetInsecureWithFlag(gomock.Any()).AnyTimes()
client.EXPECT().IsCryptoSm2().Return(false).AnyTimes()
client.EXPECT().NewKeyStore().Return(ks).AnyTimes()

t.Run("failed to get privateKey", func(t *testing.T) {
expectedErr := errors.New("failed to get privateKey")
Expand All @@ -169,19 +169,19 @@ func TestSendAction(t *testing.T) {
})

client.EXPECT().APIServiceClient().Return(apiServiceClient, nil).AnyTimes()
client.EXPECT().ReadSecret().Return(passwd, nil).Times(1)
client.EXPECT().Address(gomock.Any()).Return(accAddr.String(), nil).Times(7)
client.EXPECT().Alias(gomock.Any()).Return("producer", nil).Times(10)
client.EXPECT().ReadInput().Return("confirm", nil)
client.EXPECT().ReadSecret().Return(passwd, nil).AnyTimes()
client.EXPECT().Address(gomock.Any()).Return(accAddr.String(), nil).AnyTimes()
client.EXPECT().Alias(gomock.Any()).Return("producer", nil).AnyTimes()
client.EXPECT().ReadInput().Return("confirm", nil).AnyTimes()
client.EXPECT().AskToConfirm(gomock.Any()).Return(true, nil).Times(2)
client.EXPECT().Config().Return(config.Config{
Explorer: "iotexscan",
Endpoint: "testnet1",
}).Times(11)
}).AnyTimes()

apiServiceClient.EXPECT().GetChainMeta(gomock.Any(), gomock.Any()).Return(chainMetaResponse, nil).Times(6)
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResponse, nil).Times(4)
apiServiceClient.EXPECT().SendAction(gomock.Any(), gomock.Any()).Return(&iotexapi.SendActionResponse{}, nil).Times(4)
apiServiceClient.EXPECT().SendAction(gomock.Any(), gomock.Any()).Return(&iotexapi.SendActionResponse{}, nil).AnyTimes()

t.Run("sends signed action to blockchain", func(t *testing.T) {
cmd := NewActionCmd(client)
Expand Down Expand Up @@ -234,18 +234,16 @@ func TestSendAction(t *testing.T) {
err = SendAction(client, cmd, elp, "hdw::1/2", passwd, 1, false)
require.Contains(err.Error(), expectedErr.Error())
})

t.Run("failed to get chain meta", func(t *testing.T) {
expectedErr := errors.New("failed to get chain meta")
apiServiceClient.EXPECT().GetChainMeta(gomock.Any(), gomock.Any()).Return(nil, expectedErr)
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResponse, nil)
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResponse, nil).AnyTimes()

cmd := NewActionCmd(client)
err = SendAction(client, cmd, elp, accAddr.String(), passwd, 1, false)
require.Contains(err.Error(), expectedErr.Error())
})
}

func TestExecute(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
Expand Down Expand Up @@ -354,16 +352,14 @@ func TestRead(t *testing.T) {
apiServiceClient := mock_iotexapi.NewMockAPIServiceClient(ctrl)
accAddr := identityset.Address(0)
bytecode := "608060405234801561001057600080fd5b506040516040806108018339810180604052810190808051906020019092919080519060200190929190505050816004819055508060058190555050506107a58061005c6000396000f300608060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631249c58b1461007d57806327e235e31461009457806353277879146100eb5780636941b84414610142578063810ad50514610199578063a9059cbb14610223575b600080fd5b34801561008957600080fd5b50610092610270565b005b3480156100a057600080fd5b506100d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610475565b6040518082815260200191505060405180910390f35b3480156100f757600080fd5b5061012c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061048d565b6040518082815260200191505060405180910390f35b34801561014e57600080fd5b50610183600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104a5565b6040518082815260200191505060405180910390f35b3480156101a557600080fd5b506101da600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104bd565b604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390f35b34801561022f57600080fd5b5061026e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610501565b005b436004546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115151561032a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f746f6f20736f6f6e20746f206d696e740000000000000000000000000000000081525060200191505060405180910390fd5b436000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600554600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055503373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fec61728879a33aa50b55e1f4789dcfc1c680f30a24d7b8694a9f874e242a97b46005546040518082815260200191505060405180910390a3565b60016020528060005260406000206000915090505481565b60026020528060005260406000206000915090505481565b60006020528060005260406000206000915090505481565b60036020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154905082565b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156105b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f696e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060408051908101604052803373ffffffffffffffffffffffffffffffffffffffff16815260200182815250600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101559050508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fec61728879a33aa50b55e1f4789dcfc1c680f30a24d7b8694a9f874e242a97b4836040518082815260200191505060405180910390a350505600a165627a7a7230582047e5e1380e66d6b109548617ae59ff7baf70ee2d4a6734559b8fc5cabca0870b0029000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000186a0"
chainMetaResponse := &iotexapi.GetChainMetaResponse{ChainMeta: &iotextypes.ChainMeta{}}

client.EXPECT().SelectTranslation(gomock.Any()).Return("action", config.English).Times(4)
client.EXPECT().SetEndpointWithFlag(gomock.Any()).Times(2)
client.EXPECT().SetInsecureWithFlag(gomock.Any()).Times(2)
client.EXPECT().SelectTranslation(gomock.Any()).Return("action", config.English).AnyTimes()
client.EXPECT().SetEndpointWithFlag(gomock.Any()).AnyTimes()
client.EXPECT().SetInsecureWithFlag(gomock.Any()).AnyTimes()
client.EXPECT().APIServiceClient().Return(apiServiceClient, nil).Times(2)

t.Run("reads smart contract on IoTeX blockchain", func(t *testing.T) {
client.EXPECT().AddressWithDefaultIfNotExist(gomock.Any()).Return("test", nil)
apiServiceClient.EXPECT().GetChainMeta(gomock.Any(), gomock.Any()).Return(chainMetaResponse, nil)
apiServiceClient.EXPECT().ReadContract(gomock.Any(), gomock.Any()).Return(&iotexapi.ReadContractResponse{
Data: "test",
}, nil)
Expand Down
2 changes: 1 addition & 1 deletion ioctl/newcmd/action/actionclaim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestNewActionClaimCmd(t *testing.T) {
client.EXPECT().Config().Return(config.Config{
Explorer: "iotexscan",
Endpoint: "testnet1",
}).Times(10)
}).AnyTimes()

accountResp := &iotexapi.GetAccountResponse{
AccountMeta: &iotextypes.AccountMeta{
Expand Down
2 changes: 1 addition & 1 deletion ioctl/newcmd/action/actiondeposit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestNewActionDepositCmd(t *testing.T) {
client.EXPECT().Config().Return(config.Config{
Explorer: "iotexscan",
Endpoint: "testnet1",
}).Times(10)
}).AnyTimes()

accountResp := &iotexapi.GetAccountResponse{
AccountMeta: &iotextypes.AccountMeta{
Expand Down
2 changes: 1 addition & 1 deletion ioctl/newcmd/action/actionread_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestNewActionReadCmd(t *testing.T) {
apiServiceClient := mock_iotexapi.NewMockAPIServiceClient(ctrl)
addr := identityset.Address(0).String()

client.EXPECT().SelectTranslation(gomock.Any()).Return("mockTranslationString", config.English).Times(36)
client.EXPECT().SelectTranslation(gomock.Any()).Return("mockTranslationString", config.English).AnyTimes()
client.EXPECT().APIServiceClient().Return(apiServiceClient, nil).Times(2)
client.EXPECT().Address(gomock.Any()).Return(addr, nil).Times(3)
client.EXPECT().AddressWithDefaultIfNotExist(gomock.Any()).Return(addr, nil).Times(2)
Expand Down
2 changes: 1 addition & 1 deletion ioctl/newcmd/action/actionsendraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestNewActionSendRawCmd(t *testing.T) {
ctrl := gomock.NewController(t)
client := mock_ioctlclient.NewMockClient(ctrl)
apiServiceClient := mock_iotexapi.NewMockAPIServiceClient(ctrl)
client.EXPECT().SelectTranslation(gomock.Any()).Return("mockTranslationString", config.English).Times(8)
client.EXPECT().SelectTranslation(gomock.Any()).Return("mockTranslationString", config.English).AnyTimes()

t.Run("action send raw", func(t *testing.T) {
client.EXPECT().APIServiceClient().Return(apiServiceClient, nil)
Expand Down
8 changes: 4 additions & 4 deletions ioctl/newcmd/action/actiontransfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func TestNewActionTransferCmd(t *testing.T) {
client.EXPECT().SelectTranslation(gomock.Any()).Return("mockTranslationString", config.English).AnyTimes()
client.EXPECT().Alias(gomock.Any()).Return("producer", nil).Times(10)
client.EXPECT().APIServiceClient().Return(apiServiceClient, nil).AnyTimes()
client.EXPECT().IsCryptoSm2().Return(false).Times(19)
client.EXPECT().ReadSecret().Return("", nil).Times(6)
client.EXPECT().IsCryptoSm2().Return(false).AnyTimes()
client.EXPECT().ReadSecret().Return("", nil).AnyTimes()
client.EXPECT().Address(gomock.Any()).Return(accAddr.String(), nil).Times(17)
client.EXPECT().AddressWithDefaultIfNotExist(gomock.Any()).Return(accAddr.String(), nil).Times(7)
client.EXPECT().NewKeyStore().Return(ks).Times(12)
client.EXPECT().NewKeyStore().Return(ks).AnyTimes()
client.EXPECT().AskToConfirm(gomock.Any()).Return(true, nil).Times(5)
client.EXPECT().Config().Return(config.Config{
Explorer: "iotexscan",
Expand All @@ -61,7 +61,7 @@ func TestNewActionTransferCmd(t *testing.T) {
}
sendActionResp := &iotexapi.SendActionResponse{}
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResp, nil).Times(18)
apiServiceClient.EXPECT().GetChainMeta(gomock.Any(), gomock.Any()).Return(chainMetaResp, nil).Times(6)
apiServiceClient.EXPECT().GetChainMeta(gomock.Any(), gomock.Any()).Return(chainMetaResp, nil).AnyTimes()
apiServiceClient.EXPECT().SendAction(gomock.Any(), gomock.Any()).Return(sendActionResp, nil).Times(5)

t.Run("action transfer", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions ioctl/newcmd/action/stake2withdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestNewStake2WithdrawCmd(t *testing.T) {
client.EXPECT().Config().Return(config.Config{
Explorer: "iotexscan",
Endpoint: "testnet1",
}).Times(10)
}).AnyTimes()

accountResp := &iotexapi.GetAccountResponse{
AccountMeta: &iotextypes.AccountMeta{
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestNewStake2WithdrawCmd(t *testing.T) {
t.Run("failed to get signed address", func(t *testing.T) {
expectedErr := errors.New("failed to get signed address")
client.EXPECT().AddressWithDefaultIfNotExist(gomock.Any()).Return("", expectedErr)
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResp, nil)
apiServiceClient.EXPECT().GetAccount(gomock.Any(), gomock.Any()).Return(accountResp, nil).AnyTimes()

cmd := NewStake2WithdrawCmd(client)
_, err = util.ExecuteCmd(cmd, "10", "--signer", accAddr.String())
Expand Down
Loading

0 comments on commit 23984f0

Please sign in to comment.