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

Update go/ethereum to v1.15.5 #145

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

env:
go_version: 1.21
go_version: 1.23
GO111MODULE: on
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GOIMPORTS_CMD=goimports
LINT_SETTINGS=golint,misspell,gocyclo,gocritic,whitespace,goconst,gocognit,bodyclose,unconvert,lll,unparam
ADDLICENSE_INSTALL=go install github.com/google/addlicense@latest
ADDLICENSE_CMD=addlicense
ADDLICENSE_IGNORE=-ignore ".github/**/*" -ignore ".idea/**/*" -ignore .codeflow.yml -ignore "examples/ethereum/*/*/*"
ADDLICENSE_IGNORE=-ignore ".github/**/*" -ignore ".idea/**/*" -ignore .codeflow.yml -ignore salus.yaml -ignore "examples/ethereum/*/*/*"
ADDLICENCE_SCRIPT=${ADDLICENSE_CMD} -c "Coinbase, Inc." -l "apache" -v ${ADDLICENSE_IGNORE}
GOLINES_INSTALL=go install github.com/segmentio/golines@latest
GOLINES_CMD=golines
Expand Down
22 changes: 11 additions & 11 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"net/http"
"strconv"

"github.com/holiman/uint256"

"github.com/coinbase/rosetta-geth-sdk/configuration"
sdkTypes "github.com/coinbase/rosetta-geth-sdk/types"

