Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
test(rpc): update isSyncing() check and tests (#548)
Browse files Browse the repository at this point in the history
Co-authored-by: maskpp <[email protected]>
  • Loading branch information
davidtaikocha and mask-pp committed Feb 7, 2024
1 parent c63de17 commit 7a68419
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ require (
rsc.io/tmplfunc v0.0.3 // indirect
)

replace github.com/ethereum/go-ethereum v1.13.11 => github.com/taikoxyz/taiko-geth v0.0.0-20240207044711-7f625e6a8228
replace github.com/ethereum/go-ethereum v1.13.11 => github.com/taikoxyz/taiko-geth v0.0.0-20240207045737-1f775750a248
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04=
github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/taikoxyz/taiko-geth v0.0.0-20240207044711-7f625e6a8228 h1:gLp/Gr3/VLpoGTwq+irtf685KSpb9aNj3+fzRKEf5M0=
github.com/taikoxyz/taiko-geth v0.0.0-20240207044711-7f625e6a8228/go.mod h1:gFtlVORuUcT+UUIcJ/veCNjkuOSujCi338uSHJrYAew=
github.com/taikoxyz/taiko-geth v0.0.0-20240207045737-1f775750a248 h1:biOi7poktBhAsrkxrvO3Sczs8L6OyvBFtt7lUxdwe7A=
github.com/taikoxyz/taiko-geth v0.0.0-20240207045737-1f775750a248/go.mod h1:gFtlVORuUcT+UUIcJ/veCNjkuOSujCi338uSHJrYAew=
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e h1:cR8/SYRgyQCt5cNCMniB/ZScMkhI9nk8U5C7SbISXjo=
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e/go.mod h1:Tu4lItkATkonrYuvtVjG0/rhy15qrNGNTjPdaphtZ/8=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
Expand Down
3 changes: 1 addition & 2 deletions internal/testutils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ func ProposeAndInsertValidBlock(
s.Nil(err)
s.Greater(newL1Head.Number.Uint64(), l1Head.Number.Uint64())

syncProgress, err := s.RPCClient.L2.SyncProgress(context.Background())
_, err = s.RPCClient.L2.SyncProgress(context.Background())
s.Nil(err)
s.Nil(syncProgress)

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpc/dial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestDialEngineClientWithBackoff(t *testing.T) {
var result engine.ExecutableData
err = client.CallContext(context.Background(), &result, "engine_getPayloadV1", engine.PayloadID{})

require.Equal(t, engine.UnknownPayload.Error(), err.Error())
require.Equal(t, engine.UnsupportedFork.Error(), err.Error())
}

func TestDialClientWithBackoff(t *testing.T) {
Expand Down
7 changes: 5 additions & 2 deletions pkg/rpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,11 @@ type L2SyncProgress struct {

// isSyncing returns true if the L2 execution engine is syncing with L1.
func (p *L2SyncProgress) isSyncing() bool {
return p.SyncProgress != nil ||
p.CurrentBlockID == nil ||
if p.SyncProgress == nil {
return false
}

return p.CurrentBlockID == nil ||
p.HighestBlockID == nil ||
p.CurrentBlockID.Cmp(p.HighestBlockID) < 0
}
Expand Down

0 comments on commit 7a68419

Please sign in to comment.