Skip to content

Commit

Permalink
Upgrade Coordinator: changed ABI of rituals
Browse files Browse the repository at this point in the history
  • Loading branch information
vzotova committed Aug 23, 2024
1 parent 2593c52 commit b785a75
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 108 deletions.
4 changes: 2 additions & 2 deletions contracts/contracts/coordination/Coordinator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ contract Coordinator is Initializable, AccessControlDefaultAdminRulesUpgradeable
}

function rituals(
uint32 ritualId
uint256 ritualId // uint256 for backward compatibility
)
external
view
Expand All @@ -161,7 +161,7 @@ contract Coordinator is Initializable, AccessControlDefaultAdminRulesUpgradeable
IFeeModel feeModel
)
{
Ritual storage ritual = storageRitual(ritualId);
Ritual storage ritual = storageRitual(uint32(ritualId));
initiator = ritual.initiator;
initTimestamp = ritual.initTimestamp;
endTimestamp = ritual.endTimestamp;
Expand Down
174 changes: 70 additions & 104 deletions deployment/artifacts/lynx.json
Original file line number Diff line number Diff line change
Expand Up @@ -4852,121 +4852,87 @@
"inputs": [
{
"name": "ritualId",
"type": "uint32",
"internalType": "uint32"
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"name": "initiator",
"type": "address",
"internalType": "address"
},
{
"name": "initTimestamp",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "endTimestamp",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "totalTranscripts",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "totalAggregations",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "authority",
"type": "address",
"internalType": "address"
},
{
"name": "dkgSize",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "threshold",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "aggregationMismatch",
"type": "bool",
"internalType": "bool"
},
{
"name": "accessController",
"type": "address",
"internalType": "contract IEncryptionAuthorizer"
},
{
"name": "publicKey",
"type": "tuple",
"components": [
{
"name": "initiator",
"type": "address",
"internalType": "address"
},
{
"name": "initTimestamp",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "endTimestamp",
"type": "uint32",
"internalType": "uint32"
},
{
"name": "totalTranscripts",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "totalAggregations",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "authority",
"type": "address",
"internalType": "address"
},
{
"name": "dkgSize",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "threshold",
"type": "uint16",
"internalType": "uint16"
},
{
"name": "aggregationMismatch",
"type": "bool",
"internalType": "bool"
},
{
"name": "accessController",
"type": "address",
"internalType": "contract IEncryptionAuthorizer"
},
{
"name": "publicKey",
"type": "tuple",
"components": [
{
"name": "word0",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "word1",
"type": "bytes16",
"internalType": "bytes16"
}
],
"internalType": "struct BLS12381.G1Point"
},
{
"name": "aggregatedTranscript",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "participant",
"type": "tuple[]",
"components": [
{
"name": "provider",
"type": "address",
"internalType": "address"
},
{
"name": "aggregated",
"type": "bool",
"internalType": "bool"
},
{
"name": "transcript",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "decryptionRequestStaticKey",
"type": "bytes",
"internalType": "bytes"
}
],
"internalType": "struct Coordinator.Participant[]"
"name": "word0",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "feeModel",
"type": "address",
"internalType": "contract IFeeModel"
"name": "word1",
"type": "bytes16",
"internalType": "bytes16"
}
],
"internalType": "struct Coordinator.Ritual"
"internalType": "struct BLS12381.G1Point"
},
{
"name": "aggregatedTranscript",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "feeModel",
"type": "address",
"internalType": "contract IFeeModel"
}
]
},
Expand Down
11 changes: 9 additions & 2 deletions scripts/lynx/upgrade_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

from deployment.constants import ARTIFACTS_DIR, CONSTRUCTOR_PARAMS_DIR
from deployment.params import Deployer
from deployment.registry import contracts_from_registry
from deployment.registry import contracts_from_registry, merge_registries

VERIFY = False
CONSTRUCTOR_PARAMS_FILEPATH = CONSTRUCTOR_PARAMS_DIR / "lynx" / "upgrade-coordinator.yml"
LYNX_REGISTRY = ARTIFACTS_DIR / "lynx.json"


def main():
Expand All @@ -19,7 +20,8 @@ def main():
instances = contracts_from_registry(filepath=ARTIFACTS_DIR / "lynx.json", chain_id=80002)

implementation = deployer.deploy(project.Coordinator)
encoded_initializer_function = implementation.initializeNumberOfRituals.encode_input()
# encoded_initializer_function = implementation.initializeNumberOfRituals.encode_input()
encoded_initializer_function = b""
coordinator = deployer.upgradeTo(
implementation,
instances[project.Coordinator.contract_type.name].address,
Expand All @@ -31,3 +33,8 @@ def main():
]

deployer.finalize(deployments=deployments)
merge_registries(
registry_1_filepath=LYNX_REGISTRY,
registry_2_filepath=deployer.registry_filepath,
output_filepath=LYNX_REGISTRY,
)

0 comments on commit b785a75

Please sign in to comment.