Skip to content

Commit cf9adc4

Browse files
Merge pull request #2913 from rainlanguage/fix-2911-deploy-suite-deps
Deploy suites declare exactly the deployments their code calls
2 parents e3ed129 + 86dc874 commit cf9adc4

7 files changed

Lines changed: 174 additions & 20 deletions

‎src/abstract/RaindexDeploySuites.sol‎

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import {
1515
DEPLOYED_ADDRESS as TOFU_DECIMALS_ADDRESS,
1616
RUNTIME_CODE as TOFU_DECIMALS_RUNTIME_CODE
1717
} from "rain-tofu-erc20-decimals-deploy-0.1.3/src/generated/0_1_0/TOFUTokenDecimals.sol";
18-
import {
19-
DEPLOYED_ADDRESS as META_BOARD_ADDRESS,
20-
RUNTIME_CODE as META_BOARD_RUNTIME_CODE
21-
} from "rain-metadata-deploy-0.1.3/src/generated/0_1_1/MetaBoard.sol";
2218
import {
2319
CREATION_CODE as RAINDEX_CREATION_CODE_CANDIDATE,
2420
RUNTIME_CODE as RAINDEX_RUNTIME_CODE_CANDIDATE
@@ -73,14 +69,52 @@ abstract contract RaindexDeploySuites is RainDeploySuitesBase {
7369
return candidates;
7470
}
7571

76-
/// The code that must already be on a network before `RaindexV6` or
77-
/// `RaindexV6SubParser` can be broadcast there: the TOFU decimals reader
78-
/// and the metaboard.
72+
/// The TOFU decimals reader, which `RaindexV6` and every arb read token
73+
/// decimals through.
74+
/// @return The dependency.
75+
function tofuDecimalsDependency() internal pure returns (DeployDependency memory) {
76+
return DeployDependency({deployedAddress: TOFU_DECIMALS_ADDRESS, runtimeCode: TOFU_DECIMALS_RUNTIME_CODE});
77+
}
78+
79+
/// The candidate `RaindexV6`, the only raindex every arb accepts.
80+
/// @return The dependency.
81+
function raindexDependency() internal pure returns (DeployDependency memory) {
82+
return DeployDependency({
83+
deployedAddress: LibRaindexDeploy.RAINDEX_DEPLOYED_ADDRESS, runtimeCode: RAINDEX_RUNTIME_CODE_CANDIDATE
84+
});
85+
}
86+
87+
/// The code that must already be on a network before an arb can be
88+
/// broadcast there: the raindex it takes orders from and the TOFU
89+
/// decimals reader.
7990
/// @return The dependencies.
80-
function raindexDependencies() internal pure returns (DeployDependency[] memory) {
91+
function arbDependencies() internal pure returns (DeployDependency[] memory) {
8192
DeployDependency[] memory deps = new DeployDependency[](2);
82-
deps[0] = DeployDependency({deployedAddress: TOFU_DECIMALS_ADDRESS, runtimeCode: TOFU_DECIMALS_RUNTIME_CODE});
83-
deps[1] = DeployDependency({deployedAddress: META_BOARD_ADDRESS, runtimeCode: META_BOARD_RUNTIME_CODE});
93+
deps[0] = raindexDependency();
94+
deps[1] = tofuDecimalsDependency();
95+
return deps;
96+
}
97+
98+
/// `arbDependencies` plus the `RouteProcessor4` candidate the arb swaps
99+
/// through.
100+
/// @return The dependencies.
101+
function routeProcessorArbDependencies() internal pure returns (DeployDependency[] memory) {
102+
DeployDependency[] memory deps = new DeployDependency[](3);
103+
deps[0] = raindexDependency();
104+
deps[1] = tofuDecimalsDependency();
105+
deps[2] = DeployDependency({
106+
deployedAddress: LibRaindexDeploy.ROUTE_PROCESSOR_DEPLOYED_ADDRESS,
107+
runtimeCode: ROUTE_PROCESSOR_RUNTIME_CODE_CANDIDATE
108+
});
109+
return deps;
110+
}
111+
112+
/// The code that must already be on a network before `RaindexV6` can be
113+
/// broadcast there: the TOFU decimals reader.
114+
/// @return The dependencies.
115+
function raindexDependencies() internal pure returns (DeployDependency[] memory) {
116+
DeployDependency[] memory deps = new DeployDependency[](1);
117+
deps[0] = tofuDecimalsDependency();
84118
return deps;
85119
}
86120

@@ -118,7 +152,7 @@ abstract contract RaindexDeploySuites is RainDeploySuitesBase {
118152
storedBytecodeHash: LibRaindexDeploy.SUB_PARSER_DEPLOYED_CODEHASH,
119153
storedRuntimeCode: SUB_PARSER_RUNTIME_CODE_CANDIDATE,
120154
artifactPath: "src/concrete/parser/RaindexV6SubParser.sol:RaindexV6SubParser",
121-
dependencies: raindexDependencies(),
155+
dependencies: new DeployDependency[](0),
122156
mechanism: DeployMechanism.Zoltu,
123157
mechanismData: ""
124158
}),
@@ -159,7 +193,7 @@ abstract contract RaindexDeploySuites is RainDeploySuitesBase {
159193
storedBytecodeHash: LibRaindexDeploy.GENERIC_POOL_ARB_ORDER_TAKER_DEPLOYED_CODEHASH,
160194
storedRuntimeCode: GENERIC_POOL_ARB_OT_RUNTIME_CODE_CANDIDATE,
161195
artifactPath: "src/concrete/arb/GenericPoolRaindexV6ArbOrderTaker.sol:GenericPoolRaindexV6ArbOrderTaker",
162-
dependencies: new DeployDependency[](0),
196+
dependencies: arbDependencies(),
163197
mechanism: DeployMechanism.Zoltu,
164198
mechanismData: ""
165199
}),
@@ -178,7 +212,7 @@ abstract contract RaindexDeploySuites is RainDeploySuitesBase {
178212
storedBytecodeHash: LibRaindexDeploy.ROUTE_PROCESSOR_ARB_ORDER_TAKER_DEPLOYED_CODEHASH,
179213
storedRuntimeCode: RP_ARB_OT_RUNTIME_CODE_CANDIDATE,
180214
artifactPath: "src/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.sol:RouteProcessorRaindexV6ArbOrderTaker",
181-
dependencies: new DeployDependency[](0),
215+
dependencies: routeProcessorArbDependencies(),
182216
mechanism: DeployMechanism.Zoltu,
183217
mechanismData: ""
184218
}),
@@ -197,7 +231,7 @@ abstract contract RaindexDeploySuites is RainDeploySuitesBase {
197231
storedBytecodeHash: LibRaindexDeploy.GENERIC_POOL_FLASH_BORROWER_DEPLOYED_CODEHASH,
198232
storedRuntimeCode: GENERIC_POOL_FB_RUNTIME_CODE_CANDIDATE,
199233
artifactPath: "src/concrete/arb/GenericPoolRaindexV6FlashBorrower.sol:GenericPoolRaindexV6FlashBorrower",
200-
dependencies: new DeployDependency[](0),
234+
dependencies: arbDependencies(),
201235
mechanism: DeployMechanism.Zoltu,
202236
mechanismData: ""
203237
}),

