Skip to content

Commit

Permalink
Merge pull request #84 from catalystdao/docs
Browse files Browse the repository at this point in the history
Update in-code documentation & new deployment
  • Loading branch information
reednaa committed May 18, 2024
2 parents 5eaf375 + 22bc4b7 commit 0870735
Show file tree
Hide file tree
Showing 61 changed files with 1,268 additions and 1,152 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: Cata Labs
Licensor: Cata Labs Inc.

Licensed Work: Catalyst V1
The Licensed Work is (c) 2024 Cata Labs
The Licensed Work is (c) 2024 Cata Labs Inc.

Change Date: 2028-04-02

Expand Down
2 changes: 1 addition & 1 deletion evm/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CATALYST_ADDRESS="0x0000007aAAC54131e031b3C0D6557723f9365A5B"
CATALYST_ADDRESS="0x0000000099263f0735D03bB2787cE8FB84f6ED6E"
ROUTER_DEPLOYER=
DEPLOYER_PK=

Expand Down
4 changes: 2 additions & 2 deletions evm/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: Cata Labs
Licensor: Cata Labs Inc.

Licensed Work: Catalyst V1
The Licensed Work is (c) 2024 Cata Labs
The Licensed Work is (c) 2024 Cata Labs Inc.

Change Date: 2028-04-02

