Skip to content

Commit 04afa0f

Browse files
committed
tilt: e2e with mm and executor
1 parent a0bad59 commit 04afa0f

29 files changed

+4950
-270
lines changed

Tiltfile

+44-15
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ docker_build(
1414
ignore=["./sdk/__tests__", "./sdk/Dockerfile", "./sdk/ci.yaml", "./sdk/**/dist", "./sdk/node_modules", "./sdk/**/node_modules"],
1515
dockerfile = "./solana/Dockerfile",
1616
)
17-
docker_build(
18-
ref = "solana-test-validator",
19-
context = "solana",
20-
dockerfile = "solana/Dockerfile.test-validator"
21-
)
22-
k8s_yaml_with_ns("./solana/solana-devnet.yaml")
23-
k8s_resource(
24-
"solana-devnet",
25-
labels = ["anchor-ntt"],
26-
port_forwards = [
27-
port_forward(8899, name = "Solana RPC [:8899]"),
28-
port_forward(8900, name = "Solana WS [:8900]"),
29-
],
30-
)
17+
# docker_build(
18+
# ref = "solana-test-validator",
19+
# context = "solana",
20+
# dockerfile = "solana/Dockerfile.test-validator"
21+
# )
22+
# k8s_yaml_with_ns("./solana/solana-devnet.yaml")
23+
# k8s_resource(
24+
# "solana-devnet",
25+
# labels = ["anchor-ntt"],
26+
# port_forwards = [
27+
# port_forward(8899, name = "Solana RPC [:8899]"),
28+
# port_forward(8900, name = "Solana WS [:8900]"),
29+
# ],
30+
# )
3131

3232
# EVM build
3333
docker_build(
@@ -36,6 +36,35 @@ docker_build(
3636
dockerfile = "./evm/Dockerfile",
3737
)
3838

39+
# MM and Executor Contract Deploy / Setup
40+
docker_build(
41+
ref = "executor-deploy",
42+
context = "tilt",
43+
dockerfile = "tilt/Dockerfile.deploy",
44+
only = ["deploy.sh"]
45+
)
46+
docker_build(
47+
ref = "executor",
48+
context = "tilt",
49+
dockerfile = "tilt/Dockerfile.executor",
50+
only = [],
51+
)
52+
k8s_yaml_with_ns("tilt/executor-deploy.yaml")
53+
k8s_resource(
54+
"executor-deploy",
55+
labels = ["executor"],
56+
resource_deps = ["eth-devnet", "eth-devnet2"],
57+
)
58+
k8s_yaml_with_ns("tilt/executor.yaml")
59+
k8s_resource(
60+
"executor",
61+
labels = ["executor"],
62+
resource_deps = ["eth-devnet", "eth-devnet2", "guardian", "executor-deploy"],
63+
port_forwards = [
64+
port_forward(3000, name = "Executor [:3000]"),
65+
],
66+
)
67+
3968
# CI tests
4069
docker_build(
4170
ref = "ntt-ci",
@@ -47,5 +76,5 @@ k8s_yaml_with_ns("./sdk/ci.yaml")
4776
k8s_resource(
4877
"ntt-ci-tests",
4978
labels = ["ntt"],
50-
resource_deps = ["eth-devnet", "eth-devnet2", "solana-devnet", "guardian", "relayer-engine", "wormchain"],
79+
resource_deps = ["eth-devnet", "eth-devnet2", "solana-devnet", "guardian", "relayer-engine", "wormchain", "executor"],
5180
)

evm/src/NttManager/NttManager.sol

+10-10
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
4242
using TrimmedAmountLib for uint256;
4343
using TrimmedAmountLib for TrimmedAmount;
4444

45-
string public constant NTT_MANAGER_VERSION = "1.1.0";
45+
string public constant NTT_MANAGER_VERSION = "2.0.0";
4646

4747
// =============== Setup =================================================================
4848

@@ -597,7 +597,8 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
597597
checkFork(evmChainId);
598598

599599
// Compute the quote price and refund user excess value from msg.value
600-
uint256 epTotalPriceQuote = quoteAndRefund(recipientChain, transceiverInstructions);
600+
(uint256 epTotalPriceQuote, uint256 excessValue) =
601+
quoteEndpoint(recipientChain, transceiverInstructions);
601602

602603
return _transfer(
603604
_TransferArgs({
@@ -610,7 +611,8 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
610611
executorQuote: executorQuote,
611612
relayInstructions: relayInstructions,
612613
transceiverInstructions: transceiverInstructions,
613-
epTotalPriceQuote: epTotalPriceQuote
614+
epTotalPriceQuote: epTotalPriceQuote,
615+
excessValue: excessValue
614616
})
615617
);
616618
}
@@ -627,6 +629,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
627629
bytes relayInstructions;
628630
bytes transceiverInstructions;
629631
uint256 epTotalPriceQuote;
632+
uint256 excessValue;
630633
}
631634