‎src/generated/candidate/GenericPoolRaindexV6ArbOrderTaker.sol‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎src/generated/candidate/GenericPoolRaindexV6FlashBorrower.sol‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎src/generated/candidate/RaindexV6.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ bytes constant RUNTIME_CODE =
2424
/// `abi.encode`d as a `DeployDependency[]` because Solidity has no
2525
/// file-scope constant of dynamic array type.
2626
bytes constant DEPENDENCIES =
27-
hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000500000000000000000000000000200e12d10bb0c5e4a17e7018f0f1161919bb93890000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000044b608060405234801561000f575f80fd5b506004361061004a575f3560e01c80630782d7e11461004e57806354636d2b14610078578063b7bad1b11461009d578063f5c36eaf146100b0575b5f80fd5b61006161005c366004610363565b6100c3565b60405161006f929190610403565b60405180910390f35b61008b610086366004610363565b6100d8565b60405160ff909116815260200161006f565b6100616100ab366004610363565b6100e9565b61008b6100be366004610363565b6100f5565b5f806100cf5f84610100565b91509150915091565b5f6100e35f836101f0565b92915050565b5f806100cf5f84610281565b5f6100e35f83610356565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526020838152604080832081518083019092525460ff8082161515835261010090910416818301527f313ce56700000000000000000000000000000000000000000000000000000000808452839283908190816004818a5afa915060203d1015610182575f91505b811561019857505f5160ff811115610198575f91505b816101af57505050602001516003925090506101e9565b83516101c3575f955093506101e992505050565b836020015160ff1681146101d85760026101db565b60015b846020015195509550505050505b9250929050565b5f805f6101fd8585610281565b909250905060018260038111156102165761021661039d565b1415801561023557505f8260038111156102325761023261039d565b14155b156102795783826040517fee07877f000000000000000000000000000000000000000000000000000000008152600401610270929190610421565b60405180910390fd5b949350505050565b5f805f8061028f8686610100565b90925090505f8260038111156102a7576102a761039d565b0361034b576040805180820182526001815260ff838116602080840191825273ffffffffffffffffffffffffffffffffffffffff8a165f908152908b9052939093209151825493517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009094169015157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff161761010093909116929092029190911790555b909590945092505050565b5f805f6101fd8585610100565b5f60208284031215610373575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610396575f80fd5b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b600481106103ff577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b9052565b6040810161041182856103ca565b60ff831660208301529392505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040810161039660208301846103ca560000000000000000000000000000000000000000000000000000000000000000008fd50ff9db9835ba1b61394752a26f53d721d2a100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260608060405234801561000f575f80fd5b5060043610610029575f3560e01c806337480e2a1461002d575b5f80fd5b61004061003b366004610149565b610042565b005b6100818383838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061008692505050565b505050565b61008f816100ce565b7fd46c2c56b35c8210e9e712ec3f02242d5fc90187c0ac8ed80cc33626846ec3693383836040516100c29392919061020a565b60405180910390a15050565b6100d78161011b565b61011857806040517f644cc25800000000000000000000000000000000000000000000000000000000815260040161010f9190610247565b60405180910390fd5b50565b5f60088251101561012d57505f919050565b506008015167ffffffffffffffff1667ff0a89c674ee78741490565b5f805f6040848603121561015b575f80fd5b83359250602084013567ffffffffffffffff80821115610179575f80fd5b818601915086601f83011261018c575f80fd5b81358181111561019a575f80fd5b8760208285010111156101ab575f80fd5b6020830194508093505050509250925092565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b73ffffffffffffffffffffffffffffffffffffffff84168152826020820152606060408201525f61023e60608301846101be565b95945050505050565b602081525f61025960208301846101be565b939250505056";
27+
hex"000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000200e12d10bb0c5e4a17e7018f0f1161919bb93890000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000044b608060405234801561000f575f80fd5b506004361061004a575f3560e01c80630782d7e11461004e57806354636d2b14610078578063b7bad1b11461009d578063f5c36eaf146100b0575b5f80fd5b61006161005c366004610363565b6100c3565b60405161006f929190610403565b60405180910390f35b61008b610086366004610363565b6100d8565b60405160ff909116815260200161006f565b6100616100ab366004610363565b6100e9565b61008b6100be366004610363565b6100f5565b5f806100cf5f84610100565b91509150915091565b5f6100e35f836101f0565b92915050565b5f806100cf5f84610281565b5f6100e35f83610356565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526020838152604080832081518083019092525460ff8082161515835261010090910416818301527f313ce56700000000000000000000000000000000000000000000000000000000808452839283908190816004818a5afa915060203d1015610182575f91505b811561019857505f5160ff811115610198575f91505b816101af57505050602001516003925090506101e9565b83516101c3575f955093506101e992505050565b836020015160ff1681146101d85760026101db565b60015b846020015195509550505050505b9250929050565b5f805f6101fd8585610281565b909250905060018260038111156102165761021661039d565b1415801561023557505f8260038111156102325761023261039d565b14155b156102795783826040517fee07877f000000000000000000000000000000000000000000000000000000008152600401610270929190610421565b60405180910390fd5b949350505050565b5f805f8061028f8686610100565b90925090505f8260038111156102a7576102a761039d565b0361034b576040805180820182526001815260ff838116602080840191825273ffffffffffffffffffffffffffffffffffffffff8a165f908152908b9052939093209151825493517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009094169015157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff161761010093909116929092029190911790555b909590945092505050565b5f805f6101fd8585610100565b5f60208284031215610373575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610396575f80fd5b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b600481106103ff577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b9052565b6040810161041182856103ca565b60ff831660208301529392505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040810161039660208301846103ca56000000000000000000000000000000000000000000";

