-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
BCFR-1099 sei custom log index #15858
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7e85776
add sei chain and error mapping
flodesi 492281f
fix changeset and config_test
flodesi 730b375
remove sei chain type
flodesi 871afa3
add pricemax
flodesi 3746b12
custom calculation of log's index for Sei
dhaidashenko c26d2a4
fix lint issues & tests
dhaidashenko c710a29
Merge branch 'develop' into feature/BCFR-1099-sei-custom-log-index
dhaidashenko 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
#added Sei config and error mapping |
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,18 @@ | ||
ChainID = '1328' | ||
ChainType = 'sei' | ||
# finality_depth: instant | ||
FinalityDepth = 10 | ||
# block_time: ~0.4s, adding 1 second buffer | ||
LogPollInterval = '2s' | ||
# finality_depth * block_time / 60 secs = ~0.8 min (finality time) | ||
NoNewFinalizedHeadsThreshold = '5m' | ||
# "RPC node returned multiple missing blocks on query for block numbers [31592085 31592084] even though the WS subscription already sent us these blocks. It might help to increase EVM.RPCBlockQueryDelay (currently 1)" | ||
RPCBlockQueryDelay = 5 | ||
|
||
[GasEstimator] | ||
EIP1559DynamicFees = false | ||
Mode = 'BlockHistory' | ||
PriceMax = '3000 gwei' # recommended by ds&a | ||
|
||
[GasEstimator.BlockHistory] | ||
BlockHistorySize = 200 |
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,3 @@ | ||
//go:build !amd64 && !arm64 | ||
package build | ||
"non-64-bits architectures are not supported" |
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 |
---|---|---|
|
@@ -143,6 +143,7 @@ func Test_Eth_Errors(t *testing.T) { | |
{"ErrorObject { code: ServerError(3), message: \\\"known transaction. transaction with hash 0xf016…ad63 is already in the system\\\", data: Some(RawValue(\\\"0x\\\")) }", true, "zkSync"}, | ||
{"client error transaction already in mempool", true, "tomlConfig"}, | ||
{"alreadyknown", true, "Gnosis"}, | ||
{"tx already exists in cache", true, "Sei"}, | ||
} | ||
for _, test := range tests { | ||
err = evmclient.NewSendErrorS(test.message) | ||
|
@@ -442,6 +443,11 @@ func Test_Eth_Errors_Fatal(t *testing.T) { | |
{"client error fatal", true, "tomlConfig"}, | ||
{"[Request ID: d9711488-4c1e-4af2-bc1f-7969913d7b60] Error invoking RPC: transaction [email protected] failed precheck with status INVALID_SIGNATURE", true, "hedera"}, | ||
{"invalid chain id for signer", true, "Treasure"}, | ||
|
||
{": out of gas", true, "Sei"}, | ||
{"Tx too large. Max size is 2048576, but got 2097431", true, "Sei"}, | ||
{": insufficient funds", true, "Sei"}, | ||
{"insufficient fee", true, "Sei"}, | ||
} | ||
|
||
for _, test := range tests { | ||
|
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,93 @@ | ||
package client | ||
|
||
import ( | ||
"errors" | ||
"math" | ||
"testing" | ||
|
||
ethtypes "github.com/ethereum/go-ethereum/core/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
commonclient "github.com/smartcontractkit/chainlink/v2/common/client" | ||
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/chaintype" | ||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
) | ||
|
||
func TestRPCClient_MakeLogsValid(t *testing.T) { | ||
testCases := []struct { | ||
Name string | ||
TxIndex uint | ||
LogIndex uint | ||
ExpectedLogIndex uint | ||
ExpectedError error | ||
}{ | ||
{ | ||
Name: "TxIndex = 0 LogIndex = 0", | ||
TxIndex: 0, | ||
LogIndex: 0, | ||
ExpectedLogIndex: 0, | ||
ExpectedError: nil, | ||
}, | ||
{ | ||
Name: "TxIndex = 0 LogIndex = 1", | ||
TxIndex: 0, | ||
LogIndex: 1, | ||
ExpectedLogIndex: 1, | ||
ExpectedError: nil, | ||
}, | ||
{ | ||
Name: "TxIndex = 0 LogIndex = MaxUint32", | ||
TxIndex: 0, | ||
LogIndex: math.MaxUint32, | ||
ExpectedLogIndex: math.MaxUint32, | ||
ExpectedError: nil, | ||
}, | ||
{ | ||
Name: "LogIndex = MaxUint32 + 1 => returns an error", | ||
TxIndex: 0, | ||
LogIndex: math.MaxUint32 + 1, | ||
ExpectedLogIndex: 0, | ||
ExpectedError: errors.New("log's index 4294967296 of tx 0x0000000000000000000000000000000000000000000000000000000000000000 exceeds max supported value of 4294967295"), | ||
}, | ||
{ | ||
Name: "TxIndex = 1 LogIndex = 0", | ||
TxIndex: 1, | ||
LogIndex: 0, | ||
ExpectedLogIndex: math.MaxUint32 + 1, | ||
ExpectedError: nil, | ||
}, | ||
{ | ||
Name: "TxIndex = MaxUint32 LogIndex = MaxUint32", | ||
TxIndex: math.MaxUint32, | ||
LogIndex: math.MaxUint32, | ||
ExpectedLogIndex: math.MaxUint64, | ||
ExpectedError: nil, | ||
}, | ||
{ | ||
Name: "TxIndex = MaxUint32 + 1 => returns an error", | ||
TxIndex: math.MaxUint32 + 1, | ||
LogIndex: 0, | ||
ExpectedLogIndex: 0, | ||
ExpectedError: errors.New("TxIndex of tx 0x0000000000000000000000000000000000000000000000000000000000000000 exceeds max supported value of 4294967295"), | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
t.Run(tc.Name, func(t *testing.T) { | ||
rpc := NewRPCClient(TestNodePoolConfig{}, logger.TestLogger(t), nil, nil, "eth-primary-rpc-0", 0, nil, commonclient.Primary, commonclient.QueryTimeout, commonclient.QueryTimeout, "") | ||
log, err := rpc.makeLogValid(ethtypes.Log{TxIndex: tc.TxIndex, Index: tc.LogIndex}) | ||
// non sei should return as is | ||
require.NoError(t, err) | ||
require.Equal(t, tc.TxIndex, log.TxIndex) | ||
require.Equal(t, tc.LogIndex, log.Index) | ||
seiRPC := NewRPCClient(TestNodePoolConfig{}, logger.TestLogger(t), nil, nil, "eth-primary-rpc-0", 0, nil, commonclient.Primary, commonclient.QueryTimeout, commonclient.QueryTimeout, chaintype.ChainSei) | ||
log, err = seiRPC.makeLogValid(ethtypes.Log{TxIndex: tc.TxIndex, Index: tc.LogIndex}) | ||
if tc.ExpectedError != nil { | ||
require.EqualError(t, err, tc.ExpectedError.Error()) | ||
return | ||
} | ||
|
||
require.Equal(t, tc.ExpectedLogIndex, log.Index) | ||
require.Equal(t, tc.TxIndex, log.TxIndex) | ||
}) | ||
} | ||
} |
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.
Does this mean we can't support LogPoller / CCIP on AStar?
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.
Oh, nevermind... I forgot we only use batch requests with
eth_getBlockByNumber
. Still, very strange that AStar wouldn't support this! We have thought about changing theeth_getLogs
requests to a batched request, I guess if we do that we'll have to fall back to the older method on AStar 🤔