mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-08 20:11:21 +00:00
529d359ca6
An update to the devnet to introduce a local heimdall to facilitate multiple validators without the need for an external process, and hence validator registration/staking etc. In this initial release only span generation is supported. It has the following changes: * Introduction of a local grpc heimdall interface * Allocation of accounts via a devnet account generator () * Introduction on 'Services' for the network config "--chain bor-devnet --bor.localheimdall" will run a 2 validator network with a local service "--chain bor-devnet --bor.withoutheimdall" will sun a single validator with no heimdall service as before --------- Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro-2.local>
48 lines
1.3 KiB
Solidity
48 lines
1.3 KiB
Solidity
// SPDX-License-Identifier: GPL-3.0
|
|
|
|
pragma solidity ^0.8.2;
|
|
|
|
contract TestStateSender {
|
|
|
|
uint256 public counter;
|
|
mapping(address => address) public registrations;
|
|
|
|
event NewRegistration(
|
|
address indexed user,
|
|
address indexed sender,
|
|
address indexed receiver
|
|
);
|
|
event RegistrationUpdated(
|
|
address indexed user,
|
|
address indexed sender,
|
|
address indexed receiver
|
|
);
|
|
event StateSynced(
|
|
uint256 indexed id,
|
|
address indexed contractAddress,
|
|
bytes data
|
|
);
|
|
|
|
modifier onlyRegistered(address receiver) {
|
|
require(registrations[receiver] == msg.sender, "Invalid sender");
|
|
_;
|
|
}
|
|
|
|
function syncState(address receiver, bytes calldata data)
|
|
external
|
|
onlyRegistered(receiver)
|
|
{
|
|
counter = counter = counter + 1;
|
|
emit StateSynced(counter, receiver, data);
|
|
}
|
|
|
|
// register new contract for state sync
|
|
function register(address sender, address receiver) public {
|
|
registrations[receiver] = sender;
|
|
if (registrations[receiver] == address(0)) {
|
|
emit NewRegistration(msg.sender, sender, receiver);
|
|
} else {
|
|
emit RegistrationUpdated(msg.sender, sender, receiver);
|
|
}
|
|
}
|
|
} |