-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Migrate warp backend from Subnet-EVM * warp/handlers: update duration greater than assertion to pass on windows * Update precompile setup for warp * Pass predicate context through block build / verify * Fix up dynamic fee extra data window handling post D-Upgrade * Migrate x/warp package and start migrating tests * Fix most of the tests * Copy chain configs in vm initialize to fix test * Remove duration stats test from warp network handler * Fix trailing newline * Move aggregateSignatures log to add more detail * Add subnetIDStr option to warp p2p API server/client * Update signature aggregator constructor comment * Add back CanTransferMC and TransferMultiCoin * Remove duplicate from reserved address space * remove duplicate check in different package * Remove js related code from contracts/ * Update README to apply to both Coreth and Subnet-EVM * Update warp/aggregator/aggregator.go Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org> Signed-off-by: aaronbuchwald <aaron.buchwald56@gmail.com> * core/vm: move native asset contracts to separate file * Remove unused istanbul field from txpool * force load precompile registry from vm.go * use packTopic in MakeTopics --------- Signed-off-by: aaronbuchwald <aaron.buchwald56@gmail.com> Co-authored-by: Ceyhun Onur <ceyhun.onur@avalabs.org>
- Loading branch information
1 parent
cbc0d3a
commit f4ea162
Showing
27 changed files
with
4,501 additions
and
85 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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "./interfaces/IWarpMessenger.sol"; | ||
|
||
contract ExampleWarp { | ||
address constant WARP_ADDRESS = 0x0200000000000000000000000000000000000005; | ||
IWarpMessenger warp = IWarpMessenger(WARP_ADDRESS); | ||
|
||
// sendWarpMessage sends a warp message containing the payload | ||
function sendWarpMessage(bytes calldata payload) external { | ||
warp.sendWarpMessage(payload); | ||
} | ||
|
||
// validateWarpMessage retrieves the warp message attached to the transaction and verifies all of its attributes. | ||
function validateWarpMessage( | ||
uint32 index, | ||
bytes32 sourceChainID, | ||
address originSenderAddress, | ||
bytes calldata payload | ||
) external view { | ||
(WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); | ||
require(valid); | ||
require(message.sourceChainID == sourceChainID); | ||
require(message.originSenderAddress == originSenderAddress); | ||
require(keccak256(message.payload) == keccak256(payload)); | ||
} | ||
|
||
function validateInvalidWarpMessage(uint32 index) external view { | ||
(WarpMessage memory message, bool valid) = warp.getVerifiedWarpMessage(index); | ||
require(!valid); | ||
require(message.sourceChainID == bytes32(0)); | ||
require(message.originSenderAddress == address(0)); | ||
require(keccak256(message.payload) == keccak256(bytes(""))); | ||
} | ||
|
||
// validateWarpBlockHash retrieves the warp block hash attached to the transaction and verifies it matches the | ||
// expected block hash. | ||
function validateWarpBlockHash(uint32 index, bytes32 sourceChainID, bytes32 blockHash) external view { | ||
(WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); | ||
require(valid); | ||
require(warpBlockHash.sourceChainID == sourceChainID); | ||
require(warpBlockHash.blockHash == blockHash); | ||
} | ||
|
||
function validateInvalidWarpBlockHash(uint32 index) external view { | ||
(WarpBlockHash memory warpBlockHash, bool valid) = warp.getVerifiedWarpBlockHash(index); | ||
require(!valid); | ||
require(warpBlockHash.sourceChainID == bytes32(0)); | ||
require(warpBlockHash.blockHash == bytes32(0)); | ||
} | ||
|
||
// validateGetBlockchainID checks that the blockchainID returned by warp matches the argument | ||
function validateGetBlockchainID(bytes32 blockchainID) external view { | ||
require(blockchainID == warp.getBlockchainID()); | ||
} | ||
} |
Oops, something went wrong.