Skip to content
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
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ all:
test: all
$(GORUN) build/ci.go test

<<<<<<< HEAD
#? test-oasys: Run Oasys consensus tests
test-oasys:
go test -v ./consensus/oasys/...

=======
#? lint: Run certain pre-selected linters
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164
lint: ## Run linters.
$(GORUN) build/ci.go lint

Expand Down
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<<<<<<< HEAD
![logo1](https://user-images.githubusercontent.com/107421475/227834490-3a3a9834-21a8-4079-8166-f6fe571d6b8d.png)
# Oasys Validator
Validator client for Oasys. Forked from go ethereum.
=======
## Go Ethereum

Golang execution layer implementation of the Ethereum protocol.
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164

[![API Reference](
https://pkg.go.dev/badge/github.com/ethereum/go-ethereum
)](https://pkg.go.dev/github.com/ethereum/go-ethereum?tab=doc)
[![Go Report Card](https://goreportcard.com/badge/github.com/ethereum/go-ethereum)](https://goreportcard.com/report/github.com/ethereum/go-ethereum)
<<<<<<< HEAD
[![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/oasysgames)
=======
[![Travis](https://app.travis-ci.com/ethereum/go-ethereum.svg?branch=master)](https://app.travis-ci.com/github/ethereum/go-ethereum)
[![Discord](https://img.shields.io/badge/discord-join%20chat-blue.svg)](https://discord.gg/nthXNEv)
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164

Automated builds are available for stable releases and the unstable master branch. Binary
archives are published at https://github.com/oasysgames/oasys-validator/releases.
Expand Down
3 changes: 2 additions & 1 deletion consensus/oasys/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
"github.com/holiman/uint256"
)

const (
Expand Down Expand Up @@ -796,7 +797,7 @@ func applyMessage(
*msg.To(),
msg.Data(),
msg.Gas(),
msg.Value(),
uint256.MustFromBig(msg.Value()),
)
if err != nil {
log.Error("failed apply message", "msg", string(ret), "err", err)
Expand Down
4 changes: 2 additions & 2 deletions consensus/oasys/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,11 @@ func makeEnv(wallet accounts.Wallet, account accounts.Account) (*testEnv, error)
}

// Generate StateDB
_, _, statedb := tests.MakePreState(db, genspec.Alloc, false, rawdb.HashScheme)
stateTestState := tests.MakePreState(db, genspec.Alloc, false, rawdb.HashScheme)

// Replace artifact bytecode
environment.artifact.DeployedBytecode = fmt.Sprintf("0x%s", hex.EncodeToString(genspec.Alloc[_environmentAddress].Code))
stakeManager.artifact.DeployedBytecode = fmt.Sprintf("0x%s", hex.EncodeToString(genspec.Alloc[_stakeManagerAddress].Code))

return &testEnv{engine, chain, statedb}, nil
return &testEnv{engine, chain, stateTestState.StateDB}, nil
}
3 changes: 2 additions & 1 deletion consensus/oasys/oasys.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/trie"
lru "github.com/hashicorp/golang-lru"
"github.com/holiman/uint256"
"github.com/prysmaticlabs/prysm/v5/crypto/bls"
"github.com/willf/bitset"
"golang.org/x/crypto/sha3"
Expand Down Expand Up @@ -1494,7 +1495,7 @@ func (c *Oasys) addBalanceToStakeManager(state *state.StateDB, hash common.Hash,
return nil
}

state.AddBalance(stakeManager.address, rewards)
state.AddBalance(stakeManager.address, uint256.MustFromBig(rewards))
log.Info("Balance added to stake manager", "hash", hash, "amount", rewards.String())
return nil
}
Expand Down
13 changes: 10 additions & 3 deletions eth/protocols/eth/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,16 @@ func (p *Peer) announceTransactions() {
if len(pending) > 0 {
done = make(chan struct{})
go func() {
if err := p.sendPooledTransactionHashes(pending, pendingTypes, pendingSizes); err != nil {
fail <- err
return
if p.version >= ETH68 {
if err := p.sendPooledTransactionHashes(pending, pendingTypes, pendingSizes); err != nil {
fail <- err
return
}
} else {
if err := p.sendPooledTransactionHashes66(pending); err != nil {
fail <- err
return
}
}
close(done)
p.Log().Trace("Sent transaction announcements", "count", len(pending))
Expand Down
5 changes: 4 additions & 1 deletion eth/protocols/eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ type TxPool interface {
func MakeProtocols(backend Backend, network uint64, dnsdisc enode.Iterator) []p2p.Protocol {
protocols := make([]p2p.Protocol, 0, len(ProtocolVersions))
for _, version := range ProtocolVersions {
// Blob transactions require eth/68 announcements, disable everything else
if version <= ETH67 && backend.Chain().Config().CancunTime != nil {
continue
}
version := version // Closure

protocols = append(protocols, p2p.Protocol{
Expand Down Expand Up @@ -209,7 +213,6 @@ func handleMessage(backend Backend, peer *Peer) error {
if peer.Version() >= ETH68 {
handlers = eth68
}

// Track the amount of time it takes to serve the request and run the handler
if metrics.Enabled {
h := fmt.Sprintf("%s/%s/%d/%#02x", p2p.HandleHistName, ProtocolName, peer.Version(), msg.Code)
Expand Down
17 changes: 17 additions & 0 deletions eth/protocols/eth/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,23 @@ func handleReceipts(backend Backend, msg Decoder, peer *Peer) error {
}, metadata)
}

func handleNewPooledTransactionHashes67(backend Backend, msg Decoder, peer *Peer) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eth v67をサポートするもろもろの変更

Copy link
Collaborator

Choose a reason for hiding this comment

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

ETH67のサポート必要でしょうか?[email protected][email protected]共にETH68のみの様ですが。念の為メインネットRPCノードを確認しましたがバージョン68のピアしかいません。

root@rpc01:~# sudo -u geth geth attach -exec 'admin.peers.map(x => x.protocols.eth.version)'
[68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68]

// New transaction announcement arrived, make sure we have
// a valid and fresh chain to handle them
if !backend.AcceptTxs() {
return nil
}
ann := new(NewPooledTransactionHashesPacket67)
if err := msg.Decode(ann); err != nil {
return fmt.Errorf("%w: message %v: %v", errDecode, msg, err)
}
// Schedule all the unknown hashes for retrieval
for _, hash := range *ann {
peer.markTransaction(hash)
}
return backend.Handle(peer, ann)
}

func handleNewPooledTransactionHashes(backend Backend, msg Decoder, peer *Peer) error {
// New transaction announcement arrived, make sure we have
// a valid and fresh chain to handle them
Expand Down
12 changes: 12 additions & 0 deletions eth/protocols/eth/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,18 @@ func (p *Peer) AsyncSendTransactions(hashes []common.Hash) {
}
}

// sendPooledTransactionHashes66 sends transaction hashes to the peer and includes
// them in its transaction hash set for future reference.
//
// This method is a helper used by the async transaction announcer. Don't call it
// directly as the queueing (memory) and transmission (bandwidth) costs should
// not be managed directly.
func (p *Peer) sendPooledTransactionHashes66(hashes []common.Hash) error {
// Mark all the transactions as known, but ensure we don't overflow our limits
p.knownTxs.Add(hashes...)
return p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket67(hashes))
}

// sendPooledTransactionHashes sends transaction hashes (tagged with their type
// and size) to the peer and includes them in its transaction hash set for future
// reference.
Expand Down
9 changes: 7 additions & 2 deletions eth/protocols/eth/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ type ReceiptsRLPPacket struct {
ReceiptsRLPResponse
}

// NewPooledTransactionHashesPacket67 represents a transaction announcement packet on eth/67.
type NewPooledTransactionHashesPacket67 []common.Hash

// NewPooledTransactionHashesPacket represents a transaction announcement packet on eth/68 and newer.
type NewPooledTransactionHashesPacket struct {
Types []byte
Expand Down Expand Up @@ -343,8 +346,10 @@ func (*BlockBodiesResponse) Kind() byte { return BlockBodiesMsg }
func (*NewBlockPacket) Name() string { return "NewBlock" }
func (*NewBlockPacket) Kind() byte { return NewBlockMsg }

func (*NewPooledTransactionHashesPacket) Name() string { return "NewPooledTransactionHashes" }
func (*NewPooledTransactionHashesPacket) Kind() byte { return NewPooledTransactionHashesMsg }
func (*NewPooledTransactionHashesPacket67) Name() string { return "NewPooledTransactionHashes" }
func (*NewPooledTransactionHashesPacket67) Kind() byte { return NewPooledTransactionHashesMsg }
func (*NewPooledTransactionHashesPacket) Name() string { return "NewPooledTransactionHashes" }
func (*NewPooledTransactionHashesPacket) Kind() byte { return NewPooledTransactionHashesMsg }

func (*GetPooledTransactionsRequest) Name() string { return "GetPooledTransactions" }
func (*GetPooledTransactionsRequest) Kind() byte { return GetPooledTransactionsMsg }
Expand Down
30 changes: 2 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ require (
github.com/gorilla/websocket v1.5.1
github.com/graph-gophers/graphql-go v1.3.0
github.com/hashicorp/go-bexpr v0.1.10
<<<<<<< HEAD
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/holiman/billy v0.0.0-20230718173358-1c7e68d277a7
=======
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164
github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.2.4
github.com/huin/goupnp v1.3.0
Expand Down Expand Up @@ -75,17 +71,10 @@ require (
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.3
github.com/willf/bitset v1.1.3
go.uber.org/automaxprocs v1.5.2
<<<<<<< HEAD
golang.org/x/crypto v0.19.0
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
golang.org/x/sync v0.6.0
golang.org/x/sys v0.17.0
=======
golang.org/x/crypto v0.17.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
golang.org/x/sync v0.5.0
golang.org/x/sys v0.16.0
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164
golang.org/x/text v0.14.0
golang.org/x/time v0.5.0
golang.org/x/tools v0.18.0
Expand Down Expand Up @@ -131,20 +120,15 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ferranbt/fastssz v0.0.0-20210120143747-11b9eff30ea9 // indirect
github.com/flynn/noise v1.1.0 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
<<<<<<< HEAD
github.com/getsentry/sentry-go v0.25.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.13.0 // indirect
=======
github.com/go-ole/go-ole v1.3.0 // indirect
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/goccy/go-json v0.10.2 // indirect
Expand Down Expand Up @@ -172,7 +156,6 @@ require (
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a // indirect
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
<<<<<<< HEAD
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
Expand Down Expand Up @@ -202,16 +185,7 @@ require (
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
=======
github.com/klauspost/compress v1.15.15 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // 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/minio/sha256-simd v1.0.0 // indirect
>>>>>>> c5ba367eb6232e3eddd7d6226bfd374449c63164
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Copy link
Contributor Author

@tak1827 tak1827 Oct 17, 2024

Choose a reason for hiding this comment

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

後述のgo-eth2-types/[email protected]が使ってる。BSCのマスターも使っていた。

github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand Down Expand Up @@ -265,7 +239,7 @@ require (
github.com/trailofbits/go-mutexasserts v0.0.0-20230328101604-8cdbc5f3d279 // indirect
github.com/uber/jaeger-client-go v2.25.0+incompatible // indirect
github.com/wealdtech/go-bytesutil v1.1.1 // indirect
github.com/wealdtech/go-eth2-types/v2 v2.5.2 // indirect
github.com/wealdtech/go-eth2-types/v2 v2.7.0 // indirect
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BSCがフォークしたgithub.com/bnb-chain/fastsszの使用を避けるために、上げざるを得なかった。

github.com/wealdtech/go-eth2-util v1.6.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
Expand Down
Loading