diff --git ledgerwatch/erigon/.goreleaser.yml testinprod-io/erigon/.goreleaser.yml
index c305e2c6392e1cdf902357c28943807e17ab70fc..517587e26583dae8270577e218836419f41b1a82 100644
--- ledgerwatch/erigon/.goreleaser.yml
+++ testinprod-io/erigon/.goreleaser.yml
@@ -1,4 +1,4 @@
-project_name: erigon
+project_name: op-erigon
release:
disable: false
@@ -50,16 +50,16 @@ - CXX=aarch64-linux-gnu-g++
tags: [ nosqlite, noboltdb, netgo ]
ldflags: -s -w -extldflags "-static" # We need to build a static binary because we are building in a glibc based system and running in a musl container
- - id: windows-amd64
- main: ./cmd/erigon
- binary: erigon
- goos: [ windows ]
- goarch: [ amd64 ]
- env:
- - CC=x86_64-w64-mingw32-gcc
- - CXX=x86_64-w64-mingw32-g++
- tags: [ nosqlite, noboltdb, netgo ]
- ldflags: -s -w
+# - id: windows-amd64
+# main: ./cmd/erigon
+# binary: erigon
+# goos: [ windows ]
+# goarch: [ amd64 ]
+# env:
+# - CC=x86_64-w64-mingw32-gcc
+# - CXX=x86_64-w64-mingw32-g++
+# tags: [ nosqlite, noboltdb, netgo ]
+# ldflags: -s -w
snapshot:
@@ -67,8 +67,7 @@ name_template: "{{ .Tag }}.next"
dockers:
- image_templates:
- - thorax/{{ .ProjectName }}:{{ .Version }}-amd64
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-amd64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-amd64
dockerfile: Dockerfile.release
use: buildx
skip_push: true
@@ -79,8 +78,7 @@ build_flag_templates:
- --platform=linux/amd64
- image_templates:
- - thorax/{{ .ProjectName }}:{{ .Version }}-arm64
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-arm64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-arm64
dockerfile: Dockerfile.release
skip_push: true
use: buildx
@@ -91,29 +89,17 @@ build_flag_templates:
- --platform=linux/arm64/v8
docker_manifests:
- - name_template: thorax/{{ .ProjectName }}:{{ .Version }}
- skip_push: true
- image_templates:
- - thorax/{{ .ProjectName }}:{{ .Version }}-amd64
- - thorax/{{ .ProjectName }}:{{ .Version }}-arm64
-
- - name_template: ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}
- skip_push: true
- image_templates:
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-amd64
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-arm64
-
- - name_template: thorax/{{ .ProjectName }}:latest
+ - name_template: testinprod/{{ .ProjectName }}:{{ .Version }}
skip_push: true
image_templates:
- - thorax/{{ .ProjectName }}:{{ .Version }}-amd64
- - thorax/{{ .ProjectName }}:{{ .Version }}-arm64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-amd64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-arm64
- - name_template: ghcr.io/ledgerwatch/{{ .ProjectName }}:latest
+ - name_template: testinprod/{{ .ProjectName }}:latest
skip_push: true
image_templates:
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-amd64
- - ghcr.io/ledgerwatch/{{ .ProjectName }}:{{ .Version }}-arm64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-amd64
+ - testinprod/{{ .ProjectName }}:{{ .Version }}-arm64
announce:
slack:
diff --git ledgerwatch/erigon/Dockerfile.debian testinprod-io/erigon/Dockerfile.debian
index 7cf40a1e9037430b3a331cf17db41cc4b29d74ca..1f57b7c8a9ece13d2f8f85994b47b9bb9086c822 100644
--- ledgerwatch/erigon/Dockerfile.debian
+++ testinprod-io/erigon/Dockerfile.debian
@@ -95,10 +95,8 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.description="Erigon Ethereum Client" \
org.label-schema.name="Erigon" \
org.label-schema.schema-version="1.0" \
- org.label-schema.url="https://torquem.ch" \
org.label-schema.vcs-ref=$VCS_REF \
- org.label-schema.vcs-url="https://github.com/ledgerwatch/erigon.git" \
- org.label-schema.vendor="Torquem" \
+ org.label-schema.vcs-url="https://github.com/testinprod-io/op-erigon.git" \
org.label-schema.version=$VERSION
ENTRYPOINT ["erigon"]
diff --git ledgerwatch/erigon/cmd/rpcdaemon/cli/config.go testinprod-io/erigon/cmd/rpcdaemon/cli/config.go
index 8d489c71a67423a39800244e26f07078fff3216e..f33b8f1b629fcdca9160479adb44c7f544dd6f92 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/cli/config.go
+++ testinprod-io/erigon/cmd/rpcdaemon/cli/config.go
@@ -121,6 +121,10 @@ rootCmd.PersistentFlags().DurationVar(&cfg.EvmCallTimeout, "rpc.evmtimeout", rpccfg.DefaultEvmCallTimeout, "Maximum amount of time to wait for the answer from EVM call.")
rootCmd.PersistentFlags().IntVar(&cfg.BatchLimit, utils.RpcBatchLimit.Name, utils.RpcBatchLimit.Value, utils.RpcBatchLimit.Usage)
rootCmd.PersistentFlags().IntVar(&cfg.ReturnDataLimit, utils.RpcReturnDataLimit.Name, utils.RpcReturnDataLimit.Value, utils.RpcReturnDataLimit.Usage)
+ rootCmd.PersistentFlags().StringVar(&cfg.RollupSequencerHTTP, utils.RollupSequencerHTTPFlag.Name, "", "HTTP endpoint for the sequencer mempool")
+ rootCmd.PersistentFlags().StringVar(&cfg.RollupHistoricalRPC, utils.RollupHistoricalRPCFlag.Name, "", "RPC endpoint for historical data")
+ rootCmd.PersistentFlags().DurationVar(&cfg.RollupHistoricalRPCTimeout, utils.RollupHistoricalRPCTimeoutFlag.Name, rpccfg.DefaultHistoricalRPCTimeout, "Timeout for historical RPC requests")
+
if err := rootCmd.MarkPersistentFlagFilename("rpc.accessList", "json"); err != nil {
panic(err)
}
diff --git ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg/http_cfg.go testinprod-io/erigon/cmd/rpcdaemon/cli/httpcfg/http_cfg.go
index fb5f41650430e247da36413716f8143479e554ab..9c8733ee7b7dbc118534c8f66dbbdb5add8e5202 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/cli/httpcfg/http_cfg.go
+++ testinprod-io/erigon/cmd/rpcdaemon/cli/httpcfg/http_cfg.go
@@ -64,4 +64,9 @@ LogDirPath string
BatchLimit int // Maximum number of requests in a batch
ReturnDataLimit int // Maximum number of bytes returned from calls (like eth_call)
+
+ // Optimism
+ RollupSequencerHTTP string
+ RollupHistoricalRPC string
+ RollupHistoricalRPCTimeout time.Duration
}
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/call_traces_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/call_traces_test.go
index a8c7f899f7dfde948569e6ce3ce1298e4b6386e7..bf66cca7ab8f932f0104aa9c002068dd8f16195a 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/call_traces_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/call_traces_test.go
@@ -56,7 +56,7 @@
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
api := NewTraceAPI(
- NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs),
+ NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil),
m.DB, &httpcfg.HttpCfg{})
// Insert blocks 1 by 1, to tirgget possible "off by one" errors
for i := 0; i < chain.Length(); i++ {
@@ -104,7 +104,7 @@ }
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
if err = m.InsertChain(chainA); err != nil {
t.Fatalf("inserting chainA: %v", err)
@@ -167,7 +167,7 @@ t.Fatalf("generate chain: %v", err)
}
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
// Insert blocks 1 by 1, to tirgget possible "off by one" errors
for i := 0; i < chain.Length(); i++ {
if err = m.InsertChain(chain.Slice(i, i+1)); err != nil {
@@ -193,7 +193,7 @@ func TestFilterAddressIntersection(t *testing.T) {
m := stages.Mock(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
toAddress1, toAddress2, other := common.Address{1}, common.Address{2}, common.Address{3}
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/corner_cases_support_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/corner_cases_support_test.go
index 66011e6b000d98883171bbd40572953419cc4614..92207ffc5d68bc3f3960053946ff84b19b4f0a5b 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/corner_cases_support_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/corner_cases_support_test.go
@@ -23,7 +23,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
api := NewEthAPI(
- NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs),
+ NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil),
m.DB, nil, nil, nil, 5000000, 100_000)
ctx := context.Background()
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/debug_api.go testinprod-io/erigon/cmd/rpcdaemon/commands/debug_api.go
index 35c3bfe076e569b3d3df537103c7f329436beb68..4f9ea09a5cc74b5437f1fc9053b9b8f8bf13c184 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/debug_api.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/debug_api.go
@@ -60,6 +60,10 @@ GasCap: gascap,
}
}
+func (api *PrivateDebugAPIImpl) relayToHistoricalBackend(ctx context.Context, result interface{}, method string, args ...interface{}) error {
+ return api.historicalRPCService.CallContext(ctx, result, method, args...)
+}
+
// storageRangeAt implements debug_storageRangeAt. Returns information about a range of storage locations (if any) for the given address.
func (api *PrivateDebugAPIImpl) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex uint64, contractAddress common.Address, keyStart hexutility.Bytes, maxResult int) (StorageRangeResult, error) {
tx, err := api.db.BeginRo(ctx)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/debug_api_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/debug_api_test.go
index bb6bf7765c5daa70d57081e69fae77d6daf0750f..c2eb62530388c3e15489bf28a8849c095a8eb041 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/debug_api_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/debug_api_test.go
@@ -55,7 +55,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
ethApi := NewEthAPI(baseApi, m.DB, nil, nil, nil, 5000000, 100_000)
api := NewPrivateDebugAPI(baseApi, m.DB, 0)
for _, tt := range debugTraceTransactionTests {
@@ -104,7 +104,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
ethApi := NewEthAPI(baseApi, m.DB, nil, nil, nil, 5000000, 100_000)
api := NewPrivateDebugAPI(baseApi, m.DB, 0)
for _, tt := range debugTraceTransactionTests {
@@ -140,7 +140,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewPrivateDebugAPI(base, m.DB, 0)
for _, tt := range debugTraceTransactionTests {
var buf bytes.Buffer
@@ -173,7 +173,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
agg := m.HistoryV3Components()
api := NewPrivateDebugAPI(
- NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs),
+ NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil),
m.DB, 0)
for _, tt := range debugTraceTransactionNoRefundTests {
var buf bytes.Buffer
@@ -207,7 +207,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
agg := m.HistoryV3Components()
api := NewPrivateDebugAPI(
- NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs),
+ NewBaseApi(nil, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil),
m.DB, 0)
t.Run("invalid addr", func(t *testing.T) {
var block4 *types.Block
@@ -304,7 +304,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewPrivateDebugAPI(base, m.DB, 0)
t.Run("valid account", func(t *testing.T) {
@@ -367,7 +367,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewPrivateDebugAPI(base, m.DB, 0)
t.Run("correct input", func(t *testing.T) {
@@ -470,7 +470,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ base := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewPrivateDebugAPI(base, m.DB, 0)
var blockHash0, blockHash1, blockHash3, blockHash10, blockHash12 common.Hash
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_api_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_api_test.go
index 6f3fef131b444110d7bb6b9585966b3f20a852e9..349262bc89897e47374bd9c59d0689e8dd042db8 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_api_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_api_test.go
@@ -29,7 +29,7 @@ br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
db := m.DB
agg := m.HistoryV3Components()
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), db, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), db, nil)
balances, err := api.GetBalanceChangesInBlock(context.Background(), myBlockNum)
if err != nil {
t.Errorf("calling GetBalanceChangesInBlock resulted in an error: %v", err)
@@ -52,7 +52,7 @@ db := m.DB
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), db, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), db, nil, nil, nil, 5000000, 100_000)
// Call GetTransactionReceipt for transaction which is not in the database
if _, err := api.GetTransactionReceipt(context.Background(), common.Hash{}); err != nil {
t.Errorf("calling GetTransactionReceipt with empty hash: %v", err)
@@ -64,7 +64,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
// Call GetTransactionReceipt for un-protected transaction
if _, err := api.GetTransactionReceipt(context.Background(), common.HexToHash("0x3f3cb8a0e13ed2481f97f53f7095b9cbc78b6ffb779f2d3e565146371a8830ea")); err != nil {
t.Errorf("calling GetTransactionReceipt for unprotected tx: %v", err)
@@ -79,7 +79,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithNumber(0))
@@ -96,7 +96,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), false))
@@ -113,7 +113,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
result, err := api.GetStorageAt(context.Background(), addr, "0x0", rpc.BlockNumberOrHashWithHash(m.Genesis.Hash(), true))
@@ -129,7 +129,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
offChain, err := core.GenerateChain(m.ChainConfig, m.Genesis, m.Engine, m.DB, 1, func(i int, block *core.BlockGen) {
@@ -153,7 +153,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
offChain, err := core.GenerateChain(m.ChainConfig, m.Genesis, m.Engine, m.DB, 1, func(i int, block *core.BlockGen) {
@@ -178,7 +178,7 @@ m, _, orphanedChain := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
orphanedBlock := orphanedChain[0].Blocks[0]
@@ -200,7 +200,7 @@ m, _, orphanedChain := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
addr := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
orphanedBlock := orphanedChain[0].Blocks[0]
@@ -219,7 +219,7 @@ m, _, orphanedChain := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
from := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
to := common.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
@@ -245,7 +245,7 @@ m, _, orphanedChain := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
from := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
to := common.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_block_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_block_test.go
index ccc4ddcf1cbdad02b5363823d87f715ebd364148..522d2e8e29e812a4ceb230ba52a6519eab6e39e1 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_block_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_block_test.go
@@ -28,7 +28,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
b, err := api.GetBlockByNumber(context.Background(), rpc.LatestBlockNumber, false)
expected := common.HexToHash("0x5883164d4100b95e1d8e931b8b9574586a1dea7507941e6ad3c1e3a2591485fd")
if err != nil {
@@ -61,7 +61,7 @@ t.Error("didn't find forkchoice head hash")
}
tx.Commit()
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
block, err := api.GetBlockByNumber(ctx, rpc.LatestBlockNumber, false)
if err != nil {
t.Errorf("error retrieving block by number: %s", err)
@@ -93,7 +93,7 @@ ff.HandlePendingBlock(&txpool.OnPendingBlockReply{
RplBlock: rlpBlock,
})
- api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
b, err := api.GetBlockByNumber(context.Background(), rpc.PendingBlockNumber, false)
if err != nil {
t.Errorf("error getting block number with pending tag: %s", err)
@@ -107,7 +107,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
if _, err := api.GetBlockByNumber(ctx, rpc.FinalizedBlockNumber, false); err != nil {
assert.ErrorIs(t, rpchelper.UnknownBlockError, err)
}
@@ -137,7 +137,7 @@ t.Error("didn't find forkchoice finalized hash")
}
tx.Commit()
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
block, err := api.GetBlockByNumber(ctx, rpc.FinalizedBlockNumber, false)
if err != nil {
t.Errorf("error retrieving block by number: %s", err)
@@ -152,7 +152,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
if _, err := api.GetBlockByNumber(ctx, rpc.SafeBlockNumber, false); err != nil {
assert.ErrorIs(t, rpchelper.UnknownBlockError, err)
}
@@ -182,7 +182,7 @@ t.Error("didn't find forkchoice safe block hash")
}
tx.Commit()
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
block, err := api.GetBlockByNumber(ctx, rpc.SafeBlockNumber, false)
if err != nil {
t.Errorf("error retrieving block by number: %s", err)
@@ -198,7 +198,7 @@ br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
blockHash := common.HexToHash("0x6804117de2f3e6ee32953e78ced1db7b20214e0d8c745a03b8fecf7cc8ee76ef")
tx, err := m.DB.BeginRw(ctx)
@@ -234,7 +234,7 @@ br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
blockHash := common.HexToHash("0x5883164d4100b95e1d8e931b8b9574586a1dea7507941e6ad3c1e3a2591485fd")
tx, err := m.DB.BeginRw(ctx)
@@ -269,7 +269,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
blockHash := common.HexToHash("0x6804117de2f3e6ee32953e78ced1db7b20214e0d8c745a03b8fecf7cc8ee76ef")
tx, err := m.DB.BeginRw(ctx)
@@ -304,7 +304,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
ctx := context.Background()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
blockHash := common.HexToHash("0x5883164d4100b95e1d8e931b8b9574586a1dea7507941e6ad3c1e3a2591485fd")
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_callMany_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_callMany_test.go
index 4dbeb9488a161898747644f38e07c9ba2c5d3d12..88b9835689d871470ff327ca4e4f39bb15abe09b 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_callMany_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_callMany_test.go
@@ -82,7 +82,7 @@ var secondNonce hexutil.Uint64 = 2
db := contractBackend.DB()
engine := contractBackend.Engine()
- api := NewEthAPI(NewBaseApi(nil, stateCache, contractBackend.BlockReader(), contractBackend.Agg(), false, rpccfg.DefaultEvmCallTimeout, engine, datadir.New(t.TempDir())), db, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, contractBackend.BlockReader(), contractBackend.Agg(), false, rpccfg.DefaultEvmCallTimeout, engine, datadir.New(t.TempDir()), nil, nil), db, nil, nil, nil, 5000000, 100_000)
callArgAddr1 := ethapi.CallArgs{From: &address, To: &tokenAddr, Nonce: &nonce,
MaxPriorityFeePerGas: (*hexutil.Big)(big.NewInt(1e9)),
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_call_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_call_test.go
index bd7bd99becbc16760f93c5bc8a104466638d4135..fa3627763a852606dd351eea74209ebb17481aad 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_call_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_call_test.go
@@ -46,7 +46,7 @@ stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, stages.Mock(t))
mining := txpool.NewMiningClient(conn)
ff := rpchelper.New(ctx, nil, nil, mining, func() {})
- api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
var from = libcommon.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
var to = libcommon.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
if _, err := api.EstimateGas(context.Background(), ðapi.CallArgs{
@@ -62,7 +62,7 @@ m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
var from = libcommon.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
var to = libcommon.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
if _, err := api.Call(context.Background(), ethapi.CallArgs{
@@ -87,7 +87,7 @@
agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
callData := hexutil.MustDecode("0x2e64cec1")
callDataBytes := hexutility.Bytes(callData)
@@ -280,7 +280,7 @@ }
agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
key := func(b byte) libcommon.Hash {
result := libcommon.Hash{}
@@ -382,10 +382,10 @@ }
defer tx.Rollback()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil)
latestBlock := rawdb.ReadCurrentBlock(tx)
- response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false)
+ response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false, nil)
if err != nil {
t.Error("couldn't get the rpc marshal block")
@@ -420,14 +420,14 @@ }
defer tx.Rollback()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil)
oldestBlock, err := rawdb.ReadBlockByNumber(tx, 0)
if err != nil {
t.Error("couldn't retrieve oldest block")
}
- response, err := ethapi.RPCMarshalBlockDeprecated(oldestBlock, true, false)
+ response, err := ethapi.RPCMarshalBlockDeprecated(oldestBlock, true, false, nil)
if err != nil {
t.Error("couldn't get the rpc marshal block")
@@ -462,11 +462,11 @@ }
defer tx.Rollback()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil)
latestBlock := rawdb.ReadCurrentBlock(tx)
- response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false)
+ response, err := ethapi.RPCMarshalBlockDeprecated(latestBlock, true, false, nil)
if err != nil {
t.Error("couldn't get the rpc marshal block")
@@ -501,7 +501,7 @@ }
defer tx.Rollback()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil)
currentHeader := rawdb.ReadCurrentHeader(tx)
oldestHeader, err := api._blockReader.HeaderByNumber(ctx, tx, 0)
@@ -518,7 +518,7 @@ if err != nil {
t.Error("couldn't retrieve middle block")
}
- response, err := ethapi.RPCMarshalBlockDeprecated(middleBlock, true, false)
+ response, err := ethapi.RPCMarshalBlockDeprecated(middleBlock, true, false, nil)
if err != nil {
t.Error("couldn't get the rpc marshal block")
@@ -552,7 +552,7 @@ }
defer tx.Rollback()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil)
+ api := NewErigonAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil)
highestBlockNumber := rawdb.ReadCurrentHeader(tx).Number
pickedBlock, err := rawdb.ReadBlockByNumber(tx, highestBlockNumber.Uint64()/3)
@@ -563,7 +563,7 @@
if pickedBlock == nil {
t.Error("couldn't retrieve picked block")
}
- response, err := ethapi.RPCMarshalBlockDeprecated(pickedBlock, true, false)
+ response, err := ethapi.RPCMarshalBlockDeprecated(pickedBlock, true, false, nil)
if err != nil {
t.Error("couldn't get the rpc marshal block")
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_filters.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_filters.go
index 3945b826804230d0a7bbcacb54c6f6bb4e9f1320..0e55bcca22a594824bf7b42f65d010dacca650f1 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_filters.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_filters.go
@@ -4,6 +4,7 @@ import (
"context"
"strings"
+ libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/log/v3"
"github.com/ledgerwatch/erigon/common/debug"
@@ -267,6 +268,10 @@ for {
select {
case h, ok := <-logs:
if h != nil {
+ // avoid null json array for topics
+ if h.Topics == nil {
+ h.Topics = []libcommon.Hash{}
+ }
err := notifier.Notify(rpcSub.ID, h)
if err != nil {
log.Warn("error while notifying subscription", "err", err)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_filters_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_filters_test.go
index 6f5d906bd405a36bdad741194a95557935ddc82f..46cd0fecc08266e6b2c2c12a61ed12fea3f6e51e 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_filters_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_filters_test.go
@@ -31,7 +31,7 @@ stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, stages.Mock(t))
mining := txpool.NewMiningClient(conn)
ff := rpchelper.New(ctx, nil, nil, mining, func() {})
- api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, nil, nil, 5000000, 100_000)
+ api := NewEthAPI(NewBaseApi(ff, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, nil, nil, 5000000, 100_000)
ptf, err := api.NewPendingTransactionFilter(ctx)
assert.Nil(err)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_mining_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_mining_test.go
index b740ea838b6205a3b1442734038c3b310c26c602..7c9b29a4feca9fd132188e9488d294224f39b6e8 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_mining_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_mining_test.go
@@ -27,7 +27,7 @@ ff := rpchelper.New(ctx, nil, nil, mining, func() {})
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
engine := ethash.NewFaker()
api := NewEthAPI(NewBaseApi(ff, stateCache, snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3), nil, false, rpccfg.DefaultEvmCallTimeout, engine,
- m.Dirs), nil, nil, nil, mining, 5000000, 100_000)
+ m.Dirs, nil, nil), nil, nil, nil, mining, 5000000, 100_000)
expect := uint64(12345)
b, err := rlp.EncodeToBytes(types.NewBlockWithHeader(&types.Header{Number: big.NewInt(int64(expect))}))
require.NoError(t, err)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_system.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_system.go
index 4077a6f0366dde8f12a80a2c5ba1b944aa48a40b..7ac65fccced23a249da957b8a32e6d721a101756 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_system.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_system.go
@@ -222,7 +222,7 @@ func (b *GasPriceOracleBackend) ChainConfig() *chain.Config {
return b.cc
}
func (b *GasPriceOracleBackend) GetReceipts(ctx context.Context, hash libcommon.Hash) (types.Receipts, error) {
- return rawdb.ReadReceiptsByHash(b.tx, hash)
+ return rawdb.ReadReceiptsByHash(b.cc, b.tx, hash)
}
func (b *GasPriceOracleBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts) {
return nil, nil
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_system_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/eth_system_test.go
index 923a1d477add9262529f4008c1facd9acaea41d3..fd38af495252883d8abf40516c8d19b61421f773 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/eth_system_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/eth_system_test.go
@@ -43,7 +43,7 @@ t.Run(testCase.description, func(t *testing.T) {
m := createGasPriceTestKV(t, testCase.chainSize)
defer m.DB.Close()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- base := NewBaseApi(nil, stateCache, snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3), nil, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ base := NewBaseApi(nil, stateCache, snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3), nil, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
eth := NewEthAPI(base, m.DB, nil, nil, nil, 5000000, 100_000)
ctx := context.Background()
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/gen_traces_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/gen_traces_test.go
index 6f674eff2fb666c8cce573d18c56c214719609a0..a9a0ae322a7adf43f5189635511398a905dd67b2 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/gen_traces_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/gen_traces_test.go
@@ -32,7 +32,7 @@ m := rpcdaemontest.CreateTestSentryForTraces(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewPrivateDebugAPI(baseApi, m.DB, 0)
var buf bytes.Buffer
stream := jsoniter.NewStream(jsoniter.ConfigDefault, &buf, 4096)
@@ -120,7 +120,7 @@ m := rpcdaemontest.CreateTestSentryForTraces(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewTraceAPI(baseApi, m.DB, &httpcfg.HttpCfg{})
traces, err := api.Block(context.Background(), rpc.BlockNumber(1), new(bool))
if err != nil {
@@ -279,7 +279,7 @@ m := rpcdaemontest.CreateTestSentryForTracesCollision(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs)
+ baseApi := NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil)
api := NewTraceAPI(baseApi, m.DB, &httpcfg.HttpCfg{})
traces, err := api.Transaction(context.Background(), common.HexToHash("0xb2b9fa4c999c1c8370ce1fbd1c4315a9ce7f8421fe2ebed8a9051ff2e4e7e3da"), new(bool))
if err != nil {
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/graphql_api.go testinprod-io/erigon/cmd/rpcdaemon/commands/graphql_api.go
index b4f2fb053342395e8252b9dcfc4241803c13b427..b8dd20bc5a92d20923da6e69303436152cc9db44 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/graphql_api.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/graphql_api.go
@@ -115,7 +115,8 @@ if err != nil {
return nil, err
}
additionalFields := make(map[string]interface{})
- response, err := ethapi.RPCMarshalBlock(b, inclTx, inclTx, additionalFields)
+ depositNonces := rawdb.ReadDepositNonces(tx, uint64(number.Int64()))
+ response, err := ethapi.RPCMarshalBlock(b, inclTx, inclTx, additionalFields, depositNonces)
if !inclTx {
delete(response, "transactions") // workaround for https://github.com/ledgerwatch/erigon/issues/4989#issuecomment-1218415666
}
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_contract_creator_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_contract_creator_test.go
index 65a901dbacfd365a8c94ceda6c9cc40525ec80a9..309ecc27a99c6976ab70740ec2dc512c7573fc2c 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_contract_creator_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_contract_creator_test.go
@@ -14,7 +14,7 @@ func TestGetContractCreator(t *testing.T) {
m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB)
+ api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB)
addr := libcommon.HexToAddress("0x537e697c7ab75a26f9ecf0ce810e3154dfcaaf44")
expectCreator := libcommon.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_search_backward_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_search_backward_test.go
index 56026b3ce31ff5faa16da373a653c9c92516275b..af9d2838a282958ed087b3c14932779abab9b3ab 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_search_backward_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_search_backward_test.go
@@ -152,7 +152,7 @@ func TestSearchTransactionsBefore(t *testing.T) {
m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB)
+ api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB)
addr := libcommon.HexToAddress("0x537e697c7ab75a26f9ecf0ce810e3154dfcaaf44")
t.Run("small page size", func(t *testing.T) {
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_transaction_by_sender_and_nonce_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_transaction_by_sender_and_nonce_test.go
index 7ca335ed6fc4a13299cba1810ac1edef5bd799ca..aacc670098ba6a0d0d217c73630a60f25832e4db 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/otterscan_transaction_by_sender_and_nonce_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/otterscan_transaction_by_sender_and_nonce_test.go
@@ -14,7 +14,7 @@ func TestGetTransactionBySenderAndNonce(t *testing.T) {
m, _, _ := rpcdaemontest.CreateTestSentry(t)
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB)
+ api := NewOtterscanAPI(NewBaseApi(nil, nil, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB)
addr := common.HexToAddress("0x537e697c7ab75a26f9ecf0ce810e3154dfcaaf44")
expectCreator := common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/send_transaction_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/send_transaction_test.go
index 35edda6013bfa346fa90979b2e8b68fe7aa6857a..0c60744ce738660b0c2c10cf169d8d5db18f1e9d 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/send_transaction_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/send_transaction_test.go
@@ -74,7 +74,7 @@ txPool := txpool.NewTxpoolClient(conn)
ff := rpchelper.New(ctx, nil, txPool, txpool.NewMiningClient(conn), func() {})
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := commands.NewEthAPI(commands.NewBaseApi(ff, stateCache, br, nil, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, nil, txPool, nil, 5000000, 100_000)
+ api := commands.NewEthAPI(commands.NewBaseApi(ff, stateCache, br, nil, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, nil, txPool, nil, 5000000, 100_000)
buf := bytes.NewBuffer(nil)
err = txn.MarshalBinary(buf)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/trace_adhoc_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/trace_adhoc_test.go
index d75e7eef7bd231ed1a855b840682c2a4bd2ba9d9..53c9b302df206c2ec781f533a130b36617c7be73 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/trace_adhoc_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/trace_adhoc_test.go
@@ -25,7 +25,7 @@ agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
// Call GetTransactionReceipt for transaction which is not in the database
var latest = rpc.LatestBlockNumber
results, err := api.CallMany(context.Background(), json.RawMessage("[]"), &rpc.BlockNumberOrHash{BlockNumber: &latest})
@@ -45,7 +45,7 @@ agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
// Call GetTransactionReceipt for transaction which is not in the database
var latest = rpc.LatestBlockNumber
results, err := api.CallMany(context.Background(), json.RawMessage(`
@@ -75,7 +75,7 @@ agg := m.HistoryV3Components()
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
var txnHash libcommon.Hash
if err := m.DB.View(context.Background(), func(tx kv.Tx) error {
b, err := rawdb.ReadBlockByNumber(tx, 6)
@@ -106,7 +106,7 @@ agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
stateCache := kvcache.New(kvcache.DefaultCoherentConfig)
- api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, &httpcfg.HttpCfg{})
+ api := NewTraceAPI(NewBaseApi(nil, stateCache, br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, &httpcfg.HttpCfg{})
// Call GetTransactionReceipt for transaction which is not in the database
n := rpc.BlockNumber(6)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/trace_types.go testinprod-io/erigon/cmd/rpcdaemon/commands/trace_types.go
index a905d3a4c8a20998c96912589bafbb882484b52d..6f2ed25e4788bb856275a56ef1c49d0582cbbea5 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/trace_types.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/trace_types.go
@@ -20,17 +20,17 @@ // directly with existing Parity tests
// GethTrace The trace as received from the existing Geth javascript tracer 'callTracer'
type GethTrace struct {
- Type string `json:"type"`
- Error string `json:"error"`
- From string `json:"from"`
- To string `json:"to"`
- Value string `json:"value"`
- Gas string `json:"gas"`
- GasUsed string `json:"gasUsed"`
- Input string `json:"input"`
- Output string `json:"output"`
- Time string `json:"time"`
- Calls GethTraces `json:"calls"`
+ Type string `json:"type,omitempty"`
+ Error string `json:"error,omitempty"`
+ From string `json:"from,omitempty"`
+ To string `json:"to,omitempty"`
+ Value string `json:"value,omitempty"`
+ Gas string `json:"gas,omitempty"`
+ GasUsed string `json:"gasUsed,omitempty"`
+ Input string `json:"input,omitempty"`
+ Output string `json:"output,omitempty"`
+ Time string `json:"time,omitempty"`
+ Calls GethTraces `json:"calls,omitempty"`
}
// GethTraces an array of GethTraces
diff --git ledgerwatch/erigon/cmd/rpcdaemon/commands/txpool_api_test.go testinprod-io/erigon/cmd/rpcdaemon/commands/txpool_api_test.go
index fe6fd07fd4c4448a44cd1b2de9db41b8b71c24c0..cca59f3f685cab7a3de7fcd86df77079969d5c39 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/commands/txpool_api_test.go
+++ testinprod-io/erigon/cmd/rpcdaemon/commands/txpool_api_test.go
@@ -37,7 +37,7 @@ txPool := txpool.NewTxpoolClient(conn)
ff := rpchelper.New(ctx, nil, txPool, txpool.NewMiningClient(conn), func() {})
agg := m.HistoryV3Components()
br := snapshotsync.NewBlockReaderWithSnapshots(m.BlockSnapshots, m.TransactionsV3)
- api := NewTxPoolAPI(NewBaseApi(ff, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs), m.DB, txPool)
+ api := NewTxPoolAPI(NewBaseApi(ff, kvcache.New(kvcache.DefaultCoherentConfig), br, agg, false, rpccfg.DefaultEvmCallTimeout, m.Engine, m.Dirs, nil, nil), m.DB, txPool)
expectValue := uint64(1234)
txn, err := types.SignTx(types.NewTransaction(0, libcommon.Address{1}, uint256.NewInt(expectValue), params.TxGas, uint256.NewInt(10*params.GWei), nil), *types.LatestSignerForChainID(m.ChainConfig.ChainID), m.Key)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/graphql/graph/helpers.go testinprod-io/erigon/cmd/rpcdaemon/graphql/graph/helpers.go
index 4bc6c7da4e681865739d45a53f265196c753e7de..7bf46967739ffa2eee6ea10662c11da0c1b75d14 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/graphql/graph/helpers.go
+++ testinprod-io/erigon/cmd/rpcdaemon/graphql/graph/helpers.go
@@ -18,6 +18,10 @@
func convertDataToStringP(abstractMap map[string]interface{}, field string) *string {
var result string
+ if reflect.ValueOf(abstractMap[field]).IsZero() {
+ return nil
+ }
+
switch v := abstractMap[field].(type) {
case int64:
result = strconv.FormatInt(v, 10)
diff --git ledgerwatch/erigon/cmd/rpcdaemon/main.go testinprod-io/erigon/cmd/rpcdaemon/main.go
index 3db874b510631a9e411f7a13fbd9ddd32267ed3a..299c7a3f028d1ab78c791e465804181d8393a1b7 100644
--- ledgerwatch/erigon/cmd/rpcdaemon/main.go
+++ testinprod-io/erigon/cmd/rpcdaemon/main.go
@@ -1,12 +1,15 @@
package main
import (
+ "context"
"os"
+ "time"
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/erigon/cmd/rpcdaemon/commands"
"github.com/ledgerwatch/erigon/consensus/ethash"
+ "github.com/ledgerwatch/erigon/rpc"
"github.com/ledgerwatch/erigon/turbo/logging"
"github.com/ledgerwatch/log/v3"
"github.com/spf13/cobra"
@@ -28,9 +31,34 @@ if borDb != nil {
defer borDb.Close()
}
+ var seqRPCService *rpc.Client
+ var historicalRPCService *rpc.Client
+
+ // Setup sequencer and hsistorical RPC relay services
+ if cfg.RollupSequencerHTTP != "" {
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ client, err := rpc.DialContext(ctx, cfg.RollupSequencerHTTP)
+ cancel()
+ if err != nil {
+ log.Error(err.Error())
+ return nil
+ }
+ seqRPCService = client
+ }
+ if cfg.RollupHistoricalRPC != "" {
+ ctx, cancel := context.WithTimeout(context.Background(), cfg.RollupHistoricalRPCTimeout)
+ client, err := rpc.DialContext(ctx, cfg.RollupHistoricalRPC)
+ cancel()
+ if err != nil {
+ log.Error(err.Error())
+ return nil
+ }
+ historicalRPCService = client
+ }
+
// TODO: Replace with correct consensus Engine
engine := ethash.NewFaker()
- apiList := commands.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg, engine)
+ apiList := commands.APIList(db, borDb, backend, txPool, mining, ff, stateCache, blockReader, agg, *cfg, engine, seqRPCService, historicalRPCService)
if err := cli.StartRpcServer(ctx, *cfg, apiList, nil); err != nil {
log.Error(err.Error())
return nil
diff --git ledgerwatch/erigon/cmd/sentry/sentry/sentry_multi_client.go testinprod-io/erigon/cmd/sentry/sentry/sentry_multi_client.go
index b56b1cd100618cd10047bb309ab1a6534867c207..5554d6e43664f3847e09911537776ac1ee0b419b 100644
--- ledgerwatch/erigon/cmd/sentry/sentry/sentry_multi_client.go
+++ testinprod-io/erigon/cmd/sentry/sentry/sentry_multi_client.go
@@ -670,7 +670,7 @@ if err != nil {
return err
}
defer tx.Rollback()
- receipts, err := eth.AnswerGetReceiptsQuery(tx, query.GetReceiptsPacket)
+ receipts, err := eth.AnswerGetReceiptsQuery(cs.ChainConfig, tx, query.GetReceiptsPacket)
if err != nil {
return err
}
diff --git ledgerwatch/erigon/common/hexutil/hexutil.go testinprod-io/erigon/common/hexutil/hexutil.go
index 3df5272075c795bba8d566c6e40a1ff5594b734a..5dc731f15b180ee0addfc97562a921ed63cc35b5 100644
--- ledgerwatch/erigon/common/hexutil/hexutil.go
+++ testinprod-io/erigon/common/hexutil/hexutil.go
@@ -56,6 +56,14 @@ type decError struct{ msg string }
func (err decError) Error() string { return err.msg }
+// Encode encodes b as a hex string with 0x prefix.
+func Encode(b []byte) string {
+ enc := make([]byte, len(b)*2+2)
+ copy(enc, "0x")
+ hex.Encode(enc[2:], b)
+ return string(enc)
+}
+
// Decode decodes a hex string with 0x prefix.
func Decode(input string) ([]byte, error) {
if len(input) == 0 {
diff --git ledgerwatch/erigon/core/blockchain.go testinprod-io/erigon/core/blockchain.go
index 39695039ea7bde89e4f8aa54358bd7133e6e2298..5b74da3cf24b4aa3ead1396c056d58a93b84bff3 100644
--- ledgerwatch/erigon/core/blockchain.go
+++ testinprod-io/erigon/core/blockchain.go
@@ -333,8 +333,9 @@ 0, u256.Num0,
math.MaxUint64, u256.Num0,
nil, nil,
data, nil, false,
- true, // isFree
- nil, // maxFeePerDataGas
+ true, // isFree
+ false, // isFake
+ nil, // maxFeePerDataGas
)
vmConfig := vm.Config{NoReceipts: true, RestoreState: constCall}
// Create a new context to be used in the EVM environment
@@ -377,8 +378,9 @@ 0, u256.Num0,
math.MaxUint64, u256.Num0,
nil, nil,
data, nil, false,
- true, // isFree
- nil, // maxFeePerDataGas
+ true, // isFree
+ false, // isFake
+ nil, // maxFeePerDataGas
)
vmConfig := vm.Config{NoReceipts: true}
// Create a new context to be used in the EVM environment
diff --git ledgerwatch/erigon/core/error.go testinprod-io/erigon/core/error.go
index 82782407dd511da37a82d26c60c962f639e23224..45fcf52e33dc90d909a9f0dd76872709bf0b3ed8 100644
--- ledgerwatch/erigon/core/error.go
+++ testinprod-io/erigon/core/error.go
@@ -99,4 +99,7 @@
// ErrSenderNoEOA is returned if the sender of a transaction is a contract.
// See EIP-3607: Reject transactions from senders with deployed code.
ErrSenderNoEOA = errors.New("sender not an eoa")
+
+ // ErrSystemTxNotSupported is returned for any deposit tx with IsSystemTx=true after the Regolith fork
+ ErrSystemTxNotSupported = errors.New("system tx not supported")
)
diff --git ledgerwatch/erigon/core/genesis_write.go testinprod-io/erigon/core/genesis_write.go
index 0c3855588e8b30ea6a8e57bf0c94e9d72b432845..a156f9ee57d28c862c37e8960f38e35c13e4b88b 100644
--- ledgerwatch/erigon/core/genesis_write.go
+++ testinprod-io/erigon/core/genesis_write.go
@@ -96,6 +96,9 @@ applyOverrides := func(config *chain.Config) {
if overrideShanghaiTime != nil {
config.ShanghaiTime = overrideShanghaiTime
}
+ if config.IsOptimism() && config.ChainID != nil && config.ChainID.Cmp(params.OptimismGoerliChainConfig.ChainID) == 0 {
+ config.RegolithTime = params.OptimismGoerliChainConfig.RegolithTime
+ }
}
if (storedHash == libcommon.Hash{}) {
@@ -405,6 +408,17 @@ Alloc: readPrealloc("allocs/bor_devnet.json"),
}
}
+func DefaultOptimismGoerliGenesisBlock() *types.Genesis {
+ return &types.Genesis{
+ Config: params.OptimismGoerliChainConfig,
+ Difficulty: big.NewInt(1),
+ Mixhash: libcommon.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"),
+ ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000027770a9694e4b4b1e130ab91bc327c36855f612e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
+ GasLimit: 15000000,
+ Alloc: readPrealloc("allocs/optimism-goerli.json"),
+ }
+}
+
func GnosisGenesisBlock() *types.Genesis {
return &types.Genesis{
Config: params.GnosisChainConfig,
@@ -616,6 +630,8 @@ case networkname.BorMainnetChainName:
return BorMainnetGenesisBlock()
case networkname.BorDevnetChainName:
return BorDevnetGenesisBlock()
+ case networkname.OptimismGoerliChainName:
+ return DefaultOptimismGoerliGenesisBlock()
case networkname.GnosisChainName:
return GnosisGenesisBlock()
case networkname.ChiadoChainName:
diff --git ledgerwatch/erigon/core/types/blob_tx_wrapper.go testinprod-io/erigon/core/types/blob_tx_wrapper.go
index fe036c683b35e3c60188673ab51daa345ef3c8f2..e9552a8732e2d9385719f26e2ea80cc8841424dd 100644
--- ledgerwatch/erigon/core/types/blob_tx_wrapper.go
+++ testinprod-io/erigon/core/types/blob_tx_wrapper.go
@@ -437,3 +437,7 @@ return err
}
return rlp.Encode(w, buf.Bytes())
}
+
+func (txw *BlobTxWrapper) RollupDataGas() RollupGasData {
+ return txw.Tx.RollupDataGas()
+}
diff --git ledgerwatch/erigon/core/types/signed_blob_tx.go testinprod-io/erigon/core/types/signed_blob_tx.go
index ca8354ecef915d7f0df59978cccd16ed7e0652f0..8d5a9383cc43047de29ca5cc6e7f926c6bed9f16 100644
--- ledgerwatch/erigon/core/types/signed_blob_tx.go
+++ testinprod-io/erigon/core/types/signed_blob_tx.go
@@ -594,3 +594,9 @@
func (stx *SignedBlobTx) FixedLength() uint64 {
return 0
}
+
+func (stx *SignedBlobTx) RollupDataGas() RollupGasData {
+ // RollupDataGas is a method for calculating L1 cost on L2.
+ // Because blob TX is not supported on L2, this method must not be called.
+ panic("BlobTx is not supported on L2")
+}
diff --git ledgerwatch/erigon/core/vm/evm.go testinprod-io/erigon/core/vm/evm.go
index 632ee1d0dcc721fce28bd78887c24095cacc096e..d64daec310fb18de7ddc58bddcf12317e27d3ac7 100644
--- ledgerwatch/erigon/core/vm/evm.go
+++ testinprod-io/erigon/core/vm/evm.go
@@ -50,6 +50,10 @@ p, ok := precompiles[addr]
return p, ok
}
+func (evm *EVM) Precompile(addr libcommon.Address) (PrecompiledContract, bool) {
+ return evm.precompile(addr)
+}
+
// run runs the given contract and takes care of running precompiles with a fallback to the byte code interpreter.
func run(evm *EVM, contract *Contract, input []byte, readOnly bool) ([]byte, error) {
return evm.interpreter.Run(contract, input, readOnly)
diff --git ledgerwatch/erigon/eth/gasprice/gasprice_test.go testinprod-io/erigon/eth/gasprice/gasprice_test.go
index fb73a02e787fcfcc26a2db9b04198a1240d113b3..184f8c1885a64db56534696e732d93794447cd23 100644
--- ledgerwatch/erigon/eth/gasprice/gasprice_test.go
+++ testinprod-io/erigon/eth/gasprice/gasprice_test.go
@@ -50,7 +50,7 @@ if err != nil {
return nil, err
}
defer tx.Rollback()
- return rawdb.ReadReceiptsByHash(tx, hash)
+ return rawdb.ReadReceiptsByHash(b.cfg, tx, hash)
}
func (b *testBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts) {
diff --git ledgerwatch/erigon/eth/protocols/eth/handler_test.go testinprod-io/erigon/eth/protocols/eth/handler_test.go
index f632d133dcadbd3848cd8d3789f1c5348bd34264..699afb66a8143ee6bcf8d8d04bfbe30906a583a4 100644
--- ledgerwatch/erigon/eth/protocols/eth/handler_test.go
+++ testinprod-io/erigon/eth/protocols/eth/handler_test.go
@@ -95,7 +95,7 @@ block := rawdb.ReadHeaderByNumber(tx, i)
hashes = append(hashes, block.Hash())
// If known, encode and queue for response packet
- r, err := rawdb.ReadReceiptsByHash(tx, block.Hash())
+ r, err := rawdb.ReadReceiptsByHash(params.TestChainConfig, tx, block.Hash())
if err != nil {
return err
}
diff --git ledgerwatch/erigon/eth/protocols/eth/handlers.go testinprod-io/erigon/eth/protocols/eth/handlers.go
index 9be97f2b29536b50faf84264275e2fc60374a3cf..05b1de6a08fed2b4d929ef1f2bd76eb072cfbe6c 100644
--- ledgerwatch/erigon/eth/protocols/eth/handlers.go
+++ testinprod-io/erigon/eth/protocols/eth/handlers.go
@@ -19,6 +19,7 @@
import (
"context"
"fmt"
+ "github.com/ledgerwatch/erigon-lib/chain"
libcommon "github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/kv"
@@ -166,7 +167,7 @@ }
return bodies
}
-func AnswerGetReceiptsQuery(db kv.Tx, query GetReceiptsPacket) ([]rlp.RawValue, error) { //nolint:unparam
+func AnswerGetReceiptsQuery(chainCfg *chain.Config, db kv.Tx, query GetReceiptsPacket) ([]rlp.RawValue, error) { //nolint:unparam
// Gather state data until the fetch or network limits is reached
var (
bytes int
@@ -178,7 +179,7 @@ lookups >= 2*maxReceiptsServe {
break
}
// Retrieve the requested block's receipts
- results, err := rawdb.ReadReceiptsByHash(db, hash)
+ results, err := rawdb.ReadReceiptsByHash(chainCfg, db, hash)
if err != nil {
return nil, err
}
diff --git ledgerwatch/erigon/eth/tracers/api.go testinprod-io/erigon/eth/tracers/api.go
index d246499924851953bac73e843e2316ea1b7720fb..402b92c1a97b9c79a506a330b7ce6c7b1a984c98 100644
--- ledgerwatch/erigon/eth/tracers/api.go
+++ testinprod-io/erigon/eth/tracers/api.go
@@ -10,13 +10,13 @@
// TraceConfig holds extra parameters to trace functions.
type TraceConfig struct {
*logger.LogConfig
- Tracer *string
- TracerConfig *json.RawMessage
- Timeout *string
- Reexec *uint64
- NoRefunds *bool // Turns off gas refunds when tracing
- StateOverrides *ethapi.StateOverrides
+ Tracer *string `json:"tracer"`
+ TracerConfig *json.RawMessage `json:"tracerConfig,omitempty"`
+ Timeout *string `json:"timeout,omitempty"`
+ Reexec *uint64 `json:"reexec,omitempty"`
+ NoRefunds *bool `json:"-"` // Turns off gas refunds when tracing
+ StateOverrides *ethapi.StateOverrides `json:"-"`
- BorTraceEnabled *bool
- BorTx *bool
+ BorTraceEnabled *bool `json:"-"`
+ BorTx *bool `json:"-"`
}
diff --git ledgerwatch/erigon/forkdiff.yaml testinprod-io/erigon/forkdiff.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..e9312585697c022a43a19cc6a11be566744d82b5
--- /dev/null
+++ testinprod-io/erigon/forkdiff.yaml
@@ -0,0 +1,183 @@
+title: "op-erigon" # Define the HTML page title
+footer: | # define the footer with markdown
+ Fork-diff overview of [op-erigon](https://github.com/testinprod-io/erigon), a fork of [erigon](https://github.com/ledgerwatch/erigon). and execution-engine of the [OP Stack](https://github.com/ethereum-optimism/optimism).
+base:
+ name: ledgerwatch/erigon
+ url: https://github.com/ledgerwatch/erigon
+ ref: refs/tags/v2.38.1
+fork:
+ name: testinprod-io/erigon
+ url: https://github.com/testinprod-io/erigon
+ ref: refs/heads/op-erigon
+def:
+ title: "op-erigon"
+ description: | # description in markdown
+ This is an overview of the changes in [op-erigon](https://github.com/testinprod-io/erigon), a fork of [erigon](https://github.com/ledgerwatch/erigon), part of the OP Stack.
+
+ There are two more forks of erigon dependencies:
+
+ - [op-erigon-lib](./erigon-lib.html)
+ - [op-erigon-interfaces](./erigon-interfaces.html)
+ sub:
+ - title: "Core modifications"
+ sub:
+ - title: "State-transition modifications"
+ sub:
+ - title: "Deposit transaction type"
+ description: |
+ The Bedrock upgrade introduces a Deposit transaction-type (0x7E) to enable both users and the rollup system itself to change the L2 state based on L1 events and system rules as [specified](https://github.com/ethereum-optimism/optimism/blob/develop/specs/deposits.md).
+ globs:
+ - "core/types/deposit_tx.go"
+ - "core/types/transaction_marshalling.go"
+ - "core/types/transaction_signing.go"
+ - title: "Transaction properties"
+ description: |
+ The Transaction type now exposes the deposit-transaction and L1-cost properties required for the rollup.
+ globs:
+ - "core/types/access_list_tx.go"
+ - "core/types/dynamic_fee_tx.go"
+ - "core/types/legacy_tx.go"
+ - title: "L1 cost computation"
+ description: |
+ Transactions must pay an additional L1 cost based on the amount of rollup-data-gas they consume, estimated based on gas-price-oracle information and encoded tx size.
+ globs:
+ - "core/types/rollup_l1_cost.go"
+ - "core/types/transaction.go"
+ - "core/vm/evmtypes/evmtypes.go"
+ - "cmd/rpcdaemon/commands/trace_adhoc.go"
+ - "cmd/rpcdaemon/commands/trace_filtering.go"
+ - "cmd/rpcdaemon/commands/tracing.go"
+ - "turbo/transactions/call.go"
+ - "turbo/transactions/tracing.go"
+ - title: "Transaction processing"
+ description: |
+ Deposit transactions have special processing rules: gas is pre-paid on L1, and deposits with EVM-failure are included with rolled back changes (except mint). For regular transactions, at the end of the transition, the 1559 burn and L1 cost are routed to vaults.
+ globs:
+ - "core/state_transition.go"
+ - title: "Gaslimit"
+ description: |
+ Deposit transactions have special processing rules: gas is pre-paid on L1, and deposits with EVM-failure are included with rolled back changes (except mint). For regular transactions, at the end of the transition, the 1559 burn and L1 cost are routed to vaults.
+ globs:
+ - "consensus/misc/eip1559.go"
+ - title: "Regolith upgrade"
+ globs:
+ - "core/state_processor.go"
+ - title: "Chain config"
+ description: |
+ The rollup functionality is enabled with the optimism field in the chain config. The EIP-1559 parameters are configurable to adjust for faster more frequent and smaller blocks. The parameters can be overriden for testing.
+ globs:
+ - "params/protocol_params.go"
+ - title: "Engine API modifications"
+ description: |
+ The Engine API is extended to insert transactions into the block and optionally exclude the tx-pool, to reproduce the exact block of the sequencer from just the inputs, as derived from L1 by the rollup-node. See [L2 execution engine specs](https://github.com/ethereum-optimism/optimism/blob/develop/specs/exec-engine.md).
+ globs:
+ - "cmd/rpcdaemon/commands/engine_api.go"
+ - "ethdb/privateapi/ethbackend.go"
+ - title: "Block-building modifications"
+ description: |
+ The block-building code (in the “mining” stages because of Proof-Of-Work legacy of ethereum) implements the changes to support the transaction-inclusion, tx-pool toggle and gaslimit parameters of the Engine API.
+ globs:
+ - "cmd/integration/commands/stages.go"
+ - "eth/stagedsync/default_stages.go"
+ - "eth/stagedsync/stage_mining_create_block.go"
+ - "eth/stagedsync/stage_mining_exec.go"
+ - "eth/stagedsync/stage_mining_force_txs.go"
+ - "eth/stagedsync/stagebuilder.go"
+ - "core/block_builder_parameters.go"
+ - "params/mining.go"
+ - "core/chain_makers.go"
+ - "eth/stagedsync/stage_mining_exec_test.go"
+ - title: "Tx-pool tx cost updates"
+ description: |
+ Transaction queueing and inclusion needs to account for the L1 cost component.
+ globs:
+ - "cmd/txpool/main.go"
+
+ - title: "Node modifications"
+ description: |
+ Changes to the node configuration and services.
+ sub:
+ - title: "CLI"
+ sub:
+ - title: "Flags"
+ description: |
+ Flag changes: - Transactions can be forwarded to an RPC for sequencing. - Historical calls can be forwarded to a legacy node. - The tx pool propagation can be enabled/disabled. - The Optimism bedrock fork activation can be changed for testing.
+ globs:
+ - "cmd/utils/flags.go"
+ - "turbo/cli/default_flags.go"
+ - title: "Versioning"
+ description: |
+ List the op-geth and upstream go-ethereum versions.
+ globs:
+ - "params/version.go"
+ - title: "Node config"
+ globs:
+ - "eth/ethconfig/config.go"
+ - title: "Tx gossip disable option"
+ - title: "Goerli testnet configs"
+ globs:
+ - "params/config.go"
+ - "core/genesis.go"
+ - "params/networkname/network_name.go"
+ - "params/chainspecs/optimism-goerli.json"
+ - "core/allocs/optimism-goerli.json"
+ - title: "User API enhancements"
+ description: |
+ Encode the Deposit Tx properties, the L1 costs, and daisy-chain RPC-calls for pre-Bedrock historical data
+ sub:
+ - title: "Receipts metadata"
+ description: |
+ Pre-Bedrock L1-cost receipt data is loaded from the database if available, and post-Bedrock the L1-cost metadata is hydrated on-the-fly based on the L1 fee information in the corresponding block.
+ globs:
+ - "core/types/receipt.go"
+ - "core/types/receipt_test.go"
+ - "cmd/rpcdaemon/commands/eth_receipts.go"
+ - "cmd/rpcdaemon/commands/erigon_receipts_test.go"
+ - "accounts/abi/bind/backends/simulated.go"
+ - "core/rawdb/accessors_chain.go"
+ - "core/rawdb/accessors_chain_test.go"
+ - "core/rawdb/accessors_indexes.go"
+ - "ethdb/cbor/pool.go"
+ - title: "API Backend"
+ description: |
+ Forward transactions to the sequencer or historical node if configured.
+ globs:
+ - "cmd/erigon-el/backend/backend.go"
+ - "cmd/rpcdaemon/commands/daemon.go"
+ - "eth/backend.go"
+ - "cmd/rpcdaemon/commands/eth_accounts.go"
+ - "cmd/rpcdaemon/commands/eth_call.go"
+ - "cmd/rpcdaemon/commands/send_transaction.go"
+ - "rpc/errors.go"
+ - title: "Transaction & Block response"
+ description: |
+ Format deposit and L1-cost data in transaction responses.
+ globs:
+ - "cmd/rpcdaemon/commands/eth_api.go"
+ - "turbo/adapter/ethapi/api.go"
+ - "turbo/adapter/ethapi/internal.go"
+ - "cmd/rpcdaemon/commands/erigon_block.go"
+ - "cmd/rpcdaemon/commands/eth_block.go"
+ - "cmd/rpcdaemon/commands/eth_txs.go"
+ - "cmd/rpcdaemon/commands/eth_uncles.go"
+ - title: "Otterscan API"
+ globs:
+ - "cmd/rpcdaemon/commands/otterscan_api.go"
+ - "cmd/rpcdaemon/commands/otterscan_block_details.go"
+ - "cmd/rpcdaemon/commands/otterscan_contract_creator.go"
+ - "cmd/rpcdaemon/commands/otterscan_generic_tracer.go"
+ - "cmd/rpcdaemon/commands/otterscan_search_trace.go"
+ - title: "Generated files"
+ globs:
+ - "core/types/receipt_codecgen_gen.go"
+# files can be ignored globally, these will be listed in a separate grayed-out section,
+# and do not count towards the total line count.
+ignore:
+ - "*.sum"
+ - ".gitignore"
+ - ".github/**/*"
+ - "Dockerfile"
+ - "cmd/downloader/recompress.sh"
+ - "cmd/downloader/torrent_hashes_update.sh"
+ - "README.md"
+ - "Makefile"
\ No newline at end of file
diff --git ledgerwatch/erigon/go.mod testinprod-io/erigon/go.mod
index 38a4f09af9bcb7a0e43bd4acefcf40787558a223..9a64564e377ae451fb1b106be810dd5672bc965f 100644
--- ledgerwatch/erigon/go.mod
+++ testinprod-io/erigon/go.mod
@@ -2,6 +2,12 @@ module github.com/ledgerwatch/erigon
go 1.19
+//fork with minor protobuf file changes and txpool support
+replace github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407 => github.com/testinprod-io/erigon-lib v0.0.0-20230510042408-cab68978c512
+
+//for local dev:
+//replace github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407 => ../erigon-lib
+
require (
github.com/ledgerwatch/erigon-lib v0.0.0-20230423044930-fc9dd74e6407
github.com/ledgerwatch/erigon-snapshot v1.1.1-0.20230404044759-5dec854ce336
diff --git ledgerwatch/erigon/node/nodecfg/defaults.go testinprod-io/erigon/node/nodecfg/defaults.go
index 611208c55ea3da2f9e9daf75d56b839b070b1661..246b7351cd1476cedc280e6270851f96f6ce9ddd 100644
--- ledgerwatch/erigon/node/nodecfg/defaults.go
+++ testinprod-io/erigon/node/nodecfg/defaults.go
@@ -17,7 +17,9 @@
package nodecfg
import (
+ "github.com/c2h5oh/datasize"
"github.com/ledgerwatch/erigon-lib/common/datadir"
+ "github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common/paths"
"github.com/ledgerwatch/erigon/p2p"
"github.com/ledgerwatch/erigon/p2p/nat"
@@ -52,4 +54,6 @@ MaxPeers: 100,
MaxPendingPeers: 1000,
NAT: nat.Any(),
},
+ MdbxPageSize: datasize.ByteSize(kv.DefaultPageSize()),
+ MdbxDBSizeLimit: 7 * datasize.TB,
}
diff --git ledgerwatch/erigon/rpc/rpccfg/rpccfg.go testinprod-io/erigon/rpc/rpccfg/rpccfg.go
index f1cde689c78d917d117656fa44f7ca02cccbe506..b7b936eaf05f5264de4e962fac21fe26e01a30c3 100644
--- ledgerwatch/erigon/rpc/rpccfg/rpccfg.go
+++ testinprod-io/erigon/rpc/rpccfg/rpccfg.go
@@ -37,3 +37,5 @@ IdleTimeout: 120 * time.Second,
}
const DefaultEvmCallTimeout = 5 * time.Minute
+
+const DefaultHistoricalRPCTimeout = 5 * time.Second
diff --git ledgerwatch/erigon/tests/automated-testing/docker-compose.yml testinprod-io/erigon/tests/automated-testing/docker-compose.yml
index aec7614b7930c3ab4a5a22c9e782eac0f4bdefcb..23a46c47a80f0b4c3649a252b1f042aad180b8fb 100644
--- ledgerwatch/erigon/tests/automated-testing/docker-compose.yml
+++ testinprod-io/erigon/tests/automated-testing/docker-compose.yml
@@ -4,7 +4,7 @@ services:
erigon:
profiles:
- first
- image: thorax/erigon:$ERIGON_TAG
+ image: testinprod/op-erigon:$ERIGON_TAG
command: |
--datadir=/home/erigon/.local/share/erigon --chain=dev --private.api.addr=0.0.0.0:9090 --mine --log.dir.path=/logs/node1
ports:
@@ -19,7 +19,7 @@
erigon-node2:
profiles:
- second
- image: thorax/erigon:$ERIGON_TAG
+ image: testinprod/op-erigon:$ERIGON_TAG
command: |
--datadir=/home/erigon/.local/share/erigon --chain=dev --private.api.addr=0.0.0.0:9090 --staticpeers=$ENODE --log.dir.path=/logs/node2
volumes:
@@ -32,7 +32,7 @@
rpcdaemon:
profiles:
- first
- image: thorax/erigon:$ERIGON_TAG
+ image: testinprod/op-erigon:$ERIGON_TAG
entrypoint: rpcdaemon
command: |
--private.api.addr=erigon:9090 --http.api=admin,eth,erigon,web3,net,debug,trace,txpool,parity --http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --http.port=8545 --graphql --log.dir.path=/logs/node1
@@ -44,7 +44,7 @@
rpcdaemon-node2:
profiles:
- second
- image: thorax/erigon:$ERIGON_TAG
+ image: testinprod/op-erigon:$ERIGON_TAG
entrypoint: rpcdaemon
command: |
--private.api.addr=erigon-node2:9090 --http.api=admin,eth,erigon,web3,net,debug,trace,txpool,parity --http.addr=0.0.0.0 --http.vhosts=* --http.corsdomain=* --http.port=8545 --log.dir.path=/logs/node2
diff --git ledgerwatch/erigon/tests/automated-testing/run.sh testinprod-io/erigon/tests/automated-testing/run.sh
index a21fb908aa3efc07b86ce294e01ed9626a70aa2c..bd15e4cda5416c4fd52c8869c1c27bba9719f6f9 100755
--- ledgerwatch/erigon/tests/automated-testing/run.sh
+++ testinprod-io/erigon/tests/automated-testing/run.sh
@@ -34,7 +34,7 @@ echo "BUILD_ERIGON=$BUILD_ERIGON"
if [ "$BUILD_ERIGON" = 1 ] ; then
echo "building erigon..."
- cd ../../ && DOCKER_TAG=thorax/erigon:$ERIGON_TAG DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker
+ cd ../../ && DOCKER_TAG=testinprod/op-erigon:$ERIGON_TAG DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) make docker
fi
# move back to the script directory
diff --git ledgerwatch/erigon/tests/state_test_util.go testinprod-io/erigon/tests/state_test_util.go
index c972b4b01415556c4d5bdd1bde12f4aa2a2d102c..57d58493db1c436a39aaf301277bf98625e98f37 100644
--- ledgerwatch/erigon/tests/state_test_util.go
+++ testinprod-io/erigon/tests/state_test_util.go
@@ -456,6 +456,7 @@ data,
accessList,
false, /* checkNonce */
false, /* isFree */
+ false, /* isFake */
uint256.NewInt(tipCap.Uint64()),
)
diff --git ledgerwatch/erigon/turbo/adapter/ethapi/api_test.go testinprod-io/erigon/turbo/adapter/ethapi/api_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..9874853cbe336768f18639016345636dc4561a44
--- /dev/null
+++ testinprod-io/erigon/turbo/adapter/ethapi/api_test.go
@@ -0,0 +1,129 @@
+package ethapi
+
+import (
+ "encoding/json"
+ "math/big"
+ "testing"
+
+ "github.com/holiman/uint256"
+ libcommon "github.com/ledgerwatch/erigon-lib/common"
+ "github.com/ledgerwatch/erigon/common/hexutil"
+ "github.com/ledgerwatch/erigon/core/types"
+ "github.com/stretchr/testify/require"
+)
+
+func TestNewRPCTransactionDepositTx(t *testing.T) {
+ tx := &types.DepositTx{
+ SourceHash: libcommon.HexToHash("0x1234"),
+ IsSystemTransaction: true,
+ Mint: uint256.NewInt(34),
+ Value: uint256.NewInt(1337),
+ }
+ nonce := uint64(7)
+ depositNonce := &nonce
+ got := newRPCTransaction(tx, libcommon.Hash{}, uint64(12), uint64(1), big.NewInt(0), depositNonce)
+ // Should provide zero values for unused fields that are required in other transactions
+ require.Equal(t, got.GasPrice, (*hexutil.Big)(big.NewInt(0)), "newRPCTransaction().GasPrice = %v, want 0x0", got.GasPrice)
+ require.Equal(t, got.V, (*hexutil.Big)(big.NewInt(0)), "newRPCTransaction().V = %v, want 0x0", got.V)
+ require.Equal(t, got.R, (*hexutil.Big)(big.NewInt(0)), "newRPCTransaction().R = %v, want 0x0", got.R)
+ require.Equal(t, got.S, (*hexutil.Big)(big.NewInt(0)), "newRPCTransaction().S = %v, want 0x0", got.S)
+
+ // Should include deposit tx specific fields
+ require.Equal(t, *got.SourceHash, tx.SourceHash, "newRPCTransaction().SourceHash = %v, want %v", got.SourceHash, tx.SourceHash)
+ require.Equal(t, *got.IsSystemTx, tx.IsSystemTransaction, "newRPCTransaction().IsSystemTransaction = %v, want %v", got.IsSystemTx, tx.IsSystemTransaction)
+ require.Equal(t, got.Mint, (*hexutil.Big)(tx.Mint.ToBig()), "newRPCTransaction().Mint = %v, want %v", got.Mint, tx.Mint.ToBig())
+ require.Equal(t, got.Nonce, (hexutil.Uint64)(nonce), "newRPCTransaction().Mint = %v, want %v", got.Nonce, nonce)
+}
+
+func TestNewRPCTransactionOmitIsSystemTxFalse(t *testing.T) {
+ tx := &types.DepositTx{
+ IsSystemTransaction: false,
+ Value: uint256.NewInt(1337),
+ }
+ got := newRPCTransaction(tx, libcommon.Hash{}, uint64(12), uint64(1), big.NewInt(0), nil)
+
+ require.Nil(t, got.IsSystemTx, "should omit IsSystemTx when false")
+}
+
+func TestUnmarshalRpcDepositTx(t *testing.T) {
+ tests := []struct {
+ name string
+ modifier func(tx *RPCTransaction)
+ valid bool
+ }{
+ {
+ name: "Unmodified",
+ modifier: func(tx *RPCTransaction) {},
+ valid: true,
+ },
+ {
+ name: "Zero Values",
+ modifier: func(tx *RPCTransaction) {
+ tx.V = (*hexutil.Big)(libcommon.Big0)
+ tx.R = (*hexutil.Big)(libcommon.Big0)
+ tx.S = (*hexutil.Big)(libcommon.Big0)
+ tx.GasPrice = (*hexutil.Big)(libcommon.Big0)
+ },
+ valid: true,
+ },
+ {
+ name: "Nil Values",
+ modifier: func(tx *RPCTransaction) {
+ tx.V = nil
+ tx.R = nil
+ tx.S = nil
+ tx.GasPrice = nil
+ },
+ valid: true,
+ },
+ {
+ name: "Non-Zero GasPrice",
+ modifier: func(tx *RPCTransaction) {
+ tx.GasPrice = (*hexutil.Big)(big.NewInt(43))
+ },
+ valid: false,
+ },
+ {
+ name: "Non-Zero V",
+ modifier: func(tx *RPCTransaction) {
+ tx.V = (*hexutil.Big)(big.NewInt(43))
+ },
+ valid: false,
+ },
+ {
+ name: "Non-Zero R",
+ modifier: func(tx *RPCTransaction) {
+ tx.R = (*hexutil.Big)(big.NewInt(43))
+ },
+ valid: false,
+ },
+ {
+ name: "Non-Zero S",
+ modifier: func(tx *RPCTransaction) {
+ tx.S = (*hexutil.Big)(big.NewInt(43))
+ },
+ valid: false,
+ },
+ }
+ for _, test := range tests {
+ t.Run(test.name, func(t *testing.T) {
+ tx := &types.DepositTx{
+ SourceHash: libcommon.HexToHash("0x1234"),
+ IsSystemTransaction: true,
+ Mint: uint256.NewInt(34),
+ Value: uint256.NewInt(1337),
+ }
+ rpcTx := newRPCTransaction(tx, libcommon.Hash{}, uint64(12), uint64(1), big.NewInt(0), nil)
+ test.modifier(rpcTx)
+ json, err := json.Marshal(rpcTx)
+ require.NoError(t, err, "marshalling failed: %w", err)
+ parsed := &types.DepositTx{}
+ err = parsed.UnmarshalJSON(json)
+ if test.valid {
+ require.NoError(t, err, "unmarshal failed: %w", err)
+ } else {
+ require.Error(t, err, "unmarshal should have failed but did not")
+ }
+ })
+ }
+}
diff --git ledgerwatch/erigon/turbo/cli/flags.go testinprod-io/erigon/turbo/cli/flags.go
index f4746770bd763e9e82d0042f5a3a93bd33f8b843..305fb2d720428f06db5c4ac25f5c9b2e80efd3fc 100644
--- ledgerwatch/erigon/turbo/cli/flags.go
+++ testinprod-io/erigon/turbo/cli/flags.go
@@ -400,6 +400,10 @@
TxPoolApiAddr: ctx.String(utils.TxpoolApiAddrFlag.Name),
StateCache: kvcache.DefaultCoherentConfig,
+
+ RollupSequencerHTTP: ctx.String(utils.RollupSequencerHTTPFlag.Name),
+ RollupHistoricalRPC: ctx.String(utils.RollupHistoricalRPCFlag.Name),
+ RollupHistoricalRPCTimeout: ctx.Duration(utils.RollupHistoricalRPCTimeoutFlag.Name),
}
if ctx.IsSet(utils.HttpCompressionFlag.Name) {
c.HttpCompression = ctx.Bool(utils.HttpCompressionFlag.Name)
diff --git ledgerwatch/erigon/turbo/stages/blockchain_test.go testinprod-io/erigon/turbo/stages/blockchain_test.go
index ee8ca992d7be64d59671caca19a6700947d7d2b1..dbf145026f1c67da491f7ca3d688854efbaac5d2 100644
--- ledgerwatch/erigon/turbo/stages/blockchain_test.go
+++ testinprod-io/erigon/turbo/stages/blockchain_test.go
@@ -486,7 +486,7 @@ for i, txn := range txs {
if txn, _, _, _, _ := rawdb.ReadTransactionByHash(tx, txn.Hash()); txn != nil {
t.Errorf("drop %d: tx %v found while shouldn't have been", i, txn)
}
- if rcpt, _, _, _, _ := rawdb.ReadReceipt(tx, txn.Hash()); rcpt != nil {
+ if rcpt, _, _, _, _ := rawdb.ReadReceipt(params.TestChainConfig, tx, txn.Hash()); rcpt != nil {
t.Errorf("drop %d: receipt %v found while shouldn't have been", i, rcpt)
}
}
@@ -502,7 +502,7 @@
if m.HistoryV3 {
// m.HistoryV3 doesn't store
} else {
- if rcpt, _, _, _, _ := rawdb.ReadReceipt(tx, txn.Hash()); rcpt == nil {
+ if rcpt, _, _, _, _ := rawdb.ReadReceipt(params.TestChainConfig, tx, txn.Hash()); rcpt == nil {
t.Errorf("add %d: expected receipt to be found", i)
}
}
@@ -516,7 +516,7 @@ }
if m.HistoryV3 {
// m.HistoryV3 doesn't store
} else {
- if rcpt, _, _, _, _ := rawdb.ReadReceipt(tx, txn.Hash()); rcpt == nil {
+ if rcpt, _, _, _, _ := rawdb.ReadReceipt(params.TestChainConfig, tx, txn.Hash()); rcpt == nil {
t.Errorf("share %d: expected receipt to be found", i)
}
}
diff --git ledgerwatch/erigon/turbo/stages/mock_sentry.go testinprod-io/erigon/turbo/stages/mock_sentry.go
index 535f611063bf81237c897a6e602b0347f2e20b75..bd35be4c241b557d596122f8e55cb633cf902cb6 100644
--- ledgerwatch/erigon/turbo/stages/mock_sentry.go
+++ testinprod-io/erigon/turbo/stages/mock_sentry.go
@@ -493,7 +493,7 @@ mock.MinedBlocks = miner.MiningResultCh
mock.MiningSync = stagedsync.New(
stagedsync.MiningStages(mock.Ctx,
stagedsync.StageMiningCreateBlockCfg(mock.DB, miner, *mock.ChainConfig, mock.Engine, mock.TxPool, nil, nil, dirs.Tmp),
- stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, mock.BlockSnapshots, cfg.TransactionsV3),
+ stagedsync.StageMiningExecCfg(mock.DB, miner, nil, *mock.ChainConfig, mock.Engine, &vm.Config{}, dirs.Tmp, nil, 0, mock.TxPool, nil, false, mock.BlockSnapshots, cfg.TransactionsV3),
stagedsync.StageHashStateCfg(mock.DB, dirs, cfg.HistoryV3, mock.agg),
stagedsync.StageTrieCfg(mock.DB, false, true, false, dirs.Tmp, blockReader, mock.sentriesClient.Hd, cfg.HistoryV3, mock.agg),
stagedsync.StageMiningFinishCfg(mock.DB, *mock.ChainConfig, mock.Engine, miner, miningCancel),