Expand Down
6 changes: 3 additions & 3 deletions evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ import { ICatalystV1Vault, ICatalystV1Structs } from "../src/ICatalystV1Vault.so
contract ExampleTest is TestCommon {
address vault1;
address vault2;
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0)));
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0xdead)));
function setUp() public override {...}
Expand Down Expand Up @@ -390,7 +390,7 @@ import { ICatalystV1Vault, ICatalystV1Structs } from "../src/ICatalystV1Vault.so
contract ExampleTest is TestCommon {
address vault1;
address vault2;
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0)));
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0xdead)));
function setUp() public override {...}
Expand Down Expand Up @@ -449,7 +449,7 @@ import { ICatalystV1Vault, ICatalystV1Structs } from "../src/ICatalystV1Vault.so
contract ExampleTest is TestCommon {
address vault1;
address vault2;
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0)));
bytes32 FEE_RECIPITANT = bytes32(uint256(uint160(0xdead)));
function setUp() public override {...}
Expand Down
2 changes: 1 addition & 1 deletion evm/lib/GeneralisedIncentives
Submodule GeneralisedIncentives updated 65 files
+1 −1 LICENSE
+4 −4 README.md
+ audit/VAR_GeneralisedIncentivesTimeout_V1_01.pdf
+ audit/ackee-blockchain-catalyst-generalised-incentives-report.pdf
+1 −1 lib/vibc-core-smart-contracts
+6 −6 script/BaseMultiChainDeployer.s.sol
+3 −3 script/Deploy.sol
+13 −9 script/bridge_contracts.json
+370 −189 src/IncentivizedMessageEscrow.sol
+1 −1 src/MessagePayload.sol
+1 −1 src/apps/mock/IncentivizedMockEscrow.sol
+3 −2 src/apps/mock/OnRecvIncentivizedMockEscrow.sol
+79 −0 src/apps/polymer/APolymerEscrow.sol
+9 −76 src/apps/polymer/UniversalPolymerEscrow.sol
+209 −0 src/apps/polymer/vIBCEscrow.sol
+29 −8 src/apps/wormhole/IncentivizedWormholeEscrow.sol
+1 −1 src/apps/wormhole/external/callworm/README.md
+4 −0 src/apps/wormhole/external/callworm/WormholeVerifier.sol
+1 −1 src/interfaces/ICrossChainReceiver.sol
+5 −5 src/interfaces/IIncentivizedMessageEscrow.sol
+24 −20 src/interfaces/IMessageEscrowErrors.sol
+12 −6 src/interfaces/IMessageEscrowEvents.sol
+1 −1 src/interfaces/IMessageEscrowStructs.sol
+1 −1 src/utils/Bytes65.sol
+9 −7 test/IncentivizedMessageEscrow/TimeoutMessage.t.sol
+1 −1 test/IncentivizedMessageEscrow/escrowMessage/Deadline.t.sol
+6 −4 test/IncentivizedMessageEscrow/escrowMessage/EscrowMessage.t.sol
+9 −5 test/IncentivizedMessageEscrow/escrowMessage/MessageIdentifier.t.sol
+1 −1 test/IncentivizedMessageEscrow/escrowMessage/NoRemoteImplementation.t.sol
+1 −1 test/IncentivizedMessageEscrow/escrowMessage/WrongGasPayment.t.sol
+2 −2 test/IncentivizedMessageEscrow/escrowMessage/refundGasTo.t.sol
+6 −4 test/IncentivizedMessageEscrow/feature/SendMessagePayment.t.sol
+11 −1 test/IncentivizedMessageEscrow/increaseBounty/IncreaseBounty.t.sol
+3 −3 test/IncentivizedMessageEscrow/processMessage/GasSpendControl.sol
+3 −3 test/IncentivizedMessageEscrow/processMessage/NoReceive.t.sol
+2 −2 test/IncentivizedMessageEscrow/processMessage/Reentry.ack.t.sol
+3 −3 test/IncentivizedMessageEscrow/processMessage/Reentry.call.t.sol
+5 −5 test/IncentivizedMessageEscrow/processMessage/RequirePaymentFromRelayer.t.sol
+1 −1 test/IncentivizedMessageEscrow/processMessage/ReturnBomb.t.sol
+6 −4 test/IncentivizedMessageEscrow/processMessage/TargetDeltaZero.t.sol
+8 −4 test/IncentivizedMessageEscrow/processMessage/TimeOverflow.t.sol
+27 −19 test/IncentivizedMessageEscrow/processMessage/_handleAck.t.sol
+4 −3 test/IncentivizedMessageEscrow/processMessage/_handleCall.t.sol
+1 −1 test/IncentivizedMessageEscrow/processMessage/_handleTimeout.t.sol
+4 −4 test/IncentivizedMessageEscrow/processMessage/_verifyTimeout.t.sol
+181 −0 test/IncentivizedMessageEscrow/reemitAck/AnyAckExploit.t.sol
+4 −11 test/IncentivizedMessageEscrow/reemitAck/ReemitAckMessage.t.sol
+20 −1 test/IncentivizedMessageEscrow/setRemoteImplementation.t.sol
+1 −1 test/OnRecvIncentivizedMockEscrow/TestOnRecvCommon.t.sol
+0 −0 test/OnRecvIncentivizedMockEscrow/Timeout.t.sol
+2 −2 test/OnRecvIncentivizedMockEscrow/processMessage/_handleAck.t.sol
+3 −3 test/OnRecvIncentivizedMockEscrow/processMessage/_handleCall.t.sol
+3 −3 test/OnRecvIncentivizedMockEscrow/processMessage/_handleTimeout.t.sol
+1 −1 test/OnRecvIncentivizedMockEscrow/processMessage/processMessage.t.sol
+2 −2 test/OnRecvIncentivizedMockEscrow/processMessage/recoverAck.t.sol
+4 −4 test/TestCommon.t.sol
+1 −1 test/mocks/BadContract.sol
+1 −1 test/mocks/MockApplication.sol
+1 −1 test/mocks/MockOnRecvAMB.sol
+1 −1 test/mocks/MockSpendGas.sol
+1 −1 test/mocks/ReturnBomber.sol
+1 −1 test/wormhole/(wh)messages.t.sol
+3 −3 test/wormhole/roundtrip.t.sol
+4 −4 test/wormhole/verifyMessage2.t.sol
+4 −4 test/wormhole/verifyMessages.t.sol
2 changes: 1 addition & 1 deletion evm/lib/openzeppelin-contracts
4 changes: 2 additions & 2 deletions evm/script/BaseMultiChainDeployer.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ contract MultiChainDeployer is BaseMultiChainDeployer {
mapping(string => string) wrappedGas;

constructor() BaseMultiChainDeployer() {
wrappedGas[chainKey[Chains.Mumbai]] = "WMATIC";

wrappedGas[chainKey[Chains.Sepolia]] = "WETH10";

wrappedGas[chainKey[Chains.BaseSepolia]] = "WETH";

wrappedGas[chainKey[Chains.ArbitrumSepolia]] = "WETH";

wrappedGas[chainKey[Chains.OptimismSepolia]] = "WETH";

wrappedGas[chainKey[Chains.BlastTestnet]] = "WETH";
}
}