632635
function _transfer(
@@ -667,7 +670,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
667670
relayInstructions = abi.encodePacked(relayInstructions, args.relayInstructions);
668671
}
669672

670-
executor.requestExecution(
673+
executor.requestExecution{value: args.excessValue}(
671674
args.recipientChain,
672675
peerData.peerAddress,
673676
UniversalAddressLibrary.fromBytes32(args.refundAddress).toAddress(),
@@ -682,15 +685,12 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
682685
return args.sequence;
683686
}
684687

685-
function quoteAndRefund(
688+
function quoteEndpoint(
686689
uint16 recipientChain,
687690
bytes memory transceiverInstructions
688-
) internal returns (uint256 epTotalPriceQuote) {
691+
) internal returns (uint256 epTotalPriceQuote, uint256 excessValue) {
689692
epTotalPriceQuote = quoteDeliveryPrice(recipientChain, transceiverInstructions);
690-
uint256 excessValue = msg.value - epTotalPriceQuote;
691-
if (excessValue > 0) {
692-
_refundToSender(excessValue);
693-
}
693+
excessValue = msg.value - epTotalPriceQuote;
694694
}
695695

696696
function buildEncodedPayload(

evm/ts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"build": "npm run build:esm && npm run build:cjs",
3838
"rebuild": "npm run clean && npm run build",
3939
"clean": "rm -rf ./dist",
40-
"generate:test": "typechain --node16-modules --target ethers-v6 --out-dir ethers-ci-contracts '../out/**/*.json'",
40+
"generate:test": "typechain --node16-modules --target ethers-v6 --out-dir ethers-ci-contracts '../out/?(WormholeTransceiver.sol|NttManager.sol)/*.json'",
4141
"generate:slim": "ABI_VERSION=`tsx scripts/readVersion.ts` && typechain --node16-modules --target ethers-v6 --out-dir src/ethers-contracts/$ABI_VERSION '../out/?(WormholeTransceiver.sol|NttManager.sol)/*.json'",
4242
"generate": "npm run generate:slim",
4343
"build:contracts": "cd ../.. && make build-evm-prod",

evm/ts/src/bindings.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import { Provider } from "ethers";
22

3-
import { _0_1_0, _1_0_0, _1_1_0 } from "./ethers-contracts/index.js";
3+
import { _0_1_0, _1_0_0, _1_1_0, _2_0_0 } from "./ethers-contracts/index.js";
44
import { Ntt } from "@wormhole-foundation/sdk-definitions-ntt";
55

66
// This is a descending list of all ABI versions the SDK is aware of.
77
// We check for the first match in descending order, allowing for higher minor and patch versions
88
// being used by the live contract (these are supposed to still be compatible with older ABIs).
9-
export const abiVersions = [
10-
["1.1.0", _1_1_0],
11-
["1.0.0", _1_0_0],
12-
["0.1.0", _0_1_0],
13-
] as const;
9+
export const abiVersions = [["2.0.0", _2_0_0]] as const;
1410
export type AbiVersion = (typeof abiVersions)[number][0];
1511

1612
export interface NttBindings {
@@ -32,7 +28,7 @@ export interface NttTransceiverBindings {
3228
}
3329

3430
export namespace NttManagerBindings {
35-
export type NttManager = ReturnType<typeof _0_1_0.NttManager.connect>;
31+
export type NttManager = ReturnType<typeof _2_0_0.NttManager.connect>;
3632
}
3733

3834
export interface NttManagerBindings {

0 commit comments

Comments
 (0)