diff --git a/contracts/README.md b/contracts/README.md index 9a737048..0d4042d2 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -1,6 +1,6 @@ # DataHaven AVS Smart Contracts -Implements the Actively Validated Service (AVS) logic for DataHaven, secured by EigenLayer. These contracts manage operator registration, handle cross-chain rewards via Snowbridge, and enforce slashing with a veto period. +Implements the Actively Validated Service (AVS) logic for DataHaven, secured by EigenLayer. These contracts manage operator registration, handle cross-chain rewards via Snowbridge, and enforce slashing. ## Project Structure @@ -65,6 +65,6 @@ Supported networks: `hoodi` (no mainnet config yet). Artifacts → `contracts/de 1. **Registration**: Validators register with EigenLayer via `DataHavenServiceManager`. 2. **Performance Tracking**: DataHaven computes reward points and sends a Merkle root to `RewardsRegistry` on Ethereum via Snowbridge. 3. **Rewards Claims**: Validators claim rewards on Ethereum from `RewardsRegistry` using Merkle proofs. -4. **Slashing**: Misbehavior triggers slashing (subject to veto period). +4. **Slashing**: Misbehavior triggers slashing. See `test/README.md` for full network integration tests. diff --git a/contracts/config/anvil.json b/contracts/config/anvil.json index ca1afec2..5b8cce9b 100644 --- a/contracts/config/anvil.json +++ b/contracts/config/anvil.json @@ -27,8 +27,6 @@ "avs": { "avsOwner": "0x976EA74026E726554dB657fA54763abd0C3a0aa9", "rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955", - "vetoCommitteeMember": "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f", - "vetoWindowBlocks": 100, "validatorsStrategies": [ "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0" ] diff --git a/contracts/config/example.jsonc b/contracts/config/example.jsonc index 2550cb11..e57c1ec7 100644 --- a/contracts/config/example.jsonc +++ b/contracts/config/example.jsonc @@ -69,10 +69,6 @@ /// This is for the EigenLayer rewards distribution way, using the RewardsCoordinator. /// But for now, we're not using it, and instead sending the rewards directly. "rewardsInitiator": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955", - /// The address of the account that is a member of the Veto Committee for vetoing slashing. - "vetoCommitteeMember": "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f", - /// The number of blocks that the Veto Committee will have to submit a veto. - "vetoWindowBlocks": 100, /// The EigenLayer strategy addresses for the Validators to stake into. /// The beaconChainETHStrategy is a virtual address representing native beacon chain ETH. /// All networks: diff --git a/contracts/config/mainnet-ethereum.json b/contracts/config/mainnet-ethereum.json index 6481710d..5a0e13fb 100644 --- a/contracts/config/mainnet-ethereum.json +++ b/contracts/config/mainnet-ethereum.json @@ -31,8 +31,6 @@ "avs": { "avsOwner": "0x0000000000000000000000000000000000000000", "rewardsInitiator": "0x0000000000000000000000000000000000000000", - "vetoCommitteeMember": "0x0000000000000000000000000000000000000000", - "vetoWindowBlocks": 7200, "validatorsStrategies": [ "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", "0x93c4b944D05dfe6df7645A86cd2206016c51564D", diff --git a/contracts/config/stagenet-hoodi.json b/contracts/config/stagenet-hoodi.json index 0f8ed550..0dbd84c1 100644 --- a/contracts/config/stagenet-hoodi.json +++ b/contracts/config/stagenet-hoodi.json @@ -33,8 +33,6 @@ "avs": { "avsOwner": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", "rewardsInitiator": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", - "vetoCommitteeMember": "0xe30a38ac89ffE5A86D5389Bfbf70C7EC766FbB6e", - "vetoWindowBlocks": 100, "validatorsStrategies": [ "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", "0xf8a1a66130d614c7360e868576d5e59203475fe0", diff --git a/contracts/config/testnet-hoodi.json b/contracts/config/testnet-hoodi.json index 784fba9d..1aa56fee 100644 --- a/contracts/config/testnet-hoodi.json +++ b/contracts/config/testnet-hoodi.json @@ -33,8 +33,6 @@ "avs": { "avsOwner": "0x0000000000000000000000000000000000000000", "rewardsInitiator": "0x0000000000000000000000000000000000000000", - "vetoCommitteeMember": "0x0000000000000000000000000000000000000000", - "vetoWindowBlocks": 100, "validatorsStrategies": [ "0xbeaC0eeEeeeeEEeEeEEEEeeEEeEeeeEeeEEBEaC0", "0xf8a1a66130d614c7360e868576d5e59203475fe0", diff --git a/contracts/script/deploy/Config.sol b/contracts/script/deploy/Config.sol index 5d731e95..ccb764b2 100644 --- a/contracts/script/deploy/Config.sol +++ b/contracts/script/deploy/Config.sol @@ -19,8 +19,6 @@ contract Config { struct AVSConfig { address avsOwner; address rewardsInitiator; - address vetoCommitteeMember; - uint32 vetoWindowBlocks; address[] validatorsStrategies; } diff --git a/contracts/script/deploy/DeployParams.s.sol b/contracts/script/deploy/DeployParams.s.sol index ca390006..1c21f32d 100644 --- a/contracts/script/deploy/DeployParams.s.sol +++ b/contracts/script/deploy/DeployParams.s.sol @@ -76,8 +76,6 @@ contract DeployParams is Script, Config { config.avsOwner = vm.parseJsonAddress(configJson, ".avs.avsOwner"); } config.rewardsInitiator = vm.parseJsonAddress(configJson, ".avs.rewardsInitiator"); - config.vetoCommitteeMember = vm.parseJsonAddress(configJson, ".avs.vetoCommitteeMember"); - config.vetoWindowBlocks = vm.parseJsonUint(configJson, ".avs.vetoWindowBlocks").toUint32(); config.validatorsStrategies = vm.parseJsonAddressArray(configJson, ".avs.validatorsStrategies"); diff --git a/contracts/test/utils/AVSDeployer.sol b/contracts/test/utils/AVSDeployer.sol index 13a4633d..a5fedb08 100644 --- a/contracts/test/utils/AVSDeployer.sol +++ b/contracts/test/utils/AVSDeployer.sol @@ -48,11 +48,6 @@ contract AVSDeployer is Test { DataHavenServiceManager public serviceManager; DataHavenServiceManager public serviceManagerImplementation; - // Truncation is intentional - deriving a deterministic mock address from hash - address public vetoCommitteeMember = - address(uint160(uint256(keccak256("vetoCommitteeMember")))); - uint32 public vetoWindowBlocks = 100; // 100 blocks veto window for tests - // EigenLayer contracts StrategyManager public strategyManager; StrategyManager public strategyManagerImplementation; diff --git a/operator/Cargo.lock b/operator/Cargo.lock index 3aa769c4..1f6d04ec 100644 --- a/operator/Cargo.lock +++ b/operator/Cargo.lock @@ -8639,8 +8639,8 @@ dependencies = [ [[package]] name = "pallet-bucket-nfts" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -8696,8 +8696,8 @@ dependencies = [ [[package]] name = "pallet-cr-randomness" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-support", "frame-system", @@ -8980,8 +8980,8 @@ dependencies = [ [[package]] name = "pallet-evm-precompile-file-system" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "fp-account", "fp-evm", @@ -9220,8 +9220,8 @@ dependencies = [ [[package]] name = "pallet-file-system" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9249,8 +9249,8 @@ dependencies = [ [[package]] name = "pallet-file-system-runtime-api" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "parity-scale-codec", "scale-info", @@ -9445,8 +9445,8 @@ dependencies = [ [[package]] name = "pallet-payment-streams" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9465,8 +9465,8 @@ dependencies = [ [[package]] name = "pallet-payment-streams-runtime-api" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "parity-scale-codec", "scale-info", @@ -9493,8 +9493,8 @@ dependencies = [ [[package]] name = "pallet-proofs-dealer" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9519,8 +9519,8 @@ dependencies = [ [[package]] name = "pallet-proofs-dealer-runtime-api" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "parity-scale-codec", "scale-info", @@ -9558,8 +9558,8 @@ dependencies = [ [[package]] name = "pallet-randomness" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9696,8 +9696,8 @@ dependencies = [ [[package]] name = "pallet-storage-providers" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-benchmarking", "frame-support", @@ -9718,8 +9718,8 @@ dependencies = [ [[package]] name = "pallet-storage-providers-runtime-api" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "parity-scale-codec", "scale-info", @@ -13881,8 +13881,8 @@ dependencies = [ [[package]] name = "shc-actors-derive" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "once_cell", "proc-macro2", @@ -13894,8 +13894,8 @@ dependencies = [ [[package]] name = "shc-actors-framework" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "bincode", @@ -13913,8 +13913,8 @@ dependencies = [ [[package]] name = "shc-blockchain-service" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "array-bytes", @@ -13969,8 +13969,8 @@ dependencies = [ [[package]] name = "shc-blockchain-service-db" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "chrono", "diesel", @@ -13993,8 +13993,8 @@ dependencies = [ [[package]] name = "shc-client" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "array-bytes", @@ -14067,8 +14067,8 @@ dependencies = [ [[package]] name = "shc-common" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "bigdecimal", @@ -14131,8 +14131,8 @@ dependencies = [ [[package]] name = "shc-file-manager" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "bincode", "hash-db", @@ -14155,8 +14155,8 @@ dependencies = [ [[package]] name = "shc-file-transfer-service" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "array-bytes", @@ -14184,8 +14184,8 @@ dependencies = [ [[package]] name = "shc-fisherman-service" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "async-trait", "diesel", @@ -14215,8 +14215,8 @@ dependencies = [ [[package]] name = "shc-forest-manager" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "async-trait", @@ -14241,8 +14241,8 @@ dependencies = [ [[package]] name = "shc-indexer-db" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "bigdecimal", "chrono", @@ -14269,8 +14269,8 @@ dependencies = [ [[package]] name = "shc-indexer-service" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "anyhow", "array-bytes", @@ -14320,8 +14320,8 @@ dependencies = [ [[package]] name = "shc-rpc" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "array-bytes", "async-trait", @@ -14366,8 +14366,8 @@ dependencies = [ [[package]] name = "shc-telemetry" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -14383,8 +14383,8 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "shp-constants" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "sp-core", "sp-runtime", @@ -14392,8 +14392,8 @@ dependencies = [ [[package]] name = "shp-data-price-updater" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-support", "parity-scale-codec", @@ -14407,8 +14407,8 @@ dependencies = [ [[package]] name = "shp-file-key-verifier" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-support", "parity-scale-codec", @@ -14425,8 +14425,8 @@ dependencies = [ [[package]] name = "shp-file-metadata" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "hex", "num-bigint", @@ -14441,8 +14441,8 @@ dependencies = [ [[package]] name = "shp-forest-verifier" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-support", "parity-scale-codec", @@ -14458,16 +14458,16 @@ dependencies = [ [[package]] name = "shp-opaque" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "sp-runtime", ] [[package]] name = "shp-session-keys" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "async-trait", "parity-scale-codec", @@ -14481,8 +14481,8 @@ dependencies = [ [[package]] name = "shp-traits" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "frame-support", "parity-scale-codec", @@ -14495,8 +14495,8 @@ dependencies = [ [[package]] name = "shp-treasury-funding" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "log", "shp-traits", @@ -14506,8 +14506,8 @@ dependencies = [ [[package]] name = "shp-tx-implicits-runtime-api" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "parity-scale-codec", "scale-info", @@ -14519,8 +14519,8 @@ dependencies = [ [[package]] name = "shp-types" -version = "0.3.5" -source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.3.5#e21f2316c07e9fc43fc67f20373e6c24a8f4d5ae" +version = "0.4.0" +source = "git+https://github.com/Moonsong-Labs/storage-hub.git?tag=v0.4.0#ea2611cb3b47e448fa2812082e130c697b66277a" dependencies = [ "sp-core", "sp-runtime", diff --git a/operator/Cargo.toml b/operator/Cargo.toml index 7ebe6851..ee2d6933 100644 --- a/operator/Cargo.toml +++ b/operator/Cargo.toml @@ -28,7 +28,6 @@ datahaven-stagenet-runtime = { path = "./runtime/stagenet", default-features = f datahaven-testnet-runtime = { path = "./runtime/testnet", default-features = false } dhp-bridge = { path = "./primitives/bridge", default-features = false } pallet-datahaven-native-transfer = { path = "./pallets/datahaven-native-transfer", default-features = false } -pallet-session-benchmarking = { path = "./pallets/session-benchmarking", default-features = false } pallet-evm-precompile-balances-erc20 = { path = "./precompiles/erc20-balances", default-features = false } pallet-evm-precompile-batch = { path = "./precompiles/batch", default-features = false } pallet-evm-precompile-call-permit = { path = "./precompiles/call-permit", default-features = false } @@ -45,6 +44,7 @@ pallet-external-validators = { path = "./pallets/external-validators", default-f pallet-external-validators-rewards = { path = "./pallets/external-validators-rewards", default-features = false } pallet-outbound-commitment-store = { path = "./pallets/outbound-commitment-store", default-features = false } pallet-proxy-genesis-companion = { path = "./pallets/proxy-genesis-companion", default-features = false } +pallet-session-benchmarking = { path = "./pallets/session-benchmarking", default-features = false } # Crates.io (wasm) alloy-core = { version = "0.8.15", default-features = false } @@ -272,42 +272,42 @@ fc-storage = { git = "https://github.com/polkadot-evm/frontier", branch = "stabl # StorageHub ## Runtime -pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } +pallet-bucket-nfts = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-cr-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-file-system-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-payment-streams = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-payment-streams-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-proofs-dealer = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-proofs-dealer-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-randomness = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-storage-providers = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +pallet-storage-providers-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-constants = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-data-price-updater = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-file-key-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-file-metadata = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-forest-verifier = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-traits = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-treasury-funding = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } ## Client -shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-tx-implicits-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } -shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } +shc-actors-derive = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-actors-framework = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-blockchain-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-client = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-common = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-file-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-file-transfer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-fisherman-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-forest-manager = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-indexer-db = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-indexer-service = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shc-rpc = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-opaque = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-tx-implicits-runtime-api = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } +shp-types = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } ## Precompiles -pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.3.5", default-features = false } +pallet-evm-precompile-file-system = { git = "https://github.com/Moonsong-Labs/storage-hub.git", tag = "v0.4.0", default-features = false } # Static linking diff --git a/operator/node/src/cli.rs b/operator/node/src/cli.rs index 1573aa77..51a881a4 100644 --- a/operator/node/src/cli.rs +++ b/operator/node/src/cli.rs @@ -741,9 +741,23 @@ pub struct FishermanConfigurations { pub fisherman_database_url: Option, /// Duration between batch deletion processing cycles (in seconds). - #[arg(long, default_value = "60", value_parser = clap::value_parser!(u64).range(1..))] + #[arg(long, default_value = "30", value_parser = clap::value_parser!(u64).range(1..))] pub fisherman_batch_interval_seconds: u64, + /// Cooldown between batch deletion attempts (in seconds). + /// + /// Set to `0` to disable cooldown. + #[arg(long, default_value = "1", value_parser = clap::value_parser!(u64).range(0..))] + pub fisherman_batch_cooldown_seconds: u64, + + /// Number of consecutive no-work batches required before switching to the slower idle polling interval. + /// + /// The minimum value is 2 because there are two kinds of work: User and Incomplete. + /// If we set the value to 1, a non-work batch in one kind of work will trigger the idle poll interval + /// on the other kind of work. + #[arg(long, default_value = "4", value_parser = clap::value_parser!(u8).range(1..))] + pub fisherman_consecutive_no_work_batches_threshold: u8, + /// Maximum number of files to process per batch deletion cycle. #[arg(long, default_value = "1000", value_parser = clap::value_parser!(u64).range(1..))] pub fisherman_batch_deletion_limit: u64, @@ -803,6 +817,9 @@ impl FishermanConfigurations { .expect("Fisherman database URL is required"), batch_interval_seconds: self.fisherman_batch_interval_seconds, batch_deletion_limit: self.fisherman_batch_deletion_limit, + batch_cooldown_seconds: self.fisherman_batch_cooldown_seconds, + consecutive_no_work_batches_threshold: self + .fisherman_consecutive_no_work_batches_threshold, maintenance_mode: false, // Skipping maintenance mode for now filtering, ordering, diff --git a/operator/node/src/rpc.rs b/operator/node/src/rpc.rs index 81d59467..25380cdb 100644 --- a/operator/node/src/rpc.rs +++ b/operator/node/src/rpc.rs @@ -24,10 +24,13 @@ use crate::consensus::BabeConsensusDataProvider; use crate::eth::DefaultEthConfig; use datahaven_runtime_common::{time::SLOT_DURATION, Block, BlockNumber, Hash}; -use fc_rpc::TxPool; use fc_rpc::{Eth, EthBlockDataCacheTask, EthFilter, Net, Web3}; +use fc_rpc::{EthPubSub, TxPool}; use fc_rpc_core::types::{FeeHistoryCache, FilterPool}; -use fc_rpc_core::{EthApiServer, EthFilterApiServer, NetApiServer, TxPoolApiServer, Web3ApiServer}; +use fc_rpc_core::{ + EthApiServer, EthFilterApiServer, EthPubSubApiServer, NetApiServer, TxPoolApiServer, + Web3ApiServer, +}; use fc_storage::StorageOverride; use fp_rpc::EthereumRuntimeRPCApi; use jsonrpsee::RpcModule; @@ -111,6 +114,12 @@ where /// Instantiate all full RPC extensions. pub fn create_full( deps: FullDeps, + subscription_task_executor: sc_rpc::SubscriptionTaskExecutor, + pubsub_notification_sinks: Arc< + fc_mapping_sync::EthereumBlockNotificationSinks< + fc_mapping_sync::EthereumBlockNotification, + >, + >, ) -> Result, Box> where P: TransactionPool + 'static, @@ -263,6 +272,17 @@ where )?; module.merge(Web3::new(Arc::clone(&client)).into_rpc())?; + module.merge( + EthPubSub::new( + pool, + Arc::clone(&client), + sync.clone(), + subscription_task_executor, + overrides, + pubsub_notification_sinks.clone(), + ) + .into_rpc(), + )?; if let Some(command_sink) = command_sink { module.merge( @@ -275,19 +295,5 @@ where let tx_pool = TxPool::new(client.clone(), graph.clone()); module.merge(tx_pool.into_rpc())?; - // module.merge(FrontierFinality::new(client.clone(), frontier_backend.clone()).into_rpc())?; - - // Extend this RPC with a custom API by using the following syntax. - // `YourRpcStruct` should have a reference to a client, which is needed - // to call into the runtime. - // `module.merge(YourRpcTrait::into_rpc(YourRpcStruct::new(ReferenceToClient, ...)))?;` - - // You probably want to enable the `rpc v2 chainSpec` API as well - // - // let chain_name = chain_spec.name().to_string(); - // let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed"); - // let properties = chain_spec.properties(); - // module.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; - Ok(module) } diff --git a/operator/node/src/service.rs b/operator/node/src/service.rs index 11c6a247..710d6e81 100644 --- a/operator/node/src/service.rs +++ b/operator/node/src/service.rs @@ -439,7 +439,7 @@ pub async fn new_full_impl< RuntimeApi, N: sc_network::NetworkBackend::Hash>, >( - config: Configuration, + mut config: Configuration, mut eth_config: EthConfiguration, role_options: Option, indexer_options: Option, @@ -673,7 +673,7 @@ where }, storage_override, sync: sync_service.clone(), - pubsub_notification_sinks, + pubsub_notification_sinks: pubsub_notification_sinks.clone(), }, ) .await; @@ -693,38 +693,52 @@ where let fee_history_limit = eth_config.fee_history_limit; let sync = sync_service.clone(); - Box::new(move |subscription_executor| { - let deps = crate::rpc::FullDeps { - client: client.clone(), - pool: pool.clone(), - graph: pool.pool().clone(), - beefy: BeefyDeps:: { - beefy_finality_proof_stream: beefy_rpc_links.from_voter_justif_stream.clone(), - beefy_best_block_stream: beefy_rpc_links.from_voter_best_beefy_stream.clone(), + Box::new( + move |subscription_executor: sc_rpc::SubscriptionTaskExecutor| { + let deps = crate::rpc::FullDeps { + client: client.clone(), + pool: pool.clone(), + graph: pool.pool().clone(), + beefy: BeefyDeps:: { + beefy_finality_proof_stream: beefy_rpc_links + .from_voter_justif_stream + .clone(), + beefy_best_block_stream: beefy_rpc_links + .from_voter_best_beefy_stream + .clone(), + subscription_executor: subscription_executor.clone(), + }, + max_past_logs, + fee_history_limit, + fee_history_cache: fee_history_cache.clone(), + network: Arc::new(network.clone()), + sync: sync.clone(), + filter_pool: filter_pool.clone(), + block_data_cache: block_data_cache.clone(), + overrides: overrides.clone(), + is_authority: is_authority.clone(), + command_sink: command_sink.clone(), + backend: backend.clone(), + frontier_backend: match &*frontier_backend { + fc_db::Backend::KeyValue(b) => b.clone(), + fc_db::Backend::Sql(b) => b.clone(), + }, + forced_parent_hashes: None, + maybe_storage_hub_client_config: maybe_storage_hub_client_rpc_config.clone(), + }; + crate::rpc::create_full( + deps, subscription_executor, - }, - max_past_logs, - fee_history_limit, - fee_history_cache: fee_history_cache.clone(), - network: Arc::new(network.clone()), - sync: sync.clone(), - filter_pool: filter_pool.clone(), - block_data_cache: block_data_cache.clone(), - overrides: overrides.clone(), - is_authority: is_authority.clone(), - command_sink: command_sink.clone(), - backend: backend.clone(), - frontier_backend: match &*frontier_backend { - fc_db::Backend::KeyValue(b) => b.clone(), - fc_db::Backend::Sql(b) => b.clone(), - }, - forced_parent_hashes: None, - maybe_storage_hub_client_config: maybe_storage_hub_client_rpc_config.clone(), - }; - crate::rpc::create_full(deps).map_err(Into::into) - }) + pubsub_notification_sinks.clone(), + ) + .map_err(Into::into) + }, + ) }; + // Use Ethereum-style hex subscription IDs (0x-prefixed) instead of jsonrpsee defaults. + config.rpc.id_provider = Some(Box::new(fc_rpc::EthereumSubIdProvider)); + let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { network: Arc::new(network.clone()), client: client.clone(), diff --git a/operator/runtime/mainnet/src/configs/runtime_params.rs b/operator/runtime/mainnet/src/configs/runtime_params.rs index d034192a..605c9f73 100644 --- a/operator/runtime/mainnet/src/configs/runtime_params.rs +++ b/operator/runtime/mainnet/src/configs/runtime_params.rs @@ -128,9 +128,9 @@ pub mod dynamic_params { /// /// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] ) /// - /// 500 = 50 + u * (e ^ (1 - 0.95) - 1) - /// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777 - pub static UpperExponentFactor: u32 = 8777; + /// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1) + /// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880 + pub static UpperExponentFactor: Balance = 8_776_874_921_880; #[codec(index = 15)] #[allow(non_upper_case_globals)] @@ -139,9 +139,9 @@ pub mod dynamic_params { /// /// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 ) /// - /// 10 = 50 - l * (e ^ (0.3 - 0) - 1) - /// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114 - pub static LowerExponentFactor: u32 = 114; + /// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1) + /// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540 + pub static LowerExponentFactor: Balance = 114_331_836_540; #[codec(index = 16)] #[allow(non_upper_case_globals)] diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs index ade0d13a..ceb8f373 100644 --- a/operator/runtime/mainnet/src/lib.rs +++ b/operator/runtime/mainnet/src/lib.rs @@ -1264,6 +1264,9 @@ impl_runtime_apis! { ) -> Vec { FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys) } + fn get_max_batch_confirm_storage_requests() -> BlockNumber { + FileSystem::get_max_batch_confirm_storage_requests() + } } impl pallet_payment_streams_runtime_api::PaymentStreamsApi, Balance, AccountId> for Runtime { diff --git a/operator/runtime/stagenet/src/configs/runtime_params.rs b/operator/runtime/stagenet/src/configs/runtime_params.rs index 8b9a35ca..f05caff5 100644 --- a/operator/runtime/stagenet/src/configs/runtime_params.rs +++ b/operator/runtime/stagenet/src/configs/runtime_params.rs @@ -135,9 +135,9 @@ pub mod dynamic_params { /// /// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] ) /// - /// 500 = 50 + u * (e ^ (1 - 0.95) - 1) - /// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777 - pub static UpperExponentFactor: u32 = 8777; + /// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1) + /// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880 + pub static UpperExponentFactor: Balance = 8_776_874_921_880; #[codec(index = 15)] #[allow(non_upper_case_globals)] @@ -146,9 +146,9 @@ pub mod dynamic_params { /// /// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 ) /// - /// 10 = 50 - l * (e ^ (0.3 - 0) - 1) - /// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114 - pub static LowerExponentFactor: u32 = 114; + /// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1) + /// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540 + pub static LowerExponentFactor: Balance = 114_331_836_540; #[codec(index = 16)] #[allow(non_upper_case_globals)] diff --git a/operator/runtime/stagenet/src/lib.rs b/operator/runtime/stagenet/src/lib.rs index d4bae772..2bc4d60b 100644 --- a/operator/runtime/stagenet/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -1267,6 +1267,9 @@ impl_runtime_apis! { ) -> Vec { FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys) } + fn get_max_batch_confirm_storage_requests() -> BlockNumber { + FileSystem::get_max_batch_confirm_storage_requests() + } } impl pallet_payment_streams_runtime_api::PaymentStreamsApi, Balance, AccountId> for Runtime { diff --git a/operator/runtime/testnet/src/configs/runtime_params.rs b/operator/runtime/testnet/src/configs/runtime_params.rs index c9a77d8c..bc218f6c 100644 --- a/operator/runtime/testnet/src/configs/runtime_params.rs +++ b/operator/runtime/testnet/src/configs/runtime_params.rs @@ -133,9 +133,9 @@ pub mod dynamic_params { /// /// [`MaxPrice`] = [`MostlyStablePrice`] + u * e ^ ( 1 - [`SystemUtilisationUpperThresholdPercentage`] ) /// - /// 500 = 50 + u * (e ^ (1 - 0.95) - 1) - /// u = (500 - 50) / (e ^ (1 - 0.95) - 1) ≈ 8777 - pub static UpperExponentFactor: u32 = 8777; + /// 500 GIGAWEI = 50 GIGAWEI + u * (e ^ (1 - 0.95) - 1) + /// u = (500 GIGAWEI - 50 GIGAWEI) / (e ^ (1 - 0.95) - 1) ≈ 8,776,874,921,880 + pub static UpperExponentFactor: Balance = 8_776_874_921_880; #[codec(index = 15)] #[allow(non_upper_case_globals)] @@ -144,9 +144,9 @@ pub mod dynamic_params { /// /// [`MinPrice`] = [`MostlyStablePrice`] - u * e ^ ( [`SystemUtilisationLowerThresholdPercentage`] - 0 ) /// - /// 10 = 50 - l * (e ^ (0.3 - 0) - 1) - /// l = (50 - 10) / (e ^ (0.3 - 0) - 1) ≈ 114 - pub static LowerExponentFactor: u32 = 114; + /// 10 GIGAWEI = 50 GIGAWEI - l * (e ^ (0.3 - 0) - 1) + /// l = (50 GIGAWEI - 10 GIGAWEI) / (e ^ (0.3 - 0) - 1) ≈ 114,331,836,540 + pub static LowerExponentFactor: Balance = 114_331_836_540; #[codec(index = 16)] #[allow(non_upper_case_globals)] diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs index 0f53637a..88ef82eb 100644 --- a/operator/runtime/testnet/src/lib.rs +++ b/operator/runtime/testnet/src/lib.rs @@ -1264,6 +1264,9 @@ impl_runtime_apis! { ) -> Vec { FileSystem::query_pending_bsp_confirm_storage_requests(bsp_id, file_keys) } + fn get_max_batch_confirm_storage_requests() -> BlockNumber { + FileSystem::get_max_batch_confirm_storage_requests() + } } impl pallet_payment_streams_runtime_api::PaymentStreamsApi, Balance, AccountId> for Runtime { diff --git a/test/.papi/descriptors/package.json b/test/.papi/descriptors/package.json index 8ece9265..b7060c4b 100644 --- a/test/.papi/descriptors/package.json +++ b/test/.papi/descriptors/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.0-autogenerated.14314240478086326730", + "version": "0.1.0-autogenerated.17981369281038341211", "name": "@polkadot-api/descriptors", "files": [ "dist" diff --git a/test/.papi/metadata/datahaven.scale b/test/.papi/metadata/datahaven.scale index edb59297..7f390905 100644 Binary files a/test/.papi/metadata/datahaven.scale and b/test/.papi/metadata/datahaven.scale differ diff --git a/test/cli/handlers/contracts/status.ts b/test/cli/handlers/contracts/status.ts index 76a86638..3c61e04b 100644 --- a/test/cli/handlers/contracts/status.ts +++ b/test/cli/handlers/contracts/status.ts @@ -24,8 +24,7 @@ export const showDeploymentPlanAndStatus = async (chain: string, environment?: s "Block Explorer": deploymentParams.blockExplorer, "Genesis Time": new Date(deploymentParams.genesisTime * 1000).toISOString(), "AVS Owner": `${config.avs.avsOwner.slice(0, 10)}...${config.avs.avsOwner.slice(-8)}`, - "Rewards Initiator": `${config.avs.rewardsInitiator.slice(0, 10)}...${config.avs.rewardsInitiator.slice(-8)}`, - "Veto Committee Member": `${config.avs.vetoCommitteeMember.slice(0, 10)}...${config.avs.vetoCommitteeMember.slice(-8)}` + "Rewards Initiator": `${config.avs.rewardsInitiator.slice(0, 10)}...${config.avs.rewardsInitiator.slice(-8)}` }; if (environment) { diff --git a/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs.ts b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs.ts new file mode 100644 index 00000000..1f33aaa1 --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs.ts @@ -0,0 +1,43 @@ +import { describeSuite, expect } from "@moonwall/cli"; + +describeSuite({ + id: "D023501", + title: "Subscription - Logs", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + it({ + id: "T01", + title: "should send a notification on new transaction", + test: async function () { + const logs: any[] = []; + const sub = await context.web3().eth.subscribe("logs"); + + await new Promise(async (resolve, reject) => { + sub.once("data", async (event) => { + logs.push(event); + resolve("success"); + }); + + sub.once("error", (error) => { + console.error(error); + reject(error); + }); + + await context.deployContract!("EventEmitter"); + }); + + const block = await context.viem().getBlock(); + + expect(logs[0]).to.include({ + blockHash: block.hash, + blockNumber: block.number, + data: "0x", + logIndex: 0n, + removed: false, + transactionHash: block.transactions[0], + transactionIndex: 0n, + }); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs2.ts b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs2.ts new file mode 100644 index 00000000..2b58d33b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-logs2.ts @@ -0,0 +1,195 @@ +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { ALITH_CONTRACT_ADDRESSES } from "@moonwall/util"; +import type { Log } from "web3"; + +describeSuite({ + id: "D023502", + title: "Subscription - Logs", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + let deployedContract: `0x${string}`; + let deployHash: `0x${string}`; + + let subSingleAddPromise: Promise; + let subMultiAddPromise: Promise; + let subTopicPromise: Promise; + let subTopicWildcardPromise: Promise; + let subTopicListPromise: Promise; + let subTopicCondPromise: Promise; + let subTopicMultiCondPromise: Promise; + let subTopicWildAndCondPromise: Promise; + + beforeAll(async () => { + const openSub = async (filter?: object) => await context.web3().eth.subscribe("logs", filter); + + const onData = (logSub: any) => { + return new Promise((resolve) => { + logSub.once("data", resolve); + }); + }; + + const [ + singleSub, + multiSub, + subTopic, + subTopicWildcard, + subTopicList, + subTopicCond, + subTopicMultiCond, + subTopicWildAndCond, + ] = await Promise.all([ + openSub({ + address: ALITH_CONTRACT_ADDRESSES[0], + }), + openSub({ + address: [ + ALITH_CONTRACT_ADDRESSES[3], + ALITH_CONTRACT_ADDRESSES[2], + ALITH_CONTRACT_ADDRESSES[1], + ALITH_CONTRACT_ADDRESSES[0], + ], + }), + openSub({ + topics: ["0x0040d54d5e5b097202376b55bcbaaedd2ee468ce4496f1d30030c4e5308bf94d"], + }), + openSub({ + topics: [null, "0x000000000000000000000000f24ff3a9cf04c71dbc94d0b566f7a27b94566cac"], + }), + openSub({ + topics: [ + ["0x0040d54d5e5b097202376b55bcbaaedd2ee468ce4496f1d30030c4e5308bf94d"], + ["0x000000000000000000000000f24ff3a9cf04c71dbc94d0b566f7a27b94566cac"], + ], + }), + + openSub({ + topics: [ + "0x0040d54d5e5b097202376b55bcbaaedd2ee468ce4496f1d30030c4e5308bf94d", + ["0x000000000000000000000000f24ff3a9cf04c71dbc94d0b566f7a27b94566cac"], + ], + }), + + openSub({ + topics: [ + "0x0040d54d5e5b097202376b55bcbaaedd2ee468ce4496f1d30030c4e5308bf94d", + [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000f24ff3a9cf04c71dbc94d0b566f7a27b94566cac", + ], + ], + }), + openSub({ + topics: [ + null, + [ + "0x000000000000000000000000f24ff3a9cf04c71dbc94d0b566f7a27b94566cac", + "0x0000000000000000000000000000000000000000000000000000000000000000", + ], + null, + ], + }), + ]); + + subSingleAddPromise = onData(singleSub); + subMultiAddPromise = onData(multiSub); + subTopicPromise = onData(subTopic); + subTopicWildcardPromise = onData(subTopicWildcard); + subTopicListPromise = onData(subTopicList); + subTopicCondPromise = onData(subTopicCond); + subTopicMultiCondPromise = onData(subTopicMultiCond); + subTopicWildAndCondPromise = onData(subTopicWildAndCond); + + const { contractAddress, hash } = await context.deployContract!("EventEmitter"); + deployedContract = contractAddress; + deployHash = hash; + }); + + it({ + id: "T01", + title: "should be able to filter by address", + test: async function () { + const eventLog = await subSingleAddPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T02", + title: "should be able to filter by multiple addresses", + test: async function () { + const eventLog = await subMultiAddPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T03", + title: "should be able to filter by topic", + test: async function () { + const eventLog = await subTopicPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T04", + title: "should be able to filter by topic wildcards", + test: async function () { + const eventLog = await subTopicWildcardPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T05", + title: "should be able to filter by topic list", + test: async function () { + const eventLog = await subTopicListPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T06", + title: "should be able to filter by topic conditional parameters", + test: async function () { + const eventLog = await subTopicCondPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T07", + title: "should support multiple topic conditional parameters", + test: async function () { + const eventLog = await subTopicMultiCondPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + + it({ + id: "T08", + title: "should combine topic wildcards and conditional parameters", + test: async function () { + const eventLog = await subTopicWildAndCondPromise; + expect(eventLog.blockNumber).toBe(1n); + expect(eventLog.address).toBe(deployedContract.toLowerCase()); + expect(eventLog.transactionHash).toBe(deployHash); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/subscription/test-subscription-pending.ts b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-pending.ts new file mode 100644 index 00000000..d053667b --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/subscription/test-subscription-pending.ts @@ -0,0 +1,30 @@ +import { describeSuite, expect } from "@moonwall/cli"; +import { BALTATHAR_ADDRESS, GLMR, createRawTransfer, sendRawTransaction } from "@moonwall/util"; +import { setTimeout } from "node:timers/promises"; + +describeSuite({ + id: "D023504", + title: "Subscription - Pending transactions", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + it({ + id: "T01", + title: "should return a valid subscriptionId", + test: async function () { + let response: any; + const sub = await context.web3().eth.subscribe("newPendingTransactions"); + + sub.once("data", (data) => { + response = data; + }); + + const rawTx = await createRawTransfer(context, BALTATHAR_ADDRESS, GLMR); + const hash = await sendRawTransaction(context, rawTx); + await setTimeout(200); + + expect(response).not.toBeUndefined(); + expect(response).toBe(hash); + }, + }); + }, +}); diff --git a/test/moonwall/suites/dev/stagenet/subscription/test-subscription.ts b/test/moonwall/suites/dev/stagenet/subscription/test-subscription.ts new file mode 100644 index 00000000..ae853cfb --- /dev/null +++ b/test/moonwall/suites/dev/stagenet/subscription/test-subscription.ts @@ -0,0 +1,61 @@ +import { beforeAll, describeSuite, expect } from "@moonwall/cli"; +import { ALITH_ADDRESS, BALTATHAR_ADDRESS, createRawTransfer } from "@moonwall/util"; +import { type PublicClient, createPublicClient, webSocket } from "viem"; + +describeSuite({ + id: "D023505", + title: "Subscription - Block headers", + foundationMethods: "dev", + testCases: ({ context, it, log }) => { + let client: PublicClient; + + beforeAll(async () => { + const transport = webSocket(context.viem().transport.url.replace("http", "ws")); + client = createPublicClient({ + transport, + }); + }); + + it({ + id: "T01", + title: "should return a valid subscriptionId", + test: async function () { + const result = (await client.transport.request({ + method: "eth_subscribe", + params: ["newHeads"], + })) as any; + + expect(result.length).toBe(34); + }, + }); + + it({ + id: "T02", + title: "should send notification on new block", + test: async function () { + const blocks: any[] = []; + const unwatch = client.watchBlocks({ + onBlock: (block) => blocks.push(block), + }); + + await context.createBlock(createRawTransfer(context, BALTATHAR_ADDRESS, 0)); + unwatch(); + + const block = await context.viem().getBlock(); + + expect(blocks[0]).to.include({ + author: ALITH_ADDRESS.toLowerCase(), + difficulty: 0n, + extraData: "0x", + logsBloom: `0x${"0".repeat(512)}`, + miner: ALITH_ADDRESS.toLowerCase(), + sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + }); + expect(blocks[0].nonce).to.be.eq("0x0000000000000000"); + // Verify subscription roots match the block fetched via RPC + expect(blocks[0].receiptsRoot).toBe(block.receiptsRoot); + expect(blocks[0].transactionsRoot).toBe(block.transactionsRoot); + }, + }); + }, +}); diff --git a/test/resources/datahaven-integration-test-flow.md b/test/resources/datahaven-integration-test-flow.md index 82b2a7f6..4dcc14ce 100644 --- a/test/resources/datahaven-integration-test-flow.md +++ b/test/resources/datahaven-integration-test-flow.md @@ -207,7 +207,6 @@ Another testing scenario is testing the operational aspects of the validator set 3. **Slashing Mechanisms** - Test slashing for various offenses - - Test veto committee mechanisms 4. **Operator Set Modifications** - Modify operator sets from Ethereum