Skip to content

Commit

Permalink
solution: make sure EtherJar can parse Sepolia transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
splix committed Apr 2, 2024
1 parent ceebe98 commit 3228992
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class TransactionDecoderSpec extends Specification {
Hex.encodeHexString(encoded) == txHex
}

def "Parse tx type 0x109332"() {
def "Parse tx type 3 0x109332"() {
// tx 0x109332e227bb505e5731fcbe231dc8d9c0136c14300cd34e40097abf72c51105
setup:
def txHex = TransactionDecoderSpec.class.getClassLoader().getResourceAsStream("tx-blob-0x109332.hex").text.trim()
Expand Down Expand Up @@ -465,4 +465,36 @@ class TransactionDecoderSpec extends Specification {
then:
Hex.encodeHexString(encoded) == txHex
}

def "Parse tx type 3 - sepolia 0x9fd491"() {
// tx 0x9fd49139b36d116b4eb5389eec4065a944792a04cb5c0f1e9a6f31837d5e40ab
setup:
def txHex = TransactionDecoderSpec.class.getClassLoader().getResourceAsStream("tx-blob-0x9fd491.hex").text.trim()
def tx = Hex.decodeHex(txHex)

when:
def act = decoder.decode(tx)

then:
act.type == TransactionType.BLOB
with((TransactionWithBlob)act) {
value == Wei.ZERO
chainId == 11155111
extractFrom() == Address.from("0x8aad4Fa2839a9E2A6dF43Ea0e8e691D0b4b03ED6")
to == Address.from("0x06676d75a43F38BEE9f48a0FFe99f95FDffA9238")
gas == 21_000
nonce == 7529
accessList.isEmpty()
transactionId().toHex() == "0x9fd49139b36d116b4eb5389eec4065a944792a04cb5c0f1e9a6f31837d5e40ab"
data.isEmpty()
blobVersionedHashes.size() == 1
blobVersionedHashes[0].toHex() == "0x0125c9f873a8784a430f9472f3991b42c21da929b2d3800e6925422adc70c26d"
}

when:
def encoded = TransactionEncoder.DEFAULT.encode(act, true)

then:
Hex.encodeHexString(encoded) == txHex
}
}
1 change: 1 addition & 0 deletions etherjar-tx/src/test/resources/tx-blob-0x9fd491.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03f89783aa36a7821d69843b9aca0084b2d05e008252089406676d75a43f38bee9f48a0ffe99f95fdffa92388080c0854d2efc158ae1a00125c9f873a8784a430f9472f3991b42c21da929b2d3800e6925422adc70c26d01a059b9827b25031a4a107eee4704843b945a0f7a142ef7bac5f7566f812e35299ca0124c018c1a0ad629b4e997fcc1f2eefcc918ae88267cd9f5acd99a434908bb5a

0 comments on commit 3228992

Please sign in to comment.