Skip to content

Commit

Permalink
chainconfig: add Shillin and Antenna hardfork on mainnet (#365)
Browse files Browse the repository at this point in the history
* chainconfig: add Shillin and Antenna hardfork on mainnet

* p2p: move ping handling into pingLoop goroutine (#27887)

Moving the response sending there allows tracking all peer goroutines
in the peer WaitGroup.

* params/version: bump Ronin to version 2.6.2

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
minh-bq and fjl authored Oct 4, 2023
1 parent fa1dc18 commit 800ec03
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
9 changes: 7 additions & 2 deletions genesis/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
"consortiumV2Contracts": {
"roninValidatorSet": "0x617c5d73662282EA7FfD231E020eCa6D2B0D552f",
"slashIndicator": "0xEBFFF2b32fA0dF9C5C8C5d5AAa7e8b51d5207bA3",
"stakingContract": "0x545edb750eB8769C868429BE9586F5857A768758"
"stakingContract": "0x545edb750eB8769C868429BE9586F5857A768758",
"profileContract": "0x840EBf1CA767CB690029E91856A357a43B85d035",
"finalityTracking": "0xA30B2932CD8b8A89E34551Cdfa13810af38dA576"
},
"puffyBlock": 0,
"bubaBlock": 0,
"olekBlock": 24935500
"olekBlock": 24935500,
"shillinBlock": 28825400,
"antennaBlock": 28825400,
"whiteListDeployerContractV2Address": "0xc1876d5C4BFAF0eE325E4226B2bdf216D9896AE1"
},
"alloc": {
"0x0000000000000000000000000000000000000011": {
Expand Down
15 changes: 13 additions & 2 deletions p2p/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ type Peer struct {
wg sync.WaitGroup
protoErr chan error
closed chan struct{}
pingRecv chan struct{}
disc chan DiscReason

// events receives message send / receive events if set
Expand Down Expand Up @@ -244,6 +245,7 @@ func newPeer(log log.Logger, conn *conn, protocols []Protocol) *Peer {
disc: make(chan DiscReason),
protoErr: make(chan error, len(protomap)+1), // protocols + pingLoop
closed: make(chan struct{}),
pingRecv: make(chan struct{}, 16),
log: log.New("id", conn.node.ID(), "conn", conn.flags),
}
return p
Expand Down Expand Up @@ -304,9 +306,11 @@ loop:
}

func (p *Peer) pingLoop() {
ping := time.NewTimer(pingInterval)
defer p.wg.Done()

ping := time.NewTimer(pingInterval)
defer ping.Stop()

for {
select {
case <-ping.C:
Expand All @@ -315,6 +319,10 @@ func (p *Peer) pingLoop() {
return
}
ping.Reset(pingInterval)

case <-p.pingRecv:
SendItems(p.rw, pongMsg)

case <-p.closed:
return
}
Expand All @@ -341,7 +349,10 @@ func (p *Peer) handle(msg Msg) error {
switch {
case msg.Code == pingMsg:
msg.Discard()
go SendItems(p.rw, pongMsg)
select {
case p.pingRecv <- struct{}{}:
case <-p.closed:
}
case msg.Code == discMsg:
// This is the last message. We don't need to discard or
// check errors because, the connection will be closed after it.
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const (
VersionMajor = 2 // Major version component of the current release
VersionMinor = 6 // Minor version component of the current release
VersionPatch = 0 // Patch version component of the current release
VersionPatch = 2 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)

Expand Down

0 comments on commit 800ec03

Please sign in to comment.