-
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
ChainComponents EVM Interface Tests #13735
Merged
Merged
Changes from all commits
Commits
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": minor | ||
--- | ||
|
||
#internal Added ChainWriter to ChainReader 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
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
39 changes: 39 additions & 0 deletions
39
core/services/relay/evm/chain_writer_historical_wrapper_test.go
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,39 @@ | ||
package evm | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" | ||
interfacetesttypes "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" | ||
primitives "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" | ||
) | ||
|
||
// This wrapper is required to enable the ChainReader to access historical data | ||
// Since the geth simulated backend doesn't support historical data, we use this | ||
// thin wrapper. | ||
type ChainWriterHistoricalWrapper struct { | ||
commontypes.ChainWriter | ||
cwh *ClientWithContractHistory | ||
} | ||
|
||
func NewChainWriterHistoricalWrapper(cw commontypes.ChainWriter, cwh *ClientWithContractHistory) *ChainWriterHistoricalWrapper { | ||
return &ChainWriterHistoricalWrapper{ChainWriter: cw, cwh: cwh} | ||
} | ||
|
||
func (cwhw *ChainWriterHistoricalWrapper) SubmitTransaction(ctx context.Context, contractName, method string, args any, transactionID string, toAddress string, meta *commontypes.TxMeta, value *big.Int) error { | ||
if primArgs, ok := args.(interfacetesttypes.PrimitiveArgs); ok { | ||
callArgs := interfacetesttypes.ExpectedGetLatestValueArgs{ | ||
ContractName: contractName, | ||
ReadName: "GetAlterablePrimitiveValue", | ||
ConfidenceLevel: primitives.Unconfirmed, | ||
Params: nil, | ||
ReturnVal: nil, | ||
} | ||
err := cwhw.cwh.SetUintLatestValue(ctx, primArgs.Value, callArgs) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return cwhw.ChainWriter.SubmitTransaction(ctx, contractName, method, args, transactionID, toAddress, meta, value) | ||
} |
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.
seems overkill to start a whole app just for keystore and chain.txm, is there simpler way to do this? I am pretty sure that you can create a keystore easily
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.
Yes, keystore can be created easier as I do in the
chainlink-evm-testing
implementation, however, I'm not sure if there's an easier way to start up a TXM without the underlying simulated app / chain, but I can look into this.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.
Has this been resolved?
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.
I see txm being initialized on its own in tests in three places 1, 2 , 3, can we reuse any of these approaches so that we don't have to init the whole app?
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.
The issue with these examples is they don't implement the underlying components of the TXM (i.e. Broadcaster, confirmer, finalizer, etc.) that are necessary to actually send transactions (they just leave them
nil
). There may be a way to individually set up these underlying components, but I am not sure it is worth the effort