Skip to content

Commit

Permalink
Added support for Firehose reader format 2.5 which will be required f…
Browse files Browse the repository at this point in the history
…or `BSC 1.4.5+`
  • Loading branch information
maoueh committed Apr 17, 2024
1 parent 6607bf5 commit 248fa5d
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). See [MAINTAINERS.md](./MAINTAINERS.md)
for instructions to keep up to date.

## v2.4.6

* Added support for Firehose reader format 2.5 which will be required for `BSC 1.4.5+`.

## v2.4.5

* Updated block model to add `BalanceChange#Reason.REWARD_BLOB_FEE` for BSC Tycho hard-fork.
Expand Down
4 changes: 2 additions & 2 deletions codec/console_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ func (ctx *parseCtx) readInit(line string) error {
ctx.normalizationFeatures.ReorderTransactionsAndRenumberOrdinals = true
ctx.readTransactionIndex = true
ctx.fhMajorVersion = 2
case "2.4":
case "2.4", "2.5":
ctx.blockVersion = 3
ctx.normalizationFeatures.ReorderTransactionsAndRenumberOrdinals = true
ctx.readTransactionIndex = true
Expand All @@ -1157,7 +1157,7 @@ func (ctx *parseCtx) readInit(line string) error {
ctx.blockVersion = 3
ctx.fhMajorVersion = 3
default:
return fmt.Errorf("major version of Firehose exchange protocol is unsupported (expected: one of [2.0, 2.1, 2.2, 2.3, 2.4], found %s), you are most probably running an incompatible version of the Firehose instrumented 'geth' client", ctx.fhVersion)
return fmt.Errorf("major version of Firehose exchange protocol is unsupported (expected: one of [2.0, 2.1, 2.2, 2.3, 2.4, 2.5], found %s), you are most probably running an incompatible version of the Firehose instrumented 'geth' client", ctx.fhVersion)
}

// Firehose 3.0 tracer are outputing directly `pbbstream.Block` messages which means that to
Expand Down
1 change: 1 addition & 0 deletions codec/console_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func TestParseFromFile(t *testing.T) {
{"testdata/read_transaction_blob.dmlog", nil, nil, true},
{"testdata/read_transaction_blob_no_hashes.dmlog", nil, nil, true},
{"testdata/read_reward_blob_fee_balance_change.dmlog", nil, nil, true},
{"testdata/firehose_format_2.5.dmlog", nil, nil, true},
{"testdata/system_call.dmlog", nil, nil, false},
{"testdata/polygon_calls_after_finalize.dmlog", nil, nil, false},
{"testdata/polygon_add_log_0.dmlog", nil, nil, false},
Expand Down
4 changes: 4 additions & 0 deletions codec/testdata/firehose_format_2.5.dmlog
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FIRE INIT 2.5 geth 1.10.17-dm-stable
FIRE BEGIN_APPLY_TRX 74b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b65 79f19a189068a79ec01343b8c70096114f048753 . 29 9b7b4ad21ac016e1766749e203d4776d351ac9c7d56cdd9b3c2d5b4f940c1f7e 5b08a942dbc15ff47f7f40d4519fe2e20948579b0baebaca66a7b651f6f483ed 966000 0ba43b7400 110 f93d3def0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004b7265616c79206c6f6e6720737472696e67206c6172676572207468616e20333220627974657320746f2074657374206f757420736f6c69646974792073706c697474696e67207374756666000000000000000000000000000000000000000000 0312345678901234567890123456789012345678900200000000000000000000000000000000000000000000000000000000000000ab00000000000000000000000000000000000000000000000000000000000000efabcdefabcdefabcdefabcdefabcdefabcdef0910001234567890123456789012345678901234567890010000000000000000000000000000000000000000000000000000000000000012 fe 56 3 1 0 99 ab 0174b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b65,0184b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b64
FIRE TRX_FROM ab07a50ad459b41fe065f7bbab866d5390e9f705
FIRE END_APPLY_TRX 23358 . 23358 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 11 0 0 []
58 changes: 58 additions & 0 deletions codec/testdata/firehose_format_2.5.dmlog.golden.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[
{
"accessList": [
{
"address": "1234567890123456789012345678901234567890",
"storageKeys": [
"00000000000000000000000000000000000000000000000000000000000000ab",
"00000000000000000000000000000000000000000000000000000000000000ef"
]
},
{
"address": "abcdefabcdefabcdefabcdefabcdefabcdef0910"
},
{
"address": "1234567890123456789012345678901234567890",
"storageKeys": [
"0000000000000000000000000000000000000000000000000000000000000012"
]
}
],
"beginOrdinal": "1",
"blobGas": "99",
"blobGasFeeCap": "ab",
"blobHashes": [
"0174b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b65",
"0184b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b64"
],
"calls": [
{
"address": "79f19a189068a79ec01343b8c70096114f048753",
"callType": "CALL",
"caller": "ab07a50ad459b41fe065f7bbab866d5390e9f705",
"index": 1
}
],
"endOrdinal": "11",
"from": "ab07a50ad459b41fe065f7bbab866d5390e9f705",
"gasLimit": "966000",
"gasPrice": "0ba43b7400",
"gasUsed": "23358",
"hash": "74b9554595faea99f11f5310c086acaec4686ef94b30466f966d67071b228b65",
"input": "f93d3def0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004b7265616c79206c6f6e6720737472696e67206c6172676572207468616e20333220627974657320746f2074657374206f757420736f6c69646974792073706c697474696e67207374756666000000000000000000000000000000000000000000",
"maxFeePerGas": "fe",
"maxPriorityFeePerGas": "56",
"nonce": "110",
"r": "9b7b4ad21ac016e1766749e203d4776d351ac9c7d56cdd9b3c2d5b4f940c1f7e",
"receipt": {
"blobGasPrice": "00",
"blobGasUsed": "0",
"cumulativeGasUsed": "23358",
"logsBloom": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
},
"s": "5b08a942dbc15ff47f7f40d4519fe2e20948579b0baebaca66a7b651f6f483ed",
"to": "79f19a189068a79ec01343b8c70096114f048753",
"type": "TRX_TYPE_BLOB",
"v": "29"
}
]

0 comments on commit 248fa5d

Please sign in to comment.