Skip to content

Conversation

@udityadav-supraoracles
Copy link

This PR includes the BlockMeta smart contract. Related to Entropy-Foundation/smr-moonshot#2524

@aregng aregng changed the base branch from feature/automation_registry to feature/erc20Supra December 16, 2025 17:36

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need separate BlockBasedCounter since we already have Counter contract?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockBasedCounter allow increment only if called by privileged address, but yes if we can extend Counter to provide increment interface guarded with privileged address, then we can remove BlockBasedCounter

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The increment function in Counter is already guarded by owner and only owner can call it. So, we can get rid of BlockBasedCounter.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockBasedCounter allow increment only if called by privileged address, but yes if we can extend Counter to provide increment interface guarded with privileged address, then we can remove BlockBasedCounter

Comment on lines 4 to 5
import {Ownable2StepUpgradeable} from "../lib/openzeppelin-contracts-upgradeable/contracts/access/Ownable2StepUpgradeable.sol";
import {UUPSUpgradeable} from "../lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@udityadav-supraoracles blockmeta is supposed to be deployed at Genesis. When it says Ownable2StepUpgradeable does it mean 2 step transfer or two step upgrade? We don't want two step transfer for blockmeta. What is 2 step upgrade, if there is such a thing?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ownable2StepUpgradeable refers to transfer of ownership in 2 steps.
In the current implementation whoever deploys the BlockMeta becomes the owner, if it's deployed using a MultiSig, the MultiSig will become the owner.

I'll change it to one step transfer.

The suffix "Upgradeable" in Ownable2StepUpgradeable means this contract is for upgradable contracts.

address constant VM_SIGNER = address(0x5355500000000000000000000000000000000000);

struct Entry {
bytes4[] selectors;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@udityadav-supraoracles , what is a selector?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first 4 bytes of keccak256 of function signature is its selector. The calldata also has same first 4 bytes which is equal to selector.

Comment on lines 80 to 84
// prevent duplicate target
if (!e.exists) {
e.exists = true;
targets.push(target);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is enumerable set a better choice here than this mechanism? @udityadav-supraoracles

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, considering we need a way to deregister, enumerableset would be better.

Comment on lines 109 to 113
if (!ok) {
emit CallFailed(target, selector, ret);
} else {
emit CallSucceeded(target, selector);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this revert the whole tx or only the side effect by callee will not happen?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't revert the transaction, it will only emit for the failed transactions and continue with execution.

-removed BlockBasedCounter
-updated BlockMeta with deregister and enumerableSet
-updated testcases
Comment on lines +18 to +19
function initialize(address _privileged) public initializer {
privilegedAddress = _privileged;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Counter is utilized in scope of Multisig tests as well, shouldn't they be also updated as the initialize function is updated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've updated tests for multisig.

if (!msg.sender.isVmSigner()) revert CallerNotVmSigner(); // Caller must be VM Signer

uint256 tLen = registeredTargets.length();
for (uint256 i; i < tLen; i++) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be required to have an ability to define the order of the execution by target. But lets keep this question open and have it discussed with Dr. @sjoshisupra when he is back, an not block PR from finalization.
I will add a reference of this comment to the ticket so we do not forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants