-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into test-crib-4-copy
- Loading branch information
Showing
63 changed files
with
7,958 additions
and
720 deletions.
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
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 |
---|---|---|
|
@@ -85,3 +85,6 @@ tools/flakeytests/coverage.txt | |
|
||
.test_summary/ | ||
.run.id | ||
|
||
# Fuzz tests can create these files | ||
**/testdata/fuzz/* |
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
117 changes: 117 additions & 0 deletions
117
contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol
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,117 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8; | ||
|
||
struct TestStruct { | ||
int32 Field; | ||
string DifferentField; | ||
uint8 OracleId; | ||
uint8[32] OracleIds; | ||
address Account; | ||
address[] Accounts; | ||
int192 BigField; | ||
MidLevelTestStruct NestedStruct; | ||
} | ||
|
||
struct MidLevelTestStruct { | ||
bytes2 FixedBytes; | ||
InnerTestStruct Inner; | ||
} | ||
|
||
struct InnerTestStruct { | ||
int64 IntVal; | ||
string S; | ||
} | ||
|
||
contract LatestValueHolder { | ||
event Triggered( | ||
int32 indexed field, | ||
string differentField, | ||
uint8 oracleId, | ||
uint8[32] oracleIds, | ||
address Account, | ||
address[] Accounts, | ||
int192 bigField, | ||
MidLevelTestStruct nestedStruct | ||
); | ||
|
||
event TriggeredEventWithDynamicTopic(string indexed fieldHash, string field); | ||
|
||
// First topic is event hash | ||
event TriggeredWithFourTopics(int32 indexed field1, int32 indexed field2, int32 indexed field3); | ||
|
||
TestStruct[] private s_seen; | ||
uint64[] private s_arr; | ||
|
||
constructor() { | ||
// See chain_reader_interface_tests.go in chainlink-relay | ||
s_arr.push(3); | ||
s_arr.push(4); | ||
} | ||
|
||
function addTestStruct( | ||
int32 field, | ||
string calldata differentField, | ||
uint8 oracleId, | ||
uint8[32] calldata oracleIds, | ||
address account, | ||
address[] calldata accounts, | ||
int192 bigField, | ||
MidLevelTestStruct calldata nestedStruct | ||
) public { | ||
s_seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct)); | ||
} | ||
|
||
function returnSeen( | ||
int32 field, | ||
string calldata differentField, | ||
uint8 oracleId, | ||
uint8[32] calldata oracleIds, | ||
address account, | ||
address[] calldata accounts, | ||
int192 bigField, | ||
MidLevelTestStruct calldata nestedStruct | ||
) public pure returns (TestStruct memory) { | ||
return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); | ||
} | ||
|
||
function getElementAtIndex(uint256 i) public view returns (TestStruct memory) { | ||
// See chain_reader_interface_tests.go in chainlink-relay | ||
return s_seen[i - 1]; | ||
} | ||
|
||
function getPrimitiveValue() public pure returns (uint64) { | ||
// See chain_reader_interface_tests.go in chainlink-relay | ||
return 3; | ||
} | ||
|
||
function getDifferentPrimitiveValue() public pure returns (uint64) { | ||
// See chain_reader_interface_tests.go in chainlink-relay | ||
return 1990; | ||
} | ||
|
||
function getSliceValue() public view returns (uint64[] memory) { | ||
return s_arr; | ||
} | ||
|
||
function triggerEvent( | ||
int32 field, | ||
string calldata differentField, | ||
uint8 oracleId, | ||
uint8[32] calldata oracleIds, | ||
address account, | ||
address[] calldata accounts, | ||
int192 bigField, | ||
MidLevelTestStruct calldata nestedStruct | ||
) public { | ||
emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct); | ||
} | ||
|
||
function triggerEventWithDynamicTopic(string calldata field) public { | ||
emit TriggeredEventWithDynamicTopic(field, field); | ||
} | ||
|
||
// first topic is the event signature | ||
function triggerWithFourTopics(int32 field1, int32 field2, int32 field3) public { | ||
emit TriggeredWithFourTopics(field1, field2, field3); | ||
} | ||
} |
830 changes: 830 additions & 0 deletions
830
core/gethwrappers/generated/chain_reader_example/chain_reader_example.go
Large diffs are not rendered by default.
Oops, something went wrong.
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.