Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
0b7963eb
Unverified
Commit
0b7963eb
authored
Dec 08, 2022
by
Håvard Anda Estensen
Committed by
GitHub
Dec 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: Replace interface{} with any (#4238)
parent
93cc6ceb
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
37 additions
and
37 deletions
+37
-37
polling.go
op-node/client/polling.go
+2
-2
polling_test.go
op-node/client/polling_test.go
+2
-2
rpc.go
op-node/client/rpc.go
+6
-6
cmd.go
op-node/cmd/genesis/cmd.go
+1
-1
account_proof.go
op-node/eth/account_proof.go
+1
-1
gossip.go
op-node/p2p/gossip.go
+3
-3
batch.go
op-node/rollup/derive/batch.go
+1
-1
batching_test.go
op-node/sources/batching_test.go
+2
-2
eth_client.go
op-node/sources/eth_client.go
+3
-3
eth_client_test.go
op-node/sources/eth_client_test.go
+4
-4
limit.go
op-node/sources/limit.go
+2
-2
receipts.go
op-node/sources/receipts.go
+1
-1
testlog.go
op-node/testlog/testlog.go
+7
-7
rpc_err_faker.go
op-node/testutils/rpc_err_faker.go
+2
-2
No files found.
op-node/client/polling.go
View file @
0b7963eb
...
@@ -78,7 +78,7 @@ func (w *PollingClient) Close() {
...
@@ -78,7 +78,7 @@ func (w *PollingClient) Close() {
w
.
c
.
Close
()
w
.
c
.
Close
()
}
}
func
(
w
*
PollingClient
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
w
*
PollingClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
return
w
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
return
w
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
}
}
...
@@ -90,7 +90,7 @@ func (w *PollingClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem)
...
@@ -90,7 +90,7 @@ func (w *PollingClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem)
// to Geth's native EthSubscribe method. It will return an error, however, if the
// to Geth's native EthSubscribe method. It will return an error, however, if the
// passed in channel is not a *types.Headers channel or the subscription type is not
// passed in channel is not a *types.Headers channel or the subscription type is not
// newHeads.
// newHeads.
func
(
w
*
PollingClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
w
*
PollingClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
select
{
select
{
case
<-
w
.
ctx
.
Done
()
:
case
<-
w
.
ctx
.
Done
()
:
return
nil
,
ErrSubscriberClosed
return
nil
,
ErrSubscriberClosed
...
...
op-node/client/polling_test.go
View file @
0b7963eb
...
@@ -33,7 +33,7 @@ func (m *MockRPC) Close() {
...
@@ -33,7 +33,7 @@ func (m *MockRPC) Close() {
m
.
closed
=
true
m
.
closed
=
true
}
}
func
(
m
*
MockRPC
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
m
*
MockRPC
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
m
.
mtx
.
Lock
()
m
.
mtx
.
Lock
()
defer
m
.
mtx
.
Unlock
()
defer
m
.
mtx
.
Unlock
()
...
@@ -61,7 +61,7 @@ func (m *MockRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
...
@@ -61,7 +61,7 @@ func (m *MockRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
return
nil
return
nil
}
}
func
(
m
*
MockRPC
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
m
*
MockRPC
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
m
.
t
.
Fatal
(
"EthSubscribe should not be called"
)
m
.
t
.
Fatal
(
"EthSubscribe should not be called"
)
return
nil
,
nil
return
nil
,
nil
}
}
...
...
op-node/client/rpc.go
View file @
0b7963eb
...
@@ -18,9 +18,9 @@ var httpRegex = regexp.MustCompile("^http(s)?://")
...
@@ -18,9 +18,9 @@ var httpRegex = regexp.MustCompile("^http(s)?://")
type
RPC
interface
{
type
RPC
interface
{
Close
()
Close
()
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
BatchCallContext
(
ctx
context
.
Context
,
b
[]
rpc
.
BatchElem
)
error
BatchCallContext
(
ctx
context
.
Context
,
b
[]
rpc
.
BatchElem
)
error
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
}
}
// NewRPC returns the correct client.RPC instance for a given RPC url.
// NewRPC returns the correct client.RPC instance for a given RPC url.
...
@@ -74,7 +74,7 @@ func (b *BaseRPCClient) Close() {
...
@@ -74,7 +74,7 @@ func (b *BaseRPCClient) Close() {
b
.
c
.
Close
()
b
.
c
.
Close
()
}
}
func
(
b
*
BaseRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
b
*
BaseRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
return
b
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
return
b
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
}
}
...
@@ -82,7 +82,7 @@ func (b *BaseRPCClient) BatchCallContext(ctx context.Context, batch []rpc.BatchE
...
@@ -82,7 +82,7 @@ func (b *BaseRPCClient) BatchCallContext(ctx context.Context, batch []rpc.BatchE
return
b
.
c
.
BatchCallContext
(
ctx
,
batch
)
return
b
.
c
.
BatchCallContext
(
ctx
,
batch
)
}
}
func
(
b
*
BaseRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
b
*
BaseRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
return
b
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
return
b
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
}
}
...
@@ -105,7 +105,7 @@ func (ic *InstrumentedRPCClient) Close() {
...
@@ -105,7 +105,7 @@ func (ic *InstrumentedRPCClient) Close() {
ic
.
c
.
Close
()
ic
.
c
.
Close
()
}
}
func
(
ic
*
InstrumentedRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
ic
*
InstrumentedRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
return
instrument1
(
ic
.
m
,
method
,
func
()
error
{
return
instrument1
(
ic
.
m
,
method
,
func
()
error
{
return
ic
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
return
ic
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
})
})
...
@@ -117,7 +117,7 @@ func (ic *InstrumentedRPCClient) BatchCallContext(ctx context.Context, b []rpc.B
...
@@ -117,7 +117,7 @@ func (ic *InstrumentedRPCClient) BatchCallContext(ctx context.Context, b []rpc.B
},
b
)
},
b
)
}
}
func
(
ic
*
InstrumentedRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
ic
*
InstrumentedRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
return
ic
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
return
ic
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
}
}
...
...
op-node/cmd/genesis/cmd.go
View file @
0b7963eb
...
@@ -173,7 +173,7 @@ var Subcommands = cli.Commands{
...
@@ -173,7 +173,7 @@ var Subcommands = cli.Commands{
},
},
}
}
func
writeGenesisFile
(
outfile
string
,
input
interface
{}
)
error
{
func
writeGenesisFile
(
outfile
string
,
input
any
)
error
{
f
,
err
:=
os
.
OpenFile
(
outfile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0
o755
)
f
,
err
:=
os
.
OpenFile
(
outfile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0
o755
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
op-node/eth/account_proof.go
View file @
0b7963eb
...
@@ -27,7 +27,7 @@ type AccountResult struct {
...
@@ -27,7 +27,7 @@ type AccountResult struct {
// Verify an account proof from the getProof RPC. See https://eips.ethereum.org/EIPS/eip-1186
// Verify an account proof from the getProof RPC. See https://eips.ethereum.org/EIPS/eip-1186
func
(
res
*
AccountResult
)
Verify
(
stateRoot
common
.
Hash
)
error
{
func
(
res
*
AccountResult
)
Verify
(
stateRoot
common
.
Hash
)
error
{
accountClaimed
:=
[]
interface
{}
{
uint64
(
res
.
Nonce
),
(
*
big
.
Int
)(
res
.
Balance
)
.
Bytes
(),
res
.
StorageHash
,
res
.
CodeHash
}
accountClaimed
:=
[]
any
{
uint64
(
res
.
Nonce
),
(
*
big
.
Int
)(
res
.
Balance
)
.
Bytes
(),
res
.
StorageHash
,
res
.
CodeHash
}
accountClaimedValue
,
err
:=
rlp
.
EncodeToBytes
(
accountClaimed
)
accountClaimedValue
,
err
:=
rlp
.
EncodeToBytes
(
accountClaimed
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to encode account from retrieved values: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to encode account from retrieved values: %w"
,
err
)
...
...
op-node/p2p/gossip.go
View file @
0b7963eb
...
@@ -155,7 +155,7 @@ func validationResultString(v pubsub.ValidationResult) string {
...
@@ -155,7 +155,7 @@ func validationResultString(v pubsub.ValidationResult) string {
func
logValidationResult
(
self
peer
.
ID
,
msg
string
,
log
log
.
Logger
,
fn
pubsub
.
ValidatorEx
)
pubsub
.
ValidatorEx
{
func
logValidationResult
(
self
peer
.
ID
,
msg
string
,
log
log
.
Logger
,
fn
pubsub
.
ValidatorEx
)
pubsub
.
ValidatorEx
{
return
func
(
ctx
context
.
Context
,
id
peer
.
ID
,
message
*
pubsub
.
Message
)
pubsub
.
ValidationResult
{
return
func
(
ctx
context
.
Context
,
id
peer
.
ID
,
message
*
pubsub
.
Message
)
pubsub
.
ValidationResult
{
res
:=
fn
(
ctx
,
id
,
message
)
res
:=
fn
(
ctx
,
id
,
message
)
var
src
interface
{}
var
src
any
src
=
id
src
=
id
if
id
==
self
{
if
id
==
self
{
src
=
"self"
src
=
"self"
...
@@ -395,10 +395,10 @@ func JoinGossip(p2pCtx context.Context, self peer.ID, ps *pubsub.PubSub, log log
...
@@ -395,10 +395,10 @@ func JoinGossip(p2pCtx context.Context, self peer.ID, ps *pubsub.PubSub, log log
}
}
type
TopicSubscriber
func
(
ctx
context
.
Context
,
sub
*
pubsub
.
Subscription
)
type
TopicSubscriber
func
(
ctx
context
.
Context
,
sub
*
pubsub
.
Subscription
)
type
MessageHandler
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
interface
{}
)
error
type
MessageHandler
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
any
)
error
func
BlocksHandler
(
onBlock
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
*
eth
.
ExecutionPayload
)
error
)
MessageHandler
{
func
BlocksHandler
(
onBlock
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
*
eth
.
ExecutionPayload
)
error
)
MessageHandler
{
return
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
interface
{}
)
error
{
return
func
(
ctx
context
.
Context
,
from
peer
.
ID
,
msg
any
)
error
{
payload
,
ok
:=
msg
.
(
*
eth
.
ExecutionPayload
)
payload
,
ok
:=
msg
.
(
*
eth
.
ExecutionPayload
)
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"expected topic validator to parse and validate data into execution payload, but got %T"
,
msg
)
return
fmt
.
Errorf
(
"expected topic validator to parse and validate data into execution payload, but got %T"
,
msg
)
...
...
op-node/rollup/derive/batch.go
View file @
0b7963eb
...
@@ -26,7 +26,7 @@ import (
...
@@ -26,7 +26,7 @@ import (
// encodeBufferPool holds temporary encoder buffers for batch encoding
// encodeBufferPool holds temporary encoder buffers for batch encoding
var
encodeBufferPool
=
sync
.
Pool
{
var
encodeBufferPool
=
sync
.
Pool
{
New
:
func
()
interface
{}
{
return
new
(
bytes
.
Buffer
)
},
New
:
func
()
any
{
return
new
(
bytes
.
Buffer
)
},
}
}
const
(
const
(
...
...
op-node/sources/batching_test.go
View file @
0b7963eb
...
@@ -43,7 +43,7 @@ func makeTestRequest(i int) (*string, rpc.BatchElem) {
...
@@ -43,7 +43,7 @@ func makeTestRequest(i int) (*string, rpc.BatchElem) {
out
:=
new
(
string
)
out
:=
new
(
string
)
return
out
,
rpc
.
BatchElem
{
return
out
,
rpc
.
BatchElem
{
Method
:
"testing_foobar"
,
Method
:
"testing_foobar"
,
Args
:
[]
interface
{}
{
i
},
Args
:
[]
any
{
i
},
Result
:
out
,
Result
:
out
,
Error
:
nil
,
Error
:
nil
,
}
}
...
@@ -94,7 +94,7 @@ func (tc *batchTestCase) Run(t *testing.T) {
...
@@ -94,7 +94,7 @@ func (tc *batchTestCase) Run(t *testing.T) {
for
_
,
elem
:=
range
bc
.
elems
{
for
_
,
elem
:=
range
bc
.
elems
{
batch
=
append
(
batch
,
rpc
.
BatchElem
{
batch
=
append
(
batch
,
rpc
.
BatchElem
{
Method
:
"testing_foobar"
,
Method
:
"testing_foobar"
,
Args
:
[]
interface
{}
{
elem
.
id
},
Args
:
[]
any
{
elem
.
id
},
Result
:
new
(
string
),
Result
:
new
(
string
),
Error
:
nil
,
Error
:
nil
,
})
})
...
...
op-node/sources/eth_client.go
View file @
0b7963eb
...
@@ -124,7 +124,7 @@ func (s *EthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Heade
...
@@ -124,7 +124,7 @@ func (s *EthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Heade
return
s
.
client
.
EthSubscribe
(
ctx
,
ch
,
"newHeads"
)
return
s
.
client
.
EthSubscribe
(
ctx
,
ch
,
"newHeads"
)
}
}
func
(
s
*
EthClient
)
headerCall
(
ctx
context
.
Context
,
method
string
,
id
interface
{}
)
(
*
HeaderInfo
,
error
)
{
func
(
s
*
EthClient
)
headerCall
(
ctx
context
.
Context
,
method
string
,
id
any
)
(
*
HeaderInfo
,
error
)
{
var
header
*
rpcHeader
var
header
*
rpcHeader
err
:=
s
.
client
.
CallContext
(
ctx
,
&
header
,
method
,
id
,
false
)
// headers are just blocks without txs
err
:=
s
.
client
.
CallContext
(
ctx
,
&
header
,
method
,
id
,
false
)
// headers are just blocks without txs
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -141,7 +141,7 @@ func (s *EthClient) headerCall(ctx context.Context, method string, id interface{
...
@@ -141,7 +141,7 @@ func (s *EthClient) headerCall(ctx context.Context, method string, id interface{
return
info
,
nil
return
info
,
nil
}
}
func
(
s
*
EthClient
)
blockCall
(
ctx
context
.
Context
,
method
string
,
id
interface
{}
)
(
*
HeaderInfo
,
types
.
Transactions
,
error
)
{
func
(
s
*
EthClient
)
blockCall
(
ctx
context
.
Context
,
method
string
,
id
any
)
(
*
HeaderInfo
,
types
.
Transactions
,
error
)
{
var
block
*
rpcBlock
var
block
*
rpcBlock
err
:=
s
.
client
.
CallContext
(
ctx
,
&
block
,
method
,
id
,
true
)
err
:=
s
.
client
.
CallContext
(
ctx
,
&
block
,
method
,
id
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -159,7 +159,7 @@ func (s *EthClient) blockCall(ctx context.Context, method string, id interface{}
...
@@ -159,7 +159,7 @@ func (s *EthClient) blockCall(ctx context.Context, method string, id interface{}
return
info
,
txs
,
nil
return
info
,
txs
,
nil
}
}
func
(
s
*
EthClient
)
payloadCall
(
ctx
context
.
Context
,
method
string
,
id
interface
{}
)
(
*
eth
.
ExecutionPayload
,
error
)
{
func
(
s
*
EthClient
)
payloadCall
(
ctx
context
.
Context
,
method
string
,
id
any
)
(
*
eth
.
ExecutionPayload
,
error
)
{
var
block
*
rpcBlock
var
block
*
rpcBlock
err
:=
s
.
client
.
CallContext
(
ctx
,
&
block
,
method
,
id
,
true
)
err
:=
s
.
client
.
CallContext
(
ctx
,
&
block
,
method
,
id
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
op-node/sources/eth_client_test.go
View file @
0b7963eb
...
@@ -27,11 +27,11 @@ func (m *mockRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
...
@@ -27,11 +27,11 @@ func (m *mockRPC) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error
return
m
.
MethodCalled
(
"BatchCallContext"
,
ctx
,
b
)
.
Get
(
0
)
.
([]
error
)[
0
]
return
m
.
MethodCalled
(
"BatchCallContext"
,
ctx
,
b
)
.
Get
(
0
)
.
([]
error
)[
0
]
}
}
func
(
m
*
mockRPC
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
m
*
mockRPC
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
return
m
.
MethodCalled
(
"CallContext"
,
ctx
,
result
,
method
,
args
)
.
Get
(
0
)
.
([]
error
)[
0
]
return
m
.
MethodCalled
(
"CallContext"
,
ctx
,
result
,
method
,
args
)
.
Get
(
0
)
.
([]
error
)[
0
]
}
}
func
(
m
*
mockRPC
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
m
*
mockRPC
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
called
:=
m
.
MethodCalled
(
"EthSubscribe"
,
channel
,
args
)
called
:=
m
.
MethodCalled
(
"EthSubscribe"
,
channel
,
args
)
return
called
.
Get
(
0
)
.
(
*
rpc
.
ClientSubscription
),
called
.
Get
(
1
)
.
([]
error
)[
0
]
return
called
.
Get
(
0
)
.
(
*
rpc
.
ClientSubscription
),
called
.
Get
(
1
)
.
([]
error
)[
0
]
}
}
...
@@ -105,7 +105,7 @@ func TestEthClient_InfoByHash(t *testing.T) {
...
@@ -105,7 +105,7 @@ func TestEthClient_InfoByHash(t *testing.T) {
expectedInfo
,
_
:=
rhdr
.
Info
(
true
,
false
)
expectedInfo
,
_
:=
rhdr
.
Info
(
true
,
false
)
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
m
.
On
(
"CallContext"
,
ctx
,
new
(
*
rpcHeader
),
m
.
On
(
"CallContext"
,
ctx
,
new
(
*
rpcHeader
),
"eth_getBlockByHash"
,
[]
interface
{}
{
rhdr
.
Hash
,
false
})
.
Run
(
func
(
args
mock
.
Arguments
)
{
"eth_getBlockByHash"
,
[]
any
{
rhdr
.
Hash
,
false
})
.
Run
(
func
(
args
mock
.
Arguments
)
{
*
args
[
1
]
.
(
**
rpcHeader
)
=
rhdr
*
args
[
1
]
.
(
**
rpcHeader
)
=
rhdr
})
.
Return
([]
error
{
nil
})
})
.
Return
([]
error
{
nil
})
s
,
err
:=
NewEthClient
(
m
,
nil
,
nil
,
testEthClientConfig
)
s
,
err
:=
NewEthClient
(
m
,
nil
,
nil
,
testEthClientConfig
)
...
@@ -128,7 +128,7 @@ func TestEthClient_InfoByNumber(t *testing.T) {
...
@@ -128,7 +128,7 @@ func TestEthClient_InfoByNumber(t *testing.T) {
n
:=
rhdr
.
Number
n
:=
rhdr
.
Number
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
m
.
On
(
"CallContext"
,
ctx
,
new
(
*
rpcHeader
),
m
.
On
(
"CallContext"
,
ctx
,
new
(
*
rpcHeader
),
"eth_getBlockByNumber"
,
[]
interface
{}
{
n
.
String
(),
false
})
.
Run
(
func
(
args
mock
.
Arguments
)
{
"eth_getBlockByNumber"
,
[]
any
{
n
.
String
(),
false
})
.
Run
(
func
(
args
mock
.
Arguments
)
{
*
args
[
1
]
.
(
**
rpcHeader
)
=
rhdr
*
args
[
1
]
.
(
**
rpcHeader
)
=
rhdr
})
.
Return
([]
error
{
nil
})
})
.
Return
([]
error
{
nil
})
s
,
err
:=
NewL1Client
(
m
,
nil
,
nil
,
L1ClientDefaultConfig
(
&
rollup
.
Config
{
SeqWindowSize
:
10
},
true
))
s
,
err
:=
NewL1Client
(
m
,
nil
,
nil
,
L1ClientDefaultConfig
(
&
rollup
.
Config
{
SeqWindowSize
:
10
},
true
))
...
...
op-node/sources/limit.go
View file @
0b7963eb
...
@@ -32,7 +32,7 @@ func (lc *limitClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem)
...
@@ -32,7 +32,7 @@ func (lc *limitClient) BatchCallContext(ctx context.Context, b []rpc.BatchElem)
return
lc
.
c
.
BatchCallContext
(
ctx
,
b
)
return
lc
.
c
.
BatchCallContext
(
ctx
,
b
)
}
}
func
(
lc
*
limitClient
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
lc
*
limitClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
lc
.
wg
.
Add
(
1
)
lc
.
wg
.
Add
(
1
)
defer
lc
.
wg
.
Done
()
defer
lc
.
wg
.
Done
()
lc
.
sema
<-
struct
{}{}
lc
.
sema
<-
struct
{}{}
...
@@ -40,7 +40,7 @@ func (lc *limitClient) CallContext(ctx context.Context, result interface{}, meth
...
@@ -40,7 +40,7 @@ func (lc *limitClient) CallContext(ctx context.Context, result interface{}, meth
return
lc
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
return
lc
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
}
}
func
(
lc
*
limitClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
lc
*
limitClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
// subscription doesn't count towards request limit
// subscription doesn't count towards request limit
return
lc
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
return
lc
.
c
.
EthSubscribe
(
ctx
,
channel
,
args
...
)
}
}
...
...
op-node/sources/receipts.go
View file @
0b7963eb
...
@@ -77,7 +77,7 @@ func makeReceiptRequest(txHash common.Hash) (*types.Receipt, rpc.BatchElem) {
...
@@ -77,7 +77,7 @@ func makeReceiptRequest(txHash common.Hash) (*types.Receipt, rpc.BatchElem) {
out
:=
new
(
types
.
Receipt
)
out
:=
new
(
types
.
Receipt
)
return
out
,
rpc
.
BatchElem
{
return
out
,
rpc
.
BatchElem
{
Method
:
"eth_getTransactionReceipt"
,
Method
:
"eth_getTransactionReceipt"
,
Args
:
[]
interface
{}
{
txHash
},
Args
:
[]
any
{
txHash
},
Result
:
&
out
,
// receipt may become nil, double pointer is intentional
Result
:
&
out
,
// receipt may become nil, double pointer is intentional
}
}
}
}
...
...
op-node/testlog/testlog.go
View file @
0b7963eb
...
@@ -90,7 +90,7 @@ func Logger(t Testing, level log.Lvl) log.Logger {
...
@@ -90,7 +90,7 @@ func Logger(t Testing, level log.Lvl) log.Logger {
return
l
return
l
}
}
func
(
l
*
logger
)
Trace
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Trace
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -98,7 +98,7 @@ func (l *logger) Trace(msg string, ctx ...interface{}) {
...
@@ -98,7 +98,7 @@ func (l *logger) Trace(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
Debug
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Debug
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -106,7 +106,7 @@ func (l *logger) Debug(msg string, ctx ...interface{}) {
...
@@ -106,7 +106,7 @@ func (l *logger) Debug(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
Info
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Info
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -114,7 +114,7 @@ func (l *logger) Info(msg string, ctx ...interface{}) {
...
@@ -114,7 +114,7 @@ func (l *logger) Info(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
Warn
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Warn
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -122,7 +122,7 @@ func (l *logger) Warn(msg string, ctx ...interface{}) {
...
@@ -122,7 +122,7 @@ func (l *logger) Warn(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
Error
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Error
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -130,7 +130,7 @@ func (l *logger) Error(msg string, ctx ...interface{}) {
...
@@ -130,7 +130,7 @@ func (l *logger) Error(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
Crit
(
msg
string
,
ctx
...
interface
{}
)
{
func
(
l
*
logger
)
Crit
(
msg
string
,
ctx
...
any
)
{
l
.
t
.
Helper
()
l
.
t
.
Helper
()
l
.
mu
.
Lock
()
l
.
mu
.
Lock
()
defer
l
.
mu
.
Unlock
()
defer
l
.
mu
.
Unlock
()
...
@@ -138,7 +138,7 @@ func (l *logger) Crit(msg string, ctx ...interface{}) {
...
@@ -138,7 +138,7 @@ func (l *logger) Crit(msg string, ctx ...interface{}) {
l
.
flush
()
l
.
flush
()
}
}
func
(
l
*
logger
)
New
(
ctx
...
interface
{}
)
log
.
Logger
{
func
(
l
*
logger
)
New
(
ctx
...
any
)
log
.
Logger
{
return
&
logger
{
l
.
t
,
l
.
l
.
New
(
ctx
...
),
l
.
mu
,
l
.
h
}
return
&
logger
{
l
.
t
,
l
.
l
.
New
(
ctx
...
),
l
.
mu
,
l
.
h
}
}
}
...
...
op-node/testutils/rpc_err_faker.go
View file @
0b7963eb
...
@@ -22,7 +22,7 @@ func (r RPCErrFaker) Close() {
...
@@ -22,7 +22,7 @@ func (r RPCErrFaker) Close() {
r
.
RPC
.
Close
()
r
.
RPC
.
Close
()
}
}
func
(
r
RPCErrFaker
)
CallContext
(
ctx
context
.
Context
,
result
interface
{},
method
string
,
args
...
interface
{}
)
error
{
func
(
r
RPCErrFaker
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
if
r
.
ErrFn
!=
nil
{
if
r
.
ErrFn
!=
nil
{
if
err
:=
r
.
ErrFn
();
err
!=
nil
{
if
err
:=
r
.
ErrFn
();
err
!=
nil
{
return
err
return
err
...
@@ -40,7 +40,7 @@ func (r RPCErrFaker) BatchCallContext(ctx context.Context, b []rpc.BatchElem) er
...
@@ -40,7 +40,7 @@ func (r RPCErrFaker) BatchCallContext(ctx context.Context, b []rpc.BatchElem) er
return
r
.
RPC
.
BatchCallContext
(
ctx
,
b
)
return
r
.
RPC
.
BatchCallContext
(
ctx
,
b
)
}
}
func
(
r
RPCErrFaker
)
EthSubscribe
(
ctx
context
.
Context
,
channel
interface
{},
args
...
interface
{}
)
(
ethereum
.
Subscription
,
error
)
{
func
(
r
RPCErrFaker
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
if
r
.
ErrFn
!=
nil
{
if
r
.
ErrFn
!=
nil
{
if
err
:=
r
.
ErrFn
();
err
!=
nil
{
if
err
:=
r
.
ErrFn
();
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment