Skip to content

Commit 3ec8afd

Browse files
committed
Misc changes
1 parent e358bf2 commit 3ec8afd

7 files changed

Lines changed: 40 additions & 24 deletions

File tree

app/services/eth_block_importer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def set_eth_block_starting_points
150150

151151
l2_block = GethDriver.client.call("eth_getBlockByNumber", ["0x#{l2_candidate.to_s(16)}", false])
152152

153-
# Start from finalization block
154-
retry_offset = 63
153+
# Start from finalization block (use smaller offset for tests)
154+
retry_offset = Rails.env.test? ? 0 : 63
155155
blocks_behind = latest_l2_block_number - l2_candidate
156156

157157
if l1_hash == l1_attributes[:hash] && l1_attributes[:number] == l1_candidate && blocks_behind >= retry_offset

app/services/geth_driver.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def init_command
219219
"--authrpc.addr localhost",
220220
"--authrpc.vhosts=\"*\"",
221221
"--nodiscover",
222-
"--cache 16000",
222+
"--cache 32000",
223223
"--rpc.gascap 5000000000",
224224
"--rpc.batch-request-limit=10000",
225225
"--rpc.batch-response-max-size=100000000",
@@ -230,7 +230,6 @@ def init_command
230230
"--gcmode archive",
231231
"--history.state 0",
232232
"--history.transactions 0",
233-
"--nocompaction",
234233
"--rollup.enabletxpooladmission=false",
235234
"--rollup.disabletxpoolgossip",
236235
"--override.canyon", "0",

config/environments/development.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
config.eager_load = true
1313

1414
# Show full error reports.
15-
config.consider_all_requests_local = true
15+
config.consider_all_requests_local = false
1616

1717
# Enable server timing
18-
config.server_timing = true
18+
config.server_timing = false
1919

2020
# Enable file-based caching for persistent checkpoints
2121
config.action_controller.perform_caching = true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class Integer
2+
def ether
3+
(self.to_d * 1e18.to_d).to_i
4+
end
5+
6+
def gwei
7+
(self.to_d * 1e9.to_d).to_i
8+
end
9+
end
10+
11+
class Float
12+
def ether
13+
(self.to_d * 1e18.to_d).to_i
14+
end
15+
16+
def gwei
17+
(self.to_d * 1e9.to_d).to_i
18+
end
19+
end
20+
21+
class String
22+
def pbcopy(strip: true)
23+
to_copy = strip ? self.strip : self
24+
Clipboard.copy(to_copy)
25+
nil
26+
end
27+
end

config/queue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default: &default
44
batch_size: 500
55
workers:
66
- queues: "*"
7-
threads: 3
7+
threads: <%= ENV.fetch("JOB_THREADS", 3).to_i %>
88
processes: <%= ENV.fetch("JOB_CONCURRENCY", 2).to_i %>
99
polling_interval: 0.1
1010

lib/block_validator.rb

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@ class BlockValidator
22
attr_reader :errors, :stats
33

44
def initialize
5-
# Initialize thread pool for storage verification
6-
storage_threads = ENV.fetch('STORAGE_VERIFICATION_THREADS', '2').to_i
7-
@storage_executor = Concurrent::ThreadPoolExecutor.new(
8-
min_threads: 1,
9-
max_threads: storage_threads,
10-
max_queue: storage_threads * 3,
11-
fallback_policy: :caller_runs
12-
)
13-
145
# Initialize validation state
156
reset_validation_state
167
end
@@ -330,16 +321,11 @@ def binary_equal?(val1, val2)
330321
def verify_storage_state(expected_data, l1_block_num, block_tag)
331322
ImportProfiler.start("storage_verification")
332323

333-
# Parallel verification using thread pool
334-
creation_promises = Array(expected_data[:creations]).map do |creation|
335-
Concurrent::Promise.execute(executor: @storage_executor) do
336-
verify_ethscription_storage(creation, l1_block_num, block_tag)
337-
end
324+
# Sequentially verify each creation on the main thread
325+
Array(expected_data[:creations]).each do |creation|
326+
verify_ethscription_storage(creation, l1_block_num, block_tag)
338327
end
339328

340-
# Wait for all creation verifications to complete
341-
creation_promises.each(&:value!)
342-
343329
# Verify ownership after transfers
344330
verify_transfer_ownership(Array(expected_data[:transfers]), block_tag)
345331

lib/ethscriptions_api_client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ def fetch_paginated(path, params)
5656
end
5757

5858
def fetch_json(path, params = {})
59+
# Add API key to query params if provided
60+
api_key = ENV['ETHSCRIPTIONS_API_KEY']
61+
params = params.merge(api_key: api_key) if api_key.present?
62+
5963
uri = URI("#{BASE_URL}#{path}")
6064
uri.query = URI.encode_www_form(params) if params.any?
6165

0 commit comments

Comments
 (0)