Expand Down Expand Up @@ -601,20 +603,18 @@ func FlattenTraces(data *Call, flattened []*FlatCall) []*FlatCall {
// https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go#L646-L653
func (ec *SDKClient) miningReward(
currentBlock *big.Int,
) int64 {
) *uint256.Int {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this a uint256 like the newest version of go-ethereum , they switched internally everything to it, @xiaying-peng

if currentBlock.Int64() == int64(0) {
return big.NewInt(0).Int64()
return uint256.NewInt(0)
}

blockReward := ethash.FrontierBlockReward.Int64()
blockReward := ethash.FrontierBlockReward

if ec.P.IsByzantium(currentBlock) {
blockReward = ethash.ByzantiumBlockReward.Int64()
blockReward = ethash.ByzantiumBlockReward
}
if ec.P.IsConstantinople(currentBlock) {
blockReward = ethash.ConstantinopleBlockReward.Int64()
blockReward = ethash.ConstantinopleBlockReward
}

return blockReward
}

Expand All @@ -624,7 +624,7 @@ func (ec *SDKClient) BlockRewardTransaction(
uncles []*EthTypes.Header,
) *RosettaTypes.Transaction {
var ops []*RosettaTypes.Operation
miningReward := ec.miningReward(big.NewInt(blockIdentifier.Index))
miningReward := ec.miningReward(big.NewInt(blockIdentifier.Index)).Uint64()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik this will be totally fine here, and i dont' want to go adn update everything to 256 just to bring in the new go/ethereum version


// https://github.com/ethereum/go-ethereum/blob/
// aaca58a7a1d9acbd24bbc74c49933efa2f1af183/consensus/ethash/consensus.go#L645
Expand All @@ -638,7 +638,7 @@ func (ec *SDKClient) BlockRewardTransaction(
reward := new(big.Float)
uncleReward := float64(numUncles) / sdkTypes.UnclesRewardMultiplier
rewardFloat := reward.Mul(big.NewFloat(uncleReward), big.NewFloat(float64(miningReward)))
rewardInt, _ := rewardFloat.Int64()
rewardInt, _ := rewardFloat.Uint64()
minerReward += rewardInt
}

Expand All @@ -653,7 +653,7 @@ func (ec *SDKClient) BlockRewardTransaction(
Address: MustChecksum(miner),
},
Amount: &RosettaTypes.Amount{
Value: strconv.FormatInt(minerReward, base),
Value: strconv.FormatUint(minerReward, base),
Currency: ec.rosettaConfig.Currency,
},
}
Expand All @@ -667,7 +667,7 @@ func (ec *SDKClient) BlockRewardTransaction(
big.Int,
).Mul(
big.NewInt(uncleBlock+sdkTypes.MaxUncleDepth-blockIdentifier.Index),
big.NewInt(miningReward/sdkTypes.MaxUncleDepth),
new(big.Int).SetUint64(miningReward/sdkTypes.MaxUncleDepth),
)

uncleRewardOp := &RosettaTypes.Operation{
Expand Down
32 changes: 16 additions & 16 deletions examples/ethereum/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const (
// in MainnetNetworkIdentifier.
MainnetNetwork string = "Mainnet"

// GoerliNetwork is the value of the network
// in GoerliNetworkNetworkIdentifier.
GoerliNetwork string = "Goerli"
// HoleskyNetwork is the value of the network
// in HoleskyNetworkNetworkIdentifier.
HoleskyNetwork string = "Holesky"

// SepoliaNetwork is the value of the network
// in SepoliaNetworkNetworkIdentifier.
Expand All @@ -66,8 +66,8 @@ const (
// Mainnet is the Ethereum Mainnet.
Mainnet string = "MAINNET"

// Goerli is the Ethereum Görli testnet.
Goerli string = "GOERLI"
// Holesky is the Ethereum Holesky testnet.
Holesky string = "HOLESKY"

// Sepolia is the Ethereum Sepolia testnet.
Sepolia string = "SEPOLIA"
Expand Down Expand Up @@ -128,8 +128,8 @@ const (
)

var (
// GoerliGethArguments are the arguments to start a goerli geth instance.
GoerliGethArguments = fmt.Sprintf("%s --goerli", MainnetGethArguments)
// HoleskyGethArguments are the arguments to start a holesky geth instance.
HoleskyGethArguments = fmt.Sprintf("%s --holesky", MainnetGethArguments)

// SepoliaGethArguments are the arguments to start a sepolia geth instance.
SepoliaGethArguments = fmt.Sprintf("%s --sepolia", MainnetGethArguments)
Expand All @@ -141,10 +141,10 @@ var (
Index: GenesisBlockIndex,
}

// GoerliGenesisBlockIdentifier is the *types.BlockIdentifier
// of the Goerli genesis block.
GoerliGenesisBlockIdentifier = &types.BlockIdentifier{
Hash: params.GoerliGenesisHash.Hex(),
// HoleskyGenesisBlockIdentifier is the *types.BlockIdentifier
// of the Holesky genesis block.
HoleskyGenesisBlockIdentifier = &types.BlockIdentifier{
Hash: params.HoleskyGenesisHash.Hex(),
Index: GenesisBlockIndex,
}

Expand Down Expand Up @@ -185,14 +185,14 @@ func LoadConfiguration() (*configuration.Configuration, error) {
config.GenesisBlockIdentifier = MainnetGenesisBlockIdentifier
config.ChainConfig = params.MainnetChainConfig
config.GethArguments = MainnetGethArguments
case Goerli:
case Holesky:
config.Network = &types.NetworkIdentifier{
Blockchain: Blockchain,
Network: GoerliNetwork,
Network: HoleskyNetwork,
}
config.GenesisBlockIdentifier = GoerliGenesisBlockIdentifier
config.ChainConfig = params.GoerliChainConfig
config.GethArguments = GoerliGethArguments
config.GenesisBlockIdentifier = HoleskyGenesisBlockIdentifier
config.ChainConfig = params.HoleskyChainConfig
config.GethArguments = HoleskyGethArguments
case Sepolia:
config.Network = &types.NetworkIdentifier{
Blockchain: Blockchain,
Expand Down
117 changes: 50 additions & 67 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,94 +1,77 @@
module github.com/coinbase/rosetta-geth-sdk

go 1.20
go 1.23.7

toolchain go1.24.0

require (
github.com/coinbase/rosetta-sdk-go v0.8.9
github.com/coinbase/rosetta-sdk-go/types v1.0.0
github.com/ethereum/go-ethereum v1.13.8
github.com/hashicorp/golang-lru v0.5.1
github.com/ethereum/go-ethereum v1.15.5
github.com/hashicorp/golang-lru v1.0.2
github.com/neilotoole/errgroup v0.1.6
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.17.0
golang.org/x/sync v0.5.0
github.com/stretchr/testify v1.10.0
golang.org/x/crypto v0.36.0
golang.org/x/sync v0.12.0
)

require (
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/DataDog/zstd v1.5.6 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/bits-and-blooms/bitset v1.21.0 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.8.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f // indirect
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
github.com/cockroachdb/redact v1.0.8 // indirect
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/bavard v0.1.29 // indirect
github.com/consensys/gnark-crypto v0.16.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.3 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gofrs/flock v0.12.1 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/holiman/uint256 v1.3.2
github.com/huin/goupnp v1.3.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pion/dtls/v2 v2.2.12 // indirect
github.com/pion/logging v0.2.3 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.10 // indirect
github.com/pion/transport/v3 v3.0.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.0 // indirect
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/segmentio/fasthash v1.0.3 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/grpc v1.61.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.9.0 // indirect
github.com/wlynxg/anet v0.0.5 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
golang.org/x/exp v0.0.0-20250228200357-dead58393ab7 // indirect
golang.org/x/net v0.36.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/grpc v1.71.0 // indirect
google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading
Loading