Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ library ECCUtils {

for (uint i=0; i<sealCount; i++) {
(seal,offset) = rlpSplit(rawSeals, offset);
signers[i] = verifySeal(keccak256(abi.encodePacked(headerHash)), seal);
signers[i] = verifySeal(headerHash, seal);
if (signers[i] == address(0)) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ contract EthCrossChainManagerImplementation is Const {
event ChangeEpochEvent(uint256 height, bytes rawHeader, address[] oldValidators, address[] newValidators);
event CrossChainEvent(address indexed sender, bytes txId, address proxyOrAssetContract, uint64 toChainId, bytes toContract, bytes rawdata);
event VerifyHeaderAndExecuteTxEvent(uint64 fromChainID, bytes toContract, bytes crossChainTxHash, bytes fromChainTxHash);

event ExecuteTxEvent(address toContract, bytes method, bytes args);

// see in Const.sol
// address constant EthCrossChainDataAddress = 0x0000000000000000000000000000000000000000;
// address constant EthCrossChainCallerFactoryAddress = 0x0000000000000000000000000000000000000000;
Expand Down Expand Up @@ -164,6 +165,8 @@ contract EthCrossChainManagerImplementation is Const {
require(returnData.length != 0, "No return value from business contract!");
bool res = abi.decode(returnData, (bool));
require(res == true, "EthCrossChain call business contract return is not true");

emit ExecuteTxEvent(_toContract, _method, _args);

return true;
}
Expand Down
5 changes: 0 additions & 5 deletions contracts/core/cross_chain_manager/logic/VerifyHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ contract VerifyHelper {
ZionCrossChainManagerAddress = zionCrossChainManagerAddress;
}

function set(address ethCrossChainDataAddress, bytes memory zionCrossChainManagerAddress) public {
EthCrossChainDataAddress = ethCrossChainDataAddress;
ZionCrossChainManagerAddress = zionCrossChainManagerAddress;
}

function verifyHeader(
bytes memory rawHeader,
bytes memory rawSeals,
Expand Down
13 changes: 13 additions & 0 deletions contracts/core/lockProxy/RippleLockProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,17 @@ contract RippleLockProxy is Ownable {
(args.toAddress, args.amount) = abi.decode(valueBs, (bytes,uint256));
return args;
}

// function for wrapper only
function assetHashMap(address fromAssetHash, uint64 toChainId) external view returns (bytes memory) {
return proxyHashMap[toChainId];
}
function lock(
address fromAssetHash,
uint64 toChainId,
bytes calldata toAddress,
uint256 amount
) external payable returns (bool) {
return lock(toChainId, toAddress, amount);
}
}
15 changes: 15 additions & 0 deletions contracts/mocks/ECCUtils/ECCUtilsMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ contract ECCUtilsMock {
function verifyHeader(bytes32 headerHash, bytes memory rawSeals, address[] memory validators) public pure returns(bool) {
return ECCUtils.verifyHeader(headerHash, rawSeals, validators);
}

function verifyHeader(bytes32 headerHash, bytes memory rawSeals) public pure returns(address[] memory) {
uint offset = 0x20;
bytes memory seal;

(rawSeals,) = rlpSplit(rawSeals, 0x20);
uint sealCount = rawSeals.length/(67);
address[] memory signers = new address[](sealCount);

for (uint i=0; i<sealCount; i++) {
(seal,offset) = rlpSplit(rawSeals, offset);
signers[i] = verifySeal(headerHash, seal);
}
return signers;
}

function verifySeal(bytes32 headerHash, bytes memory seal) public pure returns(address signer) {
return ECCUtils.verifySeal(headerHash, seal);
Expand Down
25 changes: 20 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
{
"name": "hardhat-project",
"dependencies": {},
"devDependencies": {
"@nomicfoundation/hardhat-chai-matchers": "^1.0.2",
"@nomiclabs/hardhat-ethers": "^2.1.0",
"chai": "^4.3.6",
"@nomiclabs/hardhat-ethers": "^2.2.2",
"@nomiclabs/hardhat-etherscan": "^2.1.8",
"@nomiclabs/hardhat-waffle": "^2.0.5",
"chai": "^4.3.7",
"dotenv": "^10.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.7.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-promise": "^5.2.0",
"ethereum-waffle": "^3.4.4",
"ethereumjs-util": "^7.1.5",
"ethers": "^5.6.9",
"hardhat": "^2.10.1",
"ethers": "^5.7.2",
"hardhat": "^2.13.0",
"hardhat-gas-reporter": "^1.0.9",
"prettier": "^2.8.4",
"prettier-plugin-solidity": "^1.1.3",
"solhint": "^3.4.1",
"solidity-coverage": "^0.7.22",
"web3": "^1.7.5"
}
}
Loading