‎src/generated/candidate/RaindexV6SubParser.sol‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ bytes constant RUNTIME_CODE =
2424
/// `abi.encode`d as a `DeployDependency[]` because Solidity has no
2525
/// file-scope constant of dynamic array type.
2626
bytes constant DEPENDENCIES =
27-
hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000500000000000000000000000000200e12d10bb0c5e4a17e7018f0f1161919bb93890000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000044b608060405234801561000f575f80fd5b506004361061004a575f3560e01c80630782d7e11461004e57806354636d2b14610078578063b7bad1b11461009d578063f5c36eaf146100b0575b5f80fd5b61006161005c366004610363565b6100c3565b60405161006f929190610403565b60405180910390f35b61008b610086366004610363565b6100d8565b60405160ff909116815260200161006f565b6100616100ab366004610363565b6100e9565b61008b6100be366004610363565b6100f5565b5f806100cf5f84610100565b91509150915091565b5f6100e35f836101f0565b92915050565b5f806100cf5f84610281565b5f6100e35f83610356565b73ffffffffffffffffffffffffffffffffffffffff81165f9081526020838152604080832081518083019092525460ff8082161515835261010090910416818301527f313ce56700000000000000000000000000000000000000000000000000000000808452839283908190816004818a5afa915060203d1015610182575f91505b811561019857505f5160ff811115610198575f91505b816101af57505050602001516003925090506101e9565b83516101c3575f955093506101e992505050565b836020015160ff1681146101d85760026101db565b60015b846020015195509550505050505b9250929050565b5f805f6101fd8585610281565b909250905060018260038111156102165761021661039d565b1415801561023557505f8260038111156102325761023261039d565b14155b156102795783826040517fee07877f000000000000000000000000000000000000000000000000000000008152600401610270929190610421565b60405180910390fd5b949350505050565b5f805f8061028f8686610100565b90925090505f8260038111156102a7576102a761039d565b0361034b576040805180820182526001815260ff838116602080840191825273ffffffffffffffffffffffffffffffffffffffff8a165f908152908b9052939093209151825493517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00009094169015157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff161761010093909116929092029190911790555b909590945092505050565b5f805f6101fd8585610100565b5f60208284031215610373575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff81168114610396575f80fd5b9392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b600481106103ff577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b9052565b6040810161041182856103ca565b60ff831660208301529392505050565b73ffffffffffffffffffffffffffffffffffffffff831681526040810161039660208301846103ca560000000000000000000000000000000000000000000000000000000000000000008fd50ff9db9835ba1b61394752a26f53d721d2a100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260608060405234801561000f575f80fd5b5060043610610029575f3560e01c806337480e2a1461002d575b5f80fd5b61004061003b366004610149565b610042565b005b6100818383838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061008692505050565b505050565b61008f816100ce565b7fd46c2c56b35c8210e9e712ec3f02242d5fc90187c0ac8ed80cc33626846ec3693383836040516100c29392919061020a565b60405180910390a15050565b6100d78161011b565b61011857806040517f644cc25800000000000000000000000000000000000000000000000000000000815260040161010f9190610247565b60405180910390fd5b50565b5f60088251101561012d57505f919050565b506008015167ffffffffffffffff1667ff0a89c674ee78741490565b5f805f6040848603121561015b575f80fd5b83359250602084013567ffffffffffffffff80821115610179575f80fd5b818601915086601f83011261018c575f80fd5b81358181111561019a575f80fd5b8760208285010111156101ab575f80fd5b6020830194508093505050509250925092565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b73ffffffffffffffffffffffffffffffffffffffff84168152826020820152606060408201525f61023e60608301846101be565b95945050505050565b602081525f61025960208301846101be565b939250505056";
27+
hex"00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000";

‎src/generated/candidate/RouteProcessorRaindexV6ArbOrderTaker.sol‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)