-
Notifications
You must be signed in to change notification settings - Fork 33
[C-655] add chainlink data streams oracle #404
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,53 @@ | ||
| from decimal import Decimal | ||
|
|
||
| import requests | ||
| from eip712.messages import EIP712Message, EIP712Type | ||
| from eip712.messages import EIP712Domain, EIP712Message | ||
| from eth_account.messages import _hash_eip191_message as hash_eip191_message | ||
| from eth_pydantic_types import abi | ||
| from hexbytes import HexBytes | ||
| from pydantic import BaseModel | ||
|
|
||
| from pyinjective.core.token import Token | ||
|
|
||
|
|
||
| class OrderInfo(EIP712Type): | ||
| SubaccountId: "string" # noqa: F821 | ||
| FeeRecipient: "string" # noqa: F821 | ||
| Price: "string" # noqa: F821 | ||
| Quantity: "string" # noqa: F821 | ||
| class OrderInfo(BaseModel): | ||
| SubaccountId: abi.string | ||
| FeeRecipient: abi.string | ||
| Price: abi.string | ||
| Quantity: abi.string | ||
|
|
||
|
|
||
| class SpotOrder(EIP712Message): | ||
| _name_ = "Injective Protocol" | ||
| _version_ = "2.0.0" | ||
| _chainId_ = 888 | ||
| _verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" | ||
| _salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000") | ||
|
|
||
| MarketId: "string" # noqa: F821 | ||
| eip712_domain = EIP712Domain( | ||
| name="Injective Protocol", | ||
| version="2.0.0", | ||
| chainId=888, | ||
| verifyingContract="0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", | ||
| salt=HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000"), | ||
| ) | ||
|
Comment on lines
+21
to
+27
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for chainId references
echo "=== Searching for chainId references ==="
rg -n "chainId" --type py -C 2
echo ""
echo "=== Searching for verifyingContract references ==="
rg -n "verifyingContract" --type py -C 2
echo ""
echo "=== Searching for EIP712Domain usage ==="
rg -n "EIP712Domain" --type py -C 3
echo ""
echo "=== Searching for network or environment configuration ==="
rg -n "MAINNET|TESTNET|DEVNET|network" --type py | head -30
echo ""
echo "=== Checking orderhash.py file context ==="
cat -n pyinjective/orderhash.py | head -60Repository: InjectiveLabs/sdk-python Length of output: 11373 🏁 Script executed: #!/bin/bash
# Check the build_eip712_msg function and how it uses the network parameter
echo "=== Checking build_eip712_msg function ==="
sed -n '70,120p' pyinjective/orderhash.py
echo ""
echo "=== Check if there are any related issues or TODOs ==="
rg -n "TODO|FIXME|XXX|HACK" pyinjective/orderhash.py -C 2
echo ""
echo "=== Check for any test files related to orderhash ==="
fd -e py "orderhash" tests/
echo ""
echo "=== Check if chainId=888 appears in tests ==="
rg -n "888" --type py | grep -E "(test_|orderhash)" | head -20Repository: InjectiveLabs/sdk-python Length of output: 3024 🏁 Script executed: #!/bin/bash
# Check the test_orderhash.py file
echo "=== Full test_orderhash.py file ==="
cat -n tests/test_orderhash.py
echo ""
echo "=== Check Network class to see what chain IDs are available ==="
rg -n "class Network" pyinjective/core/ -A 20 | head -80
echo ""
echo "=== Check if there's documentation about chainId=888 ==="
fd -e md -e txt -e rst . | xargs grep -l "888\|chainId" 2>/dev/null | head -10Repository: InjectiveLabs/sdk-python Length of output: 4246 🏁 Script executed: #!/bin/bash
# Get the chain_id values used in Network class
echo "=== Check Network devnet chain_id ==="
rg -n "devnet\|testnet\|mainnet" pyinjective/core/network.py -A 5 | head -100
echo ""
echo "=== Look for static Network factory methods ==="
rg -n "def devnet|def testnet|def mainnet" pyinjective/core/network.py -A 10 | head -100
echo ""
echo "=== Check what chain_id value is used in Network initialization ==="
rg -n "chain_id.*=" pyinjective/core/network.py | head -20Repository: InjectiveLabs/sdk-python Length of output: 2033 🏁 Script executed: #!/bin/bash
# Let's verify the numeric chain IDs and understand the pattern
echo "=== Summary of chain_ids ==="
grep -n "chain_id=" pyinjective/core/network.py | grep -E "(devnet|testnet|mainnet)"
echo ""
echo "=== Check if chainId in EIP712Domain should be numeric or string ==="
rg -n "chainId" --type py -B 2 -A 2
echo ""
echo "=== Verify that network parameter is passed but not used in orderhash ==="
sed -n '58,85p' pyinjective/orderhash.pyRepository: InjectiveLabs/sdk-python Length of output: 5583 🏁 Script executed: #!/bin/bash
# Extract numeric chain IDs from network definitions
echo "=== Extract numeric chain IDs from network string values ==="
grep "chain_id=" pyinjective/core/network.py | grep -E "injective-[0-9]" | sed 's/.*injective-//' | sed 's/".*//'
echo ""
echo "=== Verify the relationship between string chain_ids and numeric chainId ==="
echo "devnet: chain_id='injective-777' -> numeric chainId should be 777"
echo "testnet: chain_id='injective-888' -> numeric chainId should be 888"
echo "mainnet: chain_id='injective-1' -> numeric chainId should be 1"
echo ""
echo "Current hardcoded value in orderhash.py: chainId=888 (testnet only)"
echo ""
echo "=== Check if network parameter contains chain_id information ==="
grep -n "self.chain_id" pyinjective/core/network.py | head -5
</parameter>Repository: InjectiveLabs/sdk-python Length of output: 713 🏁 Script executed: #!/bin/bash
# Confirm the issue: network parameter has chain_id but it's not used in orderhash
echo "=== Check if OrderHashManager stores network for later use ==="
sed -n '65,105p' pyinjective/orderhash.py
echo ""
echo "=== Confirm that network.chain_id is available but not used ==="
echo "Network object has chain_id attribute (line 132 in network.py)"
echo "But build_eip712_msg function doesn't accept or use network parameter"
grep -n "def build_eip712_msg" pyinjective/orderhash.py -A 15Repository: InjectiveLabs/sdk-python Length of output: 2487 Make EIP712 domain configuration network-aware instead of hardcoded. The 🤖 Prompt for AI Agents |
||
|
|
||
| MarketId: abi.string | ||
| OrderInfo: OrderInfo | ||
| Salt: "string" # noqa: F821 | ||
| OrderType: "string" # noqa: F821 | ||
| TriggerPrice: "string" # noqa: F821 | ||
| Salt: abi.string | ||
| OrderType: abi.string | ||
| TriggerPrice: abi.string | ||
|
|
||
|
|
||
| class DerivativeOrder(EIP712Message): | ||
| _name_ = "Injective Protocol" | ||
| _version_ = "2.0.0" | ||
| _chainId_ = 888 | ||
| _verifyingContract_ = "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC" | ||
| _salt_ = HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000") | ||
|
|
||
| MarketId: "string" # noqa: F821 | ||
| eip712_domain = EIP712Domain( | ||
| name="Injective Protocol", | ||
| version="2.0.0", | ||
| chainId=888, | ||
| verifyingContract="0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", | ||
| salt=HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000"), | ||
| ) | ||
|
|
||
| MarketId: abi.string | ||
| OrderInfo: OrderInfo | ||
| OrderType: "string" # noqa: F821 | ||
| Margin: "string" # noqa: F821 | ||
| TriggerPrice: "string" # noqa: F821 | ||
| Salt: "string" # noqa: F821 | ||
| OrderType: abi.string | ||
| Margin: abi.string | ||
| TriggerPrice: abi.string | ||
| Salt: abi.string | ||
|
|
||
|
|
||
| # domain_separator = EIP712_domain.hash_struct() | ||
|
|
||
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.
Critical: Replace branch reference with tagged release or commit SHA.
Using a feature branch (
c-655/add_chainlink_data_streams_oracle) for the injective-core dependency is problematic because:🔎 Recommended fix
Use either:
🤖 Prompt for AI Agents