forked from cerc-io/plugeth
all: fix some typos (#25551)
* Fix some typos * Fix some mistakes * Revert 4byte.json * Fix an incorrect fix * Change files to fails
This commit is contained in:
+2
-2
@@ -539,7 +539,7 @@ func (api *ConsensusAPI) invalid(err error, latestValid *types.Header) beacon.Pa
|
||||
return beacon.PayloadStatusV1{Status: beacon.INVALID, LatestValidHash: ¤tHash, ValidationError: &errorMsg}
|
||||
}
|
||||
|
||||
// heatbeat loops indefinitely, and checks if there have been beacon client updates
|
||||
// heartbeat loops indefinitely, and checks if there have been beacon client updates
|
||||
// received in the last while. If not - or if they but strange ones - it warns the
|
||||
// user that something might be off with their consensus node.
|
||||
//
|
||||
@@ -649,7 +649,7 @@ func (api *ConsensusAPI) heartbeat() {
|
||||
if eta == 0 {
|
||||
log.Warn(message)
|
||||
} else {
|
||||
log.Warn(message, "eta", common.PrettyAge(time.Now().Add(-eta))) // weird hack, but duration formatted doens't handle days
|
||||
log.Warn(message, "eta", common.PrettyAge(time.Now().Add(-eta))) // weird hack, but duration formatted doesn't handle days
|
||||
}
|
||||
offlineLogged = time.Now()
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ type SyncingResult struct {
|
||||
Status ethereum.SyncProgress `json:"status"`
|
||||
}
|
||||
|
||||
// uninstallSyncSubscriptionRequest uninstalles a syncing subscription in the API event loop.
|
||||
// uninstallSyncSubscriptionRequest uninstalls a syncing subscription in the API event loop.
|
||||
type uninstallSyncSubscriptionRequest struct {
|
||||
c chan interface{}
|
||||
uninstalled chan interface{}
|
||||
|
||||
@@ -236,7 +236,7 @@ func (d *Downloader) findBeaconAncestor() (uint64, error) {
|
||||
// Binary search to find the ancestor
|
||||
start, end := beaconTail.Number.Uint64()-1, number
|
||||
if number := beaconHead.Number.Uint64(); end > number {
|
||||
// This shouldn't really happen in a healty network, but if the consensus
|
||||
// This shouldn't really happen in a healthy network, but if the consensus
|
||||
// clients feeds us a shorter chain as the canonical, we should not attempt
|
||||
// to access non-existent skeleton items.
|
||||
log.Warn("Beacon head lower than local chain", "beacon", number, "local", end)
|
||||
|
||||
@@ -364,7 +364,7 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td, ttd *big.Int,
|
||||
// The beacon header syncer is async. It will start this synchronization and
|
||||
// will continue doing other tasks. However, if synchronization needs to be
|
||||
// cancelled, the syncer needs to know if we reached the startup point (and
|
||||
// inited the cancel cannel) or not yet. Make sure that we'll signal even in
|
||||
// inited the cancel channel) or not yet. Make sure that we'll signal even in
|
||||
// case of a failure.
|
||||
if beaconPing != nil {
|
||||
defer func() {
|
||||
@@ -1461,7 +1461,7 @@ func (d *Downloader) processHeaders(origin uint64, td, ttd *big.Int, beaconMode
|
||||
}
|
||||
d.syncStatsLock.Unlock()
|
||||
|
||||
// Signal the content downloaders of the availablility of new tasks
|
||||
// Signal the content downloaders of the availability of new tasks
|
||||
for _, ch := range []chan bool{d.queue.blockWakeCh, d.queue.receiptWakeCh} {
|
||||
select {
|
||||
case ch <- true:
|
||||
|
||||
@@ -360,7 +360,7 @@ func (dlp *downloadTesterPeer) RequestAccountRange(id uint64, root, origin, limi
|
||||
}
|
||||
|
||||
// RequestStorageRanges fetches a batch of storage slots belonging to one or
|
||||
// more accounts. If slots from only one accout is requested, an origin marker
|
||||
// more accounts. If slots from only one account is requested, an origin marker
|
||||
// may also be used to retrieve from there.
|
||||
func (dlp *downloadTesterPeer) RequestStorageRanges(id uint64, root common.Hash, accounts []common.Hash, origin, limit []byte, bytes uint64) error {
|
||||
// Create the request and service it
|
||||
@@ -399,7 +399,7 @@ func (dlp *downloadTesterPeer) RequestByteCodes(id uint64, hashes []common.Hash,
|
||||
}
|
||||
|
||||
// RequestTrieNodes fetches a batch of account or storage trie nodes rooted in
|
||||
// a specificstate trie.
|
||||
// a specific state trie.
|
||||
func (dlp *downloadTesterPeer) RequestTrieNodes(id uint64, root common.Hash, paths []snap.TrieNodePathSet, bytes uint64) error {
|
||||
req := &snap.GetTrieNodesPacket{
|
||||
ID: id,
|
||||
@@ -571,8 +571,8 @@ func testForkedSync(t *testing.T, protocol uint, mode SyncMode) {
|
||||
assertOwnChain(t, tester, len(chainB.blocks))
|
||||
}
|
||||
|
||||
// Tests that synchronising against a much shorter but much heavyer fork works
|
||||
// corrently and is not dropped.
|
||||
// Tests that synchronising against a much shorter but much heavier fork works
|
||||
// currently and is not dropped.
|
||||
func TestHeavyForkedSync66Full(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, FullSync) }
|
||||
func TestHeavyForkedSync66Snap(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, SnapSync) }
|
||||
func TestHeavyForkedSync66Light(t *testing.T) { testHeavyForkedSync(t, eth.ETH66, LightSync) }
|
||||
|
||||
@@ -47,7 +47,7 @@ type typedQueue interface {
|
||||
|
||||
// capacity is responsible for calculating how many items of the abstracted
|
||||
// type a particular peer is estimated to be able to retrieve within the
|
||||
// alloted round trip time.
|
||||
// allotted round trip time.
|
||||
capacity(peer *peerConnection, rtt time.Duration) int
|
||||
|
||||
// updateCapacity is responsible for updating how many items of the abstracted
|
||||
@@ -58,7 +58,7 @@ type typedQueue interface {
|
||||
// from the download queue to the specified peer.
|
||||
reserve(peer *peerConnection, items int) (*fetchRequest, bool, bool)
|
||||
|
||||
// unreserve is resposible for removing the current retrieval allocation
|
||||
// unreserve is responsible for removing the current retrieval allocation
|
||||
// assigned to a specific peer and placing it back into the pool to allow
|
||||
// reassigning to some other peer.
|
||||
unreserve(peer string) int
|
||||
@@ -190,7 +190,7 @@ func (d *Downloader) concurrentFetch(queue typedQueue, beaconMode bool) error {
|
||||
req, err := queue.request(peer, request, responses)
|
||||
if err != nil {
|
||||
// Sending the request failed, which generally means the peer
|
||||
// was diconnected in between assignment and network send.
|
||||
// was disconnected in between assignment and network send.
|
||||
// Although all peer removal operations return allocated tasks
|
||||
// to the queue, that is async, and we can do better here by
|
||||
// immediately pushing the unfulfilled requests.
|
||||
|
||||
@@ -41,7 +41,7 @@ func (q *bodyQueue) pending() int {
|
||||
}
|
||||
|
||||
// capacity is responsible for calculating how many bodies a particular peer is
|
||||
// estimated to be able to retrieve within the alloted round trip time.
|
||||
// estimated to be able to retrieve within the allotted round trip time.
|
||||
func (q *bodyQueue) capacity(peer *peerConnection, rtt time.Duration) int {
|
||||
return peer.BodyCapacity(rtt)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ func (q *bodyQueue) reserve(peer *peerConnection, items int) (*fetchRequest, boo
|
||||
return q.queue.ReserveBodies(peer, items)
|
||||
}
|
||||
|
||||
// unreserve is resposible for removing the current body retrieval allocation
|
||||
// unreserve is responsible for removing the current body retrieval allocation
|
||||
// assigned to a specific peer and placing it back into the pool to allow
|
||||
// reassigning to some other peer.
|
||||
func (q *bodyQueue) unreserve(peer string) int {
|
||||
|
||||
@@ -41,7 +41,7 @@ func (q *headerQueue) pending() int {
|
||||
}
|
||||
|
||||
// capacity is responsible for calculating how many headers a particular peer is
|
||||
// estimated to be able to retrieve within the alloted round trip time.
|
||||
// estimated to be able to retrieve within the allotted round trip time.
|
||||
func (q *headerQueue) capacity(peer *peerConnection, rtt time.Duration) int {
|
||||
return peer.HeaderCapacity(rtt)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ func (q *headerQueue) reserve(peer *peerConnection, items int) (*fetchRequest, b
|
||||
return q.queue.ReserveHeaders(peer, items), false, false
|
||||
}
|
||||
|
||||
// unreserve is resposible for removing the current header retrieval allocation
|
||||
// unreserve is responsible for removing the current header retrieval allocation
|
||||
// assigned to a specific peer and placing it back into the pool to allow
|
||||
// reassigning to some other peer.
|
||||
func (q *headerQueue) unreserve(peer string) int {
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
// concurrent fetcher and the downloader.
|
||||
type receiptQueue Downloader
|
||||
|
||||
// waker returns a notification channel that gets pinged in case more reecipt
|
||||
// waker returns a notification channel that gets pinged in case more receipt
|
||||
// fetches have been queued up, so the fetcher might assign it to idle peers.
|
||||
func (q *receiptQueue) waker() chan bool {
|
||||
return q.queue.receiptWakeCh
|
||||
@@ -41,7 +41,7 @@ func (q *receiptQueue) pending() int {
|
||||
}
|
||||
|
||||
// capacity is responsible for calculating how many receipts a particular peer is
|
||||
// estimated to be able to retrieve within the alloted round trip time.
|
||||
// estimated to be able to retrieve within the allotted round trip time.
|
||||
func (q *receiptQueue) capacity(peer *peerConnection, rtt time.Duration) int {
|
||||
return peer.ReceiptCapacity(rtt)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ func (q *receiptQueue) reserve(peer *peerConnection, items int) (*fetchRequest,
|
||||
return q.queue.ReserveReceipts(peer, items)
|
||||
}
|
||||
|
||||
// unreserve is resposible for removing the current receipt retrieval allocation
|
||||
// unreserve is responsible for removing the current receipt retrieval allocation
|
||||
// assigned to a specific peer and placing it back into the pool to allow
|
||||
// reassigning to some other peer.
|
||||
func (q *receiptQueue) unreserve(peer string) int {
|
||||
|
||||
@@ -859,7 +859,7 @@ func (q *queue) deliver(id string, taskPool map[common.Hash]*types.Header,
|
||||
if res, stale, err := q.resultCache.GetDeliverySlot(header.Number.Uint64()); err == nil {
|
||||
reconstruct(accepted, res)
|
||||
} else {
|
||||
// else: betweeen here and above, some other peer filled this result,
|
||||
// else: between here and above, some other peer filled this result,
|
||||
// or it was indeed a no-op. This should not happen, but if it does it's
|
||||
// not something to panic about
|
||||
log.Error("Delivery stale", "stale", stale, "number", header.Number.Uint64(), "err", err)
|
||||
|
||||
@@ -51,7 +51,7 @@ const requestHeaders = 512
|
||||
// errSyncLinked is an internal helper error to signal that the current sync
|
||||
// cycle linked up to the genesis block, this the skeleton syncer should ping
|
||||
// the backfiller to resume. Since we already have that logic on sync start,
|
||||
// piggie-back on that instead of 2 entrypoints.
|
||||
// piggy-back on that instead of 2 entrypoints.
|
||||
var errSyncLinked = errors.New("sync linked")
|
||||
|
||||
// errSyncMerged is an internal helper error to signal that the current sync
|
||||
@@ -148,7 +148,7 @@ type backfiller interface {
|
||||
// suspend requests the backfiller to abort any running full or snap sync
|
||||
// based on the skeleton chain as it might be invalid. The backfiller should
|
||||
// gracefully handle multiple consecutive suspends without a resume, even
|
||||
// on initial sartup.
|
||||
// on initial startup.
|
||||
//
|
||||
// The method should return the last block header that has been successfully
|
||||
// backfilled, or nil if the backfiller was not resumed.
|
||||
@@ -209,7 +209,7 @@ type skeleton struct {
|
||||
|
||||
headEvents chan *headUpdate // Notification channel for new heads
|
||||
terminate chan chan error // Termination channel to abort sync
|
||||
terminated chan struct{} // Channel to signal that the syner is dead
|
||||
terminated chan struct{} // Channel to signal that the syncer is dead
|
||||
|
||||
// Callback hooks used during testing
|
||||
syncStarting func() // callback triggered after a sync cycle is inited but before started
|
||||
@@ -553,7 +553,7 @@ func (s *skeleton) initSync(head *types.Header) {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Either we've failed to decode the previus state, or there was none. Start
|
||||
// Either we've failed to decode the previous state, or there was none. Start
|
||||
// a fresh sync with a single subchain represented by the currently sent
|
||||
// chain head.
|
||||
s.progress = &skeletonProgress{
|
||||
@@ -823,7 +823,7 @@ func (s *skeleton) executeTask(peer *peerConnection, req *headerRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
// revertRequests locates all the currently pending reuqests from a particular
|
||||
// revertRequests locates all the currently pending requests from a particular
|
||||
// peer and reverts them, rescheduling for others to fulfill.
|
||||
func (s *skeleton) revertRequests(peer string) {
|
||||
// Gather the requests first, revertals need the lock too
|
||||
@@ -871,7 +871,7 @@ func (s *skeleton) revertRequest(req *headerRequest) {
|
||||
delete(s.requests, req.id)
|
||||
|
||||
// Remove the request from the tracked set and mark the task as not-pending,
|
||||
// ready for resheduling
|
||||
// ready for rescheduling
|
||||
s.scratchOwners[(s.scratchHead-req.head)/requestHeaders] = ""
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ func newHookedBackfiller() backfiller {
|
||||
// suspend requests the backfiller to abort any running full or snap sync
|
||||
// based on the skeleton chain as it might be invalid. The backfiller should
|
||||
// gracefully handle multiple consecutive suspends without a resume, even
|
||||
// on initial sartup.
|
||||
// on initial startup.
|
||||
func (hf *hookedBackfiller) suspend() *types.Header {
|
||||
if hf.suspendHook != nil {
|
||||
hf.suspendHook()
|
||||
@@ -111,7 +111,7 @@ func newSkeletonTestPeerWithHook(id string, headers []*types.Header, serve func(
|
||||
// function can be used to retrieve batches of headers from the particular peer.
|
||||
func (p *skeletonTestPeer) RequestHeadersByNumber(origin uint64, amount int, skip int, reverse bool, sink chan *eth.Response) (*eth.Request, error) {
|
||||
// Since skeleton test peer are in-memory mocks, dropping the does not make
|
||||
// them inaccepssible. As such, check a local `dropped` field to see if the
|
||||
// them inaccessible. As such, check a local `dropped` field to see if the
|
||||
// peer has been dropped and should not respond any more.
|
||||
if atomic.LoadUint64(&p.dropped) != 0 {
|
||||
return nil, errors.New("peer already dropped")
|
||||
@@ -204,7 +204,7 @@ func (p *skeletonTestPeer) RequestReceipts([]common.Hash, chan *eth.Response) (*
|
||||
panic("skeleton sync must not request receipts")
|
||||
}
|
||||
|
||||
// Tests various sync initialzations based on previous leftovers in the database
|
||||
// Tests various sync initializations based on previous leftovers in the database
|
||||
// and announced heads.
|
||||
func TestSkeletonSyncInit(t *testing.T) {
|
||||
// Create a few key headers
|
||||
@@ -227,7 +227,7 @@ func TestSkeletonSyncInit(t *testing.T) {
|
||||
newstate: []*subchain{{Head: 50, Tail: 50}},
|
||||
},
|
||||
// Empty database with only the genesis set with a leftover empty sync
|
||||
// progess. This is a synthetic case, just for the sake of covering things.
|
||||
// progress. This is a synthetic case, just for the sake of covering things.
|
||||
{
|
||||
oldstate: []*subchain{},
|
||||
head: block50,
|
||||
@@ -533,13 +533,13 @@ func TestSkeletonSyncRetrievals(t *testing.T) {
|
||||
peers []*skeletonTestPeer // Initial peer set to start the sync with
|
||||
midstate []*subchain // Expected sync state after initial cycle
|
||||
midserve uint64 // Expected number of header retrievals after initial cycle
|
||||
middrop uint64 // Expectd number of peers dropped after initial cycle
|
||||
middrop uint64 // Expected number of peers dropped after initial cycle
|
||||
|
||||
newHead *types.Header // New header to annount on top of the old one
|
||||
newHead *types.Header // New header to anoint on top of the old one
|
||||
newPeer *skeletonTestPeer // New peer to join the skeleton syncer
|
||||
endstate []*subchain // Expected sync state after the post-init event
|
||||
endserve uint64 // Expected number of header retrievals after the post-init event
|
||||
enddrop uint64 // Expectd number of peers dropped after the post-init event
|
||||
enddrop uint64 // Expected number of peers dropped after the post-init event
|
||||
}{
|
||||
// Completely empty database with only the genesis set. The sync is expected
|
||||
// to create a single subchain with the requested head. No peers however, so
|
||||
|
||||
@@ -196,7 +196,7 @@ type Config struct {
|
||||
RPCEVMTimeout time.Duration
|
||||
|
||||
// RPCTxFeeCap is the global transaction fee(price * gaslimit) cap for
|
||||
// send-transction variants. The unit is ether.
|
||||
// send-transaction variants. The unit is ether.
|
||||
RPCTxFeeCap float64
|
||||
|
||||
// Checkpoint is a hardcoded checkpoint which can be nil.
|
||||
|
||||
@@ -120,7 +120,7 @@ type txDelivery struct {
|
||||
direct bool // Whether this is a direct reply or a broadcast
|
||||
}
|
||||
|
||||
// txDrop is the notiication that a peer has disconnected.
|
||||
// txDrop is the notification that a peer has disconnected.
|
||||
type txDrop struct {
|
||||
peer string
|
||||
}
|
||||
@@ -260,7 +260,7 @@ func (f *TxFetcher) Notify(peer string, hashes []common.Hash) error {
|
||||
// Enqueue imports a batch of received transaction into the transaction pool
|
||||
// and the fetcher. This method may be called by both transaction broadcasts and
|
||||
// direct request replies. The differentiation is important so the fetcher can
|
||||
// re-shedule missing transactions as soon as possible.
|
||||
// re-schedule missing transactions as soon as possible.
|
||||
func (f *TxFetcher) Enqueue(peer string, txs []*types.Transaction, direct bool) error {
|
||||
// Keep track of all the propagated transactions
|
||||
if direct {
|
||||
@@ -558,7 +558,7 @@ func (f *TxFetcher) loop() {
|
||||
// In case of a direct delivery, also reschedule anything missing
|
||||
// from the original query
|
||||
if delivery.direct {
|
||||
// Mark the reqesting successful (independent of individual status)
|
||||
// Mark the requesting successful (independent of individual status)
|
||||
txRequestDoneMeter.Mark(int64(len(delivery.hashes)))
|
||||
|
||||
// Make sure something was pending, nuke it
|
||||
@@ -607,7 +607,7 @@ func (f *TxFetcher) loop() {
|
||||
delete(f.alternates, hash)
|
||||
delete(f.fetching, hash)
|
||||
}
|
||||
// Something was delivered, try to rechedule requests
|
||||
// Something was delivered, try to reschedule requests
|
||||
f.scheduleFetches(timeoutTimer, timeoutTrigger, nil) // Partial delivery may enable others to deliver too
|
||||
}
|
||||
|
||||
@@ -719,7 +719,7 @@ func (f *TxFetcher) rescheduleWait(timer *mclock.Timer, trigger chan struct{}) {
|
||||
// should be rescheduled if some request is pending. In practice, a timeout will
|
||||
// cause the timer to be rescheduled every 5 secs (until the peer comes through or
|
||||
// disconnects). This is a limitation of the fetcher code because we don't trac
|
||||
// pending requests and timed out requests separatey. Without double tracking, if
|
||||
// pending requests and timed out requests separately. Without double tracking, if
|
||||
// we simply didn't reschedule the timer on all-timeout then the timer would never
|
||||
// be set again since len(request) > 0 => something's running.
|
||||
func (f *TxFetcher) rescheduleTimeout(timer *mclock.Timer, trigger chan struct{}) {
|
||||
|
||||
@@ -1011,7 +1011,7 @@ func TestTransactionFetcherOutOfBoundDeliveries(t *testing.T) {
|
||||
}
|
||||
|
||||
// Tests that dropping a peer cleans out all internal data structures in all the
|
||||
// live or danglng stages.
|
||||
// live or dangling stages.
|
||||
func TestTransactionFetcherDrop(t *testing.T) {
|
||||
testTransactionFetcherParallel(t, txFetcherTest{
|
||||
init: func() *TxFetcher {
|
||||
@@ -1121,7 +1121,7 @@ func TestTransactionFetcherDropRescheduling(t *testing.T) {
|
||||
}
|
||||
|
||||
// This test reproduces a crash caught by the fuzzer. The root cause was a
|
||||
// dangling transaction timing out and clashing on readd with a concurrently
|
||||
// dangling transaction timing out and clashing on re-add with a concurrently
|
||||
// announced one.
|
||||
func TestTransactionFetcherFuzzCrash01(t *testing.T) {
|
||||
testTransactionFetcherParallel(t, txFetcherTest{
|
||||
@@ -1148,7 +1148,7 @@ func TestTransactionFetcherFuzzCrash01(t *testing.T) {
|
||||
}
|
||||
|
||||
// This test reproduces a crash caught by the fuzzer. The root cause was a
|
||||
// dangling transaction getting peer-dropped and clashing on readd with a
|
||||
// dangling transaction getting peer-dropped and clashing on re-add with a
|
||||
// concurrently announced one.
|
||||
func TestTransactionFetcherFuzzCrash02(t *testing.T) {
|
||||
testTransactionFetcherParallel(t, txFetcherTest{
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import (
|
||||
// and associated subscription in the event system.
|
||||
type filter struct {
|
||||
typ Type
|
||||
deadline *time.Timer // filter is inactiv when deadline triggers
|
||||
deadline *time.Timer // filter is inactive when deadline triggers
|
||||
hashes []common.Hash
|
||||
crit FilterCriteria
|
||||
logs []*types.Log
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ var (
|
||||
errPeerNotRegistered = errors.New("peer not registered")
|
||||
|
||||
// errSnapWithoutEth is returned if a peer attempts to connect only on the
|
||||
// snap protocol without advertizing the eth main protocol.
|
||||
// snap protocol without advertising the eth main protocol.
|
||||
errSnapWithoutEth = errors.New("peer connected on snap without compatible eth support")
|
||||
)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ type blockPropagation struct {
|
||||
td *big.Int
|
||||
}
|
||||
|
||||
// broadcastBlocks is a write loop that multiplexes blocks and block accouncements
|
||||
// broadcastBlocks is a write loop that multiplexes blocks and block announcements
|
||||
// to the remote peer. The goal is to have an async writer that does not lock up
|
||||
// node internals and at the same time rate limits queued data.
|
||||
func (p *Peer) broadcastBlocks() {
|
||||
|
||||
@@ -224,7 +224,7 @@ func (p *Peer) dispatcher() {
|
||||
switch {
|
||||
case res.Req == nil:
|
||||
// Response arrived with an untracked ID. Since even cancelled
|
||||
// requests are tracked until fulfilment, a dangling repsponse
|
||||
// requests are tracked until fulfilment, a dangling response
|
||||
// means the remote peer implements the protocol badly.
|
||||
resOp.fail <- errDanglingResponse
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ func (b *testBackend) Chain() *core.BlockChain { return b.chain }
|
||||
func (b *testBackend) TxPool() TxPool { return b.txpool }
|
||||
|
||||
func (b *testBackend) RunPeer(peer *Peer, handler Handler) error {
|
||||
// Normally the backend would do peer mainentance and handshakes. All that
|
||||
// Normally the backend would do peer maintenance and handshakes. All that
|
||||
// is omitted and we will just give control back to the handler.
|
||||
return handler(peer)
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ func (p *Peer) ID() string {
|
||||
return p.id
|
||||
}
|
||||
|
||||
// Version retrieves the peer's negoatiated `eth` protocol version.
|
||||
// Version retrieves the peer's negotiated `eth` protocol version.
|
||||
func (p *Peer) Version() uint {
|
||||
return p.version
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ func ServiceGetTrieNodesQuery(chain *core.BlockChain, req *GetTrieNodesPacket, s
|
||||
var (
|
||||
nodes [][]byte
|
||||
bytes uint64
|
||||
loads int // Trie hash expansions to cound database reads
|
||||
loads int // Trie hash expansions to count database reads
|
||||
)
|
||||
for _, pathset := range req.Paths {
|
||||
switch len(pathset) {
|
||||
|
||||
@@ -61,12 +61,12 @@ func (p *Peer) ID() string {
|
||||
return p.id
|
||||
}
|
||||
|
||||
// Version retrieves the peer's negoatiated `snap` protocol version.
|
||||
// Version retrieves the peer's negotiated `snap` protocol version.
|
||||
func (p *Peer) Version() uint {
|
||||
return p.version
|
||||
}
|
||||
|
||||
// Log overrides the P2P logget with the higher level one containing only the id.
|
||||
// Log overrides the P2P logger with the higher level one containing only the id.
|
||||
func (p *Peer) Log() log.Logger {
|
||||
return p.logger
|
||||
}
|
||||
@@ -87,7 +87,7 @@ func (p *Peer) RequestAccountRange(id uint64, root common.Hash, origin, limit co
|
||||
}
|
||||
|
||||
// RequestStorageRange fetches a batch of storage slots belonging to one or more
|
||||
// accounts. If slots from only one accout is requested, an origin marker may also
|
||||
// accounts. If slots from only one account is requested, an origin marker may also
|
||||
// be used to retrieve from there.
|
||||
func (p *Peer) RequestStorageRanges(id uint64, root common.Hash, accounts []common.Hash, origin, limit []byte, bytes uint64) error {
|
||||
if len(accounts) == 1 && origin != nil {
|
||||
@@ -119,7 +119,7 @@ func (p *Peer) RequestByteCodes(id uint64, hashes []common.Hash, bytes uint64) e
|
||||
}
|
||||
|
||||
// RequestTrieNodes fetches a batch of account or storage trie nodes rooted in
|
||||
// a specificstate trie.
|
||||
// a specific state trie.
|
||||
func (p *Peer) RequestTrieNodes(id uint64, root common.Hash, paths []TrieNodePathSet, bytes uint64) error {
|
||||
p.logger.Trace("Fetching set of trie nodes", "reqid", id, "root", root, "pathsets", len(paths), "bytes", common.StorageSize(bytes))
|
||||
|
||||
|
||||
+13
-13
@@ -365,7 +365,7 @@ type SyncPeer interface {
|
||||
RequestAccountRange(id uint64, root, origin, limit common.Hash, bytes uint64) error
|
||||
|
||||
// RequestStorageRanges fetches a batch of storage slots belonging to one or
|
||||
// more accounts. If slots from only one accout is requested, an origin marker
|
||||
// more accounts. If slots from only one account is requested, an origin marker
|
||||
// may also be used to retrieve from there.
|
||||
RequestStorageRanges(id uint64, root common.Hash, accounts []common.Hash, origin, limit []byte, bytes uint64) error
|
||||
|
||||
@@ -373,7 +373,7 @@ type SyncPeer interface {
|
||||
RequestByteCodes(id uint64, hashes []common.Hash, bytes uint64) error
|
||||
|
||||
// RequestTrieNodes fetches a batch of account or storage trie nodes rooted in
|
||||
// a specificstate trie.
|
||||
// a specific state trie.
|
||||
RequestTrieNodes(id uint64, root common.Hash, paths []TrieNodePathSet, bytes uint64) error
|
||||
|
||||
// Log retrieves the peer's own contextual logger.
|
||||
@@ -1183,10 +1183,10 @@ func (s *Syncer) assignStorageTasks(success chan *storageResponse, fail chan *st
|
||||
}
|
||||
if subtask == nil {
|
||||
// No large contract required retrieval, but small ones available
|
||||
for acccount, root := range task.stateTasks {
|
||||
delete(task.stateTasks, acccount)
|
||||
for account, root := range task.stateTasks {
|
||||
delete(task.stateTasks, account)
|
||||
|
||||
accounts = append(accounts, acccount)
|
||||
accounts = append(accounts, account)
|
||||
roots = append(roots, root)
|
||||
|
||||
if len(accounts) >= storageSets {
|
||||
@@ -1486,7 +1486,7 @@ func (s *Syncer) assignBytecodeHealTasks(success chan *bytecodeHealResponse, fai
|
||||
}
|
||||
}
|
||||
|
||||
// revertRequests locates all the currently pending reuqests from a particular
|
||||
// revertRequests locates all the currently pending requests from a particular
|
||||
// peer and reverts them, rescheduling for others to fulfill.
|
||||
func (s *Syncer) revertRequests(peer string) {
|
||||
// Gather the requests first, revertals need the lock too
|
||||
@@ -1575,7 +1575,7 @@ func (s *Syncer) revertAccountRequest(req *accountRequest) {
|
||||
s.lock.Unlock()
|
||||
|
||||
// If there's a timeout timer still running, abort it and mark the account
|
||||
// task as not-pending, ready for resheduling
|
||||
// task as not-pending, ready for rescheduling
|
||||
req.timeout.Stop()
|
||||
if req.task.req == req {
|
||||
req.task.req = nil
|
||||
@@ -1616,7 +1616,7 @@ func (s *Syncer) revertBytecodeRequest(req *bytecodeRequest) {
|
||||
s.lock.Unlock()
|
||||
|
||||
// If there's a timeout timer still running, abort it and mark the code
|
||||
// retrievals as not-pending, ready for resheduling
|
||||
// retrievals as not-pending, ready for rescheduling
|
||||
req.timeout.Stop()
|
||||
for _, hash := range req.hashes {
|
||||
req.task.codeTasks[hash] = struct{}{}
|
||||
@@ -1657,7 +1657,7 @@ func (s *Syncer) revertStorageRequest(req *storageRequest) {
|
||||
s.lock.Unlock()
|
||||
|
||||
// If there's a timeout timer still running, abort it and mark the storage
|
||||
// task as not-pending, ready for resheduling
|
||||
// task as not-pending, ready for rescheduling
|
||||
req.timeout.Stop()
|
||||
if req.subTask != nil {
|
||||
req.subTask.req = nil
|
||||
@@ -1743,7 +1743,7 @@ func (s *Syncer) revertBytecodeHealRequest(req *bytecodeHealRequest) {
|
||||
s.lock.Unlock()
|
||||
|
||||
// If there's a timeout timer still running, abort it and mark the code
|
||||
// retrievals as not-pending, ready for resheduling
|
||||
// retrievals as not-pending, ready for rescheduling
|
||||
req.timeout.Stop()
|
||||
for _, hash := range req.hashes {
|
||||
req.task.codeTasks[hash] = struct{}{}
|
||||
@@ -2035,7 +2035,7 @@ func (s *Syncer) processStorageResponse(res *storageResponse) {
|
||||
}
|
||||
tr.Commit()
|
||||
}
|
||||
// Persist the received storage segements. These flat state maybe
|
||||
// Persist the received storage segments. These flat state maybe
|
||||
// outdated during the sync, but it can be fixed later during the
|
||||
// snapshot generation.
|
||||
for j := 0; j < len(res.hashes[i]); j++ {
|
||||
@@ -2170,7 +2170,7 @@ func (s *Syncer) forwardAccountTask(task *accountTask) {
|
||||
}
|
||||
task.res = nil
|
||||
|
||||
// Persist the received account segements. These flat state maybe
|
||||
// Persist the received account segments. These flat state maybe
|
||||
// outdated during the sync, but it can be fixed later during the
|
||||
// snapshot generation.
|
||||
oldAccountBytes := s.accountBytes
|
||||
@@ -2773,7 +2773,7 @@ func (s *Syncer) onHealByteCodes(peer SyncPeer, id uint64, bytecodes [][]byte) e
|
||||
}
|
||||
|
||||
// onHealState is a callback method to invoke when a flat state(account
|
||||
// or storage slot) is downloded during the healing stage. The flat states
|
||||
// or storage slot) is downloaded during the healing stage. The flat states
|
||||
// can be persisted blindly and can be fixed later in the generation stage.
|
||||
// Note it's not concurrent safe, please handle the concurrent issue outside.
|
||||
func (s *Syncer) onHealState(paths [][]byte, value []byte) error {
|
||||
|
||||
@@ -44,7 +44,7 @@ import (
|
||||
// perform Commit or other 'save-to-disk' changes, this should be set to false to avoid
|
||||
// storing trash persistently
|
||||
// - preferDisk: this arg can be used by the caller to signal that even though the 'base' is provided,
|
||||
// it would be preferrable to start from a fresh state, if we have it on disk.
|
||||
// it would be preferable to start from a fresh state, if we have it on disk.
|
||||
func (eth *Ethereum) StateAtBlock(block *types.Block, reexec uint64, base *state.StateDB, checkLive bool, preferDisk bool) (statedb *state.StateDB, err error) {
|
||||
var (
|
||||
current *types.Block
|
||||
|
||||
+5
-5
@@ -116,7 +116,7 @@ func (context *chainContext) GetHeader(hash common.Hash, number uint64) *types.H
|
||||
return header
|
||||
}
|
||||
|
||||
// chainContext construts the context reader which is used by the evm for reading
|
||||
// chainContext constructs the context reader which is used by the evm for reading
|
||||
// the necessary chain context.
|
||||
func (api *API) chainContext(ctx context.Context) core.ChainContext {
|
||||
return &chainContext{api: api, ctx: ctx}
|
||||
@@ -202,10 +202,10 @@ type blockTraceTask struct {
|
||||
statedb *state.StateDB // Intermediate state prepped for tracing
|
||||
block *types.Block // Block to trace the transactions from
|
||||
rootref common.Hash // Trie root reference held for this task
|
||||
results []*txTraceResult // Trace results procudes by the task
|
||||
results []*txTraceResult // Trace results produced by the task
|
||||
}
|
||||
|
||||
// blockTraceResult represets the results of tracing a single block when an entire
|
||||
// blockTraceResult represents the results of tracing a single block when an entire
|
||||
// chain is being traced.
|
||||
type blockTraceResult struct {
|
||||
Block hexutil.Uint64 `json:"block"` // Block number corresponding to this trace
|
||||
@@ -563,7 +563,7 @@ func (api *API) StandardTraceBadBlockToFile(ctx context.Context, hash common.Has
|
||||
|
||||
// traceBlock configures a new tracer according to the provided configuration, and
|
||||
// executes all the transactions contained within. The return value will be one item
|
||||
// per transaction, dependent on the requestd tracer.
|
||||
// per transaction, dependent on the requested tracer.
|
||||
func (api *API) traceBlock(ctx context.Context, block *types.Block, config *TraceConfig) ([]*txTraceResult, error) {
|
||||
if block.NumberU64() == 0 {
|
||||
return nil, errors.New("genesis is not traceable")
|
||||
@@ -707,7 +707,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||
}
|
||||
}
|
||||
for i, tx := range block.Transactions() {
|
||||
// Prepare the trasaction for un-traced execution
|
||||
// Prepare the transaction for un-traced execution
|
||||
var (
|
||||
msg, _ = tx.AsMessage(signer, block.BaseFee())
|
||||
txContext = core.NewEVMTxContext(msg)
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/rlp"
|
||||
"github.com/ethereum/go-ethereum/tests"
|
||||
|
||||
// Force-load native and js pacakges, to trigger registration
|
||||
// Force-load native and js packages, to trigger registration
|
||||
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
|
||||
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user