Skip to content

Commit 47d7e6d

Browse files
committed
fix hyperliquid system tx determination
1 parent c1b5d14 commit 47d7e6d

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

evm/evm-rpc/src/chain-utils.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class ChainUtils {
4747
}
4848

4949
if (this.isHyperliquidMainnet || this.isHyperliquidTestnet) {
50-
transactions = transactions.filter(tx => !isHyperliquidSystemAddress(tx))
50+
transactions = transactions.filter(tx => !isHyperliquidSystemTx(tx))
5151
}
5252

5353
return transactionsRoot(transactions)
@@ -69,7 +69,7 @@ export class ChainUtils {
6969
let txByHash = new Map(transactions.map(tx => [getTxHash(tx), tx]))
7070
logs = logs.filter(log => {
7171
let tx = assertNotNull(txByHash.get(log.transactionHash))
72-
return !isHyperliquidSystemAddress(tx)
72+
return !isHyperliquidSystemTx(tx)
7373
})
7474
}
7575

@@ -83,23 +83,29 @@ export class ChainUtils {
8383
}
8484

8585
if (this.isHyperliquidMainnet || this.isHyperliquidTestnet) {
86-
receipts = receipts.filter(receipt => !isHyperliquidSystemAddress(receipt))
86+
receipts = receipts.filter(receipt => !isHyperliquidSystemReceipt(receipt))
8787
}
8888

8989
return receiptsRoot(receipts)
9090
}
9191

9292
recoverTxSender(transaction: Transaction) {
9393
if (this.isHyperliquidMainnet || this.isHyperliquidTestnet) {
94-
if (isHyperliquidSystemAddress(transaction)) return
94+
if (isHyperliquidSystemTx(transaction)) return
9595
}
9696

9797
return recoverTxSender(transaction)
9898
}
9999
}
100100

101101

102-
function isHyperliquidSystemAddress(txOrReceipt: Transaction | Receipt) {
103-
// https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers#system-addresses
104-
return txOrReceipt.from == '0x2222222222222222222222222222222222222222' || txOrReceipt.from.startsWith('0x20')
102+
function isHyperliquidSystemTx(tx: Transaction) {
103+
// https://github.com/hl-archive-node/nanoreth/blob/732f8c574db2dde90344a29b0292189a5cddd2d1/src/node/primitives/transaction.rs#L165
104+
return tx.gasPrice == '0x0'
105+
}
106+
107+
108+
function isHyperliquidSystemReceipt(receipt: Receipt) {
109+
// https://github.com/hl-archive-node/nanoreth/blob/732f8c574db2dde90344a29b0292189a5cddd2d1/src/addons/hl_node_compliance.rs#L365
110+
return receipt.cumulativeGasUsed == '0x0'
105111
}

0 commit comments

Comments
 (0)