-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rpc): implement Filecoin.EthGetMessageCidByTransactionHash #4402
Merged
elmattic
merged 93 commits into
main
from
elmattic/elmattic/eth-get-message-cid-by-transaction-hash-2
Jul 3, 2024
Merged
Changes from all commits
Commits
Show all changes
93 commits
Select commit
Hold shift + click to select a range
70e0019
Add support for Eth mappings
elmattic 63711e1
Appease clippy
elmattic 0907b35
Merge branch 'main' into elmattic/eth-mappings
elmattic 92cf525
Move info trace
elmattic a99c93d
Implement EthGetMessageCidByTransactionHash method
elmattic f38bbdc
Add tests
elmattic ab84529
Handle error
elmattic fd70514
Update CHANGELOG
elmattic d36243b
Fix db dev mode tests
elmattic adf4158
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic 633a372
Use Hash column indexes for eth mappings
elmattic 161d914
Demote info logs to debug
elmattic 07f093d
Move back to Btree column indexes
elmattic c6feb43
Merge branch 'main' into elmattic/eth-mappings
elmattic 0566486
Add doc comments
elmattic 64ed199
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic 6f60fed
Fix doc build
elmattic 59c7667
Use Hash column indexes for eth mappings
elmattic 65dfcd7
Merge branch 'main' into elmattic/eth-mappings
elmattic 81cf85a
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic af71e97
Merge branch 'main' into elmattic/eth-mappings
elmattic ffc96b6
Add timestamp when putting mapping
elmattic 3eda7aa
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic 7cffeb8
Fix method to discard the timestamp
elmattic 5851b00
Appease clippy
elmattic 541db9f
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic 32a49e5
Add task to retrieve eth txs older than a given duration
elmattic 8c50d3a
Change method name
elmattic 0c76277
Add deletion of Hash to Cid entries
elmattic f6a0b28
Merge branch 'main' into elmattic/eth-mappings
elmattic 12fdc79
Merge branch 'elmattic/eth-mappings' into elmattic/elmattic/eth-get-m…
elmattic b372c0a
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 6131239
Remove todos
elmattic 3b4a9e4
Remove newline
elmattic 2360e4a
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic fe714e8
Refactor
elmattic 9ce6bfe
Appease clippy
elmattic 876ef45
Add ttl to client Config
elmattic 4c8ddcf
Write eth tx hashes when persisting tipsets
elmattic de39542
Refactor
elmattic 2f53517
Fix doc and lint errors
elmattic 869afe6
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 7f1ea25
Fix persisting eth entries
elmattic a0abbef
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 39aee92
Add tipset key persistence
elmattic ffc4800
Add test script
elmattic a9f7386
Add job
elmattic c7e64d0
Fix shellcheck errors
elmattic dfe93e4
Rename job
elmattic 18ea5ad
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 5653afc
Try fix script
elmattic e6ceb3a
Add executable right
elmattic d9e0f3b
Fix script
elmattic 82aeaa6
Test result and return error in case of missing data
elmattic 651356a
Increase number of tipsets
elmattic 4fa644b
Fix script to check Hash to TipsetKey
elmattic 9a9aa5a
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic a79308c
Add message persistence
elmattic ea5bbff
Rename and move function to a method
elmattic d12419d
Add better logs
elmattic 0e9b7d0
Fix tipset keys not always persisted
elmattic 936962d
Remove method
elmattic 6e54ed6
Fix tipset key persistence
elmattic 1aab758
Fix tipset key persistence
elmattic 98037b3
Remove useless code
elmattic cab25c2
Start to add testing of ttl
elmattic f5acb98
Use block timestamp when writing the mapping
elmattic cc1fd73
Fix bash script
elmattic c21670f
Add more slack
elmattic 5b9546f
Add debug function to print timestamp
elmattic 23068e0
Fix shellcheck errors
elmattic 8b2537f
Appease shellcheck
elmattic 3d1e78a
Fix mapping persistence
elmattic a06777f
Remove some comment and comment out echo
elmattic 018e3be
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 286e7dd
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 7a33f6a
Change how test is done
elmattic 9bf4d07
Add two minutes of slack
elmattic df76ac2
Add newlines
elmattic f71bee6
Simplify test script
elmattic dbd1f44
Remove lines
elmattic f73f6a5
Construct option later
elmattic 2acb7a2
Remove testing code
elmattic 00aa606
Refactor and add unit test
elmattic c4257a9
Add ttl collector and test
elmattic 0f63b83
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic 910c212
Refactor
elmattic b2527fe
Fix spellcheck errors
elmattic f5dc010
Fix spellcheck error
elmattic 86d8fa5
Merge branch 'main' into elmattic/elmattic/eth-get-message-cid-by-tra…
elmattic eed5449
Remove comments
elmattic ef86ba8
Refactor bash script using jq
elmattic 971ba17
Remove dead code
elmattic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
# This script is checking the correctness of the ethereum mapping feature | ||
# It requires both the `forest` and `forest-cli` binaries to be in the PATH. | ||
|
||
set -eu | ||
|
||
source "$(dirname "$0")/harness.sh" | ||
|
||
forest_init | ||
|
||
FOREST_URL='http://127.0.0.1:2345/rpc/v1' | ||
|
||
NUM_TIPSETS=600 | ||
|
||
echo "Get Ethereum block hashes and transactions hashes from the last $NUM_TIPSETS tipsets" | ||
|
||
OUTPUT=$($FOREST_CLI_PATH info show) | ||
|
||
HEAD_EPOCH=$(echo "$OUTPUT" | sed -n 's/.*epoch: \([0-9]*\).*/\1/p') | ||
EPOCH=$((HEAD_EPOCH - 1)) | ||
|
||
ETH_BLOCK_HASHES=() | ||
ETH_TX_HASHES=() | ||
|
||
for ((i=0; i<=NUM_TIPSETS; i++)); do | ||
EPOCH_HEX=$(printf "0x%x" $EPOCH) | ||
JSON=$(curl -s -X POST "$FOREST_URL" \ | ||
-H 'Content-Type: application/json' \ | ||
--data "$(jq -n --arg epoch "$EPOCH_HEX" '{jsonrpc: "2.0", id: 1, method: "Filecoin.EthGetBlockByNumber", params: [$epoch, false]}')") | ||
|
||
|
||
HASH=$(echo "$JSON" | jq -r '.result.hash') | ||
ETH_BLOCK_HASHES+=("$HASH") | ||
|
||
if [[ $(echo "$JSON" | jq -e '.result.transactions') != "null" ]]; then | ||
TRANSACTIONS=$(echo "$JSON" | jq -r '.result.transactions[]') | ||
for tx in $TRANSACTIONS; do | ||
ETH_TX_HASHES+=("$tx") | ||
done | ||
else | ||
echo "No transactions found for block hash: $EPOCH_HEX" | ||
fi | ||
|
||
EPOCH=$((EPOCH - 1)) | ||
done | ||
|
||
ERROR=0 | ||
echo "Testing Ethereum mapping" | ||
|
||
for hash in "${ETH_BLOCK_HASHES[@]}"; do | ||
JSON=$(curl -s -X POST "$FOREST_URL" \ | ||
-H 'Content-Type: application/json' \ | ||
--data "$(jq -n --arg hash "$hash" '{jsonrpc: "2.0", id: 1, method: "Filecoin.EthGetBalance", params: ["0xff38c072f286e3b20b3954ca9f99c05fbecc64aa", $hash]}')") | ||
|
||
if [[ $(echo "$JSON" | jq -e '.result') == "null" ]]; then | ||
echo "Missing tipset key for hash $hash" | ||
ERROR=1 | ||
fi | ||
done | ||
|
||
for hash in "${ETH_TX_HASHES[@]}"; do | ||
JSON=$(curl -s -X POST "$FOREST_URL" \ | ||
-H 'Content-Type: application/json' \ | ||
--data "$(jq -n --arg hash "$hash" '{jsonrpc: "2.0", id: 1, method: "Filecoin.EthGetMessageCidByTransactionHash", params: [$hash]}')") | ||
|
||
if [[ $(echo "$JSON" | jq -e '.result') == "null" ]]; then | ||
echo "Missing cid for hash $hash" | ||
ERROR=1 | ||
fi | ||
done | ||
|
||
echo "Done" | ||
exit $ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean
lscpu
?