Skip to content

Commit b48a92b

Browse files
authored
Merge pull request #57 from tangle-network/donovan/pricing
feat: rpc address update event
2 parents 10432a1 + cd95eb0 commit b48a92b

13 files changed

+88
-330
lines changed

bytecode/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bytecode/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tnt-core-bytecode"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
edition = "2021"
55
description = "Bytecode exports for TNT Core Solidity contracts"
66
license = "MIT"

bytecode/src/lib.rs

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

foundry.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ optimizer_runs = 200
1010
fs_permissions = [{ access = "read-write", path = "./" }]
1111
solc = "0.8.20"
1212
evm_version = "shanghai"
13+
allow_internal_expect_revert = true
1314

1415
[profile.ci]
1516
verbosity = 4

src/BlueprintServiceManagerBase.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ contract BlueprintServiceManagerBase is IBlueprintServiceManager, RootChainEnabl
5353
function onUnregister(ServiceOperators.OperatorPreferences calldata operator) external virtual onlyFromMaster { }
5454

5555
/// @inheritdoc IBlueprintServiceManager
56-
function onUpdatePriceTargets(ServiceOperators.OperatorPreferences calldata operator)
56+
function onUpdateRpcAddress(ServiceOperators.OperatorPreferences calldata operator)
5757
external
5858
payable
5959
virtual

src/IBlueprintServiceManager.sol

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ interface IBlueprintServiceManager {
3232
/// @param operator The operator's details.
3333
function onUnregister(ServiceOperators.OperatorPreferences calldata operator) external;
3434

35-
/// @dev Hook for updating operator's Price Targets. Called when an operator updates
36-
/// their price targets.
37-
/// @param operator The operator's details with the to be updated price targets.
38-
function onUpdatePriceTargets(ServiceOperators.OperatorPreferences calldata operator) external payable;
35+
/// @dev Hook for updating RPC address. Called when an operator updates their RPC address.
36+
/// @param operator The operator's details with the updated RPC address.
37+
function onUpdateRpcAddress(ServiceOperators.OperatorPreferences calldata operator) external payable;
3938

4039
/// @dev Hook for service instance requests. Called when a user requests a service
4140
/// instance from the blueprint but this does not mean the service is initiated yet.

src/MasterBlueprintServiceManager.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ contract MasterBlueprintServiceManager is RootChainEnabled, AccessControl, Pausa
102102
/// @param operator The operator's preferences.
103103
event OperatorUnregistered(uint64 indexed blueprintId, ServiceOperators.OperatorPreferences operator);
104104

105-
/// @dev Emitted when an operator updates their price targets.
105+
/// @dev Emitted when an operator updates their RPC address.
106106
/// @param blueprintId The unique identifier of the blueprint.
107107
/// @param operator The operator's updated preferences.
108-
event PriceTargetsUpdated(uint64 indexed blueprintId, ServiceOperators.OperatorPreferences operator);
108+
event RpcAddressUpdated(uint64 indexed blueprintId, ServiceOperators.OperatorPreferences operator);
109109

110110
/// @dev Emitted when a service instance is requested from a blueprint.
111111
/// @param blueprintId The unique identifier of the blueprint.
@@ -301,10 +301,10 @@ contract MasterBlueprintServiceManager is RootChainEnabled, AccessControl, Pausa
301301
emit OperatorUnregistered(blueprintId, operator);
302302
}
303303

304-
/// @dev Called when an operator updates their price targets.
305-
/// @param blueprintId The blueprint unique identifier.
306-
/// @param operator The operator's details with the updated price targets.
307-
function onUpdatePriceTargets(
304+
/// @dev Hook to be called upon a new RPC address update on a blueprint.
305+
/// @param blueprintId The unique identifier of the blueprint.
306+
/// @param operator The operator's preferences.
307+
function onUpdateRpcAddress(
308308
uint64 blueprintId,
309309
ServiceOperators.OperatorPreferences calldata operator
310310
)
@@ -314,8 +314,8 @@ contract MasterBlueprintServiceManager is RootChainEnabled, AccessControl, Pausa
314314
whenNotPaused
315315
{
316316
address manager = blueprints.get(blueprintId);
317-
IBlueprintServiceManager(manager).onUpdatePriceTargets(operator);
318-
emit PriceTargetsUpdated(blueprintId, operator);
317+
IBlueprintServiceManager(manager).onUpdateRpcAddress(operator);
318+
emit RpcAddressUpdated(blueprintId, operator);
319319
}
320320

321321
/// @dev Called when a user requests a service instance from the blueprint.

src/ServiceOperatorsLib.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import { Assets } from "./AssetsLib.sol";
88
/// @dev Contains structs and enums related to service operators.
99
/// @notice Holds different structs and enums related to service operators.
1010
library ServiceOperators {
11-
/// @dev Represents the preferences of an operator, including their ECDSA public key and price targets.
11+
/// @dev Represents the preferences of an operator, including their ECDSA public key and RPC address.
1212
struct OperatorPreferences {
1313
/// @notice The ECDSA public key of the operator.
1414
bytes ecdsaPublicKey;
15-
/// @notice The price targets associated with the operator.
16-
PriceTargets priceTargets;
15+
/// @notice The address of the RPC server the operator is running.
16+
string rpcAddress;
1717
}
1818

1919
/// @dev Defines the pricing targets for various resources such as CPU, memory, and different types of storage.
@@ -36,7 +36,7 @@ library ServiceOperators {
3636
uint64 requestId;
3737
/// @notice Address of the requester
3838
address requester;
39-
/// @notice Array of operator preferences containing public keys and price targets
39+
/// @notice Array of operator preferences containing ECDSA public keys and RPC addresses
4040
OperatorPreferences[] operators;
4141
/// @notice Input parameters for the request encoded as bytes
4242
bytes requestInputs;

test/AssetsLib.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ contract AssetsLibTest is Test {
88
// Test constants
99
address constant TEST_ERC20_ADDRESS = address(0x1234567890123456789012345678901234567890);
1010
bytes32 constant TEST_ASSET_ID = bytes32(uint256(123));
11-
11+
1212
function setUp() public {
1313
// No setup required as we're testing a library
1414
}

0 commit comments

Comments
 (0)