Skip to content

Commit 56ac4c1

Browse files
committed
Clean up
1 parent ed9d2cd commit 56ac4c1

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

app/models/ethscription_transaction.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ class EthscriptionTransaction < T::Struct
3535
VALUE = 0
3636
GAS_LIMIT = 1_000_000_000
3737
TO_ADDRESS = SysConfig::ETHSCRIPTIONS_ADDRESS
38-
39-
# Dynamic source hash based on source type and index
40-
def source_hash
41-
compute_source_hash(source_type, source_index)
42-
end
43-
4438

4539
# Factory method for create operations
4640
def self.create_ethscription(
@@ -130,17 +124,17 @@ def function_selector
130124
end
131125

132126
# Unified source hash computation following Optimism pattern
133-
def compute_source_hash(operation_source, index)
134-
raise "Operation must have source metadata" if operation_source.nil? || index.nil?
127+
def source_hash
128+
raise "Operation must have source metadata" if source_type.nil? || source_index.nil?
135129

136-
source_tag = operation_source.to_s # "input" or "event"
130+
source_tag = source_type.to_s # "input" or "event"
137131
source_tag_hash = Eth::Util.keccak256(source_tag.bytes.pack('C*')) # Hash for constant width
138132

139133
payload = ByteString.from_bin(
140134
eth_transaction.block_hash.to_bin +
141135
source_tag_hash + # 32 bytes (hashed source tag)
142136
function_selector + # 4 bytes (function selector)
143-
Eth::Util.zpad_int(index, 32) # 32 bytes (index)
137+
Eth::Util.zpad_int(source_index, 32) # 32 bytes (source_index)
144138
)
145139

146140
bin_val = Eth::Util.keccak256(

0 commit comments

Comments
 (0)