10 changes: 5 additions & 5 deletions evm/script/DeployContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ contract DeployContracts is Script {

admin = admin_;

deployFactory(bytes32(uint256(251)));
deployFactory(bytes32(0x05624c1ea3c3ccda5de1f660f08f273485a6705c2a16ba15faa6dc4bc6ab08e7));

deploy_volatile_mathlib(bytes32(uint256(251)));
deploy_amplified_mathlib(bytes32(uint256(251)));
deploy_volatile_mathlib(bytes32(0xe5a3f4676abc23027a0cd4359d4c97e42f4220eafcab86d68659524867949a45));
deploy_amplified_mathlib(bytes32(0xb6b5fa2553b5e78058a72aa1df20ead9538ff71011621b994ed3114a4e573361));

deploy_volatile_template(bytes32(uint256(251)));
deploy_amplified_template(bytes32(uint256(251)));
deploy_volatile_template(bytes32(0x8add0c36c676f99a85b05f50ebf5306c7e0ca540a6985e18a339013c1f1dbc38));
deploy_amplified_template(bytes32(0xe902feb8d6b508a0bf6dabc08b2fd6a8ea2e64253f957e95108794a339201fbd));
}
}

2 changes: 1 addition & 1 deletion evm/script/DeployInterfaces.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ contract DeployInterfaces is MultiChainDeployer {


function _deploy(string[] memory bridges) internal {
admin = vm.envAddress("CATALYST_ADDRESS");
admin = vm.addr(pk);

deployCCI(bridges);
}
Expand Down
2 changes: 1 addition & 1 deletion evm/script/DeployRouter.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RouterParameters } from "../src/router/base/RouterImmutables.sol";
contract DeployRouter is MultiChainDeployer {
using stdJson for string;

address expectedRouterAddress = address(0x0000009586123fBAAe1929B0768feb8BDBB0145d);
address expectedRouterAddress = address(0x00000029e6005863Bb2E1686a17C4ae0D1723669);
address expectedPermit2Address = address(0x000000000022D473030F116dDEE9F6B43aC78BA3);

string config_token;
Expand Down
20 changes: 10 additions & 10 deletions evm/script/Registry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ contract Registry is BaseMultiChainDeployer {

function deploy(string[] memory chains) iter_chains_string(chains) broadcast external {
verify = true;
admin = vm.envAddress("CATALYST_ADDRESS");
admin = vm.addr(pk);
_deploy();
}

function deployAll() iter_chains(chain_list) broadcast external {
verify = true;
admin = vm.envAddress("CATALYST_ADDRESS");
admin = vm.addr(pk);
_deploy();
}

function deployAllLegacy() iter_chains(chain_list_legacy) broadcast external {
verify = true;
admin = vm.envAddress("CATALYST_ADDRESS");
admin = vm.addr(pk);
_deploy();
}

function getAddresses() external {
get = true;
admin = vm.envAddress("CATALYST_ADDRESS");
admin = vm.addr(vm.envUint("DEPLOYER_PK"));

vm.startBroadcast(uint256(1));

Expand Down Expand Up @@ -117,25 +117,25 @@ contract Registry is BaseMultiChainDeployer {
CatalystDescriberRegistry reg = CatalystDescriberRegistry(registry.describer_registry);

// Check what is the current describer.
address[] memory describers = reg.get_vault_describers();
CatalystDescriberRegistry.AddressAndVersion[] memory describers = reg.getVaultDescribers();
bool contains = false;
for (uint256 i = 0; i < describers.length; ++i) {
if (describers[i] == registry.describer) contains = true;
if (describers[i].addr == registry.describer) contains = true;
}
if (!contains) reg.modifyDescriber(registry.describer, version);
}

function setDescriber() internal {
CatalystDescriber desc = CatalystDescriber(registry.describer);
// Set (or update) the templates
address current_volatile_template = desc.version_to_template("volatile");
address current_volatile_template = desc.versionToTemplate("volatile");
if (current_volatile_template != contracts.volatile_template) desc.modifyWhitelistedTemplate(contracts.volatile_template, "volatile");

address current_amplified_template = desc.version_to_template("amplified");
address current_amplified_template = desc.versionToTemplate("amplified");
if (current_amplified_template != contracts.amplified_template) desc.modifyWhitelistedTemplate(contracts.amplified_template, "amplified");

// Set (or update) the factory.
address current_factory = desc.version_to_factory("v1");
address current_factory = desc.versionToFactory("v1");
if (current_factory != contracts.factory) desc.modifyWhitelistedFactory(contracts.factory, "v1");

// Set (or update) the cross-chain interfaces
Expand All @@ -147,7 +147,7 @@ contract Registry is BaseMultiChainDeployer {
}
address excepted_cci = abi.decode(config_interfaces.parseRaw(string.concat(".", incentiveVersion, ".", currentChainKey, ".interface")), (address));

address current_cci = desc.version_to_cci(incentiveVersion);
address current_cci = desc.versionToCCI(incentiveVersion);
if (current_cci != excepted_cci) desc.modifyWhitelistedCCI(excepted_cci, incentiveVersion);
}
}
Expand Down
35 changes: 35 additions & 0 deletions evm/script/TimeLock.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "forge-std/Script.sol";

import { BaseMultiChainDeployer } from "./BaseMultiChainDeployer.s.sol";

import { TimelockController } from "openzeppelin-contracts/contracts/governance/TimelockController.sol";

contract DeployTimelock is BaseMultiChainDeployer {

uint256 MIN_DELAY = 1 days;

function _deployTimelockController(bytes32 salt, uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) internal returns(TimelockController) {
vm.broadcast();
return new TimelockController{salt: salt}(minDelay, proposers, executors, admin);
}

function deployTimelockController(bytes32 salt, address initalProposer) public returns(TimelockController) {
address[] memory proposers = new address[](1);
proposers[0] = initalProposer;
address[] memory executors = new address[](1);
executors[0] = address(0); // Let anyone execute.
address admin = address(0);

return _deployTimelockController(salt, MIN_DELAY, proposers, executors, admin);
}

function run() public {
bytes32 salt = bytes32(0xe28b85a3a6cd3c7b941c273688ed961305638df07108218fc6e68bcc364e7f37);
address initalProposer = address(0xE759cBa7dE5bF6E024BcbdD01941fc3b1713D2FC);
deployTimelockController(salt, initalProposer); // 0x0000000099263f0735D03bB2787cE8FB84f6ED6E
}
}

16 changes: 8 additions & 8 deletions evm/script/config/config_contracts.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"contracts": {
"amplified_mathlib": "0xc090dcdC90178c86CFB643f6ce64aBecD3360247",
"amplified_template": "0x65E17EB8Eb46a7FA97d9E5316893C95D5e84bf35",
"factory": "0x343A85b1e0383A50D65adB5ed88B06cCF4187606",
"volatile_mathlib": "0x33D494F7AC4E506D31F37e3fD75CaE3ca87A3916",
"volatile_template": "0x35D30159b7A9B9098C1048cbe29168EffE7d3D02"
"amplified_mathlib": "0x000000575b0D9cc6ddbd8990db4d845fe480281f",
"amplified_template": "0x000000004aBe0D620b25b8B06B0712BDcff21899",
"factory": "0x00000000E5E81E25aeaD7fCCb4C9560C6b5b718F",
"volatile_mathlib": "0x000000992f6Bd813E0De5C595099C44d67ea28eD",
"volatile_template": "0x0000000003b8C9BFeB9351933CFC301Eea92073F"
},
"registry": {
"describer": "0x5514d9b55CdCbA70A6aF19Ca1E3443b1abEa104A",
"describer_registry": "0x56dCAa213D0da8dC0eb21ac71fB63EF28D497fd8",
"lens": "0x7E511493d23c0ad9dc1a6137D24BE5aa273773eE"
"describer": "0x3F578971672d5469D28B39ec2b367CbeBF238a11",
"describer_registry": "0x39AcfC1Edd61Eb08fB96523A3b5419B83A603820",
"lens": "0x7363003E709EE4Ce16c32D2DEE8B7616d91D51d5"
}
}
26 changes: 11 additions & 15 deletions evm/script/config/config_interfaces.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"Wormhole": {
"mumbai": {
"interface": "0x74e46a8113F2E06db0e07D592F6Cf5B1A59756EE",
"escrow": "0xFb4B1475e61642b3930d762B66d9DD4E08B14367"
},
"sepolia": {
"interface": "0x169e7E77E463FfE86b30Afd1605A09A632BeA5B0",
"escrow": "0x45C140Dd2526E4bfD1c2A5Bb0Aa6aA1DB00b1744"
"interface": "0xEF04d76391C4b6a0c8BB5262f0f2214c261C4AD2",
"escrow": "0x294F41D30D058C9e5A71810A6C758E595b7aC170"
},
"basesepolia": {
"interface": "0xa71ae9298Ba6DD5f2Aa96415bC1eC33e62980751",
"escrow": "0xEA2F1d38e31fBE501c0b42BA25E217a47132D8fa"
"optimismsepolia": {
"interface": "0xdB321B1E304eA155B1977768904De998818F986E",
"escrow": "0x198cDD55d90277726f3222D5A8111AdB8b0af9ee"
},
"arbitrumsepolia": {
"interface": "0xf779D8e1B07F1e3dF141A81c4f1f7D65c0A38611",
"escrow": "0xdF25f1BdE09Cee5ac1e6ef8dFA7113addBd58B28"
"basesepolia": {
"interface": "0xC7D9815055Ea739B78E2D10D0055d97010396b78",
"escrow": "0x63B4E24DC9814fAcDe241fB4dEFcA04d5fc6d763"
},
"optimismsepolia": {
"interface": "0x2603e874D589373A0c4766808B93e3D4b63164C8",
"escrow": "0xbDFD9163d8Cee1368698B023369f9A5Fd319A40F"
"blasttestnet": {
"interface": "0x39629dDb16a11E11fB62Bf46f34F63fF1c42B090",
"escrow": "0x9524ACA1fF46fAd177160F0a803189Cb552A3780"
}
},
"Polymer": {
Expand Down
3 changes: 3 additions & 0 deletions evm/script/config/config_tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
},
"optimismsepolia": {
"WETH": "0x1BDD24840e119DC2602dCC587Dd182812427A5Cc"
},
"blasttestnet": {
"WETH": "0x4200000000000000000000000000000000000006"
}
}
44 changes: 10 additions & 34 deletions evm/script/config/config_vaults.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{
"WormholeSepoliaOptimismArbitrum": {
"WormholeOptimismBaseBlast": {
"cci_version": "Wormhole",
"sepolia": {
"cci": "0x169e7e77e463ffe86b30afd1605a09a632bea5b0",
"address": "0xbd529ff730dae029fa85b38d98d6046721215fa4",
"weights": [
1
],
"fee": 500000000000000,
"tokens": {
"WGAS": 10000000000000000
}
},
"amplification": 250000000000000000,
"optimismsepolia": {
"cci": "0x2603e874d589373a0c4766808b93e3d4b63164c8",
"address": "0xbd529ff730dae029fa85b38d98d6046721215fa4",
"cci": "0xdb321b1e304ea155b1977768904de998818f986e",
"address": "0x06d4b5289b981933e34af10817f352061bad6353",
"weights": [
1
],
Expand All @@ -23,23 +13,9 @@
"WGAS": 10000000000000000
}
},
"arbitrumsepolia": {
"cci": "0xf779d8e1b07f1e3df141a81c4f1f7d65c0a38611",
"address": "0xbd529ff730dae029fa85b38d98d6046721215fa4",
"weights": [
1
],
"fee": 500000000000000,
"tokens": {
"WGAS": 10000000000000000
}
}
},
"PolymerOPBASEsepolia": {
"cci_version": "Polymer",
"optimismsepolia": {
"cci": "0x622ebf7b017b42cec6e30f47b4895f198b9a7364",
"address": "0x52ddaf2596c653bd6e0422336fe4a8dfb3418141",
"basesepolia": {
"cci": "0xc7d9815055ea739b78e2d10d0055d97010396b78",
"address": "0x06d4b5289b981933e34af10817f352061bad6353",
"weights": [
1
],
Expand All @@ -48,9 +24,9 @@
"WGAS": 10000000000000000
}
},
"basesepolia": {
"cci": "0x7d2193429c1ae9ba1b36ffb8d5ee467b4ce0efc3",
"address": "0xcdfef148155ee1d5d908d4d7030de865e5720d1f",
"blasttestnet": {
"cci": "0x39629ddb16a11e11fb62bf46f34f63ff1c42b090",
"address": "0x06d4b5289b981933e34af10817f352061bad6353",
"weights": [
1
],
Expand Down
2 changes: 1 addition & 1 deletion evm/script/mocks/MockApplication.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract MockApplication is ICrossChainReceiver {
MESSAGE_ESCROW.setRemoteImplementation(chainIdentifier, implementation);
}

function receiveAck(bytes32 destinationIdentifier, bytes32 messageIdentifier, bytes calldata acknowledgement) external {
function receiveAck(bytes32 destinationIdentifier, bytes32 /* messageIdentifier */, bytes calldata acknowledgement) external {
emit AckMessage(destinationIdentifier, acknowledgement);
}

Expand Down
Loading

0 comments on commit 0870735

Please sign in to comment.