Skip to content

Commit 3d640a0

Browse files
authored
Merge pull request #241 from oasisprotocol/tjanez/oasis-core-21.3-block-hash-changes
Update Oasis Core to 21.3.5
2 parents 2b373e2 + bfc29f8 commit 3d640a0

File tree

9 files changed

+595
-82
lines changed

9 files changed

+595
-82
lines changed

.changelog/241.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump Oasis Core to 21.3.5

.changelog/241.internal.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
go: bump github.com/ethereum/go-ethereum to 1.10.9
2+
3+
It fixes a DoS issue via a maliciously crafted p2p message.
4+
For more details, see [GHSA-59hh-656j-3p7v].
5+
6+
[GHSA-59hh-656j-3p7v]: https://github.com/advisories/GHSA-59hh-656j-3p7v

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include common.mk
22

3-
OASIS_RELEASE := 21.2.8
3+
OASIS_RELEASE := 21.3.5
44
ROSETTA_CLI_RELEASE := 0.4.0
55

66
# Check which tool to use for downloading.

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ FROM golang:1.16-alpine3.13 AS build
1313
# Install prerequisites.
1414
RUN rm -f /var/cache/apk/*; apk --no-cache add bash git make gcc g++ libressl-dev libseccomp-dev linux-headers
1515

16-
ARG CORE_BRANCH=v21.2.8
16+
ARG CORE_BRANCH=v21.3.5
1717
ARG CORE_GITHUB=https://github.com/oasisprotocol/oasis-core
1818

1919
ARG GATEWAY_BRANCH=master

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ require (
88
github.com/coinbase/rosetta-cli v0.4.0
99
github.com/coinbase/rosetta-sdk-go v0.3.3
1010
github.com/dgraph-io/badger v1.6.2
11+
github.com/ethereum/go-ethereum v1.10.9 // indirect
1112
github.com/oasisprotocol/ed25519 v0.0.0-20210127160119-f7017427c1ea
12-
github.com/oasisprotocol/oasis-core/go v0.2102.8
13+
github.com/oasisprotocol/oasis-core/go v0.2103.5
1314
github.com/vmihailenco/msgpack/v5 v5.3.4
14-
google.golang.org/grpc v1.39.1
15+
google.golang.org/grpc v1.41.0
1516
)

go.sum

Lines changed: 574 additions & 68 deletions
Large diffs are not rendered by default.

oasis/oasis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ package oasis
22

33
import (
44
"context"
5-
"encoding/hex"
65
"fmt"
76
"os"
87
"sync"
98

109
"google.golang.org/grpc"
1110
"google.golang.org/grpc/connectivity"
1211

12+
"github.com/oasisprotocol/oasis-core/go/common/crypto/hash"
1313
cmnGrpc "github.com/oasisprotocol/oasis-core/go/common/grpc"
1414
"github.com/oasisprotocol/oasis-core/go/common/logging"
1515
consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
@@ -195,7 +195,7 @@ func (c *grpcClient) GetBlock(ctx context.Context, height int64) (*Block, error)
195195
}
196196

197197
parentHeight := blk.Height - 1
198-
var parentHash []byte
198+
var parentHash hash.Hash
199199
if parentHeight <= 0 {
200200
parentHeight = 1
201201
}
@@ -217,10 +217,10 @@ func (c *grpcClient) GetBlock(ctx context.Context, height int64) (*Block, error)
217217

218218
return &Block{
219219
Height: blk.Height,
220-
Hash: hex.EncodeToString(blk.Hash),
220+
Hash: blk.Hash.Hex(),
221221
Timestamp: blk.Time.UnixNano() / 1000000, // ms
222222
ParentHeight: parentHeight,
223-
ParentHash: hex.EncodeToString(parentHash),
223+
ParentHash: parentHash.Hex(),
224224
Epoch: uint64(epoch),
225225
}, nil
226226
}

services/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,13 @@ var (
165165
// NewDetailedError returns a new Rosetta error Code, Message, and Retriable
166166
// set from proto and Details[CauseKey] set from cause.
167167
func NewDetailedError(proto *types.Error, cause error) *types.Error {
168-
module, code, msg := errors.Code(cause)
168+
module, code := errors.Code(cause)
169169
detailedError := *proto
170170
detailedError.Details = map[string]interface{}{
171171
CauseKey: map[string]interface{}{
172172
ModuleKey: module,
173173
CodeKey: code,
174-
MsgKey: msg,
174+
MsgKey: cause.Error(),
175175
},
176176
}
177177
return &detailedError

services/network.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package services
22

33
import (
44
"context"
5-
"encoding/hex"
65
"encoding/json"
76

87
"github.com/coinbase/rosetta-sdk-go/server"
@@ -79,7 +78,7 @@ func (s *networkAPIService) NetworkStatus(
7978

8079
var genesisBlockIdentifierHash string
8180
if len(status.Consensus.GenesisHash) > 0 {
82-
genesisBlockIdentifierHash = hex.EncodeToString(status.Consensus.GenesisHash)
81+
genesisBlockIdentifierHash = status.Consensus.GenesisHash.Hex()
8382
} else {
8483
// If the block is pruned, fill in a dummy value so that users can still get
8584
// other network status instead of erroring out completely.
@@ -90,14 +89,14 @@ func (s *networkAPIService) NetworkStatus(
9089
if len(status.Consensus.LastRetainedHash) > 0 {
9190
oldestBlockIdentifier = &types.BlockIdentifier{
9291
Index: status.Consensus.LastRetainedHeight,
93-
Hash: hex.EncodeToString(status.Consensus.LastRetainedHash),
92+
Hash: status.Consensus.LastRetainedHash.Hex(),
9493
}
9594
}
9695

9796
resp := &types.NetworkStatusResponse{
9897
CurrentBlockIdentifier: &types.BlockIdentifier{
9998
Index: status.Consensus.LatestHeight,
100-
Hash: hex.EncodeToString(status.Consensus.LatestHash),
99+
Hash: status.Consensus.LatestHash.Hex(),
101100
},
102101
CurrentBlockTimestamp: status.Consensus.LatestTime.UnixNano() / 1000000, // ms
103102
GenesisBlockIdentifier: &types.BlockIdentifier{

0 commit comments

Comments
 (0)